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 | if(!$GLOBALS['sessionid']) |
---|
7 | { |
---|
8 | /*if (($GLOBALS['phpgw_info']['server']['use_https'] == 2) && ($_SERVER['HTTPS'] != 'on')) |
---|
9 | { |
---|
10 | |
---|
11 | Header('Location: https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']); |
---|
12 | exit; |
---|
13 | } |
---|
14 | else |
---|
15 | {*/ |
---|
16 | $location = 'Location: ' . $_SERVER['SCRIPT_URL'].'login.php'; |
---|
17 | Header('Location: ' . $_SERVER['SCRIPT_URL'].'login.php'); |
---|
18 | //Header('Location: ' . $_SERVER['SCRIPT_URL'].'login.php' . |
---|
19 | // (isset($_SERVER['QUERY_STRING']) && !empty($_SERVER['QUERY_STRING']) ? |
---|
20 | // '?phpgw_forward='.urlencode('/index.php?'.$_SERVER['QUERY_STRING']):'')); |
---|
21 | exit; |
---|
22 | // Header('Location: login.php'. |
---|
23 | // (isset($_SERVER['QUERY_STRING']) && !empty($_SERVER['QUERY_STRING']) ? |
---|
24 | // '?phpgw_forward='.urlencode('/mobile/index.php?'.$_SERVER['QUERY_STRING']):'')); |
---|
25 | // exit; |
---|
26 | //} |
---|
27 | } |
---|
28 | |
---|
29 | if ($GLOBALS['phpgw_info']['server']['use_https'] > 0) { |
---|
30 | if ($_SERVER['HTTPS'] != 'on') { |
---|
31 | Header('Location: https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']); |
---|
32 | exit; |
---|
33 | } |
---|
34 | } |
---|
35 | |
---|
36 | /* |
---|
37 | This is the menuaction driver for the multi-layered design |
---|
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 | //$phpgw->log->message('W-BadmenuactionVariable, menuaction missing or corrupt: %1',$menuaction); |
---|
50 | //$phpgw->log->commit(); |
---|
51 | $mobileapp = 'home'; |
---|
52 | $invalid_data = True; |
---|
53 | } |
---|
54 | |
---|
55 | $GLOBALS['phpgw_info']['flags'] = array( |
---|
56 | 'noheader' => True, |
---|
57 | 'nonavbar' => True, |
---|
58 | 'currentapp' => 'mobile', |
---|
59 | 'mobileapp' => $mobileapp, |
---|
60 | ); |
---|
61 | |
---|
62 | include('../header.inc.php'); |
---|
63 | include('./mobile_header.inc.php'); |
---|
64 | |
---|
65 | if($mobileapp == 'home') |
---|
66 | { |
---|
67 | Header('Location: ' . $GLOBALS['phpgw']->link('/mobile/home.php')); |
---|
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 | //if((is_array($public_functions) && $public_functions[$method]) && ! $invalid_data) |
---|
74 | { |
---|
75 | print_header(); |
---|
76 | execmethod($_GET['menuaction']); |
---|
77 | print_footer(); |
---|
78 | unset($mobileapp); |
---|
79 | unset($class); |
---|
80 | unset($method); |
---|
81 | unset($invalid_data); |
---|
82 | } |
---|
83 | else |
---|
84 | { |
---|
85 | if(!$mobileapp || !$class || !$method) |
---|
86 | { |
---|
87 | if(@is_object($GLOBALS['phpgw']->log)) |
---|
88 | { |
---|
89 | $GLOBALS['phpgw']->log->message(array( |
---|
90 | 'text' => 'W-BadmenuactionVariable, menuaction missing or corrupt: %1', |
---|
91 | 'p1' => $menuaction, |
---|
92 | 'line' => __LINE__, |
---|
93 | 'file' => __FILE__ |
---|
94 | )); |
---|
95 | } |
---|
96 | } |
---|
97 | |
---|
98 | if(!is_array($GLOBALS[$class]->public_functions) || ! $GLOBALS[$class]->public_functions[$method] && $method) |
---|
99 | { |
---|
100 | if(@is_object($GLOBALS['phpgw']->log)) |
---|
101 | { |
---|
102 | $GLOBALS['phpgw']->log->message(array( |
---|
103 | 'text' => 'W-BadmenuactionVariable, attempted to access private method: %1', |
---|
104 | 'p1' => $method, |
---|
105 | 'line' => __LINE__, |
---|
106 | 'file' => __FILE__ |
---|
107 | )); |
---|
108 | } |
---|
109 | } |
---|
110 | if(@is_object($GLOBALS['phpgw']->log)) |
---|
111 | { |
---|
112 | $GLOBALS['phpgw']->log->commit(); |
---|
113 | } |
---|
114 | $GLOBALS['phpgw']->redirect_link('/mobile/home.php'); |
---|
115 | } |
---|
116 | |
---|
117 | ?> |
---|