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