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