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
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
|
<?php
// -------------------------------------------------------------
//
// $Id$
//
// FILENAME : pagestart.php
// STARTED : Thu Aug 2, 2001
// COPYRIGHT : © 2001, 2004 phpBB Group
// WWW : http://www.phpbb.com/
// LICENCE : GPL vs2.0 [ see /docs/COPYING ]
//
// -------------------------------------------------------------
if (!defined('IN_PHPBB') || !isset($phpbb_root_path))
{
die('Hacking attempt');
}
define('NEED_SID', true);
require($phpbb_root_path . 'common.'.$phpEx);
require($phpbb_root_path . 'includes/functions_admin.'.$phpEx);
// Start session management
$user->start();
// Did user forget to login? Give 'em a chance to here ...
if ($user->data['user_id'] == ANONYMOUS)
{
login_box("./adm/index.$phpEx$SID", '', $user->lang['LOGIN_ADMIN']);
}
$auth->acl($user->data);
$user->setup('admin');
// End session management
// Some oft used variables
$safe_mode = (@ini_get('safe_mode') || @strtolower(ini_get('safe_mode')) == 'on') ? true : false;
$file_uploads = (@ini_get('file_uploads') || strtolower(@ini_get('file_uploads')) == 'on') ? true : false;
// -----------------------------
// Functions
function adm_page_header($sub_title, $meta = '', $table_html = true)
{
global $config, $db, $user, $phpEx;
define('HEADER_INC', true);
// gzip_compression
if ($config['gzip_compress'])
{
if (extension_loaded('zlib') && !headers_sent())
{
ob_start('ob_gzhandler');
}
}
header("Content-type: text/html; charset=" . $user->lang['ENCODING']);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $user->lang['ENCODING']; ?>">
<meta http-equiv="Content-Style-Type" content="text/css">
<link rel="stylesheet" href="subSilver.css" type="text/css">
<?php
echo $meta;
?>
<style type="text/css">
<!--
th { background-image: url('images/cellpic3.gif') }
td.cat { background-image: url('images/cellpic1.gif') }
//-->
</style>
<title><?php echo $config['sitename'] . ' - ' . $page_title; ?></title>
</head>
<body>
<?php
if ($table_html)
{
?>
<a name="top"></a>
<table width="100%" cellspacing="0" cellpadding="0" border="0">
<tr>
<td colspan="2" height="25" align="right" nowrap="nowrap"><span class="subtitle">» <i><?php echo $sub_title; ?></i></span> </td>
</tr>
</table>
<table width="95%" cellspacing="0" cellpadding="0" border="0" align="center">
<tr>
<td><br clear="all" />
<?php
}
}
function adm_page_footer($copyright_html = true)
{
global $cache, $config, $db, $phpEx;
if (!empty($cache))
{
$cache->unload();
}
// Close our DB connection.
$db->sql_close();
?>
</td>
</tr>
</table>
<?php
if ($copyright_html)
{
?>
<div class="copyright" align="center">Powered by phpBB <?php echo $config['version']; ?> © 2002 <a href="http://www.phpbb.com/" target="_phpbb">phpBB Group</a></div>
<br clear="all" />
</body>
</html>
<?php
}
exit;
}
function adm_page_message($title, $message, $show_header = false, $show_prev_info = true)
{
global $phpEx, $SID, $user, $_SERVER, $_ENV;
if ($show_header)
{
?>
<table width="100%" cellspacing="0" cellpadding="0" border="0">
<tr>
<td><a href="<?php echo "../index.$phpEx$SID"; ?>"><img src="images/header_left.jpg" width="200" height="60" alt="phpBB Logo" title="phpBB Logo" border="0"/></a></td>
<td width="100%" background="images/header_bg.jpg" height="60" align="right" nowrap="nowrap"><span class="maintitle"><?php echo $user->lang['ADMIN_TITLE']; ?></span> </td>
</tr>
</table>
<?php
}
$page = (!empty($_SERVER['REQUEST_URI'])) ? $_SERVER['REQUEST_URI'] : $_ENV['REQUEST_URI'];
?>
<br /><br />
<table class="bg" width="80%" cellspacing="1" cellpadding="4" border="0" align="center">
<tr>
<th><?php echo $title; ?></th>
</tr>
<tr>
<td class="row1" align="center"><?php echo $message; ?>
<?php
if ($page && $show_prev_info)
{
echo '<br /><br />';
echo sprintf($user->lang['RETURN_PAGE'], '<a href="' . $page . '">', '</a>');
}
?> </td>
</tr>
</table>
<br />
<?php
}
function adm_page_confirm($title, $message)
{
global $phpEx, $SID, $user;
// Grab data from GET and POST arrays ... note this is _not_
// validated! Everything is typed as string to ensure no
// funny business on displayed hidden field data. Validation
// will be carried out by whatever processes this form.
$var_ary = array_merge($_GET, $_POST);
$s_hidden_fields = '';
foreach ($var_ary as $key => $var)
{
if (empty($var))
{
continue;
}
if (is_array($var))
{
foreach ($var as $k => $v)
{
if (is_array($v))
{
foreach ($v as $_k => $_v)
{
set_var($var[$k][$_k], $_v, 'string');
$s_hidden_fields .= "<input type=\"hidden\" name=\"${key}[$k][$_k]\" value=\"" . addslashes($_v) . '" />';
}
}
else
{
set_var($var[$k], $v, 'string');
$s_hidden_fields .= "<input type=\"hidden\" name=\"${key}[$k]\" value=\"" . addslashes($v) . '" />';
}
}
}
else
{
set_var($var, $var, 'string');
$s_hidden_fields .= '<input type="hidden" name="' . $key . '" value="' . addslashes($var) . '" />';
}
unset($var_ary[$key]);
}
?>
<br /><br />
<form name="confirm" method="post" action="<?php echo $_SERVER['SCRIPT_NAME'] . $SID; ?>">
<table class="bg" width="80%" cellspacing="1" cellpadding="4" border="0" align="center">
<tr>
<th><?php echo $title; ?></th>
</tr>
<tr>
<td class="row1" align="center"><?php echo $message; ?><br /><br /><input class="btnlite" type="submit" name="confirm" value="<?php echo $user->lang['YES']; ?>" /> <input class="btnmain" type="submit" name="cancel" value="<?php echo $user->lang['NO']; ?>" /></td>
</tr>
</table>
<?php echo $s_hidden_fields; ?>
</form>
<br />
<?php
adm_page_footer();
}
// General ACP module class
class module
{
var $id = 0;
var $type;
var $name;
var $mode;
// Private methods, should not be overwritten
function create($module_type, $module_url, $selected_mod = false, $selected_submod = false)
{
global $template, $auth, $db, $user, $config;
$sql = 'SELECT module_id, module_title, module_filename, module_subs, module_acl
FROM ' . MODULES_TABLE . "
WHERE module_type = 'acp'
AND module_enabled = 1
ORDER BY module_order ASC";
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
{
// Authorisation is required for the basic module
if ($row['module_acl'])
{
$is_auth = false;
eval('$is_auth = (' . preg_replace(array('#acl_([a-z_]+)#e', '#cfg_([a-z_]+)#e'), array('$auth->acl_get("\\1")', '$config["\\1"]'), $row['module_acl']) . ');');
// The user is not authorised to use this module, skip it
if (!$is_auth)
{
continue;
}
}
$selected = ($row['module_filename'] == $selected_mod || $row['module_id'] == $selected_mod || (!$selected_mod && !$i)) ? true : false;
/*
// Get the localised lang string if available, or make up our own otherwise
$template->assign_block_vars($module_type . '_section', array(
'L_TITLE' => (isset($user->lang[strtoupper($module_type) . '_' . $row['module_title']])) ? $user->lang[strtoupper($module_type) . '_' . $row['module_title']] : ucfirst(str_replace('_', ' ', strtolower($row['module_title']))),
'S_SELECTED' => $selected,
'U_TITLE' => $module_url . '&i=' . $row['module_id'])
);
*/
if ($selected)
{
$module_id = $row['module_id'];
$module_name = $row['module_filename'];
if ($row['module_subs'])
{
$j = 0;
$submodules_ary = explode("\n", $row['module_subs']);
foreach ($submodules_ary as $submodule)
{
$submodule = explode(',', trim($submodule));
$submodule_title = array_shift($submodule);
$is_auth = true;
foreach ($submodule as $auth_option)
{
if (!$auth->acl_get($auth_option))
{
$is_auth = false;
}
}
if (!$is_auth)
{
continue;
}
$selected = ($submodule_title == $selected_submod || (!$selected_submod && !$j)) ? true : false;
/*
// Get the localised lang string if available, or make up our own otherwise
$template->assign_block_vars("{$module_type}_section.{$module_type}_subsection", array(
'L_TITLE' => (isset($user->lang[strtoupper($module_type) . '_' . strtoupper($submodule_title)])) ? $user->lang[strtoupper($module_type) . '_' . strtoupper($submodule_title)] : ucfirst(str_replace('_', ' ', strtolower($submodule_title))),
'S_SELECTED' => $selected,
'U_TITLE' => $module_url . '&i=' . $module_id . '&mode=' . $submodule_title
));
*/
if ($selected)
{
$this->mode = $submodule_title;
}
$j++;
}
}
}
$i++;
}
$db->sql_freeresult($result);
if (!$module_id)
{
trigger_error('MODULE_NOT_EXIST');
}
$this->type = $module_type;
$this->id = $module_id;
$this->name = $module_name;
}
// Public methods to be overwritten by modules
function module()
{
// Module name
// Module filename
// Module description
// Module version
// Module compatibility
return false;
}
function init()
{
return false;
}
function install()
{
return false;
}
function uninstall()
{
return false;
}
}
// End Functions
// -----------------------------
?>
|