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