1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-05-30 11:11:23 +02:00

[ticket/13454] Remove unused variables

This is part 2 of the pr.

PHPBB3-13454
This commit is contained in:
Marc Alexander 2015-12-03 18:19:02 +01:00
parent 73e6e5b77f
commit f50ba9ab4f
37 changed files with 37 additions and 88 deletions

View File

@ -389,7 +389,7 @@ function mass_auth($ug_type, $forum_id, $ug_id, $acl_list, $setting)
foreach ($sql_subary as $sql)
{
$sql = "INSERT INTO $table ($id_field, forum_id, auth_option_id, auth_setting) VALUES ($sql)";
$result = $db->sql_query($sql);
$db->sql_query($sql);
$sql = '';
}
}
@ -397,7 +397,7 @@ function mass_auth($ug_type, $forum_id, $ug_id, $acl_list, $setting)
if ($sql != '')
{
$sql = "INSERT INTO $table ($id_field, forum_id, auth_option_id, auth_setting) $sql";
$result = $db->sql_query($sql);
$db->sql_query($sql);
}
break;
@ -405,7 +405,7 @@ function mass_auth($ug_type, $forum_id, $ug_id, $acl_list, $setting)
case 'delete':
foreach ($sql_subary as $sql)
{
$result = $db->sql_query($sql);
$db->sql_query($sql);
$sql = '';
}
break;

View File

