[454] | 1 | <?php |
---|
| 2 | //TODO: Aplicar o conceito de subapp (mobileapp) |
---|
| 3 | |
---|
| 4 | $phpgw_info = array(); |
---|
| 5 | $GLOBALS['sessionid'] = isset($_GET['sessionid']) ? $_GET['sessionid'] : @$_COOKIE['sessionid']; |
---|
[1851] | 6 | |
---|
[3969] | 7 | $proxies = explode(',',$_SERVER['HTTP_X_FORWARDED_HOST']); |
---|
| 8 | $fwConstruct = isset($_SERVER['HTTP_X_FORWARDED_HOST']) ? $proxies[0] : $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; |
---|
[1851] | 9 | |
---|
[454] | 10 | if(!$GLOBALS['sessionid']) |
---|
[1851] | 11 | { |
---|
| 12 | //$location = 'Location: ' . $fwConstruct . 'login.php'; |
---|
[3969] | 13 | if ($_SERVER['HTTPS'] != 'on') |
---|
| 14 | { |
---|
| 15 | $aux = 'http://'; |
---|
| 16 | } |
---|
| 17 | else |
---|
| 18 | { |
---|
| 19 | $aux = 'https://'; |
---|
| 20 | } |
---|
| 21 | |
---|
| 22 | Header('Location: ' . $aux . $fwConstruct . 'login.php'); |
---|
[454] | 23 | exit; |
---|
| 24 | } |
---|
| 25 | |
---|
[3969] | 26 | if ($GLOBALS['phpgw_info']['server']['use_https'] > 0) |
---|
| 27 | { |
---|
[454] | 28 | if ($_SERVER['HTTPS'] != 'on') { |
---|
[1851] | 29 | Header('Location: https://' . $fwConstruct . '/' . $_SERVER['REQUEST_URI']); |
---|
[454] | 30 | exit; |
---|
| 31 | } |
---|
| 32 | } |
---|
| 33 | |
---|
| 34 | /* |
---|
| 35 | This is the menuaction driver for the multi-layered design |
---|
| 36 | */ |
---|
[623] | 37 | |
---|
[3571] | 38 | if(isset($_REQUEST['menuaction'])) |
---|
[454] | 39 | { |
---|
[3571] | 40 | list($mobileapp,$class,$method) = explode('.',@$_REQUEST['menuaction']); |
---|
[454] | 41 | if(! $mobileapp || ! $class || ! $method) |
---|
| 42 | { |
---|
| 43 | $invalid_data = True; |
---|
| 44 | } |
---|
| 45 | } |
---|
| 46 | else |
---|
| 47 | { |
---|
| 48 | $mobileapp = 'home'; |
---|
| 49 | $invalid_data = True; |
---|
| 50 | } |
---|
| 51 | |
---|
[1851] | 52 | |
---|
[454] | 53 | $GLOBALS['phpgw_info']['flags'] = array( |
---|
| 54 | 'noheader' => True, |
---|
| 55 | 'nonavbar' => True, |
---|
| 56 | 'currentapp' => 'mobile', |
---|
| 57 | 'mobileapp' => $mobileapp, |
---|
| 58 | ); |
---|
| 59 | |
---|
| 60 | include('../header.inc.php'); |
---|
| 61 | include('./mobile_header.inc.php'); |
---|
[1851] | 62 | |
---|
[454] | 63 | if($mobileapp == 'home') |
---|
| 64 | { |
---|
[623] | 65 | start_prefered_app(); |
---|
[454] | 66 | } |
---|
[1851] | 67 | |
---|
[454] | 68 | $GLOBALS[$class] = CreateObject(sprintf('%s.%s','mobile',$class)); |
---|
| 69 | $public_functions = $GLOBALS[$class]->public_functions; |
---|
| 70 | if((is_array($GLOBALS[$class]->public_functions) && $GLOBALS[$class]->public_functions[$method]) && ! $invalid_data) |
---|
[1851] | 71 | { |
---|
| 72 | $GLOBALS['phpgw_info']['mobiletemplate'] = CreateObject("mobile.mobiletemplate"); |
---|
| 73 | $GLOBALS['phpgw_info']['mobiletemplate'] -> print_page($class,$method); |
---|
[454] | 74 | unset($mobileapp); |
---|
| 75 | unset($class); |
---|
| 76 | unset($method); |
---|
| 77 | unset($invalid_data); |
---|
[623] | 78 | |
---|
[454] | 79 | } |
---|
| 80 | else |
---|
| 81 | { |
---|
| 82 | if(!$mobileapp || !$class || !$method) |
---|
| 83 | { |
---|
| 84 | if(@is_object($GLOBALS['phpgw']->log)) |
---|
| 85 | { |
---|
| 86 | $GLOBALS['phpgw']->log->message(array( |
---|
| 87 | 'text' => 'W-BadmenuactionVariable, menuaction missing or corrupt: %1', |
---|
| 88 | 'p1' => $menuaction, |
---|
| 89 | 'line' => __LINE__, |
---|
| 90 | 'file' => __FILE__ |
---|
| 91 | )); |
---|
| 92 | } |
---|
| 93 | } |
---|
| 94 | |
---|
| 95 | if(!is_array($GLOBALS[$class]->public_functions) || ! $GLOBALS[$class]->public_functions[$method] && $method) |
---|
| 96 | { |
---|
| 97 | if(@is_object($GLOBALS['phpgw']->log)) |
---|
| 98 | { |
---|
| 99 | $GLOBALS['phpgw']->log->message(array( |
---|
| 100 | 'text' => 'W-BadmenuactionVariable, attempted to access private method: %1', |
---|
| 101 | 'p1' => $method, |
---|
| 102 | 'line' => __LINE__, |
---|
| 103 | 'file' => __FILE__ |
---|
| 104 | )); |
---|
| 105 | } |
---|
| 106 | } |
---|
| 107 | if(@is_object($GLOBALS['phpgw']->log)) |
---|
| 108 | { |
---|
| 109 | $GLOBALS['phpgw']->log->commit(); |
---|
[1851] | 110 | } |
---|
[623] | 111 | start_prefered_app(); |
---|
[454] | 112 | } |
---|
| 113 | |
---|
| 114 | ?> |
---|