modified some files to get the admin index page working, as well as index page in logged in state and not logged in state

additionally prepare for a working installation

git-svn-id: file:///svn/phpbb/trunk@9272 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Meik Sievertsen 2009-01-16 17:41:04 +00:00
parent 0df7a9b3e3
commit 57aea7e62f
18 changed files with 848 additions and 952 deletions

View file

@ -19,29 +19,29 @@ if (!defined('PHPBB_ROOT_PATH')) define('PHPBB_ROOT_PATH', './../');
if (!defined('PHP_EXT')) define('PHP_EXT', substr(strrchr(__FILE__, '.'), 1)); if (!defined('PHP_EXT')) define('PHP_EXT', substr(strrchr(__FILE__, '.'), 1));
if (!defined('PHPBB_ADMIN_PATH')) define('PHPBB_ADMIN_PATH', './'); if (!defined('PHPBB_ADMIN_PATH')) define('PHPBB_ADMIN_PATH', './');
include(PHPBB_ROOT_PATH . 'common.' . PHP_EXT); include PHPBB_ROOT_PATH . 'common.' . PHP_EXT;
require(PHPBB_ROOT_PATH . 'includes/functions_admin.' . PHP_EXT); require PHPBB_ROOT_PATH . 'includes/functions_admin.' . PHP_EXT;
require(PHPBB_ROOT_PATH . 'includes/functions_module.' . PHP_EXT); require PHPBB_ROOT_PATH . 'includes/functions_module.' . PHP_EXT;
// Start session management // Start session management
$user->session_begin(); phpbb::$user->session_begin();
$auth->acl($user->data); phpbb::$acl->init(phpbb::$user->data);
$user->setup('acp/common'); phpbb::$user->setup('acp/common');
// End session management // End session management
// Have they authenticated (again) as an admin for this session? // Have they authenticated (again) as an admin for this session?
if ($user->data['user_id'] != ANONYMOUS && (!isset($user->data['session_admin']) || !$user->data['session_admin'])) if (phpbb::$user->data['user_id'] != ANONYMOUS && (!isset(phpbb::$user->data['session_admin']) || !phpbb::$user->data['session_admin']))
{ {
login_box('', $user->lang['LOGIN_ADMIN_CONFIRM'], $user->lang['LOGIN_ADMIN_SUCCESS'], true, false); login_box('', phpbb::$user->lang['LOGIN_ADMIN_CONFIRM'], phpbb::$user->lang['LOGIN_ADMIN_SUCCESS'], true, false);
} }
else if ($user->data['user_id'] == ANONYMOUS) else if (phpbb::$user->data['user_id'] == ANONYMOUS)
{ {
login_box(''); login_box('');
} }
// Is user any type of admin? No, then stop here, each script needs to // Is user any type of admin? No, then stop here, each script needs to
// check specific permissions but this is a catchall // check specific permissions but this is a catchall
if (!$auth->acl_get('a_')) if (!phpbb::$acl->acl_get('a_'))
{ {
trigger_error('NO_ADMIN'); trigger_error('NO_ADMIN');
} }
@ -56,8 +56,8 @@ $module_id = request_var('i', '');
$mode = request_var('mode', ''); $mode = request_var('mode', '');
// Set custom template for admin area // Set custom template for admin area
$template->set_custom_template(PHPBB_ADMIN_PATH . 'style', 'admin'); phpbb::$template->set_custom_template(PHPBB_ADMIN_PATH . 'style', 'admin');
$template->assign_var('T_TEMPLATE_PATH', PHPBB_ADMIN_PATH . 'style'); phpbb::$template->assign_var('T_TEMPLATE_PATH', PHPBB_ADMIN_PATH . 'style');
// Instantiate new module // Instantiate new module
$module = new p_master(); $module = new p_master();
@ -70,7 +70,7 @@ $module->set_active($module_id, $mode);
// Assign data to the template engine for the list of modules // Assign data to the template engine for the list of modules
// We do this before loading the active module for correct menu display in trigger_error // We do this before loading the active module for correct menu display in trigger_error
$module->assign_tpl_vars(append_sid(PHPBB_ADMIN_PATH . 'index.' . PHP_EXT)); $module->assign_tpl_vars(phpbb::$url->append_sid(PHPBB_ADMIN_PATH . 'index.' . PHP_EXT));
// Load and execute the relevant module // Load and execute the relevant module
$module->load_active(); $module->load_active();
@ -78,7 +78,7 @@ $module->load_active();
// Generate the page // Generate the page
adm_page_header($module->get_page_title()); adm_page_header($module->get_page_title());
$template->set_filenames(array( phpbb::$template->set_filenames(array(
'body' => $module->get_tpl_name(), 'body' => $module->get_tpl_name(),
)); ));
@ -89,9 +89,6 @@ adm_page_footer();
*/ */
function adm_page_header($page_title) function adm_page_header($page_title)
{ {
global $db, $user, $template;
global $SID, $_SID;
if (defined('HEADER_INC')) if (defined('HEADER_INC'))
{ {
return; return;
@ -108,22 +105,20 @@ function adm_page_header($page_title)
} }
} }
$template->assign_vars(array( phpbb::$template->assign_vars(array(
'PAGE_TITLE' => $page_title, 'PAGE_TITLE' => $page_title,
'USERNAME' => ($user->data['user_id'] != ANONYMOUS) ? $user->data['username'] : '', 'USERNAME' => (phpbb::$user->data['user_id'] != ANONYMOUS) ? phpbb::$user->data['username'] : '',
'SID' => $SID, 'SESSION_ID' => phpbb::$user->session_id,
'_SID' => $_SID,
'SESSION_ID' => $user->session_id,
'ROOT_PATH' => PHPBB_ADMIN_PATH, 'ROOT_PATH' => PHPBB_ADMIN_PATH,
'U_LOGOUT' => append_sid('ucp', 'mode=logout'), 'U_LOGOUT' => phpbb::$url->append_sid('ucp', 'mode=logout'),
'U_ADM_LOGOUT' => append_sid(PHPBB_ADMIN_PATH . 'index.' . PHP_EXT, 'action=admlogout'), 'U_ADM_LOGOUT' => phpbb::$url->append_sid(PHPBB_ADMIN_PATH . 'index.' . PHP_EXT, 'action=admlogout'),
'U_ADM_INDEX' => append_sid(PHPBB_ADMIN_PATH . 'index.' . PHP_EXT), 'U_ADM_INDEX' => phpbb::$url->append_sid(PHPBB_ADMIN_PATH . 'index.' . PHP_EXT),
'U_INDEX' => append_sid('index'), 'U_INDEX' => phpbb::$url->append_sid('index'),
'S_USER_ADMIN' => $user->data['session_admin'], 'S_USER_ADMIN' => phpbb::$user->data['session_admin'],
'S_USER_LOGGED_IN' => ($user->data['user_id'] != ANONYMOUS && !$user->data['is_bot']), 'S_USER_LOGGED_IN' => (phpbb::$user->data['user_id'] != ANONYMOUS && !phpbb::$user->is_bot),
'T_IMAGES_PATH' => PHPBB_ROOT_PATH . 'images/', 'T_IMAGES_PATH' => PHPBB_ROOT_PATH . 'images/',
'T_SMILIES_PATH' => PHPBB_ROOT_PATH . phpbb::$config['smilies_path'] . '/', 'T_SMILIES_PATH' => PHPBB_ROOT_PATH . phpbb::$config['smilies_path'] . '/',
@ -133,22 +128,22 @@ function adm_page_header($page_title)
'T_RANKS_PATH' => PHPBB_ROOT_PATH . phpbb::$config['ranks_path'] . '/', 'T_RANKS_PATH' => PHPBB_ROOT_PATH . phpbb::$config['ranks_path'] . '/',
'T_UPLOAD_PATH' => PHPBB_ROOT_PATH . phpbb::$config['upload_path'] . '/', 'T_UPLOAD_PATH' => PHPBB_ROOT_PATH . phpbb::$config['upload_path'] . '/',
'ICON_MOVE_UP' => '<img src="' . PHPBB_ADMIN_PATH . 'images/icon_up.gif" alt="' . $user->lang['MOVE_UP'] . '" title="' . $user->lang['MOVE_UP'] . '" />', 'ICON_MOVE_UP' => '<img src="' . PHPBB_ADMIN_PATH . 'images/icon_up.gif" alt="' . phpbb::$user->lang['MOVE_UP'] . '" title="' . phpbb::$user->lang['MOVE_UP'] . '" />',
'ICON_MOVE_UP_DISABLED' => '<img src="' . PHPBB_ADMIN_PATH . 'images/icon_up_disabled.gif" alt="' . $user->lang['MOVE_UP'] . '" title="' . $user->lang['MOVE_UP'] . '" />', 'ICON_MOVE_UP_DISABLED' => '<img src="' . PHPBB_ADMIN_PATH . 'images/icon_up_disabled.gif" alt="' . phpbb::$user->lang['MOVE_UP'] . '" title="' . phpbb::$user->lang['MOVE_UP'] . '" />',
'ICON_MOVE_DOWN' => '<img src="' . PHPBB_ADMIN_PATH . 'images/icon_down.gif" alt="' . $user->lang['MOVE_DOWN'] . '" title="' . $user->lang['MOVE_DOWN'] . '" />', 'ICON_MOVE_DOWN' => '<img src="' . PHPBB_ADMIN_PATH . 'images/icon_down.gif" alt="' . phpbb::$user->lang['MOVE_DOWN'] . '" title="' . phpbb::$user->lang['MOVE_DOWN'] . '" />',
'ICON_MOVE_DOWN_DISABLED' => '<img src="' . PHPBB_ADMIN_PATH . 'images/icon_down_disabled.gif" alt="' . $user->lang['MOVE_DOWN'] . '" title="' . $user->lang['MOVE_DOWN'] . '" />', 'ICON_MOVE_DOWN_DISABLED' => '<img src="' . PHPBB_ADMIN_PATH . 'images/icon_down_disabled.gif" alt="' . phpbb::$user->lang['MOVE_DOWN'] . '" title="' . phpbb::$user->lang['MOVE_DOWN'] . '" />',
'ICON_EDIT' => '<img src="' . PHPBB_ADMIN_PATH . 'images/icon_edit.gif" alt="' . $user->lang['EDIT'] . '" title="' . $user->lang['EDIT'] . '" />', 'ICON_EDIT' => '<img src="' . PHPBB_ADMIN_PATH . 'images/icon_edit.gif" alt="' . phpbb::$user->lang['EDIT'] . '" title="' . phpbb::$user->lang['EDIT'] . '" />',
'ICON_EDIT_DISABLED' => '<img src="' . PHPBB_ADMIN_PATH . 'images/icon_edit_disabled.gif" alt="' . $user->lang['EDIT'] . '" title="' . $user->lang['EDIT'] . '" />', 'ICON_EDIT_DISABLED' => '<img src="' . PHPBB_ADMIN_PATH . 'images/icon_edit_disabled.gif" alt="' . phpbb::$user->lang['EDIT'] . '" title="' . phpbb::$user->lang['EDIT'] . '" />',
'ICON_DELETE' => '<img src="' . PHPBB_ADMIN_PATH . 'images/icon_delete.gif" alt="' . $user->lang['DELETE'] . '" title="' . $user->lang['DELETE'] . '" />', 'ICON_DELETE' => '<img src="' . PHPBB_ADMIN_PATH . 'images/icon_delete.gif" alt="' . phpbb::$user->lang['DELETE'] . '" title="' . phpbb::$user->lang['DELETE'] . '" />',
'ICON_DELETE_DISABLED' => '<img src="' . PHPBB_ADMIN_PATH . 'images/icon_delete_disabled.gif" alt="' . $user->lang['DELETE'] . '" title="' . $user->lang['DELETE'] . '" />', 'ICON_DELETE_DISABLED' => '<img src="' . PHPBB_ADMIN_PATH . 'images/icon_delete_disabled.gif" alt="' . phpbb::$user->lang['DELETE'] . '" title="' . phpbb::$user->lang['DELETE'] . '" />',
'ICON_SYNC' => '<img src="' . PHPBB_ADMIN_PATH . 'images/icon_sync.gif" alt="' . $user->lang['RESYNC'] . '" title="' . $user->lang['RESYNC'] . '" />', 'ICON_SYNC' => '<img src="' . PHPBB_ADMIN_PATH . 'images/icon_sync.gif" alt="' . phpbb::$user->lang['RESYNC'] . '" title="' . phpbb::$user->lang['RESYNC'] . '" />',
'ICON_SYNC_DISABLED' => '<img src="' . PHPBB_ADMIN_PATH . 'images/icon_sync_disabled.gif" alt="' . $user->lang['RESYNC'] . '" title="' . $user->lang['RESYNC'] . '" />', 'ICON_SYNC_DISABLED' => '<img src="' . PHPBB_ADMIN_PATH . 'images/icon_sync_disabled.gif" alt="' . phpbb::$user->lang['RESYNC'] . '" title="' . phpbb::$user->lang['RESYNC'] . '" />',
'S_USER_LANG' => $user->lang['USER_LANG'], 'S_USER_LANG' => phpbb::$user->lang['USER_LANG'],
'S_CONTENT_DIRECTION' => $user->lang['DIRECTION'], 'S_CONTENT_DIRECTION' => phpbb::$user->lang['DIRECTION'],
'S_CONTENT_ENCODING' => 'UTF-8', 'S_CONTENT_ENCODING' => 'UTF-8',
'S_CONTENT_FLOW_BEGIN' => ($user->lang['DIRECTION'] == 'ltr') ? 'left' : 'right', 'S_CONTENT_FLOW_BEGIN' => (phpbb::$user->lang['DIRECTION'] == 'ltr') ? 'left' : 'right',
'S_CONTENT_FLOW_END' => ($user->lang['DIRECTION'] == 'ltr') ? 'right' : 'left', 'S_CONTENT_FLOW_END' => (phpbb::$user->lang['DIRECTION'] == 'ltr') ? 'right' : 'left',
)); ));
// application/xhtml+xml not used because of IE // application/xhtml+xml not used because of IE
@ -166,7 +161,6 @@ function adm_page_header($page_title)
*/ */
function adm_page_footer($copyright_html = true) function adm_page_footer($copyright_html = true)
{ {
global $db, $template, $user, $auth;
global $starttime; global $starttime;
// Output page creation time // Output page creation time
@ -175,14 +169,14 @@ function adm_page_footer($copyright_html = true)
$mtime = explode(' ', microtime()); $mtime = explode(' ', microtime());
$totaltime = $mtime[0] + $mtime[1] - $starttime; $totaltime = $mtime[0] + $mtime[1] - $starttime;
if (phpbb_request::variable('explain', false) && $auth->acl_get('a_') && defined('DEBUG_EXTRA') && method_exists($db, 'sql_report')) if (phpbb_request::variable('explain', false) && phpbb::$acl->acl_get('a_') && defined('DEBUG_EXTRA') && method_exists(phpbb::$db, 'sql_report'))
{ {
$db->sql_report('display'); phpbb::$db->sql_report('display');
} }
$debug_output = sprintf('Time : %.3fs | ' . $db->sql_num_queries() . ' Queries | GZIP : ' . ((phpbb::$config['gzip_compress']) ? 'On' : 'Off') . (($user->load) ? ' | Load : ' . $user->load : ''), $totaltime); $debug_output = sprintf('Time : %.3fs | ' . phpbb::$db->sql_num_queries() . ' Queries | GZIP : ' . ((phpbb::$config['gzip_compress']) ? 'On' : 'Off') . ((phpbb::$user->system['load']) ? ' | Load : ' . phpbb::$user->system['load'] : ''), $totaltime);
if ($auth->acl_get('a_') && defined('DEBUG_EXTRA')) if (phpbb::$acl->acl_get('a_') && defined('DEBUG_EXTRA'))
{ {
if (function_exists('memory_get_usage')) if (function_exists('memory_get_usage'))
{ {
@ -196,18 +190,18 @@ function adm_page_footer($copyright_html = true)
} }
} }
$debug_output .= ' | <a href="' . build_url() . '&amp;explain=1">Explain</a>'; $debug_output .= ' | <a href="' . phpbb::$url->build_url() . '&amp;explain=1">Explain</a>';
} }
} }
$template->assign_vars(array( phpbb::$template->assign_vars(array(
'DEBUG_OUTPUT' => (defined('DEBUG')) ? $debug_output : '', 'DEBUG_OUTPUT' => (defined('DEBUG')) ? $debug_output : '',
'TRANSLATION_INFO' => (!empty($user->lang['TRANSLATION_INFO'])) ? $user->lang['TRANSLATION_INFO'] : '', 'TRANSLATION_INFO' => (!empty(phpbb::$user->lang['TRANSLATION_INFO'])) ? phpbb::$user->lang['TRANSLATION_INFO'] : '',
'S_COPYRIGHT_HTML' => $copyright_html, 'S_COPYRIGHT_HTML' => $copyright_html,
'VERSION' => phpbb::$config['version']) 'VERSION' => phpbb::$config['version'])
); );
$template->display('body'); phpbb::$template->display('body');
garbage_collection(); garbage_collection();
exit_handler(); exit_handler();
@ -218,8 +212,7 @@ function adm_page_footer($copyright_html = true)
*/ */
function adm_back_link($u_action) function adm_back_link($u_action)
{ {
global $user; return '<br /><br /><a href="' . $u_action . '">&laquo; ' . phpbb::$user->lang['BACK_TO_PREV'] . '</a>';
return '<br /><br /><a href="' . $u_action . '">&laquo; ' . $user->lang['BACK_TO_PREV'] . '</a>';
} }
/** /**
@ -227,13 +220,11 @@ function adm_back_link($u_action)
*/ */
function build_select($option_ary, $option_default = false) function build_select($option_ary, $option_default = false)
{ {
global $user;
$html = ''; $html = '';
foreach ($option_ary as $value => $title) foreach ($option_ary as $value => $title)
{ {
$selected = ($option_default !== false && $value == $option_default) ? ' selected="selected"' : ''; $selected = ($option_default !== false && $value == $option_default) ? ' selected="selected"' : '';
$html .= '<option value="' . $value . '"' . $selected . '>' . $user->lang[$title] . '</option>'; $html .= '<option value="' . $value . '"' . $selected . '>' . phpbb::$user->lang[$title] . '</option>';
} }
return $html; return $html;
@ -244,14 +235,12 @@ function build_select($option_ary, $option_default = false)
*/ */
function h_radio($name, &$input_ary, $input_default = false, $id = false, $key = false) function h_radio($name, &$input_ary, $input_default = false, $id = false, $key = false)
{ {
global $user;
$html = ''; $html = '';
$id_assigned = false; $id_assigned = false;
foreach ($input_ary as $value => $title) foreach ($input_ary as $value => $title)
{ {
$selected = ($input_default !== false && $value == $input_default) ? ' checked="checked"' : ''; $selected = ($input_default !== false && $value == $input_default) ? ' checked="checked"' : '';
$html .= '<label><input type="radio" name="' . $name . '"' . (($id && !$id_assigned) ? ' id="' . $id . '"' : '') . ' value="' . $value . '"' . $selected . (($key) ? ' accesskey="' . $key . '"' : '') . ' class="radio" /> ' . $user->lang[$title] . '</label>'; $html .= '<label><input type="radio" name="' . $name . '"' . (($id && !$id_assigned) ? ' id="' . $id . '"' : '') . ' value="' . $value . '"' . $selected . (($key) ? ' accesskey="' . $key . '"' : '') . ' class="radio" /> ' . phpbb::$user->lang[$title] . '</label>';
$id_assigned = true; $id_assigned = true;
} }
@ -263,7 +252,7 @@ function h_radio($name, &$input_ary, $input_default = false, $id = false, $key =
*/ */
function build_cfg_template($tpl_type, $key, &$new, $config_key, $vars) function build_cfg_template($tpl_type, $key, &$new, $config_key, $vars)
{ {
global $user, $module; global $module;
$tpl = ''; $tpl = '';
$name = 'config[' . $config_key . ']'; $name = 'config[' . $config_key . ']';
@ -299,8 +288,8 @@ function build_cfg_template($tpl_type, $key, &$new, $config_key, $vars)
$tpl_type_cond = explode('_', $tpl_type[1]); $tpl_type_cond = explode('_', $tpl_type[1]);
$type_no = ($tpl_type_cond[0] == 'disabled' || $tpl_type_cond[0] == 'enabled') ? false : true; $type_no = ($tpl_type_cond[0] == 'disabled' || $tpl_type_cond[0] == 'enabled') ? false : true;
$tpl_no = '<label><input type="radio" name="' . $name . '" value="0"' . $key_no . ' class="radio" /> ' . (($type_no) ? $user->lang['NO'] : $user->lang['DISABLED']) . '</label>'; $tpl_no = '<label><input type="radio" name="' . $name . '" value="0"' . $key_no . ' class="radio" /> ' . (($type_no) ? phpbb::$user->lang['NO'] : phpbb::$user->lang['DISABLED']) . '</label>';
$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>'; $tpl_yes = '<label><input type="radio" id="' . $key . '" name="' . $name . '" value="1"' . $key_yes . ' class="radio" /> ' . (($type_no) ? phpbb::$user->lang['YES'] : phpbb::$user->lang['ENABLED']) . '</label>';
$tpl = ($tpl_type_cond[0] == 'yes' || $tpl_type_cond[0] == 'enabled') ? $tpl_yes . $tpl_no : $tpl_no . $tpl_yes; $tpl = ($tpl_type_cond[0] == 'yes' || $tpl_type_cond[0] == 'enabled') ? $tpl_yes . $tpl_no : $tpl_no . $tpl_yes;
break; break;
@ -378,8 +367,6 @@ function build_cfg_template($tpl_type, $key, &$new, $config_key, $vars)
*/ */
function validate_config_vars($config_vars, &$cfg_array, &$error) function validate_config_vars($config_vars, &$cfg_array, &$error)
{ {
global $user;
$type = 0; $type = 0;
$min = 1; $min = 1;
$max = 2; $max = 2;
@ -409,11 +396,11 @@ function validate_config_vars($config_vars, &$cfg_array, &$error)
if (isset($validator[$min]) && $length < $validator[$min]) if (isset($validator[$min]) && $length < $validator[$min])
{ {
$error[] = sprintf($user->lang['SETTING_TOO_SHORT'], $user->lang[$config_definition['lang']], $validator[$min]); $error[] = sprintf(phpbb::$user->lang['SETTING_TOO_SHORT'], phpbb::$user->lang[$config_definition['lang']], $validator[$min]);
} }
else if (isset($validator[$max]) && $length > $validator[2]) else if (isset($validator[$max]) && $length > $validator[2])
{ {
$error[] = sprintf($user->lang['SETTING_TOO_LONG'], $user->lang[$config_definition['lang']], $validator[$max]); $error[] = sprintf(phpbb::$user->lang['SETTING_TOO_LONG'], phpbb::$user->lang[$config_definition['lang']], $validator[$max]);
} }
break; break;
@ -426,11 +413,11 @@ function validate_config_vars($config_vars, &$cfg_array, &$error)
if (isset($validator[$min]) && $cfg_array[$config_name] < $validator[$min]) if (isset($validator[$min]) && $cfg_array[$config_name] < $validator[$min])
{ {
$error[] = sprintf($user->lang['SETTING_TOO_LOW'], $user->lang[$config_definition['lang']], $validator[$min]); $error[] = sprintf(phpbb::$user->lang['SETTING_TOO_LOW'], phpbb::$user->lang[$config_definition['lang']], $validator[$min]);
} }
else if (isset($validator[$max]) && $cfg_array[$config_name] > $validator[$max]) else if (isset($validator[$max]) && $cfg_array[$config_name] > $validator[$max])
{ {
$error[] = sprintf($user->lang['SETTING_TOO_BIG'], $user->lang[$config_definition['lang']], $validator[$max]); $error[] = sprintf(phpbb::$user->lang['SETTING_TOO_BIG'], phpbb::$user->lang[$config_definition['lang']], $validator[$max]);
} }
break; break;
@ -474,7 +461,7 @@ function validate_config_vars($config_vars, &$cfg_array, &$error)
if (!file_exists(PHPBB_ROOT_PATH . 'language/' . $cfg_array[$config_name] . '/')) if (!file_exists(PHPBB_ROOT_PATH . 'language/' . $cfg_array[$config_name] . '/'))
{ {
$error[] = $user->lang['WRONG_DATA_LANG']; $error[] = phpbb::$user->lang['WRONG_DATA_LANG'];
} }
break; break;
@ -522,12 +509,12 @@ function validate_config_vars($config_vars, &$cfg_array, &$error)
if (!file_exists(PHPBB_ROOT_PATH . $cfg_array[$config_name])) if (!file_exists(PHPBB_ROOT_PATH . $cfg_array[$config_name]))
{ {
$error[] = sprintf($user->lang['DIRECTORY_DOES_NOT_EXIST'], $cfg_array[$config_name]); $error[] = sprintf(phpbb::$user->lang['DIRECTORY_DOES_NOT_EXIST'], $cfg_array[$config_name]);
} }
if (file_exists(PHPBB_ROOT_PATH . $cfg_array[$config_name]) && !is_dir(PHPBB_ROOT_PATH . $cfg_array[$config_name])) if (file_exists(PHPBB_ROOT_PATH . $cfg_array[$config_name]) && !is_dir(PHPBB_ROOT_PATH . $cfg_array[$config_name]))
{ {
$error[] = sprintf($user->lang['DIRECTORY_NOT_DIR'], $cfg_array[$config_name]); $error[] = sprintf(phpbb::$user->lang['DIRECTORY_NOT_DIR'], $cfg_array[$config_name]);
} }
// Check if the path is writable // Check if the path is writable
@ -535,7 +522,7 @@ function validate_config_vars($config_vars, &$cfg_array, &$error)
{ {
if (file_exists(PHPBB_ROOT_PATH . $cfg_array[$config_name]) && !@is_writable(PHPBB_ROOT_PATH . $cfg_array[$config_name])) if (file_exists(PHPBB_ROOT_PATH . $cfg_array[$config_name]) && !@is_writable(PHPBB_ROOT_PATH . $cfg_array[$config_name]))
{ {
$error[] = sprintf($user->lang['DIRECTORY_NOT_WRITABLE'], $cfg_array[$config_name]); $error[] = sprintf(phpbb::$user->lang['DIRECTORY_NOT_WRITABLE'], $cfg_array[$config_name]);
} }
} }
@ -553,8 +540,6 @@ function validate_config_vars($config_vars, &$cfg_array, &$error)
*/ */
function validate_range($value_ary, &$error) function validate_range($value_ary, &$error)
{ {
global $user;
$column_types = array( $column_types = array(
'BOOL' => array('php_type' => 'int', 'min' => 0, 'max' => 1), 'BOOL' => array('php_type' => 'int', 'min' => 0, 'max' => 1),
'USINT' => array('php_type' => 'int', 'min' => 0, 'max' => 65535), 'USINT' => array('php_type' => 'int', 'min' => 0, 'max' => 65535),
@ -584,7 +569,7 @@ function validate_range($value_ary, &$error)
$max = (isset($column[1])) ? min($column[1],$type['max']) : $type['max']; $max = (isset($column[1])) ? min($column[1],$type['max']) : $type['max'];
if (strlen($value['value']) > $max) if (strlen($value['value']) > $max)
{ {
$error[] = sprintf($user->lang['SETTING_TOO_LONG'], $user->lang[$value['lang']], $max); $error[] = sprintf(phpbb::$user->lang['SETTING_TOO_LONG'], phpbb::$user->lang[$value['lang']], $max);
} }
break; break;
@ -593,11 +578,11 @@ function validate_range($value_ary, &$error)
$max = (isset($column[2])) ? min($column[2],$type['max']) : $type['max']; $max = (isset($column[2])) ? min($column[2],$type['max']) : $type['max'];
if ($value['value'] < $min) if ($value['value'] < $min)
{ {
$error[] = sprintf($user->lang['SETTING_TOO_LOW'], $user->lang[$value['lang']], $min); $error[] = sprintf(phpbb::$user->lang['SETTING_TOO_LOW'], phpbb::$user->lang[$value['lang']], $min);
} }
else if ($value['value'] > $max) else if ($value['value'] > $max)
{ {
$error[] = sprintf($user->lang['SETTING_TOO_BIG'], $user->lang[$value['lang']], $max); $error[] = sprintf(phpbb::$user->lang['SETTING_TOO_BIG'], phpbb::$user->lang[$value['lang']], $max);
} }
break; break;
} }

File diff suppressed because it is too large Load diff

View file

@ -2287,11 +2287,9 @@ function cache_moderators()
*/ */
function view_log($mode, &$log, &$log_count, $limit = 0, $offset = 0, $forum_id = 0, $topic_id = 0, $user_id = 0, $limit_days = 0, $sort_by = 'l.log_time DESC') function view_log($mode, &$log, &$log_count, $limit = 0, $offset = 0, $forum_id = 0, $topic_id = 0, $user_id = 0, $limit_days = 0, $sort_by = 'l.log_time DESC')
{ {
global $db, $user, $auth;
$topic_id_list = $reportee_id_list = $is_auth = $is_mod = array(); $topic_id_list = $reportee_id_list = $is_auth = $is_mod = array();
$profile_url = (defined('IN_ADMIN')) ? append_sid(PHPBB_ADMIN_PATH . 'index.' . PHP_EXT, 'i=users&amp;mode=overview') : append_sid('memberlist', 'mode=viewprofile'); $profile_url = (defined('IN_ADMIN')) ? phpbb::$url->append_sid(PHPBB_ADMIN_PATH . 'index.' . PHP_EXT, 'i=users&amp;mode=overview') : phpbb::$url->append_sid('memberlist', 'mode=viewprofile');
switch ($mode) switch ($mode)
{ {
@ -2309,7 +2307,7 @@ function view_log($mode, &$log, &$log_count, $limit = 0, $offset = 0, $forum_id
} }
else if (is_array($forum_id)) else if (is_array($forum_id))
{ {
$sql_forum = 'AND ' . $db->sql_in_set('l.forum_id', array_map('intval', $forum_id)); $sql_forum = 'AND ' . phpbb::$db->sql_in_set('l.forum_id', array_map('intval', $forum_id));
} }
else else
{ {
@ -2343,11 +2341,11 @@ function view_log($mode, &$log, &$log_count, $limit = 0, $offset = 0, $forum_id
" . (($limit_days) ? "AND l.log_time >= $limit_days" : '') . " " . (($limit_days) ? "AND l.log_time >= $limit_days" : '') . "
$sql_forum $sql_forum
ORDER BY $sort_by"; ORDER BY $sort_by";
$result = $db->sql_query_limit($sql, $limit, $offset); $result = phpbb::$db->sql_query_limit($sql, $limit, $offset);
$i = 0; $i = 0;
$log = array(); $log = array();
while ($row = $db->sql_fetchrow($result)) while ($row = phpbb::$db->sql_fetchrow($result))
{ {
if ($row['topic_id']) if ($row['topic_id'])
{ {
@ -2375,15 +2373,15 @@ function view_log($mode, &$log, &$log_count, $limit = 0, $offset = 0, $forum_id
'forum_id' => $row['forum_id'], 'forum_id' => $row['forum_id'],
'topic_id' => $row['topic_id'], 'topic_id' => $row['topic_id'],
'viewforum' => ($row['forum_id'] && $auth->acl_get('f_read', $row['forum_id'])) ? append_sid('viewforum', 'f=' . $row['forum_id']) : false, 'viewforum' => ($row['forum_id'] && phpbb::$acl->acl_get('f_read', $row['forum_id'])) ? phpbb::$url->append_sid('viewforum', 'f=' . $row['forum_id']) : false,
'action' => (isset($user->lang[$row['log_operation']])) ? $user->lang[$row['log_operation']] : '{' . ucfirst(str_replace('_', ' ', $row['log_operation'])) . '}', 'action' => (isset(phpbb::$user->lang[$row['log_operation']])) ? phpbb::$user->lang[$row['log_operation']] : '{' . ucfirst(str_replace('_', ' ', $row['log_operation'])) . '}',
); );
if (!empty($row['log_data'])) if (!empty($row['log_data']))
{ {
$log_data_ary = unserialize($row['log_data']); $log_data_ary = unserialize($row['log_data']);
if (isset($user->lang[$row['log_operation']])) if (isset(phpbb::$user->lang[$row['log_operation']]))
{ {
// Check if there are more occurrences of % than arguments, if there are we fill out the arguments array // Check if there are more occurrences of % than arguments, if there are we fill out the arguments array
// It doesn't matter if we add more arguments than placeholders // It doesn't matter if we add more arguments than placeholders
@ -2417,7 +2415,7 @@ function view_log($mode, &$log, &$log_count, $limit = 0, $offset = 0, $forum_id
$i++; $i++;
} }
$db->sql_freeresult($result); phpbb::$db->sql_freeresult($result);
if (sizeof($topic_id_list)) if (sizeof($topic_id_list))
{ {
@ -2427,25 +2425,25 @@ function view_log($mode, &$log, &$log_count, $limit = 0, $offset = 0, $forum_id
// although it's also used to determine if the topic still exists in the database // although it's also used to determine if the topic still exists in the database
$sql = 'SELECT topic_id, forum_id $sql = 'SELECT topic_id, forum_id
FROM ' . TOPICS_TABLE . ' FROM ' . TOPICS_TABLE . '
WHERE ' . $db->sql_in_set('topic_id', array_map('intval', $topic_id_list)); WHERE ' . phpbb::$db->sql_in_set('topic_id', array_map('intval', $topic_id_list));
$result = $db->sql_query($sql); $result = phpbb::$db->sql_query($sql);
$default_forum_id = 0; $default_forum_id = 0;
while ($row = $db->sql_fetchrow($result)) while ($row = phpbb::$db->sql_fetchrow($result))
{ {
if (!$row['forum_id']) if (!$row['forum_id'])
{ {
if ($auth->acl_getf_global('f_read')) if (phpbb::$acl->acl_getf_global('f_read'))
{ {
if (!$default_forum_id) if (!$default_forum_id)
{ {
$sql = 'SELECT forum_id $sql = 'SELECT forum_id
FROM ' . FORUMS_TABLE . ' FROM ' . FORUMS_TABLE . '
WHERE forum_type = ' . FORUM_POST; WHERE forum_type = ' . FORUM_POST;
$f_result = $db->sql_query_limit($sql, 1); $f_result = phpbb::$db->sql_query_limit($sql, 1);
$default_forum_id = (int) $db->sql_fetchfield('forum_id', $f_result); $default_forum_id = (int) phpbb::$db->sql_fetchfield('forum_id', $f_result);
$db->sql_freeresult($f_result); phpbb::$db->sql_freeresult($f_result);
} }
$is_auth[$row['topic_id']] = $default_forum_id; $is_auth[$row['topic_id']] = $default_forum_id;
@ -2453,23 +2451,23 @@ function view_log($mode, &$log, &$log_count, $limit = 0, $offset = 0, $forum_id
} }
else else
{ {
if ($auth->acl_get('f_read', $row['forum_id'])) if (phpbb::$acl->acl_get('f_read', $row['forum_id']))
{ {
$is_auth[$row['topic_id']] = $row['forum_id']; $is_auth[$row['topic_id']] = $row['forum_id'];
} }
} }
if ($auth->acl_gets('a_', 'm_', $row['forum_id'])) if (phpbb::$acl->acl_gets('a_', 'm_', $row['forum_id']))
{ {
$is_mod[$row['topic_id']] = $row['forum_id']; $is_mod[$row['topic_id']] = $row['forum_id'];
} }
} }
$db->sql_freeresult($result); phpbb::$db->sql_freeresult($result);
foreach ($log as $key => $row) foreach ($log as $key => $row)
{ {
$log[$key]['viewtopic'] = (isset($is_auth[$row['topic_id']])) ? append_sid('viewtopic', 'f=' . $is_auth[$row['topic_id']] . '&amp;t=' . $row['topic_id']) : false; $log[$key]['viewtopic'] = (isset($is_auth[$row['topic_id']])) ? phpbb::$url->append_sid('viewtopic', 'f=' . $is_auth[$row['topic_id']] . '&amp;t=' . $row['topic_id']) : false;
$log[$key]['viewlogs'] = (isset($is_mod[$row['topic_id']])) ? append_sid('mcp', 'i=logs&amp;mode=topic_logs&amp;t=' . $row['topic_id'], true, $user->session_id) : false; $log[$key]['viewlogs'] = (isset($is_mod[$row['topic_id']])) ? phpbb::$url->append_sid('mcp', 'i=logs&amp;mode=topic_logs&amp;t=' . $row['topic_id'], true, phpbb::$user->session_id) : false;
} }
} }
@ -2480,14 +2478,14 @@ function view_log($mode, &$log, &$log_count, $limit = 0, $offset = 0, $forum_id
$sql = 'SELECT user_id, username, user_colour $sql = 'SELECT user_id, username, user_colour
FROM ' . USERS_TABLE . ' FROM ' . USERS_TABLE . '
WHERE ' . $db->sql_in_set('user_id', $reportee_id_list); WHERE ' . phpbb::$db->sql_in_set('user_id', $reportee_id_list);
$result = $db->sql_query($sql); $result = phpbb::$db->sql_query($sql);
while ($row = $db->sql_fetchrow($result)) while ($row = phpbb::$db->sql_fetchrow($result))
{ {
$reportee_names_list[$row['user_id']] = $row; $reportee_names_list[$row['user_id']] = $row;
} }
$db->sql_freeresult($result); phpbb::$db->sql_freeresult($result);
foreach ($log as $key => $row) foreach ($log as $key => $row)
{ {
@ -2506,9 +2504,9 @@ function view_log($mode, &$log, &$log_count, $limit = 0, $offset = 0, $forum_id
WHERE l.log_type = $log_type WHERE l.log_type = $log_type
AND l.log_time >= $limit_days AND l.log_time >= $limit_days
$sql_forum"; $sql_forum";
$result = $db->sql_query($sql); $result = phpbb::$db->sql_query($sql);
$log_count = (int) $db->sql_fetchfield('total_entries'); $log_count = (int) phpbb::$db->sql_fetchfield('total_entries');
$db->sql_freeresult($result); phpbb::$db->sql_freeresult($result);
return; return;
} }
@ -2629,15 +2627,13 @@ function update_foes($group_id = false, $user_id = false)
*/ */
function view_inactive_users(&$users, &$user_count, $limit = 0, $offset = 0, $limit_days = 0, $sort_by = 'user_inactive_time DESC') function view_inactive_users(&$users, &$user_count, $limit = 0, $offset = 0, $limit_days = 0, $sort_by = 'user_inactive_time DESC')
{ {
global $db, $user;
$sql = 'SELECT COUNT(user_id) AS user_count $sql = 'SELECT COUNT(user_id) AS user_count
FROM ' . USERS_TABLE . ' FROM ' . USERS_TABLE . '
WHERE user_type = ' . phpbb::USER_INACTIVE . WHERE user_type = ' . phpbb::USER_INACTIVE .
(($limit_days) ? " AND user_inactive_time >= $limit_days" : ''); (($limit_days) ? " AND user_inactive_time >= $limit_days" : '');
$result = $db->sql_query($sql); $result = phpbb::$db->sql_query($sql);
$user_count = (int) $db->sql_fetchfield('user_count'); $user_count = (int) phpbb::$db->sql_fetchfield('user_count');
$db->sql_freeresult($result); phpbb::$db->sql_freeresult($result);
if ($offset >= $user_count) if ($offset >= $user_count)
{ {
@ -2649,27 +2645,27 @@ function view_inactive_users(&$users, &$user_count, $limit = 0, $offset = 0, $li
WHERE user_type = ' . phpbb::USER_INACTIVE . WHERE user_type = ' . phpbb::USER_INACTIVE .
(($limit_days) ? " AND user_inactive_time >= $limit_days" : '') . " (($limit_days) ? " AND user_inactive_time >= $limit_days" : '') . "
ORDER BY $sort_by"; ORDER BY $sort_by";
$result = $db->sql_query_limit($sql, $limit, $offset); $result = phpbb::$db->sql_query_limit($sql, $limit, $offset);
while ($row = $db->sql_fetchrow($result)) while ($row = phpbb::$db->sql_fetchrow($result))
{ {
$row['inactive_reason'] = $user->lang['INACTIVE_REASON_UNKNOWN']; $row['inactive_reason'] = phpbb::$user->lang['INACTIVE_REASON_UNKNOWN'];
switch ($row['user_inactive_reason']) switch ($row['user_inactive_reason'])
{ {
case INACTIVE_REGISTER: case INACTIVE_REGISTER:
$row['inactive_reason'] = $user->lang['INACTIVE_REASON_REGISTER']; $row['inactive_reason'] = phpbb::$user->lang['INACTIVE_REASON_REGISTER'];
break; break;
case INACTIVE_PROFILE: case INACTIVE_PROFILE:
$row['inactive_reason'] = $user->lang['INACTIVE_REASON_PROFILE']; $row['inactive_reason'] = phpbb::$user->lang['INACTIVE_REASON_PROFILE'];
break; break;
case INACTIVE_MANUAL: case INACTIVE_MANUAL:
$row['inactive_reason'] = $user->lang['INACTIVE_REASON_MANUAL']; $row['inactive_reason'] = phpbb::$user->lang['INACTIVE_REASON_MANUAL'];
break; break;
case INACTIVE_REMIND: case INACTIVE_REMIND:
$row['inactive_reason'] = $user->lang['INACTIVE_REASON_REMIND']; $row['inactive_reason'] = phpbb::$user->lang['INACTIVE_REASON_REMIND'];
break; break;
} }
@ -2711,18 +2707,18 @@ function view_warned_users(&$users, &$user_count, $limit = 0, $offset = 0, $limi
*/ */
function get_database_size() function get_database_size()
{ {
global $db, $user, $table_prefix; global $table_prefix;
$database_size = false; $database_size = false;
// This code is heavily influenced by a similar routine in phpMyAdmin 2.2.0 // This code is heavily influenced by a similar routine in phpMyAdmin 2.2.0
switch ($db->dbms_type) switch (phpbb::$db->dbms_type)
{ {
case 'mysql': case 'mysql':
$sql = 'SELECT VERSION() AS mysql_version'; $sql = 'SELECT VERSION() AS mysql_version';
$result = $db->sql_query($sql); $result = phpbb::$db->sql_query($sql);
$row = $db->sql_fetchrow($result); $row = phpbb::$db->sql_fetchrow($result);
$db->sql_freeresult($result); phpbb::$db->sql_freeresult($result);
if ($row) if ($row)
{ {
@ -2730,14 +2726,14 @@ function get_database_size()
if (preg_match('#(3\.23|[45]\.)#', $version)) if (preg_match('#(3\.23|[45]\.)#', $version))
{ {
$db_name = (preg_match('#^(?:3\.23\.(?:[6-9]|[1-9]{2}))|[45]\.#', $version)) ? "`{$db->dbname}`" : $db->dbname; $db_name = (preg_match('#^(?:3\.23\.(?:[6-9]|[1-9]{2}))|[45]\.#', $version)) ? "`" . phpbb::$db->dbname . "`" : phpbb::$db->dbname;
$sql = 'SHOW TABLE STATUS $sql = 'SHOW TABLE STATUS
FROM ' . $db_name; FROM ' . $db_name;
$result = $db->sql_query($sql, 7200); $result = phpbb::$db->sql_query($sql, 7200);
$database_size = 0; $database_size = 0;
while ($row = $db->sql_fetchrow($result)) while ($row = phpbb::$db->sql_fetchrow($result))
{ {
if ((isset($row['Type']) && $row['Type'] != 'MRG_MyISAM') || (isset($row['Engine']) && ($row['Engine'] == 'MyISAM' || $row['Engine'] == 'InnoDB'))) if ((isset($row['Type']) && $row['Type'] != 'MRG_MyISAM') || (isset($row['Engine']) && ($row['Engine'] == 'MyISAM' || $row['Engine'] == 'InnoDB')))
{ {
@ -2754,7 +2750,7 @@ function get_database_size()
} }
} }
} }
$db->sql_freeresult($result); phpbb::$db->sql_freeresult($result);
} }
} }
break; break;
@ -2783,22 +2779,22 @@ function get_database_size()
case 'mssql': case 'mssql':
$sql = 'SELECT ((SUM(size) * 8.0) * 1024.0) as dbsize $sql = 'SELECT ((SUM(size) * 8.0) * 1024.0) as dbsize
FROM sysfiles'; FROM sysfiles';
$result = $db->sql_query($sql, 7200); $result = phpbb::$db->sql_query($sql, 7200);
$database_size = ($row = $db->sql_fetchrow($result)) ? $row['dbsize'] : false; $database_size = ($row = phpbb::$db->sql_fetchrow($result)) ? $row['dbsize'] : false;
$db->sql_freeresult($result); phpbb::$db->sql_freeresult($result);
break; break;
case 'postgres': case 'postgres':
$sql = "SELECT proname $sql = "SELECT proname
FROM pg_proc FROM pg_proc
WHERE proname = 'pg_database_size'"; WHERE proname = 'pg_database_size'";
$result = $db->sql_query($sql); $result = phpbb::$db->sql_query($sql);
$row = $db->sql_fetchrow($result); $row = phpbb::$db->sql_fetchrow($result);
$db->sql_freeresult($result); phpbb::$db->sql_freeresult($result);
if ($row['proname'] == 'pg_database_size') if ($row['proname'] == 'pg_database_size')
{ {
$database = $db->dbname; $database = phpbb::$db->dbname;
if (strpos($database, '.') !== false) if (strpos($database, '.') !== false)
{ {
list($database, ) = explode('.', $database); list($database, ) = explode('.', $database);
@ -2807,16 +2803,16 @@ function get_database_size()
$sql = "SELECT oid $sql = "SELECT oid
FROM pg_database FROM pg_database
WHERE datname = '$database'"; WHERE datname = '$database'";
$result = $db->sql_query($sql); $result = phpbb::$db->sql_query($sql);
$row = $db->sql_fetchrow($result); $row = phpbb::$db->sql_fetchrow($result);
$db->sql_freeresult($result); phpbb::$db->sql_freeresult($result);
$oid = $row['oid']; $oid = $row['oid'];
$sql = 'SELECT pg_database_size(' . $oid . ') as size'; $sql = 'SELECT pg_database_size(' . $oid . ') as size';
$result = $db->sql_query($sql); $result = phpbb::$db->sql_query($sql);
$row = $db->sql_fetchrow($result); $row = phpbb::$db->sql_fetchrow($result);
$db->sql_freeresult($result); phpbb::$db->sql_freeresult($result);
$database_size = $row['size']; $database_size = $row['size'];
} }
@ -2825,13 +2821,13 @@ function get_database_size()
case 'oracle': case 'oracle':
$sql = 'SELECT SUM(bytes) as dbsize $sql = 'SELECT SUM(bytes) as dbsize
FROM user_segments'; FROM user_segments';
$result = $db->sql_query($sql, 7200); $result = phpbb::$db->sql_query($sql, 7200);
$database_size = ($row = $db->sql_fetchrow($result)) ? $row['dbsize'] : false; $database_size = ($row = phpbb::$db->sql_fetchrow($result)) ? $row['dbsize'] : false;
$db->sql_freeresult($result); phpbb::$db->sql_freeresult($result);
break; break;
} }
$database_size = ($database_size !== false) ? get_formatted_filesize($database_size) : $user->lang['NOT_AVAILABLE']; $database_size = ($database_size !== false) ? get_formatted_filesize($database_size) : phpbb::$user->lang['NOT_AVAILABLE'];
return $database_size; return $database_size;
} }

View file

@ -323,7 +323,7 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod
if ($subforum_row['display'] && $subforum_row['name']) if ($subforum_row['display'] && $subforum_row['name'])
{ {
$subforums_list[] = array( $subforums_list[] = array(
'link' => append_sid('viewforum', 'f=' . $subforum_id), 'link' => phpbb::$url->append_sid('viewforum', 'f=' . $subforum_id),
'name' => $subforum_row['name'], 'name' => $subforum_row['name'],
'unread' => $subforum_unread, 'unread' => $subforum_unread,
); );
@ -465,7 +465,7 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod
} }
phpbb::$template->assign_vars(array( phpbb::$template->assign_vars(array(
'U_MARK_FORUMS' => (phpbb::$user->is_registered || phpbb::$config['load_anon_lastread']) ? append_sid('viewforum', 'hash=' . phpbb::$security->hash_link('global') . '&amp;f=' . $root_data['forum_id'] . '&amp;mark=forums') : '', 'U_MARK_FORUMS' => (phpbb::$user->is_registered || phpbb::$config['load_anon_lastread']) ? phpbb::$url->append_sid('viewforum', 'hash=' . generate_link_hash('global') . '&amp;f=' . $root_data['forum_id'] . '&amp;mark=forums') : '',
'S_HAS_SUBFORUM' => ($visible_forums) ? true : false, 'S_HAS_SUBFORUM' => ($visible_forums) ? true : false,
'L_SUBFORUM' => phpbb::$user->lang('SUBFORUMS', $visible_forums), 'L_SUBFORUM' => phpbb::$user->lang('SUBFORUMS', $visible_forums),
'LAST_POST_IMG' => phpbb::$user->img('icon_topic_latest', 'VIEW_LATEST_POST')) 'LAST_POST_IMG' => phpbb::$user->img('icon_topic_latest', 'VIEW_LATEST_POST'))
@ -538,7 +538,7 @@ function generate_forum_nav(&$forum_data)
'S_IS_POST' => ($parent_type == FORUM_POST) ? true : false, 'S_IS_POST' => ($parent_type == FORUM_POST) ? true : false,
'FORUM_NAME' => $parent_name, 'FORUM_NAME' => $parent_name,
'FORUM_ID' => $parent_forum_id, 'FORUM_ID' => $parent_forum_id,
'U_VIEW_FORUM' => append_sid('viewforum', 'f=' . $parent_forum_id)) 'U_VIEW_FORUM' => phpbb::$url->append_sid('viewforum', 'f=' . $parent_forum_id))
); );
} }
} }
@ -549,7 +549,7 @@ function generate_forum_nav(&$forum_data)
'S_IS_POST' => ($forum_data['forum_type'] == FORUM_POST) ? true : false, 'S_IS_POST' => ($forum_data['forum_type'] == FORUM_POST) ? true : false,
'FORUM_NAME' => $forum_data['forum_name'], 'FORUM_NAME' => $forum_data['forum_name'],
'FORUM_ID' => $forum_data['forum_id'], 'FORUM_ID' => $forum_data['forum_id'],
'U_VIEW_FORUM' => append_sid('viewforum', 'f=' . $forum_data['forum_id'])) 'U_VIEW_FORUM' => phpbb::$url->append_sid('viewforum', 'f=' . $forum_data['forum_id']))
); );
$template->assign_vars(array( $template->assign_vars(array(
@ -999,8 +999,8 @@ function display_user_activity(&$userdata)
'ACTIVE_TOPIC' => censor_text($active_t_name), 'ACTIVE_TOPIC' => censor_text($active_t_name),
'ACTIVE_TOPIC_POSTS' => ($active_t_count == 1) ? sprintf($user->lang['USER_POST'], 1) : sprintf($user->lang['USER_POSTS'], $active_t_count), 'ACTIVE_TOPIC_POSTS' => ($active_t_count == 1) ? sprintf($user->lang['USER_POST'], 1) : sprintf($user->lang['USER_POSTS'], $active_t_count),
'ACTIVE_TOPIC_PCT' => sprintf($l_active_pct, $active_t_pct), 'ACTIVE_TOPIC_PCT' => sprintf($l_active_pct, $active_t_pct),
'U_ACTIVE_FORUM' => append_sid('viewforum', 'f=' . $active_f_id), 'U_ACTIVE_FORUM' => phpbb::$url->append_sid('viewforum', 'f=' . $active_f_id),
'U_ACTIVE_TOPIC' => append_sid('viewtopic', 't=' . $active_t_id), 'U_ACTIVE_TOPIC' => phpbb::$url->append_sid('viewtopic', 't=' . $active_t_id),
'S_SHOW_ACTIVITY' => true, 'S_SHOW_ACTIVITY' => true,
)); ));
} }
@ -1043,7 +1043,7 @@ function watch_topic_forum($mode, &$s_watching, $user_id, $forum_id, $topic_id,
$uid = request_var('uid', 0); $uid = request_var('uid', 0);
if ($uid != $user_id) if ($uid != $user_id)
{ {
$redirect_url = append_sid("view$mode", "$u_url=$match_id&amp;start=$start"); $redirect_url = phpbb::$url->append_sid("view$mode", "$u_url=$match_id&amp;start=$start");
$message = $user->lang['ERR_UNWATCHING'] . '<br /><br />' . sprintf($user->lang['RETURN_' . strtoupper($mode)], '<a href="' . $redirect_url . '">', '</a>'); $message = $user->lang['ERR_UNWATCHING'] . '<br /><br />' . sprintf($user->lang['RETURN_' . strtoupper($mode)], '<a href="' . $redirect_url . '">', '</a>');
trigger_error($message); trigger_error($message);
} }
@ -1057,7 +1057,7 @@ function watch_topic_forum($mode, &$s_watching, $user_id, $forum_id, $topic_id,
$db->sql_query($sql); $db->sql_query($sql);
} }
$redirect_url = append_sid("view$mode", "$u_url=$match_id&amp;start=$start"); $redirect_url = phpbb::$url->append_sid("view$mode", "$u_url=$match_id&amp;start=$start");
meta_refresh(3, $redirect_url); meta_refresh(3, $redirect_url);
@ -1083,7 +1083,7 @@ function watch_topic_forum($mode, &$s_watching, $user_id, $forum_id, $topic_id,
if (phpbb_request::is_set('watch', phpbb_request::GET)) if (phpbb_request::is_set('watch', phpbb_request::GET))
{ {
$token = request_var('hash', ''); $token = request_var('hash', '');
$redirect_url = append_sid("view$mode", "$u_url=$match_id&amp;start=$start"); $redirect_url = phpbb::$url->append_sid("view$mode", "$u_url=$match_id&amp;start=$start");
if (phpbb_request::variable('watch', '', false, phpbb_request::GET) == $mode && check_link_hash($token, "{$mode}_$match_id")) if (phpbb_request::variable('watch', '', false, phpbb_request::GET) == $mode && check_link_hash($token, "{$mode}_$match_id"))
{ {
@ -1124,7 +1124,7 @@ function watch_topic_forum($mode, &$s_watching, $user_id, $forum_id, $topic_id,
if ($can_watch) if ($can_watch)
{ {
$s_watching['link'] = append_sid("view$mode", "$u_url=$match_id&amp;" . (($is_watching) ? 'unwatch' : 'watch') . "=$mode&amp;start=$start&amp;hash=" . generate_link_hash("{$mode}_$match_id")); $s_watching['link'] = phpbb::$url->append_sid("view$mode", "$u_url=$match_id&amp;" . (($is_watching) ? 'unwatch' : 'watch') . "=$mode&amp;start=$start&amp;hash=" . generate_link_hash("{$mode}_$match_id"));
$s_watching['title'] = $user->lang[(($is_watching) ? 'STOP' : 'START') . '_WATCHING_' . strtoupper($mode)]; $s_watching['title'] = $user->lang[(($is_watching) ? 'STOP' : 'START') . '_WATCHING_' . strtoupper($mode)];
$s_watching['is_watching'] = $is_watching; $s_watching['is_watching'] = $is_watching;
} }

View file

@ -40,7 +40,7 @@ class p_master
*/ */
public function __construct($include_path = false) public function __construct($include_path = false)
{ {
$this->include_path = ($include_path !== false) ? $include_path : PHPBB_ROOT_PATH . 'includes/'; $this->include_path = ($include_path !== false) ? $include_path : PHPBB_ROOT_PATH . 'modules/';
// Make sure the path ends with / // Make sure the path ends with /
if (substr($this->include_path, -1) !== '/') if (substr($this->include_path, -1) !== '/')
@ -78,8 +78,6 @@ class p_master
*/ */
function list_modules($p_class) function list_modules($p_class)
{ {
global $auth, $db, $user;
// Sanitise for future path use, it's escaped as appropriate for queries // Sanitise for future path use, it's escaped as appropriate for queries
$this->p_class = str_replace(array('.', '/', '\\'), '', basename($p_class)); $this->p_class = str_replace(array('.', '/', '\\'), '', basename($p_class));
@ -89,16 +87,16 @@ class p_master
// Get modules // Get modules
$sql = 'SELECT * $sql = 'SELECT *
FROM ' . MODULES_TABLE . " FROM ' . MODULES_TABLE . "
WHERE module_class = '" . $db->sql_escape($this->p_class) . "' WHERE module_class = '" . phpbb::$db->sql_escape($this->p_class) . "'
ORDER BY left_id ASC"; ORDER BY left_id ASC";
$result = $db->sql_query($sql); $result = phpbb::$db->sql_query($sql);
$rows = array(); $rows = array();
while ($row = $db->sql_fetchrow($result)) while ($row = phpbb::$db->sql_fetchrow($result))
{ {
$rows[$row['module_id']] = $row; $rows[$row['module_id']] = $row;
} }
$db->sql_freeresult($result); phpbb::$db->sql_freeresult($result);
$this->module_cache = array(); $this->module_cache = array();
foreach ($rows as $module_id => $row) foreach ($rows as $module_id => $row)
@ -243,7 +241,7 @@ class p_master
'url_extra' => (function_exists($url_func)) ? $url_func($row['module_mode'], $row) : '', 'url_extra' => (function_exists($url_func)) ? $url_func($row['module_mode'], $row) : '',
'lang' => ($row['module_basename'] && function_exists($lang_func)) ? $lang_func($row['module_mode'], $row['module_langname']) : ((!empty($user->lang[$row['module_langname']])) ? $user->lang[$row['module_langname']] : $row['module_langname']), 'lang' => ($row['module_basename'] && function_exists($lang_func)) ? $lang_func($row['module_mode'], $row['module_langname']) : phpbb::$user->lang($row['module_langname']),
'langname' => $row['module_langname'], 'langname' => $row['module_langname'],
'left' => $row['left_id'], 'left' => $row['left_id'],
@ -310,8 +308,6 @@ class p_master
*/ */
function module_auth($module_auth, $forum_id = false) function module_auth($module_auth, $forum_id = false)
{ {
global $auth;
$module_auth = trim($module_auth); $module_auth = trim($module_auth);
// Generally allowed to access module if module_auth is empty // Generally allowed to access module if module_auth is empty
@ -358,7 +354,7 @@ class p_master
$forum_id = ($forum_id === false) ? $this->acl_forum_id : $forum_id; $forum_id = ($forum_id === false) ? $this->acl_forum_id : $forum_id;
$is_auth = false; $is_auth = false;
eval('$is_auth = (int) (' . preg_replace(array('#acl_([a-z0-9_]+)(,\$id)?#', '#\$id#', '#aclf_([a-z0-9_]+)#', '#cfg_([a-z0-9_]+)#', '#request_([a-zA-Z0-9_]+)#'), array('(int) $auth->acl_get(\'\\1\'\\2)', '(int) $forum_id', '(int) $auth->acl_getf_global(\'\\1\')', '(int) phpbb::$config[\'\\1\']', 'phpbb_request::variable(\'\\1\', false)'), $module_auth) . ');'); eval('$is_auth = (int) (' . preg_replace(array('#acl_([a-z0-9_]+)(,\$id)?#', '#\$id#', '#aclf_([a-z0-9_]+)#', '#cfg_([a-z0-9_]+)#', '#request_([a-zA-Z0-9_]+)#'), array('(int) phpbb::$acl->acl_get(\'\\1\'\\2)', '(int) $forum_id', '(int) phpbb::$acl->acl_getf_global(\'\\1\')', '(int) phpbb::$config[\'\\1\']', 'phpbb_request::variable(\'\\1\', false)'), $module_auth) . ');');
return $is_auth; return $is_auth;
} }
@ -426,8 +422,6 @@ class p_master
*/ */
function load_active($mode = false, $module_url = false, $execute_module = true) function load_active($mode = false, $module_url = false, $execute_module = true)
{ {
global $user;
$module_path = $this->include_path . $this->p_class; $module_path = $this->include_path . $this->p_class;
$icat = request_var('icat', ''); $icat = request_var('icat', '');
@ -471,7 +465,7 @@ class p_master
} }
// Not being able to overwrite ;) // Not being able to overwrite ;)
$this->module->u_action = append_sid(PHPBB_ADMIN_PATH . 'index.' . PHP_EXT, "i={$this->p_name}") . (($icat) ? '&amp;icat=' . $icat : '') . "&amp;mode={$this->p_mode}"; $this->module->u_action = phpbb::$url->append_sid(PHPBB_ADMIN_PATH . 'index.' . PHP_EXT, "i={$this->p_name}") . (($icat) ? '&amp;icat=' . $icat : '') . "&amp;mode={$this->p_mode}";
} }
else else
{ {
@ -482,10 +476,10 @@ class p_master
} }
else else
{ {
$this->module->u_action = PHPBB_ROOT_PATH . (($user->page['page_dir']) ? $user->page['page_dir'] . '/' : '') . $user->page['page_name']; $this->module->u_action = PHPBB_ROOT_PATH . ((phpbb::$user->page['page_dir']) ? phpbb::$user->page['page_dir'] . '/' : '') . phpbb::$user->page['page_name'];
} }
$this->module->u_action = append_sid($this->module->u_action, "i={$this->p_name}") . (($icat) ? '&amp;icat=' . $icat : '') . "&amp;mode={$this->p_mode}"; $this->module->u_action = phpbb::$url->append_sid($this->module->u_action, "i={$this->p_name}") . (($icat) ? '&amp;icat=' . $icat : '') . "&amp;mode={$this->p_mode}";
} }
// Add url_extra parameter to u_action url // Add url_extra parameter to u_action url
@ -560,8 +554,6 @@ class p_master
*/ */
function get_parents($parent_id, $left_id, $right_id, &$all_parents) function get_parents($parent_id, $left_id, $right_id, &$all_parents)
{ {
global $db;
$parents = array(); $parents = array();
if ($parent_id > 0) if ($parent_id > 0)
@ -646,8 +638,6 @@ class p_master
*/ */
function assign_tpl_vars($module_url) function assign_tpl_vars($module_url)
{ {
global $template;
$current_id = $right_id = false; $current_id = $right_id = false;
// Make sure the module_url has a question mark set, effectively determining the delimiter to use // Make sure the module_url has a question mark set, effectively determining the delimiter to use
@ -747,7 +737,7 @@ class p_master
'U_TITLE' => $u_title 'U_TITLE' => $u_title
); );
$template->assign_block_vars($use_tabular_offset, array_merge($tpl_ary, array_change_key_case($item_ary, CASE_UPPER))); phpbb::$template->assign_block_vars($use_tabular_offset, array_merge($tpl_ary, array_change_key_case($item_ary, CASE_UPPER)));
} }
$tpl_ary = array( $tpl_ary = array(
@ -756,7 +746,7 @@ class p_master
'U_TITLE' => $u_title 'U_TITLE' => $u_title
); );
$template->assign_block_vars($linear_offset, array_merge($tpl_ary, array_change_key_case($item_ary, CASE_UPPER))); phpbb::$template->assign_block_vars($linear_offset, array_merge($tpl_ary, array_change_key_case($item_ary, CASE_UPPER)));
$current_depth = $depth; $current_depth = $depth;
} }
@ -775,14 +765,12 @@ class p_master
*/ */
function get_page_title() function get_page_title()
{ {
global $user;
if (!isset($this->module->page_title)) if (!isset($this->module->page_title))
{ {
return ''; return '';
} }
return (isset($user->lang[$this->module->page_title])) ? $user->lang[$this->module->page_title] : $this->module->page_title; return phpbb::$user->lang($this->module->page_title);
} }
/** /**
@ -804,10 +792,8 @@ class p_master
*/ */
function display($page_title, $display_online_list = true) function display($page_title, $display_online_list = true)
{ {
global $template, $user;
// Generate the page // Generate the page
if (defined('IN_ADMIN') && isset($user->data['session_admin']) && $user->data['session_admin']) if (defined('IN_ADMIN') && isset(phpbb::$user->data['session_admin']) && phpbb::$user->data['session_admin'])
{ {
adm_page_header($page_title); adm_page_header($page_title);
} }
@ -816,11 +802,11 @@ class p_master
page_header($page_title, $display_online_list); page_header($page_title, $display_online_list);
} }
$template->set_filenames(array( phpbb::$template->set_filenames(array(
'body' => $this->get_tpl_name()) 'body' => $this->get_tpl_name())
); );
if (defined('IN_ADMIN') && isset($user->data['session_admin']) && $user->data['session_admin']) if (defined('IN_ADMIN') && isset(phpbb::$user->data['session_admin']) && phpbb::$user->data['session_admin'])
{ {
adm_page_footer(); adm_page_footer();
} }
@ -849,13 +835,11 @@ class p_master
*/ */
function add_mod_info($module_class) function add_mod_info($module_class)
{ {
global $user; if (file_exists(phpbb::$user->lang_path . phpbb::$user->lang_name . '/mods'))
if (file_exists($user->lang_path . $user->lang_name . '/mods'))
{ {
$add_files = array(); $add_files = array();
$dir = @opendir($user->lang_path . $user->lang_name . '/mods'); $dir = @opendir(phpbb::$user->lang_path . phpbb::$user->lang_name . '/mods');
if ($dir) if ($dir)
{ {
@ -871,7 +855,7 @@ class p_master
if (sizeof($add_files)) if (sizeof($add_files))
{ {
$user->add_lang($add_files); phpbb::$user->add_lang($add_files);
} }
} }
} }

File diff suppressed because it is too large Load diff

View file

@ -62,7 +62,7 @@ while ($row = phpbb::$db->sql_fetchrow($result))
$colour_text = ($row['group_colour']) ? ' style="color:#' . $row['group_colour'] . '"' : ''; $colour_text = ($row['group_colour']) ? ' style="color:#' . $row['group_colour'] . '"' : '';
$group_name = ($row['group_type'] == GROUP_SPECIAL) ? phpbb::$user->lang['G_' . $row['group_name']] : $row['group_name']; $group_name = ($row['group_type'] == GROUP_SPECIAL) ? phpbb::$user->lang['G_' . $row['group_name']] : $row['group_name'];
if ($row['group_name'] == 'BOTS' || (phpbb::$user->data['user_id'] != ANONYMOUS && !$auth->acl_get('u_viewprofile'))) if ($row['group_name'] == 'BOTS' || (phpbb::$user->data['user_id'] != ANONYMOUS && !phpbb::$acl->acl_get('u_viewprofile')))
{ {
$legend[] = '<span' . $colour_text . '>' . $group_name . '</span>'; $legend[] = '<span' . $colour_text . '>' . $group_name . '</span>';
} }
@ -116,7 +116,7 @@ phpbb::$template->assign_vars(array(
'S_LOGIN_ACTION' => phpbb::$url->append_sid('ucp', 'mode=login'), 'S_LOGIN_ACTION' => phpbb::$url->append_sid('ucp', 'mode=login'),
'S_DISPLAY_BIRTHDAY_LIST' => (phpbb::$config['load_birthdays']) ? true : false, 'S_DISPLAY_BIRTHDAY_LIST' => (phpbb::$config['load_birthdays']) ? true : false,
'U_MARK_FORUMS' => (phpbb::$user->is_registered || phpbb::$config['load_anon_lastread']) ? append_sid('index', 'hash=' . generate_link_hash('global') . '&amp;mark=forums') : '', 'U_MARK_FORUMS' => (phpbb::$user->is_registered || phpbb::$config['load_anon_lastread']) ? phpbb::$url->append_sid('index', 'hash=' . generate_link_hash('global') . '&amp;mark=forums') : '',
'U_MCP' => (phpbb::$acl->acl_get('m_') || phpbb::$acl->acl_getf_global('m_')) ? phpbb::$url->append_sid('mcp', 'i=main&amp;mode=front', true, phpbb::$user->session_id) : '') 'U_MCP' => (phpbb::$acl->acl_get('m_') || phpbb::$acl->acl_getf_global('m_')) ? phpbb::$url->append_sid('mcp', 'i=main&amp;mode=front', true, phpbb::$user->session_id) : '')
); );

View file

@ -416,7 +416,7 @@ switch ($mode)
// a_user admins and founder are able to view inactive users and bots to be able to manage them more easily // a_user admins and founder are able to view inactive users and bots to be able to manage them more easily
// Normal users are able to see at least users having only changed their profile settings but not yet reactivated. // Normal users are able to see at least users having only changed their profile settings but not yet reactivated.
if (!$auth->acl_get('a_user') && $user->data['user_type'] != phpbb::USER_FOUNDER) if (!$auth->acl_get('a_user') && !phpbb::$user->is_founder)
{ {
if ($member['user_type'] == phpbb::USER_IGNORE) if ($member['user_type'] == phpbb::USER_IGNORE)
{ {

View file

@ -67,7 +67,7 @@ class acp_groups
} }
// Check if the user is allowed to manage this group if set to founder only. // Check if the user is allowed to manage this group if set to founder only.
if ($user->data['user_type'] != phpbb::USER_FOUNDER && $group_row['group_founder_manage']) if (!phpbb::$user->is_founder && $group_row['group_founder_manage'])
{ {
trigger_error($user->lang['NOT_ALLOWED_MANAGE_GROUP'] . adm_back_link($this->u_action), E_USER_WARNING); trigger_error($user->lang['NOT_ALLOWED_MANAGE_GROUP'] . adm_back_link($this->u_action), E_USER_WARNING);
} }
@ -310,7 +310,7 @@ class acp_groups
'founder_manage' => 0, 'founder_manage' => 0,
); );
if ($user->data['user_type'] == phpbb::USER_FOUNDER) if (phpbb::$user->is_founder)
{ {
$submit_ary['founder_manage'] = phpbb_request::is_set('group_founder_manage') ? 1 : 0; $submit_ary['founder_manage'] = phpbb_request::is_set('group_founder_manage') ? 1 : 0;
} }
@ -426,8 +426,9 @@ class acp_groups
$db->sql_freeresult($result); $db->sql_freeresult($result);
// Check the group if non-founder // Check the group if non-founder
if ($check_row && ($user->data['user_type'] == phpbb::USER_FOUNDER || $check_row['group_founder_manage'] == 0)) if ($check_row && (phpbb::$user->is_founder || $check_row['group_founder_manage'] == 0))
{ {
// @todo CHANGE - do we support < 4.0.14?
// From the mysql documentation: // From the mysql documentation:
// Prior to MySQL 4.0.14, the target table of the INSERT statement cannot appear in the FROM clause of the SELECT part of the query. This limitation is lifted in 4.0.14. // Prior to MySQL 4.0.14, the target table of the INSERT statement cannot appear in the FROM clause of the SELECT part of the query. This limitation is lifted in 4.0.14.
// Due to this we stay on the safe side if we do the insertion "the manual way" // Due to this we stay on the safe side if we do the insertion "the manual way"
@ -549,7 +550,7 @@ class acp_groups
'S_SPECIAL_GROUP' => ($group_type == GROUP_SPECIAL) ? true : false, 'S_SPECIAL_GROUP' => ($group_type == GROUP_SPECIAL) ? true : false,
'S_DISPLAY_GALLERY' => (phpbb::$config['allow_avatar_local'] && !$display_gallery) ? true : false, 'S_DISPLAY_GALLERY' => (phpbb::$config['allow_avatar_local'] && !$display_gallery) ? true : false,
'S_IN_GALLERY' => (phpbb::$config['allow_avatar_local'] && $display_gallery) ? true : false, 'S_IN_GALLERY' => (phpbb::$config['allow_avatar_local'] && $display_gallery) ? true : false,
'S_USER_FOUNDER' => ($user->data['user_type'] == phpbb::USER_FOUNDER) ? true : false, 'S_USER_FOUNDER' => phpbb::$user->is_founder,
'ERROR_MSG' => (sizeof($error)) ? implode('<br />', $error) : '', 'ERROR_MSG' => (sizeof($error)) ? implode('<br />', $error) : '',
'GROUP_NAME' => ($group_type == GROUP_SPECIAL) ? $user->lang['G_' . $group_name] : $group_name, 'GROUP_NAME' => ($group_type == GROUP_SPECIAL) ? $user->lang['G_' . $group_name] : $group_name,
@ -568,7 +569,7 @@ class acp_groups
'S_DESC_SMILIES_CHECKED'=> $group_desc_data['allow_smilies'], 'S_DESC_SMILIES_CHECKED'=> $group_desc_data['allow_smilies'],
'S_RANK_OPTIONS' => $rank_options, 'S_RANK_OPTIONS' => $rank_options,
'S_GROUP_OPTIONS' => group_select_options(false, false, (($user->data['user_type'] == phpbb::USER_FOUNDER) ? false : 0)), 'S_GROUP_OPTIONS' => group_select_options(false, false, ((phpbb::$user->is_founder) ? false : 0)),
'AVATAR' => $avatar_img, 'AVATAR' => $avatar_img,
'AVATAR_IMAGE' => $avatar_img, 'AVATAR_IMAGE' => $avatar_img,
'AVATAR_MAX_FILESIZE' => phpbb::$config['avatar_filesize'], 'AVATAR_MAX_FILESIZE' => phpbb::$config['avatar_filesize'],

View file

@ -25,32 +25,30 @@ class acp_main
function main($id, $mode) function main($id, $mode)
{ {
global $db, $user, $auth, $template;
// Show restore permissions notice // Show restore permissions notice
if ($user->data['user_perm_from'] && $auth->acl_get('a_switchperm')) if (phpbb::$user->data['user_perm_from'] && phpbb::$acl->acl_get('a_switchperm'))
{ {
$this->tpl_name = 'acp_main'; $this->tpl_name = 'acp_main';
$this->page_title = 'ACP_MAIN'; $this->page_title = 'ACP_MAIN';
$sql = 'SELECT user_id, username, user_colour $sql = 'SELECT user_id, username, user_colour
FROM ' . USERS_TABLE . ' FROM ' . USERS_TABLE . '
WHERE user_id = ' . $user->data['user_perm_from']; WHERE user_id = ' . phpbb::$user->data['user_perm_from'];
$result = $db->sql_query($sql); $result = phpbb::$db->sql_query($sql);
$user_row = $db->sql_fetchrow($result); $user_row = phpbb::$db->sql_fetchrow($result);
$db->sql_freeresult($result); phpbb::$db->sql_freeresult($result);
$perm_from = '<strong' . (($user_row['user_colour']) ? ' style="color: #' . $user_row['user_colour'] . '">' : '>'); $perm_from = '<strong' . (($user_row['user_colour']) ? ' style="color: #' . $user_row['user_colour'] . '">' : '>');
$perm_from .= ($user_row['user_id'] != ANONYMOUS) ? '<a href="' . append_sid('memberlist', 'mode=viewprofile&amp;u=' . $user_row['user_id']) . '">' : ''; $perm_from .= ($user_row['user_id'] != ANONYMOUS) ? '<a href="' . phpbb::$url->append_sid('memberlist', 'mode=viewprofile&amp;u=' . $user_row['user_id']) . '">' : '';
$perm_from .= $user_row['username']; $perm_from .= $user_row['username'];
$perm_from .= ($user_row['user_id'] != ANONYMOUS) ? '</a>' : ''; $perm_from .= ($user_row['user_id'] != ANONYMOUS) ? '</a>' : '';
$perm_from .= '</strong>'; $perm_from .= '</strong>';
$template->assign_vars(array( phpbb::$template->assign_vars(array(
'S_RESTORE_PERMISSIONS' => true, 'S_RESTORE_PERMISSIONS' => true,
'U_RESTORE_PERMISSIONS' => append_sid('ucp', 'mode=restore_perm'), 'U_RESTORE_PERMISSIONS' => phpbb::$url->append_sid('ucp', 'mode=restore_perm'),
'PERM_FROM' => $perm_from, 'PERM_FROM' => $perm_from,
'L_PERMISSIONS_TRANSFERRED_EXPLAIN' => sprintf($user->lang['PERMISSIONS_TRANSFERRED_EXPLAIN'], $perm_from, append_sid('ucp', 'mode=restore_perm')), 'L_PERMISSIONS_TRANSFERRED_EXPLAIN' => sprintf(phpbb::$user->lang['PERMISSIONS_TRANSFERRED_EXPLAIN'], $perm_from, phpbb::$url->append_sid('ucp', 'mode=restore_perm')),
)); ));
return; return;
@ -62,10 +60,10 @@ class acp_main
{ {
if ($action === 'admlogout') if ($action === 'admlogout')
{ {
$user->unset_admin(); phpbb::$user->unset_admin();
$redirect_url = append_sid(PHPBB_ROOT_PATH . 'index.' . PHP_EXT); $redirect_url = phpbb::$url->append_sid(PHPBB_ROOT_PATH . 'index.' . PHP_EXT);
meta_refresh(3, $redirect_url); meta_refresh(3, $redirect_url);
trigger_error($user->lang['ADM_LOGGED_OUT'] . '<br /><br />' . sprintf($user->lang['RETURN_INDEX'], '<a href="' . $redirect_url . '">', '</a>')); trigger_error(phpbb::$user->lang['ADM_LOGGED_OUT'] . '<br /><br />' . sprintf(phpbb::$user->lang['RETURN_INDEX'], '<a href="' . $redirect_url . '">', '</a>'));
} }
if (!confirm_box(true)) if (!confirm_box(true))
@ -104,7 +102,7 @@ class acp_main
if ($confirm) if ($confirm)
{ {
confirm_box(false, $user->lang[$confirm_lang], build_hidden_fields(array( confirm_box(false, phpbb::$user->lang[$confirm_lang], build_hidden_fields(array(
'i' => $id, 'i' => $id,
'mode' => $mode, 'mode' => $mode,
'action' => $action, 'action' => $action,
@ -117,9 +115,9 @@ class acp_main
{ {
case 'online': case 'online':
if (!$auth->acl_get('a_board')) if (!phpbb::$acl->acl_get('a_board'))
{ {
trigger_error($user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action), E_USER_WARNING); trigger_error(phpbb::$user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action), E_USER_WARNING);
} }
set_config('record_online_users', 1, true); set_config('record_online_users', 1, true);
@ -128,45 +126,45 @@ class acp_main
break; break;
case 'stats': case 'stats':
if (!$auth->acl_get('a_board')) if (!phpbb::$acl->acl_get('a_board'))
{ {
trigger_error($user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action), E_USER_WARNING); trigger_error(phpbb::$user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action), E_USER_WARNING);
} }
$sql = 'SELECT COUNT(post_id) AS stat $sql = 'SELECT COUNT(post_id) AS stat
FROM ' . POSTS_TABLE . ' FROM ' . POSTS_TABLE . '
WHERE post_approved = 1'; WHERE post_approved = 1';
$result = $db->sql_query($sql); $result = phpbb::$db->sql_query($sql);
set_config('num_posts', (int) $db->sql_fetchfield('stat'), true); set_config('num_posts', (int) phpbb::$db->sql_fetchfield('stat'), true);
$db->sql_freeresult($result); phpbb::$db->sql_freeresult($result);
$sql = 'SELECT COUNT(topic_id) AS stat $sql = 'SELECT COUNT(topic_id) AS stat
FROM ' . TOPICS_TABLE . ' FROM ' . TOPICS_TABLE . '
WHERE topic_approved = 1'; WHERE topic_approved = 1';
$result = $db->sql_query($sql); $result = phpbb::$db->sql_query($sql);
set_config('num_topics', (int) $db->sql_fetchfield('stat'), true); set_config('num_topics', (int) phpbb::$db->sql_fetchfield('stat'), true);
$db->sql_freeresult($result); phpbb::$db->sql_freeresult($result);
$sql = 'SELECT COUNT(user_id) AS stat $sql = 'SELECT COUNT(user_id) AS stat
FROM ' . USERS_TABLE . ' FROM ' . USERS_TABLE . '
WHERE user_type IN (' . phpbb::USER_NORMAL . ',' . phpbb::USER_FOUNDER . ')'; WHERE user_type IN (' . phpbb::USER_NORMAL . ',' . phpbb::USER_FOUNDER . ')';
$result = $db->sql_query($sql); $result = phpbb::$db->sql_query($sql);
set_config('num_users', (int) $db->sql_fetchfield('stat'), true); set_config('num_users', (int) phpbb::$db->sql_fetchfield('stat'), true);
$db->sql_freeresult($result); phpbb::$db->sql_freeresult($result);
$sql = 'SELECT COUNT(attach_id) as stat $sql = 'SELECT COUNT(attach_id) as stat
FROM ' . ATTACHMENTS_TABLE . ' FROM ' . ATTACHMENTS_TABLE . '
WHERE is_orphan = 0'; WHERE is_orphan = 0';
$result = $db->sql_query($sql); $result = phpbb::$db->sql_query($sql);
set_config('num_files', (int) $db->sql_fetchfield('stat'), true); set_config('num_files', (int) phpbb::$db->sql_fetchfield('stat'), true);
$db->sql_freeresult($result); phpbb::$db->sql_freeresult($result);
$sql = 'SELECT SUM(filesize) as stat $sql = 'SELECT SUM(filesize) as stat
FROM ' . ATTACHMENTS_TABLE . ' FROM ' . ATTACHMENTS_TABLE . '
WHERE is_orphan = 0'; WHERE is_orphan = 0';
$result = $db->sql_query($sql); $result = phpbb::$db->sql_query($sql);
set_config('upload_dir_size', (float) $db->sql_fetchfield('stat'), true); set_config('upload_dir_size', (float) phpbb::$db->sql_fetchfield('stat'), true);
$db->sql_freeresult($result); phpbb::$db->sql_freeresult($result);
if (!function_exists('update_last_username')) if (!function_exists('update_last_username'))
{ {
@ -178,9 +176,9 @@ class acp_main
break; break;
case 'user': case 'user':
if (!$auth->acl_get('a_board')) if (!phpbb::$acl->acl_get('a_board'))
{ {
trigger_error($user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action), E_USER_WARNING); trigger_error(phpbb::$user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action), E_USER_WARNING);
} }
// Resync post counts // Resync post counts
@ -189,18 +187,18 @@ class acp_main
// Find the maximum post ID, we can only stop the cycle when we've reached it // Find the maximum post ID, we can only stop the cycle when we've reached it
$sql = 'SELECT MAX(forum_last_post_id) as max_post_id $sql = 'SELECT MAX(forum_last_post_id) as max_post_id
FROM ' . FORUMS_TABLE; FROM ' . FORUMS_TABLE;
$result = $db->sql_query($sql); $result = phpbb::$db->sql_query($sql);
$max_post_id = (int) $db->sql_fetchfield('max_post_id'); $max_post_id = (int) phpbb::$db->sql_fetchfield('max_post_id');
$db->sql_freeresult($result); phpbb::$db->sql_freeresult($result);
// No maximum post id? :o // No maximum post id? :o
if (!$max_post_id) if (!$max_post_id)
{ {
$sql = 'SELECT MAX(post_id) $sql = 'SELECT MAX(post_id)
FROM ' . POSTS_TABLE; FROM ' . POSTS_TABLE;
$result = $db->sql_query($sql); $result = phpbb::$db->sql_query($sql);
$max_post_id = (int) $db->sql_fetchfield('max_post_id'); $max_post_id = (int) phpbb::$db->sql_fetchfield('max_post_id');
$db->sql_freeresult($result); phpbb::$db->sql_freeresult($result);
} }
// Still no maximum post id? Then we are finished // Still no maximum post id? Then we are finished
@ -211,7 +209,7 @@ class acp_main
} }
$step = (phpbb::$config['num_posts']) ? (max((int) (phpbb::$config['num_posts'] / 5), 20000)) : 20000; $step = (phpbb::$config['num_posts']) ? (max((int) (phpbb::$config['num_posts'] / 5), 20000)) : 20000;
$db->sql_query('UPDATE ' . USERS_TABLE . ' SET user_posts = 0'); phpbb::$db->sql_query('UPDATE ' . USERS_TABLE . ' SET user_posts = 0');
while ($start < $max_post_id) while ($start < $max_post_id)
{ {
@ -220,18 +218,18 @@ class acp_main
WHERE post_id BETWEEN ' . ($start + 1) . ' AND ' . ($start + $step) . ' WHERE post_id BETWEEN ' . ($start + 1) . ' AND ' . ($start + $step) . '
AND post_postcount = 1 AND post_approved = 1 AND post_postcount = 1 AND post_approved = 1
GROUP BY poster_id'; GROUP BY poster_id';
$result = $db->sql_query($sql); $result = phpbb::$db->sql_query($sql);
if ($row = $db->sql_fetchrow($result)) if ($row = phpbb::$db->sql_fetchrow($result))
{ {
do do
{ {
$sql = 'UPDATE ' . USERS_TABLE . " SET user_posts = user_posts + {$row['num_posts']} WHERE user_id = {$row['poster_id']}"; $sql = 'UPDATE ' . USERS_TABLE . " SET user_posts = user_posts + {$row['num_posts']} WHERE user_id = {$row['poster_id']}";
$db->sql_query($sql); phpbb::$db->sql_query($sql);
} }
while ($row = $db->sql_fetchrow($result)); while ($row = phpbb::$db->sql_fetchrow($result));
} }
$db->sql_freeresult($result); phpbb::$db->sql_freeresult($result);
$start += $step; $start += $step;
} }
@ -241,9 +239,9 @@ class acp_main
break; break;
case 'date': case 'date':
if (!$auth->acl_get('a_board')) if (!phpbb::$acl->acl_get('a_board'))
{ {
trigger_error($user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action), E_USER_WARNING); trigger_error(phpbb::$user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action), E_USER_WARNING);
} }
set_config('board_startdate', time() - 1); set_config('board_startdate', time() - 1);
@ -251,13 +249,13 @@ class acp_main
break; break;
case 'db_track': case 'db_track':
if ($db->truncate) if (phpbb::$db->features['truncate'])
{ {
$db->sql_query('TRUNCATE TABLE ' . TOPICS_POSTED_TABLE); phpbb::$db->sql_query('TRUNCATE TABLE ' . TOPICS_POSTED_TABLE);
} }
else else
{ {
$db->sql_query('DELETE FROM ' . TOPICS_POSTED_TABLE); phpbb::$db->sql_query('DELETE FROM ' . TOPICS_POSTED_TABLE);
} }
// This can get really nasty... therefore we only do the last six months // This can get really nasty... therefore we only do the last six months
@ -267,14 +265,14 @@ class acp_main
$sql = 'SELECT forum_id $sql = 'SELECT forum_id
FROM ' . FORUMS_TABLE . ' FROM ' . FORUMS_TABLE . '
WHERE forum_type <> ' . FORUM_CAT; WHERE forum_type <> ' . FORUM_CAT;
$result = $db->sql_query($sql); $result = phpbb::$db->sql_query($sql);
$forum_ids = array(); $forum_ids = array();
while ($row = $db->sql_fetchrow($result)) while ($row = phpbb::$db->sql_fetchrow($result))
{ {
$forum_ids[] = $row['forum_id']; $forum_ids[] = $row['forum_id'];
} }
$db->sql_freeresult($result); phpbb::$db->sql_freeresult($result);
// Any global announcements? ;) // Any global announcements? ;)
$forum_ids[] = 0; $forum_ids[] = 0;
@ -290,14 +288,14 @@ class acp_main
AND t.topic_id = p.topic_id AND t.topic_id = p.topic_id
AND p.poster_id <> ' . ANONYMOUS . ' AND p.poster_id <> ' . ANONYMOUS . '
GROUP BY p.poster_id, p.topic_id'; GROUP BY p.poster_id, p.topic_id';
$result = $db->sql_query($sql); $result = phpbb::$db->sql_query($sql);
$posted = array(); $posted = array();
while ($row = $db->sql_fetchrow($result)) while ($row = phpbb::$db->sql_fetchrow($result))
{ {
$posted[$row['poster_id']][] = $row['topic_id']; $posted[$row['poster_id']][] = $row['topic_id'];
} }
$db->sql_freeresult($result); phpbb::$db->sql_freeresult($result);
$sql_ary = array(); $sql_ary = array();
foreach ($posted as $user_id => $topic_row) foreach ($posted as $user_id => $topic_row)
@ -315,7 +313,7 @@ class acp_main
if (sizeof($sql_ary)) if (sizeof($sql_ary))
{ {
$db->sql_multi_insert(TOPICS_POSTED_TABLE, $sql_ary); phpbb::$db->sql_multi_insert(TOPICS_POSTED_TABLE, $sql_ary);
} }
} }
@ -323,15 +321,15 @@ class acp_main
break; break;
case 'purge_cache': case 'purge_cache':
if ((int) $user->data['user_type'] !== phpbb::USER_FOUNDER) if (!phpbb::$user->is_founder)
{ {
trigger_error($user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action), E_USER_WARNING); trigger_error(phpbb::$user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action), E_USER_WARNING);
} }
phpbb::$acm->purge(); phpbb::$acm->purge();
// Clear permissions // Clear permissions
$auth->acl_clear_prefetch(); phpbb::$acl->acl_clear_prefetch();
cache_moderators(); cache_moderators();
add_log('admin', 'LOG_PURGE_CACHE'); add_log('admin', 'LOG_PURGE_CACHE');
@ -346,7 +344,7 @@ class acp_main
$total_users = phpbb::$config['num_users']; $total_users = phpbb::$config['num_users'];
$total_files = phpbb::$config['num_files']; $total_files = phpbb::$config['num_files'];
$start_date = $user->format_date(phpbb::$config['board_startdate']); $start_date = phpbb::$user->format_date(phpbb::$config['board_startdate']);
$boarddays = (time() - phpbb::$config['board_startdate']) / 86400; $boarddays = (time() - phpbb::$config['board_startdate']) / 86400;
@ -375,7 +373,7 @@ class acp_main
else else
{ {
// Couldn't open Avatar dir. // Couldn't open Avatar dir.
$avatar_dir_size = $user->lang['NOT_AVAILABLE']; $avatar_dir_size = phpbb::$user->lang['NOT_AVAILABLE'];
} }
if ($posts_per_day > $total_posts) if ($posts_per_day > $total_posts)
@ -404,9 +402,9 @@ class acp_main
FROM ' . ATTACHMENTS_TABLE . ' FROM ' . ATTACHMENTS_TABLE . '
WHERE is_orphan = 1 WHERE is_orphan = 1
AND filetime < ' . (time() - 3*60*60); AND filetime < ' . (time() - 3*60*60);
$result = $db->sql_query($sql); $result = phpbb::$db->sql_query($sql);
$total_orphan = (int) $db->sql_fetchfield('total_orphan'); $total_orphan = (int) phpbb::$db->sql_fetchfield('total_orphan');
$db->sql_freeresult($result); phpbb::$db->sql_freeresult($result);
} }
else else
{ {
@ -415,7 +413,7 @@ class acp_main
$dbsize = get_database_size(); $dbsize = get_database_size();
$template->assign_vars(array( phpbb::$template->assign_vars(array(
'TOTAL_POSTS' => $total_posts, 'TOTAL_POSTS' => $total_posts,
'POSTS_PER_DAY' => $posts_per_day, 'POSTS_PER_DAY' => $posts_per_day,
'TOTAL_TOPICS' => $total_topics, 'TOTAL_TOPICS' => $total_topics,
@ -430,38 +428,38 @@ class acp_main
'UPLOAD_DIR_SIZE' => $upload_dir_size, 'UPLOAD_DIR_SIZE' => $upload_dir_size,
'TOTAL_ORPHAN' => $total_orphan, 'TOTAL_ORPHAN' => $total_orphan,
'S_TOTAL_ORPHAN' => ($total_orphan === false) ? false : true, 'S_TOTAL_ORPHAN' => ($total_orphan === false) ? false : true,
'GZIP_COMPRESSION' => (phpbb::$config['gzip_compress']) ? $user->lang['ON'] : $user->lang['OFF'], 'GZIP_COMPRESSION' => (phpbb::$config['gzip_compress']) ? phpbb::$user->lang['ON'] : phpbb::$user->lang['OFF'],
'DATABASE_INFO' => $db->sql_server_info(), 'DATABASE_INFO' => phpbb::$db->sql_server_info(),
'BOARD_VERSION' => phpbb::$config['version'], 'BOARD_VERSION' => phpbb::$config['version'],
'U_ACTION' => $this->u_action, 'U_ACTION' => $this->u_action,
'U_ADMIN_LOG' => append_sid(PHPBB_ADMIN_PATH . 'index.' . PHP_EXT, 'i=logs&amp;mode=admin'), 'U_ADMIN_LOG' => phpbb::$url->append_sid(PHPBB_ADMIN_PATH . 'index.' . PHP_EXT, 'i=logs&amp;mode=admin'),
'U_INACTIVE_USERS' => append_sid(PHPBB_ADMIN_PATH . 'index.' . PHP_EXT, 'i=inactive&amp;mode=list'), 'U_INACTIVE_USERS' => phpbb::$url->append_sid(PHPBB_ADMIN_PATH . 'index.' . PHP_EXT, 'i=inactive&amp;mode=list'),
'S_ACTION_OPTIONS' => ($auth->acl_get('a_board')) ? true : false, 'S_ACTION_OPTIONS' => (phpbb::$acl->acl_get('a_board')) ? true : false,
'S_FOUNDER' => ($user->data['user_type'] == phpbb::USER_FOUNDER) ? true : false, 'S_FOUNDER' => phpbb::$user->is_founder,
) )
); );
$log_data = array(); $log_data = array();
$log_count = 0; $log_count = 0;
if ($auth->acl_get('a_viewlogs')) if (phpbb::$acl->acl_get('a_viewlogs'))
{ {
view_log('admin', $log_data, $log_count, 5); view_log('admin', $log_data, $log_count, 5);
foreach ($log_data as $row) foreach ($log_data as $row)
{ {
$template->assign_block_vars('log', array( phpbb::$template->assign_block_vars('log', array(
'USERNAME' => $row['username_full'], 'USERNAME' => $row['username_full'],
'IP' => $row['ip'], 'IP' => $row['ip'],
'DATE' => $user->format_date($row['time']), 'DATE' => phpbb::$user->format_date($row['time']),
'ACTION' => $row['action']) 'ACTION' => $row['action'])
); );
} }
} }
if ($auth->acl_get('a_user')) if (phpbb::$acl->acl_get('a_user'))
{ {
$inactive = array(); $inactive = array();
$inactive_count = 0; $inactive_count = 0;
@ -470,14 +468,14 @@ class acp_main
foreach ($inactive as $row) foreach ($inactive as $row)
{ {
$template->assign_block_vars('inactive', array( phpbb::$template->assign_block_vars('inactive', array(
'INACTIVE_DATE' => $user->format_date($row['user_inactive_time']), 'INACTIVE_DATE' => phpbb::$user->format_date($row['user_inactive_time']),
'JOINED' => $user->format_date($row['user_regdate']), 'JOINED' => phpbb::$user->format_date($row['user_regdate']),
'LAST_VISIT' => (!$row['user_lastvisit']) ? ' - ' : $user->format_date($row['user_lastvisit']), 'LAST_VISIT' => (!$row['user_lastvisit']) ? ' - ' : phpbb::$user->format_date($row['user_lastvisit']),
'REASON' => $row['inactive_reason'], 'REASON' => $row['inactive_reason'],
'USER_ID' => $row['user_id'], 'USER_ID' => $row['user_id'],
'USERNAME' => $row['username'], 'USERNAME' => $row['username'],
'U_USER_ADMIN' => append_sid(PHPBB_ADMIN_PATH . 'index.' . PHP_EXT, "i=users&amp;mode=overview&amp;u={$row['user_id']}")) 'U_USER_ADMIN' => phpbb::$url->append_sid(PHPBB_ADMIN_PATH . 'index.' . PHP_EXT, "i=users&amp;mode=overview&amp;u={$row['user_id']}"))
); );
} }
@ -487,7 +485,7 @@ class acp_main
$option_ary += array('remind' => 'REMIND'); $option_ary += array('remind' => 'REMIND');
} }
$template->assign_vars(array( phpbb::$template->assign_vars(array(
'S_INACTIVE_USERS' => true, 'S_INACTIVE_USERS' => true,
'S_INACTIVE_OPTIONS' => build_select($option_ary)) 'S_INACTIVE_OPTIONS' => build_select($option_ary))
); );
@ -496,13 +494,13 @@ class acp_main
// Warn if install is still present // Warn if install is still present
if (file_exists(PHPBB_ROOT_PATH . 'install')) if (file_exists(PHPBB_ROOT_PATH . 'install'))
{ {
$template->assign_var('S_REMOVE_INSTALL', true); phpbb::$template->assign_var('S_REMOVE_INSTALL', true);
} }
if (!defined('PHPBB_DISABLE_CONFIG_CHECK') && file_exists(PHPBB_ROOT_PATH . 'config.' . PHP_EXT) && is_writable(PHPBB_ROOT_PATH . 'config.' . PHP_EXT)) if (!defined('PHPBB_DISABLE_CONFIG_CHECK') && file_exists(PHPBB_ROOT_PATH . 'config.' . PHP_EXT) && is_writable(PHPBB_ROOT_PATH . 'config.' . PHP_EXT))
{ {
// World-Writable? (000x) // World-Writable? (000x)
$template->assign_var('S_WRITABLE_CONFIG', (bool) (@fileperms(PHPBB_ROOT_PATH . 'config.' . PHP_EXT) & 0x0002)); phpbb::$template->assign_var('S_WRITABLE_CONFIG', (bool) (@fileperms(PHPBB_ROOT_PATH . 'config.' . PHP_EXT) & 0x0002));
} }
$this->tpl_name = 'acp_main'; $this->tpl_name = 'acp_main';

View file

@ -43,12 +43,12 @@ class acp_modules
function main($id, $mode) function main($id, $mode)
{ {
global $db, $user, $auth, $template, $module; global $auth, $template, $module;
// Set a global define for modules we might include (the author is able to prevent execution of code by checking this constant) // Set a global define for modules we might include (the author is able to prevent execution of code by checking this constant)
define('MODULE_INCLUDE', true); define('MODULE_INCLUDE', true);
$user->add_lang('acp/modules'); phpbb::$user->add_lang('acp/modules');
$this->tpl_name = 'acp_modules'; $this->tpl_name = 'acp_modules';
// module class // module class
@ -56,11 +56,11 @@ class acp_modules
if ($this->module_class == 'ucp') if ($this->module_class == 'ucp')
{ {
$user->add_lang('ucp'); phpbb::$user->add_lang('ucp');
} }
else if ($this->module_class == 'mcp') else if ($this->module_class == 'mcp')
{ {
$user->add_lang('mcp'); phpbb::$user->add_lang('mcp');
} }
if ($module->p_class != $this->module_class) if ($module->p_class != $this->module_class)
@ -80,7 +80,7 @@ class acp_modules
case 'delete': case 'delete':
if (!$module_id) if (!$module_id)
{ {
trigger_error($user->lang['NO_MODULE_ID'] . adm_back_link($this->u_action . '&amp;parent_id=' . $this->parent_id), E_USER_WARNING); trigger_error(phpbb::$user->lang['NO_MODULE_ID'] . adm_back_link($this->u_action . '&amp;parent_id=' . $this->parent_id), E_USER_WARNING);
} }
if (confirm_box(true)) if (confirm_box(true))
@ -91,9 +91,9 @@ class acp_modules
$sql = 'SELECT parent_id $sql = 'SELECT parent_id
FROM ' . MODULES_TABLE . ' FROM ' . MODULES_TABLE . '
WHERE module_id = ' . $module_id; WHERE module_id = ' . $module_id;
$result = $db->sql_query($sql); $result = phpbb::$db->sql_query($sql);
$this->parent_id = (int) $db->sql_fetchfield('parent_id'); $this->parent_id = (int) phpbb::$db->sql_fetchfield('parent_id');
$db->sql_freeresult($result); phpbb::$db->sql_freeresult($result);
} }
$errors = $this->delete_module($module_id); $errors = $this->delete_module($module_id);
@ -101,7 +101,7 @@ class acp_modules
if (!sizeof($errors)) if (!sizeof($errors))
{ {
$this->remove_cache_file(); $this->remove_cache_file();
trigger_error($user->lang['MODULE_DELETED'] . adm_back_link($this->u_action . '&amp;parent_id=' . $this->parent_id)); trigger_error(phpbb::$user->lang['MODULE_DELETED'] . adm_back_link($this->u_action . '&amp;parent_id=' . $this->parent_id));
} }
} }
else else
@ -121,29 +121,29 @@ class acp_modules
case 'disable': case 'disable':
if (!$module_id) if (!$module_id)
{ {
trigger_error($user->lang['NO_MODULE_ID'] . adm_back_link($this->u_action . '&amp;parent_id=' . $this->parent_id), E_USER_WARNING); trigger_error(phpbb::$user->lang['NO_MODULE_ID'] . adm_back_link($this->u_action . '&amp;parent_id=' . $this->parent_id), E_USER_WARNING);
} }
$sql = 'SELECT * $sql = 'SELECT *
FROM ' . MODULES_TABLE . " FROM ' . MODULES_TABLE . "
WHERE module_class = '" . $db->sql_escape($this->module_class) . "' WHERE module_class = '" . phpbb::$db->sql_escape($this->module_class) . "'
AND module_id = $module_id"; AND module_id = $module_id";
$result = $db->sql_query($sql); $result = phpbb::$db->sql_query($sql);
$row = $db->sql_fetchrow($result); $row = phpbb::$db->sql_fetchrow($result);
$db->sql_freeresult($result); phpbb::$db->sql_freeresult($result);
if (!$row) if (!$row)
{ {
trigger_error($user->lang['NO_MODULE'] . adm_back_link($this->u_action . '&amp;parent_id=' . $this->parent_id), E_USER_WARNING); trigger_error(phpbb::$user->lang['NO_MODULE'] . adm_back_link($this->u_action . '&amp;parent_id=' . $this->parent_id), E_USER_WARNING);
} }
$sql = 'UPDATE ' . MODULES_TABLE . ' $sql = 'UPDATE ' . MODULES_TABLE . '
SET module_enabled = ' . (($action == 'enable') ? 1 : 0) . " SET module_enabled = ' . (($action == 'enable') ? 1 : 0) . "
WHERE module_class = '" . $db->sql_escape($this->module_class) . "' WHERE module_class = '" . phpbb::$db->sql_escape($this->module_class) . "'
AND module_id = $module_id"; AND module_id = $module_id";
$db->sql_query($sql); phpbb::$db->sql_query($sql);
add_log('admin', 'LOG_MODULE_' . strtoupper($action), $this->lang_name($row['module_langname'])); add_log('admin', 'LOG_MODULE_' . strtoupper($action), phpbb::$user->lang($row['module_langname']));
$this->remove_cache_file(); $this->remove_cache_file();
break; break;
@ -152,27 +152,27 @@ class acp_modules
case 'move_down': case 'move_down':
if (!$module_id) if (!$module_id)
{ {
trigger_error($user->lang['NO_MODULE_ID'] . adm_back_link($this->u_action . '&amp;parent_id=' . $this->parent_id), E_USER_WARNING); trigger_error(phpbb::$user->lang['NO_MODULE_ID'] . adm_back_link($this->u_action . '&amp;parent_id=' . $this->parent_id), E_USER_WARNING);
} }
$sql = 'SELECT * $sql = 'SELECT *
FROM ' . MODULES_TABLE . " FROM ' . MODULES_TABLE . "
WHERE module_class = '" . $db->sql_escape($this->module_class) . "' WHERE module_class = '" . phpbb::$db->sql_escape($this->module_class) . "'
AND module_id = $module_id"; AND module_id = $module_id";
$result = $db->sql_query($sql); $result = phpbb::$db->sql_query($sql);
$row = $db->sql_fetchrow($result); $row = phpbb::$db->sql_fetchrow($result);
$db->sql_freeresult($result); phpbb::$db->sql_freeresult($result);
if (!$row) if (!$row)
{ {
trigger_error($user->lang['NO_MODULE'] . adm_back_link($this->u_action . '&amp;parent_id=' . $this->parent_id), E_USER_WARNING); trigger_error(phpbb::$user->lang['NO_MODULE'] . adm_back_link($this->u_action . '&amp;parent_id=' . $this->parent_id), E_USER_WARNING);
} }
$move_module_name = $this->move_module_by($row, $action, 1); $move_module_name = $this->move_module_by($row, $action, 1);
if ($move_module_name !== false) if ($move_module_name !== false)
{ {
add_log('admin', 'LOG_MODULE_' . strtoupper($action), $this->lang_name($row['module_langname']), $move_module_name); add_log('admin', 'LOG_MODULE_' . strtoupper($action), phpbb::$user->lang($row['module_langname']), $move_module_name);
$this->remove_cache_file(); $this->remove_cache_file();
} }
@ -213,7 +213,7 @@ class acp_modules
{ {
$this->remove_cache_file(); $this->remove_cache_file();
trigger_error($user->lang['MODULE_ADDED'] . adm_back_link($this->u_action . '&amp;parent_id=' . $this->parent_id)); trigger_error(phpbb::$user->lang['MODULE_ADDED'] . adm_back_link($this->u_action . '&amp;parent_id=' . $this->parent_id));
} }
} }
} }
@ -234,7 +234,7 @@ class acp_modules
if (!$module_id) if (!$module_id)
{ {
trigger_error($user->lang['NO_MODULE_ID'] . adm_back_link($this->u_action . '&amp;parent_id=' . $this->parent_id), E_USER_WARNING); trigger_error(phpbb::$user->lang['NO_MODULE_ID'] . adm_back_link($this->u_action . '&amp;parent_id=' . $this->parent_id), E_USER_WARNING);
} }
$module_row = $this->get_module_row($module_id); $module_row = $this->get_module_row($module_id);
@ -272,7 +272,7 @@ class acp_modules
{ {
if (!$module_data['module_langname']) if (!$module_data['module_langname'])
{ {
trigger_error($user->lang['NO_MODULE_LANGNAME'] . adm_back_link($this->u_action . '&amp;parent_id=' . $this->parent_id), E_USER_WARNING); trigger_error(phpbb::$user->lang['NO_MODULE_LANGNAME'] . adm_back_link($this->u_action . '&amp;parent_id=' . $this->parent_id), E_USER_WARNING);
} }
$module_type = request_var('module_type', 'category'); $module_type = request_var('module_type', 'category');
@ -301,7 +301,7 @@ class acp_modules
{ {
$this->remove_cache_file(); $this->remove_cache_file();
trigger_error((($action == 'add') ? $user->lang['MODULE_ADDED'] : $user->lang['MODULE_EDITED']) . adm_back_link($this->u_action . '&amp;parent_id=' . $this->parent_id)); trigger_error((($action == 'add') ? phpbb::$user->lang['MODULE_ADDED'] : phpbb::$user->lang['MODULE_EDITED']) . adm_back_link($this->u_action . '&amp;parent_id=' . $this->parent_id));
} }
} }
@ -321,7 +321,7 @@ class acp_modules
} }
// Name options // Name options
$s_name_options .= '<option value="' . $option . '"' . (($option == $module_data['module_basename']) ? ' selected="selected"' : '') . '>' . $this->lang_name($values['title']) . ' [' . $this->module_class . '_' . $option . ']</option>'; $s_name_options .= '<option value="' . $option . '"' . (($option == $module_data['module_basename']) ? ' selected="selected"' : '') . '>' . phpbb::$user->lang($values['title']) . ' [' . $this->module_class . '_' . $option . ']</option>';
$template->assign_block_vars('m_names', array('NAME' => $option, 'A_NAME' => addslashes($option))); $template->assign_block_vars('m_names', array('NAME' => $option, 'A_NAME' => addslashes($option)));
@ -330,19 +330,19 @@ class acp_modules
{ {
if ($option == $module_data['module_basename']) if ($option == $module_data['module_basename'])
{ {
$s_mode_options .= '<option value="' . $m_mode . '"' . (($m_mode == $module_data['module_mode']) ? ' selected="selected"' : '') . '>' . $this->lang_name($m_values['title']) . '</option>'; $s_mode_options .= '<option value="' . $m_mode . '"' . (($m_mode == $module_data['module_mode']) ? ' selected="selected"' : '') . '>' . phpbb::$user->lang($m_values['title']) . '</option>';
} }
$template->assign_block_vars('m_names.modes', array( $template->assign_block_vars('m_names.modes', array(
'OPTION' => $m_mode, 'OPTION' => $m_mode,
'VALUE' => $this->lang_name($m_values['title']), 'VALUE' => phpbb::$user->lang($m_values['title']),
'A_OPTION' => addslashes($m_mode), 'A_OPTION' => addslashes($m_mode),
'A_VALUE' => addslashes($this->lang_name($m_values['title']))) 'A_VALUE' => addslashes(phpbb::$user->lang($m_values['title'])))
); );
} }
} }
$s_cat_option = '<option value="0"' . (($module_data['parent_id'] == 0) ? ' selected="selected"' : '') . '>' . $user->lang['NO_PARENT'] . '</option>'; $s_cat_option = '<option value="0"' . (($module_data['parent_id'] == 0) ? ' selected="selected"' : '') . '>' . phpbb::$user->lang['NO_PARENT'] . '</option>';
$template->assign_vars(array_merge(array( $template->assign_vars(array_merge(array(
'S_EDIT_MODULE' => true, 'S_EDIT_MODULE' => true,
@ -353,9 +353,9 @@ class acp_modules
'U_BACK' => $this->u_action . '&amp;parent_id=' . $this->parent_id, 'U_BACK' => $this->u_action . '&amp;parent_id=' . $this->parent_id,
'U_EDIT_ACTION' => $this->u_action . '&amp;parent_id=' . $this->parent_id, 'U_EDIT_ACTION' => $this->u_action . '&amp;parent_id=' . $this->parent_id,
'L_TITLE' => $user->lang[strtoupper($action) . '_MODULE'], 'L_TITLE' => phpbb::$user->lang[strtoupper($action) . '_MODULE'],
'MODULENAME' => $this->lang_name($module_data['module_langname']), 'MODULENAME' => phpbb::$user->lang($module_data['module_langname']),
'ACTION' => $action, 'ACTION' => $action,
'MODULE_ID' => $module_id, 'MODULE_ID' => $module_id,
@ -397,7 +397,7 @@ class acp_modules
foreach ($modules_nav as $row) foreach ($modules_nav as $row)
{ {
$langname = $this->lang_name($row['module_langname']); $langname = phpbb::$user->lang($row['module_langname']);
if ($row['module_id'] == $this->parent_id) if ($row['module_id'] == $this->parent_id)
{ {
@ -416,23 +416,23 @@ class acp_modules
$sql = 'SELECT * $sql = 'SELECT *
FROM ' . MODULES_TABLE . " FROM ' . MODULES_TABLE . "
WHERE parent_id = {$this->parent_id} WHERE parent_id = {$this->parent_id}
AND module_class = '" . $db->sql_escape($this->module_class) . "' AND module_class = '" . phpbb::$db->sql_escape($this->module_class) . "'
ORDER BY left_id"; ORDER BY left_id";
$result = $db->sql_query($sql); $result = phpbb::$db->sql_query($sql);
if ($row = $db->sql_fetchrow($result)) if ($row = phpbb::$db->sql_fetchrow($result))
{ {
do do
{ {
$langname = $this->lang_name($row['module_langname']); $langname = phpbb::$user->lang($row['module_langname']);
if (!$row['module_enabled']) if (!$row['module_enabled'])
{ {
$module_image = '<img src="images/icon_folder_lock.gif" alt="' . $user->lang['DEACTIVATED_MODULE'] .'" />'; $module_image = '<img src="images/icon_folder_lock.gif" alt="' . phpbb::$user->lang['DEACTIVATED_MODULE'] .'" />';
} }
else else
{ {
$module_image = (!$row['module_basename'] || $row['left_id'] + 1 != $row['right_id']) ? '<img src="images/icon_subfolder.gif" alt="' . $user->lang['CATEGORY'] . '" />' : '<img src="images/icon_folder.gif" alt="' . $user->lang['MODULE'] . '" />'; $module_image = (!$row['module_basename'] || $row['left_id'] + 1 != $row['right_id']) ? '<img src="images/icon_subfolder.gif" alt="' . phpbb::$user->lang['CATEGORY'] . '" />' : '<img src="images/icon_folder.gif" alt="' . phpbb::$user->lang['MODULE'] . '" />';
} }
$url = $this->u_action . '&amp;parent_id=' . $this->parent_id . '&amp;m=' . $row['module_id']; $url = $this->u_action . '&amp;parent_id=' . $this->parent_id . '&amp;m=' . $row['module_id'];
@ -455,7 +455,7 @@ class acp_modules
'U_DISABLE' => $url . '&amp;action=disable') 'U_DISABLE' => $url . '&amp;action=disable')
); );
} }
while ($row = $db->sql_fetchrow($result)); while ($row = phpbb::$db->sql_fetchrow($result));
} }
else if ($this->parent_id) else if ($this->parent_id)
{ {
@ -475,7 +475,7 @@ class acp_modules
'U_DISABLE' => $url . '&amp;action=disable') 'U_DISABLE' => $url . '&amp;action=disable')
); );
} }
$db->sql_freeresult($result); phpbb::$db->sql_freeresult($result);
// Quick adding module // Quick adding module
$module_infos = $this->get_module_infos(); $module_infos = $this->get_module_infos();
@ -485,12 +485,12 @@ class acp_modules
foreach ($module_infos as $option => $values) foreach ($module_infos as $option => $values)
{ {
// Name options // Name options
$s_install_options .= '<optgroup label="' . $this->lang_name($values['title']) . ' [' . $this->module_class . '_' . $option . ']">'; $s_install_options .= '<optgroup label="' . phpbb::$user->lang($values['title']) . ' [' . $this->module_class . '_' . $option . ']">';
// Build module modes // Build module modes
foreach ($values['modes'] as $m_mode => $m_values) foreach ($values['modes'] as $m_mode => $m_values)
{ {
$s_install_options .= '<option value="' . $option . '::' . $m_mode . '">&nbsp; &nbsp;' . $this->lang_name($m_values['title']) . '</option>'; $s_install_options .= '<option value="' . $option . '::' . $m_mode . '">&nbsp; &nbsp;' . phpbb::$user->lang($m_values['title']) . '</option>';
} }
$s_install_options .= '</optgroup>'; $s_install_options .= '</optgroup>';
@ -512,19 +512,17 @@ class acp_modules
*/ */
function get_module_row($module_id) function get_module_row($module_id)
{ {
global $db, $user;
$sql = 'SELECT * $sql = 'SELECT *
FROM ' . MODULES_TABLE . " FROM ' . MODULES_TABLE . "
WHERE module_class = '" . $db->sql_escape($this->module_class) . "' WHERE module_class = '" . phpbb::$db->sql_escape($this->module_class) . "'
AND module_id = $module_id"; AND module_id = $module_id";
$result = $db->sql_query($sql); $result = phpbb::$db->sql_query($sql);
$row = $db->sql_fetchrow($result); $row = phpbb::$db->sql_fetchrow($result);
$db->sql_freeresult($result); phpbb::$db->sql_freeresult($result);
if (!$row) if (!$row)
{ {
trigger_error($user->lang['NO_MODULE'] . adm_back_link($this->u_action . '&amp;parent_id=' . $this->parent_id), E_USER_WARNING); trigger_error(phpbb::$user->lang['NO_MODULE'] . adm_back_link($this->u_action . '&amp;parent_id=' . $this->parent_id), E_USER_WARNING);
} }
return $row; return $row;
@ -537,7 +535,7 @@ class acp_modules
{ {
$module_class = ($module_class === false) ? $this->module_class : $module_class; $module_class = ($module_class === false) ? $this->module_class : $module_class;
$directory = PHPBB_ROOT_PATH . 'includes/' . $module_class . '/info/'; $directory = PHPBB_ROOT_PATH . 'modules/' . $module_class . '/info/';
$fileinfo = array(); $fileinfo = array();
if (!$module) if (!$module)
@ -601,19 +599,19 @@ class acp_modules
*/ */
function make_module_select($select_id = false, $ignore_id = false, $ignore_acl = false, $ignore_nonpost = false, $ignore_emptycat = true, $ignore_noncat = false) function make_module_select($select_id = false, $ignore_id = false, $ignore_acl = false, $ignore_nonpost = false, $ignore_emptycat = true, $ignore_noncat = false)
{ {
global $db, $user, $auth; global $auth;
$sql = 'SELECT module_id, module_enabled, module_basename, parent_id, module_langname, left_id, right_id, module_auth $sql = 'SELECT module_id, module_enabled, module_basename, parent_id, module_langname, left_id, right_id, module_auth
FROM ' . MODULES_TABLE . " FROM ' . MODULES_TABLE . "
WHERE module_class = '" . $db->sql_escape($this->module_class) . "' WHERE module_class = '" . phpbb::$db->sql_escape($this->module_class) . "'
ORDER BY left_id ASC"; ORDER BY left_id ASC";
$result = $db->sql_query($sql); $result = phpbb::$db->sql_query($sql);
$right = $iteration = 0; $right = $iteration = 0;
$padding_store = array('0' => ''); $padding_store = array('0' => '');
$module_list = $padding = ''; $module_list = $padding = '';
while ($row = $db->sql_fetchrow($result)) while ($row = phpbb::$db->sql_fetchrow($result))
{ {
if ($row['left_id'] < $right) if ($row['left_id'] < $right)
{ {
@ -656,12 +654,12 @@ class acp_modules
$selected = (is_array($select_id)) ? ((in_array($row['module_id'], $select_id)) ? ' selected="selected"' : '') : (($row['module_id'] == $select_id) ? ' selected="selected"' : ''); $selected = (is_array($select_id)) ? ((in_array($row['module_id'], $select_id)) ? ' selected="selected"' : '') : (($row['module_id'] == $select_id) ? ' selected="selected"' : '');
$langname = $this->lang_name($row['module_langname']); $langname = phpbb::$user->lang($row['module_langname']);
$module_list .= '<option value="' . $row['module_id'] . '"' . $selected . ((!$row['module_enabled']) ? ' class="disabled"' : '') . '>' . $padding . $langname . '</option>'; $module_list .= '<option value="' . $row['module_id'] . '"' . $selected . ((!$row['module_enabled']) ? ' class="disabled"' : '') . '>' . $padding . $langname . '</option>';
$iteration++; $iteration++;
} }
$db->sql_freeresult($result); phpbb::$db->sql_freeresult($result);
unset($padding_store); unset($padding_store);
@ -673,8 +671,6 @@ class acp_modules
*/ */
function get_module_branch($module_id, $type = 'all', $order = 'descending', $include_module = true) function get_module_branch($module_id, $type = 'all', $order = 'descending', $include_module = true)
{ {
global $db;
switch ($type) switch ($type)
{ {
case 'parents': case 'parents':
@ -695,13 +691,13 @@ class acp_modules
$sql = 'SELECT m2.* $sql = 'SELECT m2.*
FROM ' . MODULES_TABLE . ' m1 FROM ' . MODULES_TABLE . ' m1
LEFT JOIN ' . MODULES_TABLE . " m2 ON ($condition) LEFT JOIN ' . MODULES_TABLE . " m2 ON ($condition)
WHERE m1.module_class = '" . $db->sql_escape($this->module_class) . "' WHERE m1.module_class = '" . phpbb::$db->sql_escape($this->module_class) . "'
AND m2.module_class = '" . $db->sql_escape($this->module_class) . "' AND m2.module_class = '" . phpbb::$db->sql_escape($this->module_class) . "'
AND m1.module_id = $module_id AND m1.module_id = $module_id
ORDER BY m2.left_id " . (($order == 'descending') ? 'ASC' : 'DESC'); ORDER BY m2.left_id " . (($order == 'descending') ? 'ASC' : 'DESC');
$result = $db->sql_query($sql); $result = phpbb::$db->sql_query($sql);
while ($row = $db->sql_fetchrow($result)) while ($row = phpbb::$db->sql_fetchrow($result))
{ {
if (!$include_module && $row['module_id'] == $module_id) if (!$include_module && $row['module_id'] == $module_id)
{ {
@ -710,7 +706,7 @@ class acp_modules
$rows[] = $row; $rows[] = $row;
} }
$db->sql_freeresult($result); phpbb::$db->sql_freeresult($result);
return $rows; return $rows;
} }
@ -729,16 +725,6 @@ class acp_modules
phpbb::$acm->destroy_sql(MODULES_TABLE); phpbb::$acm->destroy_sql(MODULES_TABLE);
} }
/**
* Return correct language name
*/
function lang_name($module_langname)
{
global $user;
return (!empty($user->lang[$module_langname])) ? $user->lang[$module_langname] : $module_langname;
}
/** /**
* Update/Add module * Update/Add module
* *
@ -746,8 +732,6 @@ class acp_modules
*/ */
function update_module_data(&$module_data, $run_inline = false) function update_module_data(&$module_data, $run_inline = false)
{ {
global $db, $user;
if (!isset($module_data['module_id'])) if (!isset($module_data['module_id']))
{ {
// no module_id means we're creating a new category/module // no module_id means we're creating a new category/module
@ -755,11 +739,11 @@ class acp_modules
{ {
$sql = 'SELECT left_id, right_id $sql = 'SELECT left_id, right_id
FROM ' . MODULES_TABLE . " FROM ' . MODULES_TABLE . "
WHERE module_class = '" . $db->sql_escape($module_data['module_class']) . "' WHERE module_class = '" . phpbb::$db->sql_escape($module_data['module_class']) . "'
AND module_id = " . (int) $module_data['parent_id']; AND module_id = " . (int) $module_data['parent_id'];
$result = $db->sql_query($sql); $result = phpbb::$db->sql_query($sql);
$row = $db->sql_fetchrow($result); $row = phpbb::$db->sql_fetchrow($result);
$db->sql_freeresult($result); phpbb::$db->sql_freeresult($result);
if (!$row) if (!$row)
{ {
@ -768,7 +752,7 @@ class acp_modules
return 'PARENT_NO_EXIST'; return 'PARENT_NO_EXIST';
} }
trigger_error($user->lang['PARENT_NO_EXIST'] . adm_back_link($this->u_action . '&amp;parent_id=' . $this->parent_id), E_USER_WARNING); trigger_error(phpbb::$user->lang['PARENT_NO_EXIST'] . adm_back_link($this->u_action . '&amp;parent_id=' . $this->parent_id), E_USER_WARNING);
} }
// Workaround // Workaround
@ -777,15 +761,15 @@ class acp_modules
$sql = 'UPDATE ' . MODULES_TABLE . " $sql = 'UPDATE ' . MODULES_TABLE . "
SET left_id = left_id + 2, right_id = right_id + 2 SET left_id = left_id + 2, right_id = right_id + 2
WHERE module_class = '" . $db->sql_escape($module_data['module_class']) . "' WHERE module_class = '" . phpbb::$db->sql_escape($module_data['module_class']) . "'
AND left_id > {$row['right_id']}"; AND left_id > {$row['right_id']}";
$db->sql_query($sql); phpbb::$db->sql_query($sql);
$sql = 'UPDATE ' . MODULES_TABLE . " $sql = 'UPDATE ' . MODULES_TABLE . "
SET right_id = right_id + 2 SET right_id = right_id + 2
WHERE module_class = '" . $db->sql_escape($module_data['module_class']) . "' WHERE module_class = '" . phpbb::$db->sql_escape($module_data['module_class']) . "'
AND {$row['left_id']} BETWEEN left_id AND right_id"; AND {$row['left_id']} BETWEEN left_id AND right_id";
$db->sql_query($sql); phpbb::$db->sql_query($sql);
$module_data['left_id'] = (int) $row['right_id']; $module_data['left_id'] = (int) $row['right_id'];
$module_data['right_id'] = (int) $row['right_id'] + 1; $module_data['right_id'] = (int) $row['right_id'] + 1;
@ -794,23 +778,23 @@ class acp_modules
{ {
$sql = 'SELECT MAX(right_id) AS right_id $sql = 'SELECT MAX(right_id) AS right_id
FROM ' . MODULES_TABLE . " FROM ' . MODULES_TABLE . "
WHERE module_class = '" . $db->sql_escape($module_data['module_class']) . "'"; WHERE module_class = '" . phpbb::$db->sql_escape($module_data['module_class']) . "'";
$result = $db->sql_query($sql); $result = phpbb::$db->sql_query($sql);
$row = $db->sql_fetchrow($result); $row = phpbb::$db->sql_fetchrow($result);
$db->sql_freeresult($result); phpbb::$db->sql_freeresult($result);
$module_data['left_id'] = (int) $row['right_id'] + 1; $module_data['left_id'] = (int) $row['right_id'] + 1;
$module_data['right_id'] = (int) $row['right_id'] + 2; $module_data['right_id'] = (int) $row['right_id'] + 2;
} }
$sql = 'INSERT INTO ' . MODULES_TABLE . ' ' . $db->sql_build_array('INSERT', $module_data); $sql = 'INSERT INTO ' . MODULES_TABLE . ' ' . phpbb::$db->sql_build_array('INSERT', $module_data);
$db->sql_query($sql); phpbb::$db->sql_query($sql);
$module_data['module_id'] = $db->sql_nextid(); $module_data['module_id'] = phpbb::$db->sql_nextid();
if (!$run_inline) if (!$run_inline)
{ {
add_log('admin', 'LOG_MODULE_ADD', $this->lang_name($module_data['module_langname'])); add_log('admin', 'LOG_MODULE_ADD', phpbb::$user->lang($module_data['module_langname']));
} }
} }
else else
@ -824,7 +808,7 @@ class acp_modules
if (sizeof($branch)) if (sizeof($branch))
{ {
return array($user->lang['NO_CATEGORY_TO_MODULE']); return array(phpbb::$user->lang['NO_CATEGORY_TO_MODULE']);
} }
} }
@ -837,14 +821,14 @@ class acp_modules
unset($update_ary['module_id']); unset($update_ary['module_id']);
$sql = 'UPDATE ' . MODULES_TABLE . ' $sql = 'UPDATE ' . MODULES_TABLE . '
SET ' . $db->sql_build_array('UPDATE', $update_ary) . " SET ' . phpbb::$db->sql_build_array('UPDATE', $update_ary) . "
WHERE module_class = '" . $db->sql_escape($module_data['module_class']) . "' WHERE module_class = '" . phpbb::$db->sql_escape($module_data['module_class']) . "'
AND module_id = " . (int) $module_data['module_id']; AND module_id = " . (int) $module_data['module_id'];
$db->sql_query($sql); phpbb::$db->sql_query($sql);
if (!$run_inline) if (!$run_inline)
{ {
add_log('admin', 'LOG_MODULE_EDIT', $this->lang_name($module_data['module_langname'])); add_log('admin', 'LOG_MODULE_EDIT', phpbb::$user->lang($module_data['module_langname']));
} }
} }
@ -856,8 +840,6 @@ class acp_modules
*/ */
function move_module($from_module_id, $to_parent_id) function move_module($from_module_id, $to_parent_id)
{ {
global $db;
$moved_modules = $this->get_module_branch($from_module_id, 'children', 'descending'); $moved_modules = $this->get_module_branch($from_module_id, 'children', 'descending');
$from_data = $moved_modules[0]; $from_data = $moved_modules[0];
$diff = sizeof($moved_modules) * 2; $diff = sizeof($moved_modules) * 2;
@ -871,17 +853,17 @@ class acp_modules
// Resync parents // Resync parents
$sql = 'UPDATE ' . MODULES_TABLE . " $sql = 'UPDATE ' . MODULES_TABLE . "
SET right_id = right_id - $diff SET right_id = right_id - $diff
WHERE module_class = '" . $db->sql_escape($this->module_class) . "' WHERE module_class = '" . phpbb::$db->sql_escape($this->module_class) . "'
AND left_id < " . (int) $from_data['right_id'] . ' AND left_id < " . (int) $from_data['right_id'] . '
AND right_id > ' . (int) $from_data['right_id']; AND right_id > ' . (int) $from_data['right_id'];
$db->sql_query($sql); phpbb::$db->sql_query($sql);
// Resync righthand side of tree // Resync righthand side of tree
$sql = 'UPDATE ' . MODULES_TABLE . " $sql = 'UPDATE ' . MODULES_TABLE . "
SET left_id = left_id - $diff, right_id = right_id - $diff SET left_id = left_id - $diff, right_id = right_id - $diff
WHERE module_class = '" . $db->sql_escape($this->module_class) . "' WHERE module_class = '" . phpbb::$db->sql_escape($this->module_class) . "'
AND left_id > " . (int) $from_data['right_id']; AND left_id > " . (int) $from_data['right_id'];
$db->sql_query($sql); phpbb::$db->sql_query($sql);
if ($to_parent_id > 0) if ($to_parent_id > 0)
{ {
@ -890,18 +872,18 @@ class acp_modules
// Resync new parents // Resync new parents
$sql = 'UPDATE ' . MODULES_TABLE . " $sql = 'UPDATE ' . MODULES_TABLE . "
SET right_id = right_id + $diff SET right_id = right_id + $diff
WHERE module_class = '" . $db->sql_escape($this->module_class) . "' WHERE module_class = '" . phpbb::$db->sql_escape($this->module_class) . "'
AND " . (int) $to_data['right_id'] . ' BETWEEN left_id AND right_id AND " . (int) $to_data['right_id'] . ' BETWEEN left_id AND right_id
AND ' . $db->sql_in_set('module_id', $moved_ids, true); AND ' . phpbb::$db->sql_in_set('module_id', $moved_ids, true);
$db->sql_query($sql); phpbb::$db->sql_query($sql);
// Resync the righthand side of the tree // Resync the righthand side of the tree
$sql = 'UPDATE ' . MODULES_TABLE . " $sql = 'UPDATE ' . MODULES_TABLE . "
SET left_id = left_id + $diff, right_id = right_id + $diff SET left_id = left_id + $diff, right_id = right_id + $diff
WHERE module_class = '" . $db->sql_escape($this->module_class) . "' WHERE module_class = '" . phpbb::$db->sql_escape($this->module_class) . "'
AND left_id > " . (int) $to_data['right_id'] . ' AND left_id > " . (int) $to_data['right_id'] . '
AND ' . $db->sql_in_set('module_id', $moved_ids, true); AND ' . phpbb::$db->sql_in_set('module_id', $moved_ids, true);
$db->sql_query($sql); phpbb::$db->sql_query($sql);
// Resync moved branch // Resync moved branch
$to_data['right_id'] += $diff; $to_data['right_id'] += $diff;
@ -918,20 +900,20 @@ class acp_modules
{ {
$sql = 'SELECT MAX(right_id) AS right_id $sql = 'SELECT MAX(right_id) AS right_id
FROM ' . MODULES_TABLE . " FROM ' . MODULES_TABLE . "
WHERE module_class = '" . $db->sql_escape($this->module_class) . "' WHERE module_class = '" . phpbb::$db->sql_escape($this->module_class) . "'
AND " . $db->sql_in_set('module_id', $moved_ids, true); AND " . phpbb::$db->sql_in_set('module_id', $moved_ids, true);
$result = $db->sql_query($sql); $result = phpbb::$db->sql_query($sql);
$row = $db->sql_fetchrow($result); $row = phpbb::$db->sql_fetchrow($result);
$db->sql_freeresult($result); phpbb::$db->sql_freeresult($result);
$diff = '+ ' . (int) ($row['right_id'] - $from_data['left_id'] + 1); $diff = '+ ' . (int) ($row['right_id'] - $from_data['left_id'] + 1);
} }
$sql = 'UPDATE ' . MODULES_TABLE . " $sql = 'UPDATE ' . MODULES_TABLE . "
SET left_id = left_id $diff, right_id = right_id $diff SET left_id = left_id $diff, right_id = right_id $diff
WHERE module_class = '" . $db->sql_escape($this->module_class) . "' WHERE module_class = '" . phpbb::$db->sql_escape($this->module_class) . "'
AND " . $db->sql_in_set('module_id', $moved_ids); AND " . phpbb::$db->sql_in_set('module_id', $moved_ids);
$db->sql_query($sql); phpbb::$db->sql_query($sql);
} }
/** /**
@ -939,23 +921,21 @@ class acp_modules
*/ */
function delete_module($module_id) function delete_module($module_id)
{ {
global $db, $user;
$row = $this->get_module_row($module_id); $row = $this->get_module_row($module_id);
$branch = $this->get_module_branch($module_id, 'children', 'descending', false); $branch = $this->get_module_branch($module_id, 'children', 'descending', false);
if (sizeof($branch)) if (sizeof($branch))
{ {
return array($user->lang['CANNOT_REMOVE_MODULE']); return array(phpbb::$user->lang['CANNOT_REMOVE_MODULE']);
} }
// If not move // If not move
$diff = 2; $diff = 2;
$sql = 'DELETE FROM ' . MODULES_TABLE . " $sql = 'DELETE FROM ' . MODULES_TABLE . "
WHERE module_class = '" . $db->sql_escape($this->module_class) . "' WHERE module_class = '" . phpbb::$db->sql_escape($this->module_class) . "'
AND module_id = $module_id"; AND module_id = $module_id";
$db->sql_query($sql); phpbb::$db->sql_query($sql);
$row['right_id'] = (int) $row['right_id']; $row['right_id'] = (int) $row['right_id'];
$row['left_id'] = (int) $row['left_id']; $row['left_id'] = (int) $row['left_id'];
@ -963,17 +943,17 @@ class acp_modules
// Resync tree // Resync tree
$sql = 'UPDATE ' . MODULES_TABLE . " $sql = 'UPDATE ' . MODULES_TABLE . "
SET right_id = right_id - $diff SET right_id = right_id - $diff
WHERE module_class = '" . $db->sql_escape($this->module_class) . "' WHERE module_class = '" . phpbb::$db->sql_escape($this->module_class) . "'
AND left_id < {$row['right_id']} AND right_id > {$row['right_id']}"; AND left_id < {$row['right_id']} AND right_id > {$row['right_id']}";
$db->sql_query($sql); phpbb::$db->sql_query($sql);
$sql = 'UPDATE ' . MODULES_TABLE . " $sql = 'UPDATE ' . MODULES_TABLE . "
SET left_id = left_id - $diff, right_id = right_id - $diff SET left_id = left_id - $diff, right_id = right_id - $diff
WHERE module_class = '" . $db->sql_escape($this->module_class) . "' WHERE module_class = '" . phpbb::$db->sql_escape($this->module_class) . "'
AND left_id > {$row['right_id']}"; AND left_id > {$row['right_id']}";
$db->sql_query($sql); phpbb::$db->sql_query($sql);
add_log('admin', 'LOG_MODULE_REMOVED', $this->lang_name($row['module_langname'])); add_log('admin', 'LOG_MODULE_REMOVED', phpbb::$user->lang($row['module_langname']));
return array(); return array();
@ -984,8 +964,6 @@ class acp_modules
*/ */
function move_module_by($module_row, $action = 'move_up', $steps = 1) function move_module_by($module_row, $action = 'move_up', $steps = 1)
{ {
global $db;
/** /**
* Fetch all the siblings between the module's current spot * Fetch all the siblings between the module's current spot
* and where we want to move it to. If there are less than $steps * and where we want to move it to. If there are less than $steps
@ -994,17 +972,17 @@ class acp_modules
*/ */
$sql = 'SELECT module_id, left_id, right_id, module_langname $sql = 'SELECT module_id, left_id, right_id, module_langname
FROM ' . MODULES_TABLE . " FROM ' . MODULES_TABLE . "
WHERE module_class = '" . $db->sql_escape($this->module_class) . "' WHERE module_class = '" . phpbb::$db->sql_escape($this->module_class) . "'
AND parent_id = " . (int) $module_row['parent_id'] . ' AND parent_id = " . (int) $module_row['parent_id'] . '
AND ' . (($action == 'move_up') ? 'right_id < ' . (int) $module_row['right_id'] . ' ORDER BY right_id DESC' : 'left_id > ' . (int) $module_row['left_id'] . ' ORDER BY left_id ASC'); AND ' . (($action == 'move_up') ? 'right_id < ' . (int) $module_row['right_id'] . ' ORDER BY right_id DESC' : 'left_id > ' . (int) $module_row['left_id'] . ' ORDER BY left_id ASC');
$result = $db->sql_query_limit($sql, $steps); $result = phpbb::$db->sql_query_limit($sql, $steps);
$target = array(); $target = array();
while ($row = $db->sql_fetchrow($result)) while ($row = phpbb::$db->sql_fetchrow($result))
{ {
$target = $row; $target = $row;
} }
$db->sql_freeresult($result); phpbb::$db->sql_freeresult($result);
if (!sizeof($target)) if (!sizeof($target))
{ {
@ -1052,14 +1030,14 @@ class acp_modules
WHEN right_id BETWEEN {$move_up_left} AND {$move_up_right} THEN -{$diff_up} WHEN right_id BETWEEN {$move_up_left} AND {$move_up_right} THEN -{$diff_up}
ELSE {$diff_down} ELSE {$diff_down}
END END
WHERE module_class = '" . $db->sql_escape($this->module_class) . "' WHERE module_class = '" . phpbb::$db->sql_escape($this->module_class) . "'
AND left_id BETWEEN {$left_id} AND {$right_id} AND left_id BETWEEN {$left_id} AND {$right_id}
AND right_id BETWEEN {$left_id} AND {$right_id}"; AND right_id BETWEEN {$left_id} AND {$right_id}";
$db->sql_query($sql); phpbb::$db->sql_query($sql);
$this->remove_cache_file(); $this->remove_cache_file();
return $this->lang_name($target['module_langname']); return phpbb::$user->lang($target['module_langname']);
} }
} }

View file

@ -368,7 +368,7 @@ class acp_permissions
$template->assign_vars(array( $template->assign_vars(array(
'S_SELECT_GROUP' => true, 'S_SELECT_GROUP' => true,
'S_GROUP_OPTIONS' => group_select_options(false, false, (($user->data['user_type'] == phpbb::USER_FOUNDER) ? false : 0))) 'S_GROUP_OPTIONS' => group_select_options(false, false, ((phpbb::$user->is_founder) ? false : 0)))
); );
break; break;
@ -414,7 +414,7 @@ class acp_permissions
'S_SELECT_USERGROUP_VIEW' => ($victim == 'usergroup_view') ? true : false, 'S_SELECT_USERGROUP_VIEW' => ($victim == 'usergroup_view') ? true : false,
'S_DEFINED_USER_OPTIONS' => $items['user_ids_options'], 'S_DEFINED_USER_OPTIONS' => $items['user_ids_options'],
'S_DEFINED_GROUP_OPTIONS' => $items['group_ids_options'], 'S_DEFINED_GROUP_OPTIONS' => $items['group_ids_options'],
'S_ADD_GROUP_OPTIONS' => group_select_options(false, $items['group_ids'], (($user->data['user_type'] == phpbb::USER_FOUNDER) ? false : 0)), 'S_ADD_GROUP_OPTIONS' => group_select_options(false, $items['group_ids'], ((phpbb::$user->is_founder) ? false : 0)),
'U_FIND_USERNAME' => append_sid('memberlist', 'mode=searchuser&amp;form=add_user&amp;field=username&amp;select_single=true'), 'U_FIND_USERNAME' => append_sid('memberlist', 'mode=searchuser&amp;form=add_user&amp;field=username&amp;select_single=true'),
)); ));

View file

@ -293,7 +293,7 @@ parse_css_file = {PARSE_CSS_FILE}
// Save CSS contents // Save CSS contents
$sql_ary = array( $sql_ary = array(
'theme_mtime' => (int) filemtime(PHPBB_ROOT_PATH . "styles/{$theme_row['theme_path']}/theme/stylesheet.css"), 'theme_mtime' => (int) filemtime(PHPBB_ROOT_PATH . "styles/{$theme_row['theme_path']}/theme/stylesheet.css"),
'theme_data' => $this->db_theme_data($theme_row) 'theme_data' => self::db_theme_data($theme_row)
); );
$sql = 'UPDATE ' . STYLES_THEME_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . " $sql = 'UPDATE ' . STYLES_THEME_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . "
@ -974,7 +974,7 @@ parse_css_file = {PARSE_CSS_FILE}
$sql_ary = array( $sql_ary = array(
'theme_mtime' => time(), 'theme_mtime' => time(),
'theme_storedb' => 1, 'theme_storedb' => 1,
'theme_data' => $this->db_theme_data($theme_info, $theme_data), 'theme_data' => self::db_theme_data($theme_info, $theme_data),
); );
$sql = 'UPDATE ' . STYLES_THEME_TABLE . ' $sql = 'UPDATE ' . STYLES_THEME_TABLE . '
SET ' . $db->sql_build_array('UPDATE', $sql_ary) . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . '
@ -2123,7 +2123,7 @@ parse_css_file = {PARSE_CSS_FILE}
/** /**
* Load css file contents * Load css file contents
*/ */
function load_css_file($path, $filename) static function load_css_file($path, $filename)
{ {
$file = PHPBB_ROOT_PATH . "styles/$path/theme/$filename"; $file = PHPBB_ROOT_PATH . "styles/$path/theme/$filename";
@ -2149,7 +2149,7 @@ parse_css_file = {PARSE_CSS_FILE}
* *
* @return string Stylesheet data for theme_data column in the theme table * @return string Stylesheet data for theme_data column in the theme table
*/ */
function db_theme_data($theme_row, $stylesheet = false, $root_path = '') static function db_theme_data($theme_row, $stylesheet = false, $root_path = '')
{ {
if (!$root_path) if (!$root_path)
{ {
@ -2173,7 +2173,7 @@ parse_css_file = {PARSE_CSS_FILE}
{ {
foreach ($matches[0] as $idx => $match) foreach ($matches[0] as $idx => $match)
{ {
$stylesheet = str_replace($match, acp_styles::load_css_file($theme_row['theme_path'], $matches[1][$idx]), $stylesheet); $stylesheet = str_replace($match, self::load_css_file($theme_row['theme_path'], $matches[1][$idx]), $stylesheet);
} }
} }
@ -2939,7 +2939,7 @@ parse_css_file = {PARSE_CSS_FILE}
$sql_ary += array( $sql_ary += array(
'theme_storedb' => $store_db, 'theme_storedb' => $store_db,
'theme_data' => ($store_db) ? $this->db_theme_data($sql_ary, false, $root_path) : '', 'theme_data' => ($store_db) ? self::db_theme_data($sql_ary, false, $root_path) : '',
'theme_mtime' => (int) filemtime(PHPBB_ROOT_PATH . "styles/$path/theme/stylesheet.css") 'theme_mtime' => (int) filemtime(PHPBB_ROOT_PATH . "styles/$path/theme/stylesheet.css")
); );
break; break;

View file

@ -152,7 +152,7 @@ class acp_users
); );
// Prevent normal users/admins change/view founders if they are not a founder by themselves // Prevent normal users/admins change/view founders if they are not a founder by themselves
if ($user->data['user_type'] != phpbb::USER_FOUNDER && $user_row['user_type'] == phpbb::USER_FOUNDER) if (!phpbb::$user->is_founder && $user_row['user_type'] == phpbb::USER_FOUNDER)
{ {
trigger_error($user->lang['NOT_MANAGE_FOUNDER'] . adm_back_link($this->u_action), E_USER_WARNING); trigger_error($user->lang['NOT_MANAGE_FOUNDER'] . adm_back_link($this->u_action), E_USER_WARNING);
} }
@ -718,10 +718,10 @@ class acp_users
{ {
$sql_ary = array(); $sql_ary = array();
if ($user_row['user_type'] != phpbb::USER_FOUNDER || $user->data['user_type'] == phpbb::USER_FOUNDER) if ($user_row['user_type'] != phpbb::USER_FOUNDER || phpbb::$user->is_founder)
{ {
// Only allow founders updating the founder status... // Only allow founders updating the founder status...
if ($user->data['user_type'] == phpbb::USER_FOUNDER) if (phpbb::$user->is_founder)
{ {
// Setting a normal member to be a founder // Setting a normal member to be a founder
if ($data['user_founder'] && $user_row['user_type'] != phpbb::USER_FOUNDER) if ($data['user_founder'] && $user_row['user_type'] != phpbb::USER_FOUNDER)
@ -903,7 +903,7 @@ class acp_users
'L_NAME_CHARS_EXPLAIN' => sprintf($user->lang[phpbb::$config['allow_name_chars'] . '_EXPLAIN'], phpbb::$config['min_name_chars'], phpbb::$config['max_name_chars']), 'L_NAME_CHARS_EXPLAIN' => sprintf($user->lang[phpbb::$config['allow_name_chars'] . '_EXPLAIN'], phpbb::$config['min_name_chars'], phpbb::$config['max_name_chars']),
'L_CHANGE_PASSWORD_EXPLAIN' => sprintf($user->lang[phpbb::$config['pass_complex'] . '_EXPLAIN'], phpbb::$config['min_pass_chars'], phpbb::$config['max_pass_chars']), 'L_CHANGE_PASSWORD_EXPLAIN' => sprintf($user->lang[phpbb::$config['pass_complex'] . '_EXPLAIN'], phpbb::$config['min_pass_chars'], phpbb::$config['max_pass_chars']),
'L_POSTS_IN_QUEUE' => $user->lang('NUM_POSTS_IN_QUEUE', $user_row['posts_in_queue']), 'L_POSTS_IN_QUEUE' => $user->lang('NUM_POSTS_IN_QUEUE', $user_row['posts_in_queue']),
'S_FOUNDER' => ($user->data['user_type'] == phpbb::USER_FOUNDER) ? true : false, 'S_FOUNDER' => phpbb::$user->is_founder,
'S_OVERVIEW' => true, 'S_OVERVIEW' => true,
'S_USER_IP' => ($user_row['user_ip']) ? true : false, 'S_USER_IP' => ($user_row['user_ip']) ? true : false,
@ -1801,7 +1801,7 @@ class acp_users
$founder_manage = (int) $db->sql_fetchfield('group_founder_manage'); $founder_manage = (int) $db->sql_fetchfield('group_founder_manage');
$db->sql_freeresult($result); $db->sql_freeresult($result);
if ($user->data['user_type'] != phpbb::USER_FOUNDER && $founder_manage) if (!phpbb::$user->is_founder && $founder_manage)
{ {
trigger_error($user->lang['NOT_ALLOWED_MANAGE_GROUP'] . adm_back_link($this->u_action . '&amp;u=' . $user_id), E_USER_WARNING); trigger_error($user->lang['NOT_ALLOWED_MANAGE_GROUP'] . adm_back_link($this->u_action . '&amp;u=' . $user_id), E_USER_WARNING);
} }
@ -1921,7 +1921,7 @@ class acp_users
} }
// Do not display those groups not allowed to be managed // Do not display those groups not allowed to be managed
if ($user->data['user_type'] != phpbb::USER_FOUNDER && $row['group_founder_manage']) if (!phpbb::$user->is_founder && $row['group_founder_manage'])
{ {
continue; continue;
} }

View file

@ -429,7 +429,7 @@ class ucp_groups
} }
// Check if the user is allowed to manage this group if set to founder only. // Check if the user is allowed to manage this group if set to founder only.
if ($user->data['user_type'] != phpbb::USER_FOUNDER && $group_row['group_founder_manage']) if (!phpbb::$user->is_founder && $group_row['group_founder_manage'])
{ {
trigger_error($user->lang['NOT_ALLOWED_MANAGE_GROUP'] . $return_page, E_USER_WARNING); trigger_error($user->lang['NOT_ALLOWED_MANAGE_GROUP'] . $return_page, E_USER_WARNING);
} }

View file

@ -133,7 +133,7 @@ class ucp_profile
$message = 'PROFILE_UPDATED'; $message = 'PROFILE_UPDATED';
if (phpbb::$config['email_enable'] && $data['email'] != $user->data['user_email'] && $user->data['user_type'] != phpbb::USER_FOUNDER && (phpbb::$config['require_activation'] == USER_ACTIVATION_SELF || phpbb::$config['require_activation'] == USER_ACTIVATION_ADMIN)) if (phpbb::$config['email_enable'] && $data['email'] != $user->data['user_email'] && !phpbb::$user->is_founder && (phpbb::$config['require_activation'] == USER_ACTIVATION_SELF || phpbb::$config['require_activation'] == USER_ACTIVATION_ADMIN))
{ {
$message = (phpbb::$config['require_activation'] == USER_ACTIVATION_SELF) ? 'ACCOUNT_EMAIL_CHANGED' : 'ACCOUNT_EMAIL_CHANGED_ADMIN'; $message = (phpbb::$config['require_activation'] == USER_ACTIVATION_SELF) ? 'ACCOUNT_EMAIL_CHANGED' : 'ACCOUNT_EMAIL_CHANGED_ADMIN';

View file

@ -121,7 +121,7 @@ if ($recache)
'theme_data' => $theme['theme_data'] 'theme_data' => $theme['theme_data']
); );
phpbb::$db->sql_handle_data('UPDATE', STYLES_THEME_TABLE, $sql_ary, 'theme_id = ' . $theme['theme_id']); phpbb::$db->sql_query('UPDATE ' . STYLES_THEME_TABLE . ' SET ' . phpbb::$db->sql_build_array('UPDATE', $sql_ary) . ' WHERE theme_id = ' . $theme['theme_id']);
phpbb::$acm->destroy_sql(STYLES_THEME_TABLE); phpbb::$acm->destroy_sql(STYLES_THEME_TABLE);
} }

View file

@ -14,9 +14,9 @@
define('IN_PHPBB', true); define('IN_PHPBB', true);
if (!defined('PHPBB_ROOT_PATH')) define('PHPBB_ROOT_PATH', './'); if (!defined('PHPBB_ROOT_PATH')) define('PHPBB_ROOT_PATH', './');
if (!defined('PHP_EXT')) define('PHP_EXT', substr(strrchr(__FILE__, '.'), 1)); if (!defined('PHP_EXT')) define('PHP_EXT', substr(strrchr(__FILE__, '.'), 1));
include(PHPBB_ROOT_PATH . 'common.' . PHP_EXT); include PHPBB_ROOT_PATH . 'common.' . PHP_EXT;
require(PHPBB_ROOT_PATH . 'includes/functions_user.' . PHP_EXT); require PHPBB_ROOT_PATH . 'includes/functions_user.' . PHP_EXT;
require(PHPBB_ROOT_PATH . 'includes/functions_module.' . PHP_EXT); require PHPBB_ROOT_PATH . 'includes/functions_module.' . PHP_EXT;
// Basic parameter data // Basic parameter data
$id = request_var('i', ''); $id = request_var('i', '');
@ -28,12 +28,12 @@ if ($mode == 'login' || $mode == 'logout' || $mode == 'confirm')
} }
// Start session management // Start session management
$user->session_begin(); phpbb::$user->session_begin();
$auth->acl($user->data); phpbb::$acl->init(phpbb::$user->data);
$user->setup('ucp'); phpbb::$user->setup('ucp');
// Setting a variable to let the style designer know where he is... // Setting a variable to let the style designer know where he is...
$template->assign_var('S_IN_UCP', true); phpbb::$template->assign_var('S_IN_UCP', true);
$module = new p_master(); $module = new p_master();
@ -72,28 +72,28 @@ switch ($mode)
break; break;
case 'login': case 'login':
if ($user->data['is_registered']) if (phpbb::$user->is_registered)
{ {
redirect(append_sid('index')); phpbb::$url->redirect(phpbb::$url->append_sid('index'));
} }
login_box(request_var('redirect', 'index')); login_box(request_var('redirect', 'index'));
break; break;
case 'logout': case 'logout':
if ($user->data['user_id'] != ANONYMOUS && phpbb_request::variable('sid', '', false, phpbb_request::GET) === $user->session_id) if (phpbb::$user->data['user_id'] != ANONYMOUS && phpbb_request::variable('sid', '', false, phpbb_request::GET) === phpbb::$user->session_id)
{ {
$user->session_kill(); phpbb::$user->session_kill();
$user->session_begin(); phpbb::$user->session_begin();
$message = $user->lang['LOGOUT_REDIRECT']; $message = phpbb::$user->lang['LOGOUT_REDIRECT'];
} }
else else
{ {
$message = ($user->data['user_id'] == ANONYMOUS) ? $user->lang['LOGOUT_REDIRECT'] : $user->lang['LOGOUT_FAILED']; $message = (phpbb::$user->data['user_id'] == ANONYMOUS) ? phpbb::$user->lang['LOGOUT_REDIRECT'] : phpbb::$user->lang['LOGOUT_FAILED'];
} }
meta_refresh(3, append_sid('index')); phpbb::$url->meta_refresh(3, phpbb::$url->append_sid('index'));
$message = $message . '<br /><br />' . sprintf($user->lang['RETURN_INDEX'], '<a href="' . append_sid('index') . '">', '</a> '); $message = $message . '<br /><br />' . phpbb::$user->lang('RETURN_INDEX', '<a href="' . phpbb::$url->append_sid('index') . '">', '</a> ');
trigger_error($message); trigger_error($message);
break; break;