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