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 | 'currentapp' => $app |
---|
57 | ); |
---|
58 | include('./header.inc.php'); |
---|
59 | |
---|
60 | if (($GLOBALS['phpgw_info']['server']['use_https'] == 2) && ($_SERVER['HTTPS'] != 'on')) |
---|
61 | { |
---|
62 | Header('Location: https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']); |
---|
63 | exit; |
---|
64 | } |
---|
65 | |
---|
66 | if ( $app == 'home' && ! $api_requested ) |
---|
67 | { |
---|
68 | $target = 'home.php'; |
---|
69 | if ( $GLOBALS['phpgw_info']['user']['preferences']['common']['default_app'] && $GLOBALS['phpgw_info']['user']['apps'][$GLOBALS['phpgw_info']['user']['preferences']['common']['default_app']]) |
---|
70 | $target = $GLOBALS['phpgw_info']['user']['preferences']['common']['default_app'] . '/index.php'; |
---|
71 | |
---|
72 | $target = '( function( ){ var target = window.location.hash; target = (' |
---|
73 | . '( arguments.length && ( target && target.length > 1 ) ) ?' |
---|
74 | . 'URL_SERVER + target.substr( 1 ) : "' . $GLOBALS[ 'phpgw' ] -> link( $target ). '" ); ExpressoLivre.link( target ); } )'; |
---|
75 | |
---|
76 | if ( array_key_exists( 'HTTP_BACKGROUNDREQUEST', $_SERVER ) || array_key_exists( 'BackgroundRequest', $_GET ) ) |
---|
77 | $target = "{$target}( );"; |
---|
78 | else |
---|
79 | $target = "XEvents.add( window, 'onload', {$target} );"; |
---|
80 | |
---|
81 | echo "<script>{$target}</script>"; |
---|
82 | |
---|
83 | exit; |
---|
84 | } |
---|
85 | |
---|
86 | if($api_requested) |
---|
87 | { |
---|
88 | $app = 'phpgwapi'; |
---|
89 | } |
---|
90 | |
---|
91 | $GLOBALS[$class] = CreateObject(sprintf('%s.%s',$app,$class)); |
---|
92 | if ( is_object( $GLOBALS[ $class ] ) && ( ( ! property_exists( $class, 'public_functions' ) ) || (is_array($GLOBALS[$class]->public_functions) && $GLOBALS[$class]->public_functions[$method]) && ! $invalid_data ) ) |
---|
93 | { |
---|
94 | echo execmethod( $_GET[ 'menuaction' ], $_GET ); |
---|
95 | unset($app); |
---|
96 | unset($class); |
---|
97 | unset($method); |
---|
98 | unset($invalid_data); |
---|
99 | unset($api_requested); |
---|
100 | } |
---|
101 | else |
---|
102 | { |
---|
103 | if(!$app || !$class || !$method) |
---|
104 | { |
---|
105 | if(@is_object($GLOBALS['phpgw']->log)) |
---|
106 | { |
---|
107 | if($menuaction) |
---|
108 | { |
---|
109 | $GLOBALS['phpgw']->log->message(array( |
---|
110 | 'text' => "W-BadmenuactionVariable, menuaction missing or corrupt: $menuaction", |
---|
111 | 'p1' => $menuaction, |
---|
112 | 'line' => __LINE__, |
---|
113 | 'file' => __FILE__ |
---|
114 | )); |
---|
115 | } |
---|
116 | } |
---|
117 | } |
---|
118 | |
---|
119 | if(!is_array($GLOBALS[$class]->public_functions) || ! $$GLOBALS[$class]->public_functions[$method] && $method) |
---|
120 | { |
---|
121 | if(@is_object($GLOBALS['phpgw']->log)) |
---|
122 | { |
---|
123 | if($menuaction) |
---|
124 | { |
---|
125 | $GLOBALS['phpgw']->log->message(array( |
---|
126 | 'text' => "W-BadmenuactionVariable, attempted to access private method: $method", |
---|
127 | 'p1' => $method, |
---|
128 | 'line' => __LINE__, |
---|
129 | 'file' => __FILE__ |
---|
130 | )); |
---|
131 | } |
---|
132 | } |
---|
133 | } |
---|
134 | if(@is_object($GLOBALS['phpgw']->log)) |
---|
135 | { |
---|
136 | $GLOBALS['phpgw']->log->commit(); |
---|
137 | } |
---|
138 | |
---|
139 | echo '<script>ExpressoLivre.link( "' . $GLOBALS[ 'phpgw' ] -> link( '/home.php' ) . '", true );/* ??? */</script>'; |
---|
140 | exit; |
---|
141 | } |
---|
142 | ?> |
---|