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