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 | |
---|
13 | $phpgw_info = array(); |
---|
14 | if(!file_exists('header.inc.php')) |
---|
15 | { |
---|
16 | Header('Location: setup/index.php'); |
---|
17 | exit; |
---|
18 | } |
---|
19 | |
---|
20 | $GLOBALS['sessionid'] = isset($_GET['sessionid']) ? $_GET['sessionid'] : @$_COOKIE['sessionid']; |
---|
21 | if(!$GLOBALS['sessionid']) |
---|
22 | { |
---|
23 | Header('Location: login.php'. |
---|
24 | (isset($_SERVER['QUERY_STRING']) && !empty($_SERVER['QUERY_STRING']) ? |
---|
25 | '?phpgw_forward='.urlencode('/index.php?'.$_SERVER['QUERY_STRING']):'')); |
---|
26 | exit; |
---|
27 | } |
---|
28 | |
---|
29 | /* |
---|
30 | This is the menuaction driver for the multi-layered design |
---|
31 | */ |
---|
32 | if(isset($_GET['menuaction'])) |
---|
33 | { |
---|
34 | list($app,$class,$method) = explode('.',@$_GET['menuaction']); |
---|
35 | if(! $app || ! $class || ! $method) |
---|
36 | { |
---|
37 | $invalid_data = True; |
---|
38 | } |
---|
39 | } |
---|
40 | else |
---|
41 | { |
---|
42 | //$phpgw->log->message('W-BadmenuactionVariable, menuaction missing or corrupt: %1',$menuaction); |
---|
43 | //$phpgw->log->commit(); |
---|
44 | |
---|
45 | $app = 'home'; |
---|
46 | $invalid_data = True; |
---|
47 | } |
---|
48 | |
---|
49 | if($app == 'phpgwapi') |
---|
50 | { |
---|
51 | $app = 'home'; |
---|
52 | $api_requested = True; |
---|
53 | } |
---|
54 | |
---|
55 | $GLOBALS['phpgw_info']['flags'] = array( |
---|
56 | 'noheader' => True, |
---|
57 | 'nonavbar' => True, |
---|
58 | 'currentapp' => $app |
---|
59 | ); |
---|
60 | include('./header.inc.php'); |
---|
61 | |
---|
62 | if (($GLOBALS['phpgw_info']['server']['use_https'] == 2) && ($_SERVER['HTTPS'] != 'on')) |
---|
63 | { |
---|
64 | Header('Location: https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']); |
---|
65 | exit; |
---|
66 | } |
---|
67 | |
---|
68 | if($app == 'home' && !$api_requested) |
---|
69 | { |
---|
70 | Header('Location: ' . $GLOBALS['phpgw']->link('/home.php')); |
---|
71 | } |
---|
72 | |
---|
73 | if($api_requested) |
---|
74 | { |
---|
75 | $app = 'phpgwapi'; |
---|
76 | } |
---|
77 | |
---|
78 | $GLOBALS[$class] = CreateObject(sprintf('%s.%s',$app,$class)); |
---|
79 | if((is_array($GLOBALS[$class]->public_functions) && $GLOBALS[$class]->public_functions[$method]) && ! $invalid_data) |
---|
80 | { |
---|
81 | execmethod($_GET['menuaction']); |
---|
82 | unset($app); |
---|
83 | unset($class); |
---|
84 | unset($method); |
---|
85 | unset($invalid_data); |
---|
86 | unset($api_requested); |
---|
87 | } |
---|
88 | else |
---|
89 | { |
---|
90 | if(!$app || !$class || !$method) |
---|
91 | { |
---|
92 | if(@is_object($GLOBALS['phpgw']->log)) |
---|
93 | { |
---|
94 | $GLOBALS['phpgw']->log->message(array( |
---|
95 | 'text' => 'W-BadmenuactionVariable, menuaction missing or corrupt: %1', |
---|
96 | 'p1' => $menuaction, |
---|
97 | 'line' => __LINE__, |
---|
98 | 'file' => __FILE__ |
---|
99 | )); |
---|
100 | } |
---|
101 | } |
---|
102 | |
---|
103 | if(!is_array($GLOBALS[$class]->public_functions) || ! $$GLOBALS[$class]->public_functions[$method] && $method) |
---|
104 | { |
---|
105 | if(@is_object($GLOBALS['phpgw']->log)) |
---|
106 | { |
---|
107 | $GLOBALS['phpgw']->log->message(array( |
---|
108 | 'text' => 'W-BadmenuactionVariable, attempted to access private method: %1', |
---|
109 | 'p1' => $method, |
---|
110 | 'line' => __LINE__, |
---|
111 | 'file' => __FILE__ |
---|
112 | )); |
---|
113 | } |
---|
114 | } |
---|
115 | if(@is_object($GLOBALS['phpgw']->log)) |
---|
116 | { |
---|
117 | $GLOBALS['phpgw']->log->commit(); |
---|
118 | } |
---|
119 | |
---|
120 | $GLOBALS['phpgw']->redirect_link('/home.php'); |
---|
121 | } |
---|
122 | |
---|
123 | /*if(!isset($GLOBALS['phpgw_info']['nofooter'])) |
---|
124 | { |
---|
125 | $GLOBALS['phpgw']->common->phpgw_footer(); |
---|
126 | }*/ |
---|
127 | ?> |
---|