-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathindex_admin.php
executable file
·339 lines (280 loc) · 9.21 KB
/
index_admin.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
<?php
//
// $Id: index_admin.php 9465 2002-04-24 07:38:20Z jhe $
//
// Created on: <09-Nov-2000 14:52:40 ce>
//
// This source file is part of eZ publish, publishing software.
//
// Copyright (C) 1999-2001 eZ Systems. All rights reserved.
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, US
//
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . "GMT");
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
// Find out, where our files are.
// Find out, where our files are.
if ( preg_match( "/(.*\/)([^\/]+\.php)$/", $_SERVER['SCRIPT_FILENAME'], $regs ) )
{
$siteDir = $regs[1];
$index = "/" . $regs[2];
}
elseif ( preg_match( "/(.*\/)([^\/]+\.php)/?/", $_SERVER['PHP_SELF'], $regs ) )
{
// Some people using CGI have their $SCRIPT_FILENAME not right... so we are trying this.
$siteDir = $_SERVER['DOCUMENT_ROOT'] . $regs[1];
$index = "/" . $regs[2];
}
else
{
// Fallback... doesn't work with virtual-hosts, but better than nothing
$siteDir = "./";
$index = "/index_admin.php";
}
// What OS-type are we using?
if ( substr( php_uname(), 0, 7) == "Windows" )
$separator = ";";
else
$separator = ":";
// Setting the right include_path
$includePath = ini_get( "include_path" );
if ( trim( $includePath ) != "" )
$includePath .= $separator . $siteDir;
else
$includePath = $siteDir;
ini_set( "include_path", $includePath );
$wwwDir='';
// Get the webdir.
if ( preg_match( "/(.*)\/([^\/]+\.php)$/", $_SERVER['SCRIPT_NAME'], $regs ) )
$wwwDir = $regs[1];
// Fallback... Finding the paths above failed, so $PHP_SELF is not set right.
if ( $siteDir == "./" )
$_SERVER['PHP_SELF'] = $_SERVER['REQUEST_URI'];
// Trick: Rewrite setup doesn't have index.php in $PHP_SELF, so we don't want an $index
if ( ! preg_match( "/.*index\.php.*/", $_SERVER['PHP_SELF'] ) )
$index = "";
else
{
// Get the right $REQUEST_URI, when using nVH setup.
if ( preg_match( "/^$wwwDir$index(.+)/", $_SERVER['PHP_SELF'], $req ) )
$_SERVER['REQUEST_URI'] = $req[1];
}
// Remove url parameters
preg_match( "/([^?]+)/", $_SERVER['REQUEST_URI'], $regs );
$_SERVER['REQUEST_URI'] = $regs[1];
$GLOBALS["DDD"] = '';
$GLOBALS["DEBUG"] = false;
$UsePHPSessions = false;
// Start the buffer cache
ob_start();
// Turn on output buffering with gz compression
//ob_start("ob_gzhandler");
if ( $UsePHPSessions == true )
{
// start session handling
session_start();
}
// settings for sessions
// max timeout is set to 48 hours
ini_alter("session.gc_maxlifetime", "172800");
ini_alter("session.entropy_file","/dev/urandom");
ini_alter("session.entropy_length", "512");
ini_alter("session.cache_expire", "172800");
include_once( "classes/ezdb.php" );
include_once( "classes/INIFile.php" );
include_once( "classes/template.inc" );
include_once( "classes/ezmenubox.php" );
include_once( "ezsession/classes/ezsession.php" );
include_once( "ezuser/classes/ezuser.php" );
include_once( "ezuser/classes/ezusergroup.php" );
include_once( "ezuser/classes/ezmodule.php" );
include_once( "ezuser/classes/ezpermission.php" );
include_once( "ezmodule/classes/ezmodulehandler.php" );
include_once( "classes/ezhttptool.php" );
// File functions
include_once( "classes/ezfile.php" );
$ini =& INIFile::globalINI();
$GlobalSiteIni =& $ini;
// Set the global nVH variables.
$GlobalSiteIni->Index = $index;
$GlobalSiteIni->WWWDir = $wwwDir;
$GlobalSiteIni->SiteDir = $siteDir;
unset( $index );
unset( $wwwDir );
// $session =& eZSession::globalSession();
// $session->fetch();
// print( "<pre>" . $session->hash() . "</pre>" );
// do the statistics
include_once( "ezstats/classes/ezpageview.php" );
$SiteStyle =& $ini->read_var( "site", "SiteStyle" );
$GLOBALS["DEBUG"] = true;
$url_array = explode( "/", $_SERVER['REQUEST_URI'] );
$HelpMode = "disabled";
$user =& eZUser::currentUser();
if ( $user )
{
if ( $url_array[1] == "help" )
{
$HelpMode = "enabled";
include( "design/admin/help_header.php" );
}
else
{
// html header
if ( !empty($_REQUEST['PrintableVersion']))
{
include( "design/admin/print_header.php" );
}
else
{
include( "design/admin/header.php" );
}
}
require( "ezuser/admin/admincheck.php" );
if ( $HelpMode != "enabled" )
{
include_once( "ezsession/classes/ezpreferences.php" );
$preferences = new eZPreferences();
$site_modules = $ini->read_array( "site", "EnabledModules" );
$modules =& eZModuleHandler::active();
$uri = $_SERVER["REQUEST_URI"];
if ( empty($_REQUEST['PrintableVersion']))
{
if ( !empty( $_REQUEST["ToggleMenu"] ) )
{
foreach( $modules as $module )
{
$module_dir = strtolower( $module );
if ( $_REQUEST["ToggleMenu"] == $module_dir )
{
eZModuleHandler::toggle( $module_dir );
$uri = eZHTTPTool::removeVariable( $uri, "ToggleMenu" );
eZHTTPTool::header( "Location: $uri" );
exit;
}
}
}
$moved_module = false;
if (isset($_REQUEST["MoveUp"])) {
eZModuleHandler::moveUp( $modules, $_REQUEST["MoveUp"], $moved_module );
if ( !$moved_module && isset($_REQUEST["MoveDown"]))
{
eZModuleHandler::moveDown( $modules, $_REQUEST["MoveDown"], $moved_module );
}
}
$uri = eZHTTPTool::removeVariable( $uri, "MoveUp" );
$uri = eZHTTPTool::removeVariable( $uri, "MoveDown" );
if ( $moved_module )
{
$preferences->setVariable( "EnabledModules", $modules );
eZHTTPTool::header( "Location: $uri" );
exit;
}
// draw modules
foreach ( $modules as $module )
{
if ( !empty( $module ) )
{
$module_dir =& strtolower( $module );
unset( $menuItems );
include( "$module_dir/admin/menubox.php" );
if ( isset( $menuItems ) )
eZMenuBox::createBox( $module, $module_dir, "admin",
$SiteStyle, $menuItems, true, false,
"$module_dir/admin/menubox.php", false, true );
}
}
}
// parse the URI
$page = "";
// send the URI to the right decoder
$page = "ez" . $url_array[1] . "/admin/datasupplier.php";
// set the module logo
$moduleName =& $url_array[1];
if ( $moduleName == "" )
$moduleName = "user";
if ( empty($_REQUEST['PrintableVersion']))
{
// break the column an draw a horizontal line
include( "design/admin/separator.php" );
}
if ( eZFile::file_exists( $page ) )
{
include( $page );
}
else
{
include( "ezuser/admin/welcome.php" );
}
}
else
{
// show the help page
$helpFile = "ez" . $url_array[2] . "/admin/help/". $Language . "/" . $url_array[3] . "_" . $url_array[4] . ".hlp";
if ( eZFile::file_exists( $helpFile ) )
{
include( $helpFile );
}
else
{
print( "help file not found" );
}
}
if ( $HelpMode == "enabled" )
{
include( "design/admin/help_footer.php" );
}
else
{
// html footer
if ( !empty($_REQUEST['PrintableVersion']))
{
include( "design/admin/print_footer.php" );
}
else
{
include( "design/admin/footer.php" );
}
}
}
else
{
include( "design/admin/loginheader.php" );
if ( $moduleName == "" )
$moduleName = "user";
$LoginSeparator = true;
if ( $_SERVER['REQUEST_URI'] == "/" )
{
$_SERVER['REQUEST_URI'] = "/user/login";
$url_array =& explode( "/", $_SERVER['REQUEST_URI'] );
}
// parse the URI
$page = "";
// send the URI to the right decoder
$page = "ezuser/admin/datasupplier.php";
if ( eZFile::file_exists( $page ) )
{
include( $page );
}
// html footer
include( "design/admin/loginfooter.php" );
}
// close the database connection.
$db =& eZDB::globalDatabase();
$db->close();
// flush the buffer cache
ob_end_flush();