@ -194,8 +194,7 @@ class acp_ban
{
case 'user':
$field = 'username';
$l_ban_cell = $user->lang['USERNAME'];
$field = 'username';;
$sql = 'SELECT b.*, u.user_id, u.username, u.username_clean
FROM ' . BANLIST_TABLE . ' b, ' . USERS_TABLE . ' u
@ -208,7 +207,6 @@ class acp_ban
case 'ip':
$field = 'ban_ip';
$l_ban_cell = $user->lang['IP_HOSTNAME'];
$sql = 'SELECT *
FROM ' . BANLIST_TABLE . '
@ -221,7 +219,6 @@ class acp_ban
case 'email':
$field = 'ban_email';
$l_ban_cell = $user->lang['EMAIL_ADDRESS'];
$sql = 'SELECT *
FROM ' . BANLIST_TABLE . '

View File

@ -178,7 +178,7 @@ class acp_captcha
*/
function deliver_demo($selected)
{
global $db, $user, $config, $phpbb_container;
global $phpbb_container;
$captcha = $phpbb_container->get('captcha.factory')->get_instance($selected);
$captcha->init(CONFIRM_REG);

View File

@ -306,8 +306,6 @@ class acp_groups
include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
}
$data = $submit_ary = array();
if ($action == 'edit' && !$group_id)
{
trigger_error($user->lang['NO_GROUP'] . adm_back_link($this->u_action), E_USER_WARNING);

View File

@ -194,7 +194,6 @@ class acp_icons
$data = array();
$after = false;
$display = 0;
$order_lists = array('', '');
$add_order_lists = array('', '');
$display_count = 0;
@ -209,7 +208,6 @@ class acp_icons
if ($row[$fields . '_id'] == $icon_id)
{
$after = true;
$display = $row['display_on_posting'];
$data[$row[$fields . '_url']] = $row;
}
else

View File

@ -232,8 +232,8 @@ class acp_prune
*/
function prune_users($id, $mode)
{
global $db, $user, $auth, $template, $cache, $phpbb_log, $request;
global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx, $phpbb_container;
global $db, $user, $auth, $template, $phpbb_log, $request;
global $phpbb_root_path, $phpbb_admin_path, $phpEx, $phpbb_container;
/** @var \phpbb\group\helper $group_helper */
$group_helper = $phpbb_container->get('group_helper');

View File

@ -232,8 +232,8 @@ class acp_search
function index($id, $mode)
{
global $db, $user, $auth, $template, $cache, $phpbb_log, $request;
global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx;
global $db, $user, $template, $phpbb_log, $request;
global $config, $phpbb_admin_path, $phpEx;
$action = $request->variable('action', '');
$this->state = explode(',', $config['search_indexing_state']);

View File

@ -201,7 +201,6 @@ class acp_styles
$messages = array();
$installed_names = array();
$installed_dirs = array();
$last_installed = false;
foreach ($dirs as $dir)
{
if (in_array($dir, $this->reserved_style_names))
@ -224,7 +223,6 @@ class acp_styles
$style['style_id'] = $this->install_style($style);
$style['_installed'] = true;
$found = true;
$last_installed = $style['style_id'];
$installed_names[] = $style['style_name'];
$installed_dirs[] = $style['style_path'];
$messages[] = sprintf($this->user->lang['STYLE_INSTALLED'], htmlspecialchars($style['style_name']));

View File

@ -298,13 +298,11 @@ class acp_users
case 'banuser':
$ban[] = $user_row['username'];
$reason = 'USER_ADMIN_BAN_NAME_REASON';
$log = 'LOG_USER_BAN_USER';
break;
case 'banemail':
$ban[] = $user_row['user_email'];
$reason = 'USER_ADMIN_BAN_EMAIL_REASON';
$log = 'LOG_USER_BAN_EMAIL';
break;
case 'banip':
@ -322,7 +320,6 @@ class acp_users
$db->sql_freeresult($result);
$reason = 'USER_ADMIN_BAN_IP_REASON';
$log = 'LOG_USER_BAN_IP';
break;
}

View File

@ -266,7 +266,7 @@ class auth_admin extends \phpbb\auth\auth
*/
function display_mask($mode, $permission_type, &$hold_ary, $user_mode = 'user', $local = false, $group_display = true)
{
global $template, $user, $db, $phpbb_root_path, $phpEx, $phpbb_container;
global $template, $user, $db, $phpbb_container;
/* @var $phpbb_permissions \phpbb\permissions */
$phpbb_permissions = $phpbb_container->get('acl.permissions');

View File

@ -273,7 +273,7 @@ function build_cfg_template($tpl_type, $key, &$new_ary, $config_key, $vars)
break;
case 'number':
$min = $max = $maxlength = '';
$max = $maxlength = '';
$min = ( isset($tpl_type[1]) ) ? (int) $tpl_type[1] : false;
if ( isset($tpl_type[2]) )
{
@ -285,7 +285,7 @@ function build_cfg_template($tpl_type, $key, &$new_ary, $config_key, $vars)
break;
case 'dimension':
$min = $max = $maxlength = $size = '';
$max = $maxlength = $size = '';
$min = (int) $tpl_type[1];
@ -321,8 +321,6 @@ function build_cfg_template($tpl_type, $key, &$new_ary, $config_key, $vars)
case 'select':
case 'custom':
$return = '';
if (isset($vars['method']))
{
$call = array($module->module, $vars['method']);

View File

@ -423,7 +423,7 @@ function remote_avatar_dims()
function import_avatar_gallery($gallery_name = '', $subdirs_as_galleries = false)
{
global $config, $convert, $phpbb_root_path, $user;
global $config, $convert, $user;
$relative_path = empty($convert->convertor['source_path_absolute']);

View File

@ -206,7 +206,7 @@ class messenger
*/
function template($template_file, $template_lang = '', $template_path = '')
{
global $config, $phpbb_root_path, $phpEx, $user, $phpbb_extension_manager;
global $config, $phpbb_root_path, $user;
$this->setup_template();
@ -349,7 +349,7 @@ class messenger
*/
function error($type, $msg)
{
global $user, $phpEx, $phpbb_root_path, $config, $request, $phpbb_log;
global $user, $config, $request, $phpbb_log;
// Session doesn't exist, create it
if (!isset($user->session_id) || $user->session_id === '')
@ -359,7 +359,6 @@ class messenger
$calling_page = htmlspecialchars_decode($request->server('PHP_SELF'));
$message = '';
switch ($type)
{
case 'EMAIL':

View File

@ -387,8 +387,7 @@ class p_master
*/
static function module_auth($module_auth, $forum_id)
{
global $auth, $config;
global $request, $phpbb_extension_manager, $phpbb_dispatcher;
global $phpbb_dispatcher;
$module_auth = trim($module_auth);

View File

@ -333,7 +333,7 @@ function posting_gen_topic_icons($mode, $icon_id)
*/
function posting_gen_topic_types($forum_id, $cur_topic_type = POST_NORMAL)
{
global $auth, $user, $template, $topic_type;
global $auth, $user, $template;
$toggle = false;

View File

@ -226,7 +226,7 @@ function get_folder($user_id, $folder_id = false)
*/
function clean_sentbox($num_sentbox_messages)
{
global $db, $user, $config;
global $db, $user;
// Check Message Limit
if ($user->data['message_limit'] && $num_sentbox_messages > $user->data['message_limit'])
@ -255,8 +255,6 @@ function clean_sentbox($num_sentbox_messages)
*/
function check_rule(&$rules, &$rule_row, &$message_row, $user_id)
{
global $user, $config;
if (!isset($rules[$rule_row['rule_check']][$rule_row['rule_connection']]))
{
return false;
@ -335,7 +333,7 @@ function check_rule(&$rules, &$rule_row, &$message_row, $user_id)
break;
case ACTION_DELETE_MESSAGE:
global $db, $auth;
global $db;
// Check for admins/mods - users are not allowed to remove those messages...
// We do the check here to make sure the data we use is consistent

View File

@ -406,9 +406,6 @@ class ftp extends transfer
*/
function _put($from_file, $to_file)
{
// get the file extension
$file_extension = strtolower(substr(strrchr($to_file, '.'), 1));
// We only use the BINARY file mode to cicumvent rewrite actions from ftp server (mostly linefeeds being replaced)
$mode = FTP_BINARY;

View File

@ -241,8 +241,6 @@ function mcp_forum_view($id, $mode, $action, $forum_info)
foreach ($topic_list as $topic_id)
{
$topic_title = '';
$row_ary = &$topic_rows[$topic_id];
$replies = $phpbb_content_visibility->get_count('topic_posts', $row_ary, $forum_id) - 1;
@ -358,7 +356,7 @@ function mcp_forum_view($id, $mode, $action, $forum_info)
*/
function mcp_resync_topics($topic_ids)
{
global $auth, $db, $template, $phpEx, $user, $phpbb_root_path, $phpbb_log, $request;
global $db, $user, $phpbb_log, $request;
if (!sizeof($topic_ids))
{
@ -406,7 +404,7 @@ function mcp_resync_topics($topic_ids)
*/
function merge_topics($forum_id, $topic_ids, $to_topic_id)
{
global $db, $template, $user, $phpEx, $phpbb_root_path, $auth, $phpbb_log, $request;
global $db, $template, $user, $phpEx, $phpbb_root_path, $phpbb_log, $request;
if (!sizeof($topic_ids))
{

View File

@ -262,7 +262,7 @@ class mcp_main
*/
function lock_unlock($action, $ids)
{
global $auth, $user, $db, $phpEx, $phpbb_root_path, $request, $phpbb_log, $phpbb_dispatcher;
global $user, $db, $request, $phpbb_log, $phpbb_dispatcher;
if ($action == 'lock' || $action == 'unlock')
{
@ -306,7 +306,6 @@ function lock_unlock($action, $ids)
'action' => $action,
'redirect' => $redirect)
);
$success_msg = '';
if (confirm_box(true))
{
@ -367,7 +366,7 @@ function lock_unlock($action, $ids)
*/
function change_topic_type($action, $topic_ids)
{
global $auth, $user, $db, $phpEx, $phpbb_root_path, $request, $phpbb_log;
global $user, $db, $request, $phpbb_log;
switch ($action)
{
@ -412,7 +411,6 @@ function change_topic_type($action, $topic_ids)
'action' => $action,
'redirect' => $redirect,
);
$success_msg = '';
if (confirm_box(true))
{

View File

@ -195,7 +195,7 @@ class mcp_queue
));
}
$extensions = $attachments = $topic_tracking_info = array();
$attachments = $topic_tracking_info = array();
// Get topic tracking info
if ($config['load_db_lastread'])
@ -217,8 +217,6 @@ class mcp_queue
if ($post_info['post_attachment'] && $auth->acl_get('u_download') && $auth->acl_get('f_download', $post_info['forum_id']))
{
$extensions = $cache->obtain_attach_extensions($post_info['forum_id']);
$sql = 'SELECT *
FROM ' . ATTACHMENTS_TABLE . '
WHERE post_msg_id = ' . $post_id . '
@ -417,7 +415,6 @@ class mcp_queue
$sort_by_sql = $sort_order_sql = array();
phpbb_mcp_sorting($mode, $sort_days, $sort_key, $sort_dir, $sort_by_sql, $sort_order_sql, $total, $forum_id, $topic_id);
$forum_topics = ($total == -1) ? $forum_info['forum_topics_approved'] : $total;
$limit_time_sql = ($sort_days) ? 'AND t.topic_last_post_time >= ' . (time() - ($sort_days * 86400)) : '';
$forum_names = array();

View File

@ -182,7 +182,7 @@ class mcp_reports
));
}
$topic_tracking_info = $extensions = $attachments = array();
$attachments = array();
// Get topic tracking info
if ($config['load_db_lastread'])
{
@ -351,8 +351,6 @@ class mcp_reports
trigger_error('NOT_MODERATOR');
}
$global_id = $forum_list[0];
$sql = 'SELECT SUM(forum_topics_approved) as sum_forum_topics
FROM ' . FORUMS_TABLE . '
WHERE ' . $db->sql_in_set('forum_id', $forum_list);
@ -391,7 +389,6 @@ class mcp_reports
$sort_by_sql = $sort_order_sql = array();
phpbb_mcp_sorting($mode, $sort_days, $sort_key, $sort_dir, $sort_by_sql, $sort_order_sql, $total, $forum_id, $topic_id);
$forum_topics = ($total == -1) ? $forum_info['forum_topics_approved'] : $total;
$limit_time_sql = ($sort_days) ? 'AND r.report_time >= ' . (time() - ($sort_days * 86400)) : '';
if ($mode == 'reports')

View File

@ -171,11 +171,9 @@ function mcp_topic_view($id, $mode, $action)
$has_unapproved_posts = $has_deleted_posts = false;
// Grab extensions
$extensions = $attachments = array();
$attachments = array();
if ($topic_info['topic_attachment'] && sizeof($post_id_list))
{
$extensions = $cache->obtain_attach_extensions($topic_info['forum_id']);
// Get attachments...
if ($auth->acl_get('u_download') && $auth->acl_get('f_download', $topic_info['forum_id']))
{
@ -269,8 +267,6 @@ function mcp_topic_view($id, $mode, $action)
'U_MCP_REPORT' => ($auth->acl_get('m_report', $topic_info['forum_id'])) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=reports&mode=report_details&f=' . $topic_info['forum_id'] . '&p=' . $row['post_id']) : '',
);
$current_row_number = $i;
/**
* Event to modify the template data block for topic reviews in the MCP
*

View File

@ -190,7 +190,7 @@ class mcp_warn
function mcp_warn_post_view($action)
{
global $phpEx, $phpbb_root_path, $config, $request;
global $template, $db, $user, $auth, $phpbb_dispatcher;
global $template, $db, $user, $phpbb_dispatcher;
$post_id = $request->variable('p', 0);
$forum_id = $request->variable('f', 0);
@ -369,8 +369,8 @@ class mcp_warn
*/
function mcp_warn_user_view($action)
{
global $phpEx, $phpbb_root_path, $config, $module, $request;
global $template, $db, $user, $auth, $phpbb_dispatcher;
global $phpEx, $phpbb_root_path, $config, $request;
global $template, $db, $user, $phpbb_dispatcher;
$user_id = $request->variable('u', 0);
$username = $request->variable('username', '', true);

View File

@ -257,7 +257,7 @@ class phpbb_questionnaire_phpbb_data_provider
*/
function get_data()
{
global $phpbb_root_path, $phpEx, $phpbb_config_php_file;
global $phpbb_config_php_file;
extract($phpbb_config_php_file->get_all());
unset($dbhost, $dbport, $dbname, $dbuser, $dbpasswd); // Just a precaution

View File

@ -182,7 +182,7 @@ class ucp_login_link
*/
protected function process_login_result($result)
{
global $config, $request, $template, $user, $phpbb_container;
global $config, $template, $user, $phpbb_container;
$login_error = null;

View File

@ -221,7 +221,6 @@ class ucp_main
{
$forums = array_keys($request->variable('f', array(0 => 0)));
$topics = array_keys($request->variable('t', array(0 => 0)));
$msg = '';
if (sizeof($forums) || sizeof($topics))
{

View File

@ -50,9 +50,6 @@ function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row)
trigger_error('NO_AUTH_READ_HOLD_MESSAGE');
}
// Grab icons
$cache->obtain_icons();
// Load the custom profile fields
if ($config['load_cpf_pm'])
{
@ -357,7 +354,7 @@ function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row)
*/
function get_user_information($user_id, $user_row)
{
global $db, $auth, $user, $cache;
global $db, $auth, $user;
global $phpbb_root_path, $phpEx, $config;
if (!$user_id)

View File

@ -429,7 +429,6 @@ class ucp_profile
$selected = ($i == $data['bday_month']) ? ' selected="selected"' : '';
$s_birthday_month_options .= "<option value=\"$i\"$selected>$i</option>";
}
$s_birthday_year_options = '';
$now = getdate();
$s_birthday_year_options = '<option value="0"' . ((!$data['bday_year']) ? ' selected="selected"' : '') . '>--</option>';

View File

@ -179,7 +179,6 @@ function phpbb_insert_forums()
$db->sql_query($sql);
$cats_added[$unknown_cat_id] = $max_forum_id;
$max_forum_id++;
}
// Now insert the forums
@ -422,8 +421,6 @@ function phpbb_set_encoding($text, $grab_user_lang = true)
}
}
$encoding = $lang_enc_array[$get_lang];
return utf8_recode($text, $lang_enc_array[$get_lang]);
}

View File

@ -191,7 +191,7 @@ abstract class captcha_abstract
function validate()
{
global $config, $db, $user;
global $user;
if (!$user->is_setup())
{

View File

@ -192,8 +192,6 @@ class oracle_extractor extends base_extractor
$ary_name[$i] = ocicolumnname($result, $i + 1);
}
$sql_data = '';
while ($row = $this->db->sql_fetchrow($result))
{
$schema_vals = $schema_fields = array();

View File

@ -420,7 +420,7 @@ class log implements \phpbb\log\log_interface
$this->entry_count = 0;
$this->last_page_offset = $offset;
$post_id_list = $topic_id_list = $reportee_id_list = array();
$topic_id_list = $reportee_id_list = array();
$profile_url = ($this->get_is_admin() && $this->phpbb_admin_path) ? append_sid("{$this->phpbb_admin_path}index.{$this->php_ext}", 'i=users&amp;mode=overview') : append_sid("{$this->phpbb_root_path}memberlist.{$this->php_ext}", 'mode=viewprofile');

View File

@ -352,9 +352,6 @@ class fulltext_native extends \phpbb\search\base
$this->must_not_contain_ids = array();
$this->must_exclude_one_ids = array();
$mode = '';
$ignore_no_id = true;
foreach ($query as $word)
{
if (empty($word))

View File

@ -404,7 +404,7 @@ class fulltext_sphinx
$variable = $section->get_variable_by_name($key);
if (!$variable)
{
$variable = $section->create_variable($key, $value);
$section->create_variable($key, $value);
}
else
{
@ -413,7 +413,7 @@ class fulltext_sphinx
}
else
{
$variable = $section->create_variable($key, $value);
$section->create_variable($key, $value);
}
}
}
@ -437,7 +437,6 @@ class fulltext_sphinx
$match = array('#\sand\s#i', '#\sor\s#i', '#\snot\s#i', '#\+#', '#-#', '#\|#', '#@#');
$replace = array(' & ', ' | ', ' - ', ' +', ' -', ' |', '');
$replacements = 0;
$keywords = preg_replace($match, $replace, $keywords);
$this->sphinx->SetMatchMode(SPH_MATCH_EXTENDED);
}

View File

@ -232,7 +232,6 @@ class renderer implements \phpbb\textformatter\renderer_interface
{
$xml = $this->quote_helper->inject_metadata($xml);
}
$renderer = $this;
/**
* Modify a parsed text before it is rendered

View File

@ -391,7 +391,6 @@ abstract class nestedset implements \phpbb\tree\tree_interface
throw new \OutOfBoundsException($this->message_prefix . 'INVALID_PARENT');
}
$diff = sizeof($move_items) * 2;
$sql_exclude_moved_items = $this->db->sql_in_set($this->column_item_id, $move_items, true);
$this->db->sql_transaction('begin');

View File

@ -281,7 +281,7 @@ class user extends \phpbb\session
// User has wrong style
if (!$this->style && $style_id == $this->data['user_style'])
{
$style_id = $this->data['user_style'] = $config['default_style'];
$this->data['user_style'] = $config['default_style'];
$sql = 'UPDATE ' . USERS_TABLE . "
SET user_style = $style_id