1 | <?php |
---|
2 | /**************************************************************************\ |
---|
3 | * phpGroupWare * |
---|
4 | * http://www.phpgroupware.org * |
---|
5 | * -------------------------------------------- * |
---|
6 | * This program is free software; you can redistribute it and/or modify it * |
---|
7 | * under the terms of the GNU General Public License as published by the * |
---|
8 | * Free Software Foundation; either version 2 of the License, or (at your * |
---|
9 | * option) any later version. * |
---|
10 | \**************************************************************************/ |
---|
11 | |
---|
12 | $current_url = substr($_SERVER["SCRIPT_NAME"], 0, strpos($_SERVER["SCRIPT_NAME"],'index.php')); |
---|
13 | |
---|
14 | $phpgw_info = array(); |
---|
15 | if(!file_exists('header.inc.php')) |
---|
16 | { |
---|
17 | Header('Location: '.$current_url.'setup/index.php'); |
---|
18 | exit; |
---|
19 | } |
---|
20 | |
---|
21 | $GLOBALS['sessionid'] = isset($_GET['sessionid']) ? $_GET['sessionid'] : @$_COOKIE['sessionid']; |
---|
22 | if(!$GLOBALS['sessionid']) |
---|
23 | { |
---|
24 | Header('Location: '.$current_url.'login.php'. |
---|
25 | (isset($_SERVER['QUERY_STRING']) && !empty($_SERVER['QUERY_STRING']) ? |
---|
26 | '?phpgw_forward='.urlencode('/index.php?'.$_SERVER['QUERY_STRING']):'')); |
---|
27 | exit; |
---|
28 | } |
---|
29 | |
---|
30 | /* |
---|
31 | This is the menuaction driver for the multi-layered design |
---|
32 | */ |
---|
33 | if(isset($_GET['menuaction'])) |
---|
34 | { |
---|
35 | list($app,$class,$method) = explode('.',@$_GET['menuaction']); |
---|
36 | if(! $app || ! $class || ! $method) |
---|
37 | { |
---|
38 | $invalid_data = True; |
---|
39 | } |
---|
40 | } |
---|
41 | else |
---|
42 | { |
---|
43 | //$phpgw->log->message('W-BadmenuactionVariable, menuaction missing or corrupt: %1',$menuaction); |
---|
44 | //$phpgw->log->commit(); |
---|
45 | |
---|
46 | $app = 'home'; |
---|
47 | $invalid_data = True; |
---|
48 | } |
---|
49 | |
---|
50 | if($app == 'phpgwapi') |
---|
51 | { |
---|
52 | $app = 'home'; |
---|
53 | $api_requested = True; |
---|
54 | } |
---|
55 | |
---|
56 | $GLOBALS['phpgw_info']['flags'] = array( |
---|
57 | 'noheader' => True, |
---|
58 | 'nonavbar' => True, |
---|
59 | 'currentapp' => $app |
---|
60 | ); |
---|
61 | include('./header.inc.php'); |
---|
62 | |
---|
63 | if (($GLOBALS['phpgw_info']['server']['use_https'] == 2) && ($_SERVER['HTTPS'] != 'on')) |
---|
64 | { |
---|
65 | Header('Location: https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']); |
---|
66 | exit; |
---|
67 | } |
---|
68 | |
---|
69 | if($app == 'home' && !$api_requested) |
---|
70 | { |
---|
71 | Header('Location: ' . $GLOBALS['phpgw']->link('/home.php')); |
---|
72 | } |
---|
73 | |
---|
74 | if($api_requested) |
---|
75 | { |
---|
76 | $app = 'phpgwapi'; |
---|
77 | } |
---|
78 | |
---|
79 | $GLOBALS[$class] = CreateObject(sprintf('%s.%s',$app,$class)); |
---|
80 | if((is_array($GLOBALS[$class]->public_functions) && $GLOBALS[$class]->public_functions[$method]) && ! $invalid_data) |
---|
81 | { |
---|
82 | execmethod($_GET['menuaction']); |
---|
83 | unset($app); |
---|
84 | unset($class); |
---|
85 | unset($method); |
---|
86 | unset($invalid_data); |
---|
87 | unset($api_requested); |
---|
88 | } |
---|
89 | else |
---|
90 | { |
---|
91 | if(!$app || !$class || !$method) |
---|
92 | { |
---|
93 | if(@is_object($GLOBALS['phpgw']->log)) |
---|
94 | { |
---|
95 | if($menuaction) |
---|
96 | { |
---|
97 | $GLOBALS['phpgw']->log->message(array( |
---|
98 | 'text' => "W-BadmenuactionVariable, menuaction missing or corrupt: $menuaction", |
---|
99 | 'p1' => $menuaction, |
---|
100 | 'line' => __LINE__, |
---|
101 | 'file' => __FILE__ |
---|
102 | )); |
---|
103 | } |
---|
104 | } |
---|
105 | } |
---|
106 | |
---|
107 | if(!is_array($GLOBALS[$class]->public_functions) || ! $$GLOBALS[$class]->public_functions[$method] && $method) |
---|
108 | { |
---|
109 | if(@is_object($GLOBALS['phpgw']->log)) |
---|
110 | { |
---|
111 | if($menuaction) |
---|
112 | { |
---|
113 | $GLOBALS['phpgw']->log->message(array( |
---|
114 | 'text' => "W-BadmenuactionVariable, attempted to access private method: $method", |
---|
115 | 'p1' => $method, |
---|
116 | 'line' => __LINE__, |
---|
117 | 'file' => __FILE__ |
---|
118 | )); |
---|
119 | } |
---|
120 | } |
---|
121 | } |
---|
122 | if(@is_object($GLOBALS['phpgw']->log)) |
---|
123 | { |
---|
124 | $GLOBALS['phpgw']->log->commit(); |
---|
125 | } |
---|
126 | |
---|
127 | $GLOBALS['phpgw']->redirect_link('/home.php'); |
---|
128 | } |
---|
129 | |
---|
130 | /*if(!isset($GLOBALS['phpgw_info']['nofooter'])) |
---|
131 | { |
---|
132 | $GLOBALS['phpgw']->common->phpgw_footer(); |
---|
133 | }*/ |
---|
134 | ?> |
---|