443
by dcoles
Added Forum application along with unmodifed version of phpBB3 "Olympus" 3.0.0 |
1 |
<?php
|
2 |
/**
|
|
3 |
*
|
|
4 |
* @package acp
|
|
5 |
* @version $Id: index.php,v 1.74 2007/12/12 16:45:58 acydburn Exp $
|
|
6 |
* @copyright (c) 2005 phpBB Group
|
|
7 |
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
|
8 |
*
|
|
9 |
*/
|
|
10 |
||
11 |
/**
|
|
12 |
*/
|
|
13 |
define('IN_PHPBB', true); |
|
14 |
define('ADMIN_START', true); |
|
15 |
define('NEED_SID', true); |
|
16 |
||
17 |
// Include files
|
|
18 |
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './../'; |
|
19 |
$phpEx = substr(strrchr(__FILE__, '.'), 1); |
|
20 |
require($phpbb_root_path . 'common.' . $phpEx); |
|
21 |
require($phpbb_root_path . 'includes/functions_admin.' . $phpEx); |
|
22 |
require($phpbb_root_path . 'includes/functions_module.' . $phpEx); |
|
23 |
||
24 |
// Start session management
|
|
25 |
$user->session_begin(); |
|
26 |
$auth->acl($user->data); |
|
27 |
$user->setup('acp/common'); |
|
28 |
// End session management
|
|
29 |
||
30 |
// Have they authenticated (again) as an admin for this session?
|
|
520
by dcoles
forum: Fixed setup.py to include forum files in install, disabled |
31 |
#if (!isset($user->data['session_admin']) || !$user->data['session_admin'])
|
32 |
#{
|
|
33 |
# login_box('', $user->lang['LOGIN_ADMIN_CONFIRM'],
|
|
34 |
# $user->lang['LOGIN_ADMIN_SUCCESS'], true, false);
|
|
35 |
#}
|
|
443
by dcoles
Added Forum application along with unmodifed version of phpBB3 "Olympus" 3.0.0 |
36 |
|
37 |
// Is user any type of admin? No, then stop here, each script needs to
|
|
38 |
// check specific permissions but this is a catchall
|
|
39 |
if (!$auth->acl_get('a_')) |
|
40 |
{
|
|
41 |
trigger_error('NO_ADMIN'); |
|
42 |
}
|
|
43 |
||
44 |
// We define the admin variables now, because the user is now able to use the admin related features...
|
|
45 |
define('IN_ADMIN', true); |
|
46 |
$phpbb_admin_path = (defined('PHPBB_ADMIN_PATH')) ? PHPBB_ADMIN_PATH : './'; |
|
47 |
||
48 |
// Some oft used variables
|
|
49 |
$safe_mode = (@ini_get('safe_mode') || @strtolower(ini_get('safe_mode')) == 'on') ? true : false; |
|
50 |
$file_uploads = (@ini_get('file_uploads') || strtolower(@ini_get('file_uploads')) == 'on') ? true : false; |
|
51 |
$module_id = request_var('i', ''); |
|
52 |
$mode = request_var('mode', ''); |
|
53 |
||
54 |
// Set custom template for admin area
|
|
55 |
$template->set_custom_template($phpbb_admin_path . 'style', 'admin'); |
|
56 |
$template->assign_var('T_TEMPLATE_PATH', $phpbb_admin_path . 'style'); |
|
57 |
||
58 |
// the acp template is never stored in the database
|
|
59 |
$user->theme['template_storedb'] = false; |
|
60 |
||
61 |
// Instantiate new module
|
|
62 |
$module = new p_master(); |
|
63 |
||
64 |
// Instantiate module system and generate list of available modules
|
|
65 |
$module->list_modules('acp'); |
|
66 |
||
67 |
// Select the active module
|
|
68 |
$module->set_active($module_id, $mode); |
|
69 |
||
70 |
// Assign data to the template engine for the list of modules
|
|
71 |
// We do this before loading the active module for correct menu display in trigger_error
|
|
72 |
$module->assign_tpl_vars(append_sid("{$phpbb_admin_path}index.$phpEx")); |
|
73 |
||
74 |
// Load and execute the relevant module
|
|
75 |
$module->load_active(); |
|
76 |
||
77 |
// Generate the page
|
|
78 |
adm_page_header($module->get_page_title()); |
|
79 |
||
80 |
$template->set_filenames(array( |
|
81 |
'body' => $module->get_tpl_name(), |
|
82 |
));
|
|
83 |
||
84 |
adm_page_footer(); |
|
85 |
||
86 |
/**
|
|
87 |
* Header for acp pages
|
|
88 |
*/
|
|
89 |
function adm_page_header($page_title) |
|
90 |
{
|
|
91 |
global $config, $db, $user, $template; |
|
92 |
global $phpbb_root_path, $phpbb_admin_path, $phpEx, $SID, $_SID; |
|
93 |
||
94 |
if (defined('HEADER_INC')) |
|
95 |
{
|
|
96 |
return; |
|
97 |
}
|
|
98 |
||
99 |
define('HEADER_INC', true); |
|
100 |
||
101 |
// gzip_compression
|
|
102 |
if ($config['gzip_compress']) |
|
103 |
{
|
|
104 |
if (@extension_loaded('zlib') && !headers_sent()) |
|
105 |
{
|
|
106 |
ob_start('ob_gzhandler'); |
|
107 |
}
|
|
108 |
}
|
|
109 |
||
110 |
$template->assign_vars(array( |
|
111 |
'PAGE_TITLE' => $page_title, |
|
112 |
'USERNAME' => $user->data['username'], |
|
113 |
||
114 |
'SID' => $SID, |
|
115 |
'_SID' => $_SID, |
|
116 |
'SESSION_ID' => $user->session_id, |
|
117 |
'ROOT_PATH' => $phpbb_admin_path, |
|
118 |
||
119 |
'U_LOGOUT' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=logout'), |
|
120 |
'U_ADM_INDEX' => append_sid("{$phpbb_admin_path}index.$phpEx"), |
|
121 |
'U_INDEX' => append_sid("{$phpbb_root_path}index.$phpEx"), |
|
122 |
||
123 |
'T_IMAGES_PATH' => "{$phpbb_root_path}images/", |
|
124 |
'T_SMILIES_PATH' => "{$phpbb_root_path}{$config['smilies_path']}/", |
|
125 |
'T_AVATAR_PATH' => "{$phpbb_root_path}{$config['avatar_path']}/", |
|
126 |
'T_AVATAR_GALLERY_PATH' => "{$phpbb_root_path}{$config['avatar_gallery_path']}/", |
|
127 |
'T_ICONS_PATH' => "{$phpbb_root_path}{$config['icons_path']}/", |
|
128 |
'T_RANKS_PATH' => "{$phpbb_root_path}{$config['ranks_path']}/", |
|
129 |
'T_UPLOAD_PATH' => "{$phpbb_root_path}{$config['upload_path']}/", |
|
130 |
||
131 |
'ICON_MOVE_UP' => '<img src="' . $phpbb_admin_path . 'images/icon_up.gif" alt="' . $user->lang['MOVE_UP'] . '" title="' . $user->lang['MOVE_UP'] . '" />', |
|
132 |
'ICON_MOVE_UP_DISABLED' => '<img src="' . $phpbb_admin_path . 'images/icon_up_disabled.gif" alt="' . $user->lang['MOVE_UP'] . '" title="' . $user->lang['MOVE_UP'] . '" />', |
|
133 |
'ICON_MOVE_DOWN' => '<img src="' . $phpbb_admin_path . 'images/icon_down.gif" alt="' . $user->lang['MOVE_DOWN'] . '" title="' . $user->lang['MOVE_DOWN'] . '" />', |
|
134 |
'ICON_MOVE_DOWN_DISABLED' => '<img src="' . $phpbb_admin_path . 'images/icon_down_disabled.gif" alt="' . $user->lang['MOVE_DOWN'] . '" title="' . $user->lang['MOVE_DOWN'] . '" />', |
|
135 |
'ICON_EDIT' => '<img src="' . $phpbb_admin_path . 'images/icon_edit.gif" alt="' . $user->lang['EDIT'] . '" title="' . $user->lang['EDIT'] . '" />', |
|
136 |
'ICON_EDIT_DISABLED' => '<img src="' . $phpbb_admin_path . 'images/icon_edit_disabled.gif" alt="' . $user->lang['EDIT'] . '" title="' . $user->lang['EDIT'] . '" />', |
|
137 |
'ICON_DELETE' => '<img src="' . $phpbb_admin_path . 'images/icon_delete.gif" alt="' . $user->lang['DELETE'] . '" title="' . $user->lang['DELETE'] . '" />', |
|
138 |
'ICON_DELETE_DISABLED' => '<img src="' . $phpbb_admin_path . 'images/icon_delete_disabled.gif" alt="' . $user->lang['DELETE'] . '" title="' . $user->lang['DELETE'] . '" />', |
|
139 |
'ICON_SYNC' => '<img src="' . $phpbb_admin_path . 'images/icon_sync.gif" alt="' . $user->lang['RESYNC'] . '" title="' . $user->lang['RESYNC'] . '" />', |
|
140 |
'ICON_SYNC_DISABLED' => '<img src="' . $phpbb_admin_path . 'images/icon_sync_disabled.gif" alt="' . $user->lang['RESYNC'] . '" title="' . $user->lang['RESYNC'] . '" />', |
|
141 |
||
142 |
'S_USER_LANG' => $user->lang['USER_LANG'], |
|
143 |
'S_CONTENT_DIRECTION' => $user->lang['DIRECTION'], |
|
144 |
'S_CONTENT_ENCODING' => 'UTF-8', |
|
145 |
'S_CONTENT_FLOW_BEGIN' => ($user->lang['DIRECTION'] == 'ltr') ? 'left' : 'right', |
|
146 |
'S_CONTENT_FLOW_END' => ($user->lang['DIRECTION'] == 'ltr') ? 'right' : 'left', |
|
147 |
));
|
|
148 |
||
149 |
// application/xhtml+xml not used because of IE
|
|
150 |
header('Content-type: text/html; charset=UTF-8'); |
|
151 |
||
152 |
header('Cache-Control: private, no-cache="set-cookie"'); |
|
153 |
header('Expires: 0'); |
|
154 |
header('Pragma: no-cache'); |
|
155 |
||
156 |
return; |
|
157 |
}
|
|
158 |
||
159 |
/**
|
|
160 |
* Page footer for acp pages
|
|
161 |
*/
|
|
162 |
function adm_page_footer($copyright_html = true) |
|
163 |
{
|
|
164 |
global $db, $config, $template, $user, $auth, $cache; |
|
165 |
global $starttime, $phpbb_root_path, $phpbb_admin_path, $phpEx; |
|
166 |
||
167 |
// Output page creation time
|
|
168 |
if (defined('DEBUG')) |
|
169 |
{
|
|
170 |
$mtime = explode(' ', microtime()); |
|
171 |
$totaltime = $mtime[0] + $mtime[1] - $starttime; |
|
172 |
||
173 |
if (!empty($_REQUEST['explain']) && $auth->acl_get('a_') && defined('DEBUG_EXTRA') && method_exists($db, 'sql_report')) |
|
174 |
{
|
|
175 |
$db->sql_report('display'); |
|
176 |
}
|
|
177 |
||
178 |
$debug_output = sprintf('Time : %.3fs | ' . $db->sql_num_queries() . ' Queries | GZIP : ' . (($config['gzip_compress']) ? 'On' : 'Off') . (($user->load) ? ' | Load : ' . $user->load : ''), $totaltime); |
|
179 |
||
180 |
if ($auth->acl_get('a_') && defined('DEBUG_EXTRA')) |
|
181 |
{
|
|
182 |
if (function_exists('memory_get_usage')) |
|
183 |
{
|
|
184 |
if ($memory_usage = memory_get_usage()) |
|
185 |
{
|
|
186 |
global $base_memory_usage; |
|
187 |
$memory_usage -= $base_memory_usage; |
|
188 |
$memory_usage = ($memory_usage >= 1048576) ? round((round($memory_usage / 1048576 * 100) / 100), 2) . ' ' . $user->lang['MB'] : (($memory_usage >= 1024) ? round((round($memory_usage / 1024 * 100) / 100), 2) . ' ' . $user->lang['KB'] : $memory_usage . ' ' . $user->lang['BYTES']); |
|
189 |
||
190 |
$debug_output .= ' | Memory Usage: ' . $memory_usage; |
|
191 |
}
|
|
192 |
}
|
|
193 |
||
194 |
$debug_output .= ' | <a href="' . build_url() . '&explain=1">Explain</a>'; |
|
195 |
}
|
|
196 |
}
|
|
197 |
||
198 |
$template->assign_vars(array( |
|
199 |
'DEBUG_OUTPUT' => (defined('DEBUG')) ? $debug_output : '', |
|
200 |
'TRANSLATION_INFO' => (!empty($user->lang['TRANSLATION_INFO'])) ? $user->lang['TRANSLATION_INFO'] : '', |
|
201 |
'S_COPYRIGHT_HTML' => $copyright_html, |
|
202 |
'VERSION' => $config['version']) |
|
203 |
);
|
|
204 |
||
205 |
$template->display('body'); |
|
206 |
||
207 |
garbage_collection(); |
|
208 |
exit_handler(); |
|
209 |
}
|
|
210 |
||
211 |
/**
|
|
212 |
* Generate back link for acp pages
|
|
213 |
*/
|
|
214 |
function adm_back_link($u_action) |
|
215 |
{
|
|
216 |
global $user; |
|
217 |
return '<br /><br /><a href="' . $u_action . '">« ' . $user->lang['BACK_TO_PREV'] . '</a>'; |
|
218 |
}
|
|
219 |
||
220 |
/**
|
|
221 |
* Build select field options in acp pages
|
|
222 |
*/
|
|
223 |
function build_select($option_ary, $option_default = false) |
|
224 |
{
|
|
225 |
global $user; |
|
226 |
||
227 |
$html = ''; |
|
228 |
foreach ($option_ary as $value => $title) |
|
229 |
{
|
|
230 |
$selected = ($option_default !== false && $value == $option_default) ? ' selected="selected"' : ''; |
|
231 |
$html .= '<option value="' . $value . '"' . $selected . '>' . $user->lang[$title] . '</option>'; |
|
232 |
}
|
|
233 |
||
234 |
return $html; |
|
235 |
}
|
|
236 |
||
237 |
/**
|
|
238 |
* Build radio fields in acp pages
|
|
239 |
*/
|
|
240 |
function h_radio($name, &$input_ary, $input_default = false, $id = false, $key = false) |
|
241 |
{
|
|
242 |
global $user; |
|
243 |
||
244 |
$html = ''; |
|
245 |
$id_assigned = false; |
|
246 |
foreach ($input_ary as $value => $title) |
|
247 |
{
|
|
248 |
$selected = ($input_default !== false && $value == $input_default) ? ' checked="checked"' : ''; |
|
249 |
$html .= '<label><input type="radio" name="' . $name . '"' . (($id && !$id_assigned) ? ' id="' . $id . '"' : '') . ' value="' . $value . '"' . $selected . (($key) ? ' accesskey="' . $key . '"' : '') . ' class="radio" /> ' . $user->lang[$title] . '</label>'; |
|
250 |
$id_assigned = true; |
|
251 |
}
|
|
252 |
||
253 |
return $html; |
|
254 |
}
|
|
255 |
||
256 |
/**
|
|
257 |
* Build configuration template for acp configuration pages
|
|
258 |
*/
|
|
259 |
function build_cfg_template($tpl_type, $key, &$new, $config_key, $vars) |
|
260 |
{
|
|
261 |
global $user, $module; |
|
262 |
||
263 |
$tpl = ''; |
|
264 |
$name = 'config[' . $config_key . ']'; |
|
265 |
||
266 |
switch ($tpl_type[0]) |
|
267 |
{
|
|
268 |
case 'text': |
|
269 |
case 'password': |
|
270 |
$size = (int) $tpl_type[1]; |
|
271 |
$maxlength = (int) $tpl_type[2]; |
|
272 |
||
273 |
$tpl = '<input id="' . $key . '" type="' . $tpl_type[0] . '"' . (($size) ? ' size="' . $size . '"' : '') . ' maxlength="' . (($maxlength) ? $maxlength : 255) . '" name="' . $name . '" value="' . $new[$config_key] . '" />'; |
|
274 |
break; |
|
275 |
||
276 |
case 'dimension': |
|
277 |
$size = (int) $tpl_type[1]; |
|
278 |
$maxlength = (int) $tpl_type[2]; |
|
279 |
||
280 |
$tpl = '<input id="' . $key . '" type="text"' . (($size) ? ' size="' . $size . '"' : '') . ' maxlength="' . (($maxlength) ? $maxlength : 255) . '" name="config[' . $config_key . '_width]" value="' . $new[$config_key . '_width'] . '" /> x <input type="text"' . (($size) ? ' size="' . $size . '"' : '') . ' maxlength="' . (($maxlength) ? $maxlength : 255) . '" name="config[' . $config_key . '_height]" value="' . $new[$config_key . '_height'] . '" />'; |
|
281 |
break; |
|
282 |
||
283 |
case 'textarea': |
|
284 |
$rows = (int) $tpl_type[1]; |
|
285 |
$cols = (int) $tpl_type[2]; |
|
286 |
||
287 |
$tpl = '<textarea id="' . $key . '" name="' . $name . '" rows="' . $rows . '" cols="' . $cols . '">' . $new[$config_key] . '</textarea>'; |
|
288 |
break; |
|
289 |
||
290 |
case 'radio': |
|
291 |
$key_yes = ($new[$config_key]) ? ' checked="checked"' : ''; |
|
292 |
$key_no = (!$new[$config_key]) ? ' checked="checked"' : ''; |
|
293 |
||
294 |
$tpl_type_cond = explode('_', $tpl_type[1]); |
|
295 |
$type_no = ($tpl_type_cond[0] == 'disabled' || $tpl_type_cond[0] == 'enabled') ? false : true; |
|
296 |
||
297 |
$tpl_no = '<label><input type="radio" name="' . $name . '" value="0"' . $key_no . ' class="radio" /> ' . (($type_no) ? $user->lang['NO'] : $user->lang['DISABLED']) . '</label>'; |
|
298 |
$tpl_yes = '<label><input type="radio" id="' . $key . '" name="' . $name . '" value="1"' . $key_yes . ' class="radio" /> ' . (($type_no) ? $user->lang['YES'] : $user->lang['ENABLED']) . '</label>'; |
|
299 |
||
300 |
$tpl = ($tpl_type_cond[0] == 'yes' || $tpl_type_cond[0] == 'enabled') ? $tpl_yes . $tpl_no : $tpl_no . $tpl_yes; |
|
301 |
break; |
|
302 |
||
303 |
case 'select': |
|
304 |
case 'custom': |
|
305 |
||
306 |
$return = ''; |
|
307 |
||
308 |
if (isset($vars['method'])) |
|
309 |
{
|
|
310 |
$call = array($module->module, $vars['method']); |
|
311 |
}
|
|
312 |
else if (isset($vars['function'])) |
|
313 |
{
|
|
314 |
$call = $vars['function']; |
|
315 |
}
|
|
316 |
else
|
|
317 |
{
|
|
318 |
break; |
|
319 |
}
|
|
320 |
||
321 |
if (isset($vars['params'])) |
|
322 |
{
|
|
323 |
$args = array(); |
|
324 |
foreach ($vars['params'] as $value) |
|
325 |
{
|
|
326 |
switch ($value) |
|
327 |
{
|
|
328 |
case '{CONFIG_VALUE}': |
|
329 |
$value = $new[$config_key]; |
|
330 |
break; |
|
331 |
||
332 |
case '{KEY}': |
|
333 |
$value = $key; |
|
334 |
break; |
|
335 |
}
|
|
336 |
||
337 |
$args[] = $value; |
|
338 |
}
|
|
339 |
}
|
|
340 |
else
|
|
341 |
{
|
|
342 |
$args = array($new[$config_key], $key); |
|
343 |
}
|
|
344 |
||
345 |
$return = call_user_func_array($call, $args); |
|
346 |
||
347 |
if ($tpl_type[0] == 'select') |
|
348 |
{
|
|
349 |
$tpl = '<select id="' . $key . '" name="' . $name . '">' . $return . '</select>'; |
|
350 |
}
|
|
351 |
else
|
|
352 |
{
|
|
353 |
$tpl = $return; |
|
354 |
}
|
|
355 |
||
356 |
break; |
|
357 |
||
358 |
default: |
|
359 |
break; |
|
360 |
}
|
|
361 |
||
362 |
if (isset($vars['append'])) |
|
363 |
{
|
|
364 |
$tpl .= $vars['append']; |
|
365 |
}
|
|
366 |
||
367 |
return $tpl; |
|
368 |
}
|
|
369 |
||
370 |
/**
|
|
371 |
* Going through a config array and validate values, writing errors to $error.
|
|
372 |
*/
|
|
373 |
function validate_config_vars($config_vars, &$cfg_array, &$error) |
|
374 |
{
|
|
375 |
global $phpbb_root_path, $user; |
|
376 |
||
377 |
foreach ($config_vars as $config_name => $config_definition) |
|
378 |
{
|
|
379 |
if (!isset($cfg_array[$config_name]) || strpos($config_name, 'legend') !== false) |
|
380 |
{
|
|
381 |
continue; |
|
382 |
}
|
|
383 |
||
384 |
if (!isset($config_definition['validate'])) |
|
385 |
{
|
|
386 |
continue; |
|
387 |
}
|
|
388 |
||
389 |
// Validate a bit. ;) String is already checked through request_var(), therefore we do not check this again
|
|
390 |
switch ($config_definition['validate']) |
|
391 |
{
|
|
392 |
case 'bool': |
|
393 |
$cfg_array[$config_name] = ($cfg_array[$config_name]) ? 1 : 0; |
|
394 |
break; |
|
395 |
||
396 |
case 'int': |
|
397 |
$cfg_array[$config_name] = (int) $cfg_array[$config_name]; |
|
398 |
break; |
|
399 |
||
400 |
// Absolute path
|
|
401 |
case 'script_path': |
|
402 |
if (!$cfg_array[$config_name]) |
|
403 |
{
|
|
404 |
break; |
|
405 |
}
|
|
406 |
||
407 |
$destination = str_replace('\\', '/', $cfg_array[$config_name]); |
|
408 |
||
409 |
if ($destination !== '/') |
|
410 |
{
|
|
411 |
// Adjust destination path (no trailing slash)
|
|
412 |
if (substr($destination, -1, 1) == '/') |
|
413 |
{
|
|
414 |
$destination = substr($destination, 0, -1); |
|
415 |
}
|
|
416 |
||
417 |
$destination = str_replace(array('../', './'), '', $destination); |
|
418 |
||
419 |
if ($destination[0] != '/') |
|
420 |
{
|
|
421 |
$destination = '/' . $destination; |
|
422 |
}
|
|
423 |
}
|
|
424 |
||
425 |
$cfg_array[$config_name] = trim($destination); |
|
426 |
||
427 |
break; |
|
428 |
||
429 |
// Absolute path
|
|
430 |
case 'lang': |
|
431 |
if (!$cfg_array[$config_name]) |
|
432 |
{
|
|
433 |
break; |
|
434 |
}
|
|
435 |
||
436 |
$cfg_array[$config_name] = basename($cfg_array[$config_name]); |
|
437 |
||
438 |
if (!file_exists($phpbb_root_path . 'language/' . $cfg_array[$config_name] . '/')) |
|
439 |
{
|
|
440 |
$error[] = $user->lang['WRONG_DATA_LANG']; |
|
441 |
}
|
|
442 |
break; |
|
443 |
||
444 |
// Relative path (appended $phpbb_root_path)
|
|
445 |
case 'rpath': |
|
446 |
case 'rwpath': |
|
447 |
if (!$cfg_array[$config_name]) |
|
448 |
{
|
|
449 |
break; |
|
450 |
}
|
|
451 |
||
452 |
$destination = $cfg_array[$config_name]; |
|
453 |
||
454 |
// Adjust destination path (no trailing slash)
|
|
455 |
if (substr($destination, -1, 1) == '/' || substr($destination, -1, 1) == '\\') |
|
456 |
{
|
|
457 |
$destination = substr($destination, 0, -1); |
|
458 |
}
|
|
459 |
||
460 |
$destination = str_replace(array('../', '..\\', './', '.\\'), '', $destination); |
|
461 |
if ($destination && ($destination[0] == '/' || $destination[0] == "\\")) |
|
462 |
{
|
|
463 |
$destination = ''; |
|
464 |
}
|
|
465 |
||
466 |
$cfg_array[$config_name] = trim($destination); |
|
467 |
||
468 |
// Path being relative (still prefixed by phpbb_root_path), but with the ability to escape the root dir...
|
|
469 |
case 'path': |
|
470 |
case 'wpath': |
|
471 |
||
472 |
if (!$cfg_array[$config_name]) |
|
473 |
{
|
|
474 |
break; |
|
475 |
}
|
|
476 |
||
477 |
$cfg_array[$config_name] = trim($cfg_array[$config_name]); |
|
478 |
||
479 |
// Make sure no NUL byte is present...
|
|
480 |
if (strpos($cfg_array[$config_name], "\0") !== false || strpos($cfg_array[$config_name], '%00') !== false) |
|
481 |
{
|
|
482 |
$cfg_array[$config_name] = ''; |
|
483 |
break; |
|
484 |
}
|
|
485 |
||
486 |
if (!file_exists($phpbb_root_path . $cfg_array[$config_name])) |
|
487 |
{
|
|
488 |
$error[] = sprintf($user->lang['DIRECTORY_DOES_NOT_EXIST'], $cfg_array[$config_name]); |
|
489 |
}
|
|
490 |
||
491 |
if (file_exists($phpbb_root_path . $cfg_array[$config_name]) && !is_dir($phpbb_root_path . $cfg_array[$config_name])) |
|
492 |
{
|
|
493 |
$error[] = sprintf($user->lang['DIRECTORY_NOT_DIR'], $cfg_array[$config_name]); |
|
494 |
}
|
|
495 |
||
496 |
// Check if the path is writable
|
|
497 |
if ($config_definition['validate'] == 'wpath' || $config_definition['validate'] == 'rwpath') |
|
498 |
{
|
|
499 |
if (file_exists($phpbb_root_path . $cfg_array[$config_name]) && !@is_writable($phpbb_root_path . $cfg_array[$config_name])) |
|
500 |
{
|
|
501 |
$error[] = sprintf($user->lang['DIRECTORY_NOT_WRITABLE'], $cfg_array[$config_name]); |
|
502 |
}
|
|
503 |
}
|
|
504 |
||
505 |
break; |
|
506 |
}
|
|
507 |
}
|
|
508 |
||
509 |
return; |
|
510 |
}
|
|
511 |
||
520
by dcoles
forum: Fixed setup.py to include forum files in install, disabled |
512 |
?>
|