[ticket/13454] Remove unused variables

Part 4

PHPBB3-13454
This commit is contained in:
Marc Alexander 2015-12-04 11:50:39 +01:00
parent 6c25ad4822
commit 266576c6a4
35 changed files with 41 additions and 78 deletions

View file

@ -709,8 +709,6 @@ class acp_attachments
$forum_ids = array();
}
$extensions = array();
$sql = 'SELECT *
FROM ' . EXTENSIONS_TABLE . "
WHERE group_id = $group_id

View file

@ -759,7 +759,7 @@ class acp_board
*/
function select_auth_method($selected_method, $key = '')
{
global $phpbb_root_path, $phpEx, $phpbb_container;
global $phpbb_container;
/* @var $auth_providers \phpbb\auth\provider_collection */
$auth_providers = $phpbb_container->get('auth.provider_collection');

View file

@ -579,7 +579,7 @@ 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)
{
global $db, $user, $auth, $config;
global $db, $user;
$sql = 'SELECT module_id, module_enabled, module_basename, parent_id, module_langname, left_id, right_id, module_auth
FROM ' . MODULES_TABLE . "

View file

@ -690,7 +690,7 @@ class acp_permissions
trigger_error($user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action), E_USER_WARNING);
}
$ug_id = $forum_id = 0;
$forum_id = 0;
// We loop through the auth settings defined in our submit
list($ug_id, ) = each($psubmit);

View file

@ -549,11 +549,7 @@ class acp_profile
}
}
if (sizeof($error))
{
$submit = false;
}
else
if (!sizeof($error))
{
$step = (isset($_REQUEST['next'])) ? $step + 1 : ((isset($_REQUEST['prev'])) ? $step - 1 : $step);
}
@ -775,7 +771,7 @@ class acp_profile
*/
function build_language_options(&$cp, $field_type, $action = 'create')
{
global $user, $config, $db, $phpbb_container, $request;
global $user, $config, $db, $request;
$default_lang_id = (!empty($this->edit_lang_id)) ? $this->edit_lang_id : $this->lang_defs['iso'][$config['default_lang']];

View file

@ -551,7 +551,7 @@ class acp_search
function get_search_types()
{
global $phpbb_root_path, $phpEx, $phpbb_extension_manager;
global $phpbb_extension_manager;
$finder = $phpbb_extension_manager->get_finder();

View file

@ -607,7 +607,7 @@ class auth_admin extends \phpbb\auth\auth
*/
function display_role_mask(&$hold_ary)
{
global $db, $template, $user, $phpbb_root_path, $phpbb_admin_path, $phpEx;
global $db, $template, $user, $phpbb_root_path, $phpEx;
global $phpbb_container;
if (!sizeof($hold_ary))

View file

@ -720,7 +720,6 @@ class diff_renderer_side_by_side extends diff_renderer
if (!empty($current_context))
{
$line = $current_context;
$current_context = '';
$output .= '<tr class="unmodified"><td><pre>' . ((strlen($line)) ? $line : '&nbsp;') . '<br /></pre></td>';
$output .= '<td><pre>' . ((strlen($line)) ? $line : '&nbsp;') . '<br /></pre></td></tr>';

View file

@ -650,8 +650,6 @@ function validate_range($value_ary, &$error)
foreach ($value_ary as $value)
{
$column = explode(':', $value['column_type']);
$max = $min = 0;
$type = 0;
if (!isset($column_types[$column[0]]))
{
continue;

View file

@ -651,7 +651,7 @@ function generate_text_for_storage(&$text, &$uid, &$bitfield, &$flags, $allow_bb
*/
function generate_text_for_edit($text, $uid, $flags)
{
global $phpbb_root_path, $phpEx, $phpbb_dispatcher;
global $phpbb_dispatcher;
/**
* Use this event to modify the text before it is decoded for editing
@ -763,8 +763,6 @@ function make_clickable_callback($type, $whitespace, $url, $relative_url, $class
// set last_char to empty here, so the variable can be used later to
// check whether a character was removed
default:
$last_char = '';
break;
}
$short_url = (utf8_strlen($url) > 55) ? utf8_substr($url, 0, 39) . ' ... ' . utf8_substr($url, -10) : $url;

View file

@ -492,7 +492,7 @@ function import_avatar_gallery($gallery_name = '', $subdirs_as_galleries = false
function import_attachment_files($category_name = '')
{
global $config, $convert, $phpbb_root_path, $db, $user;
global $config, $convert, $db, $user;
$sql = 'SELECT config_value AS upload_path
FROM ' . CONFIG_TABLE . "
@ -590,7 +590,7 @@ function import_attachment($source, $use_target = false)
return '';
}
global $convert, $phpbb_root_path, $config, $user;
global $convert, $config, $user;
// check for trailing slash
if (rtrim($convert->convertor['upload_path'], '/') === '')
@ -632,7 +632,7 @@ function import_rank($source, $use_target = false)
return '';
}
global $convert, $phpbb_root_path, $config, $user;
global $convert, $user;
if (!isset($convert->convertor['ranks_path']))
{
@ -650,7 +650,7 @@ function import_smiley($source, $use_target = false)
return '';
}
global $convert, $phpbb_root_path, $config, $user;
global $convert, $user;
// check for trailing slash
if (rtrim($convert->convertor['smilies_path'], '/') === '')
@ -671,7 +671,7 @@ function import_avatar($source, $use_target = false, $user_id = false)
return;
}
global $convert, $phpbb_root_path, $config, $user;
global $convert, $config, $user;
// check for trailing slash
if (rtrim($convert->convertor['avatar_path'], '/') === '')
@ -684,7 +684,7 @@ function import_avatar($source, $use_target = false, $user_id = false)
$use_target = $config['avatar_salt'] . '_' . $user_id . '.' . substr(strrchr($source, '.'), 1);
}
$result = _import_check('avatar_path', $source, $use_target);
_import_check('avatar_path', $source, $use_target);
return ((!empty($user_id)) ? $user_id : $use_target) . '.' . substr(strrchr($source, '.'), 1);
}
@ -750,7 +750,7 @@ function get_smiley_dim($source, $axis)
return $smiley_cache[$source][$axis];
}
global $convert, $phpbb_root_path, $config, $user;
global $convert, $user;
$orig_source = $source;
@ -858,14 +858,12 @@ function get_upload_avatar_dim($source, $axis)
return $cachedims[$axis];
}
$orig_source = $source;
if (substr($source, 0, 7) == 'upload:')
{
$source = substr($source, 7);
}
global $convert, $phpbb_root_path, $config, $user;
global $convert, $user;
if (!isset($convert->convertor['avatar_path']))
{

View file

@ -731,7 +731,7 @@ function generate_forum_rules(&$forum_data)
return;
}
global $template, $phpbb_root_path, $phpEx;
global $template;
if ($forum_data['forum_rules'])
{
@ -751,7 +751,7 @@ function generate_forum_rules(&$forum_data)
*/
function generate_forum_nav(&$forum_data_ary)
{
global $db, $user, $template, $auth, $config;
global $template, $auth, $config;
global $phpEx, $phpbb_root_path, $phpbb_dispatcher;
if (!$auth->acl_get('f_list', $forum_data_ary['forum_id']))
@ -759,7 +759,7 @@ function generate_forum_nav(&$forum_data_ary)
return;
}
$navlinks = $navlinks_parents = $forum_template_data = array();
$navlinks_parents = $forum_template_data = array();
// Get forum parents
$forum_parents = get_forum_parents($forum_data_ary);

View file

@ -550,7 +550,7 @@ class messenger
*/
function msg_jabber()
{
global $config, $db, $user, $phpbb_root_path, $phpEx;
global $config, $user, $phpbb_root_path, $phpEx;
if (empty($config['jab_enable']) || empty($config['jab_host']) || empty($config['jab_username']) || empty($config['jab_password']))
{
@ -622,7 +622,7 @@ class messenger
*/
protected function setup_template()
{
global $config, $phpbb_path_helper, $user, $phpbb_extension_manager, $phpbb_container, $phpbb_filesystem;
global $phpbb_extension_manager, $phpbb_container, $phpbb_filesystem;
if ($this->template instanceof \phpbb\template\template)
{
@ -714,7 +714,7 @@ class queue
*/
function process()
{
global $db, $config, $phpEx, $phpbb_root_path, $user;
global $config, $phpEx, $phpbb_root_path, $user;
$lock = new \phpbb\lock\flock($this->cache_file);
$lock->acquire();

View file

@ -729,8 +729,6 @@ class p_master
*/
function get_parents($parent_id, $left_id, $right_id, &$all_parents)
{
global $db;
$parents = array();
if ($parent_id > 0)
@ -822,7 +820,7 @@ class p_master
// Make sure the module_url has a question mark set, effectively determining the delimiter to use
$delim = (strpos($module_url, '?') === false) ? '?' : '&amp;';
$current_padding = $current_depth = 0;
$current_depth = 0;
$linear_offset = 'l_block1';
$tabular_offset = 't_block2';

View file

@ -833,7 +833,7 @@ function load_drafts($topic_id = 0, $forum_id = 0, $id = 0, $pm_action = '', $ms
foreach ($draft_rows as $draft)
{
$link_topic = $link_forum = $link_pm = false;
$insert_url = $view_url = $title = '';
$view_url = $title = '';
if (isset($topic_rows[$draft['topic_id']])
&& (

View file

@ -544,7 +544,7 @@ function place_pm_into_folder(&$global_privmsgs_rules, $release = false)
}
// We place actions into arrays, to save queries.
$sql = $unread_ids = $delete_ids = $important_ids = array();
$unread_ids = $delete_ids = $important_ids = array();
foreach ($action_ary as $msg_id => $msg_ary)
{

View file

@ -727,7 +727,7 @@ function mcp_move_topic($topic_ids)
*/
function mcp_restore_topic($topic_ids)
{
global $auth, $user, $db, $phpEx, $phpbb_root_path, $request, $phpbb_container, $phpbb_log;
global $user, $phpEx, $phpbb_root_path, $request, $phpbb_container, $phpbb_log;
if (!phpbb_check_ids($topic_ids, TOPICS_TABLE, 'topic_id', array('m_approve')))
{

View file

@ -618,7 +618,7 @@ class mcp_queue
*/
static public function approve_posts($action, $post_id_list, $id, $mode)
{
global $db, $template, $user, $config, $request, $phpbb_container, $phpbb_dispatcher;
global $template, $user, $request, $phpbb_container, $phpbb_dispatcher;
global $phpEx, $phpbb_root_path, $phpbb_log;
if (!phpbb_check_ids($post_id_list, POSTS_TABLE, 'post_id', array('m_approve')))
@ -628,7 +628,7 @@ class mcp_queue
$redirect = $request->variable('redirect', build_url(array('quickmod')));
$redirect = reapply_sid($redirect);
$success_msg = $post_url = '';
$post_url = '';
$approve_log = array();
$num_topics = 0;

View file

@ -519,7 +519,7 @@ class mcp_reports
*/
function close_report($report_id_list, $mode, $action, $pm = false)
{
global $db, $template, $user, $config, $auth, $phpbb_log, $request;
global $db, $user, $auth, $phpbb_log, $request;
global $phpEx, $phpbb_root_path, $phpbb_container;
$pm_where = ($pm) ? ' AND r.post_id = 0 ' : ' AND r.pm_id = 0 ';

View file

@ -637,7 +637,7 @@ function split_topic($action, $topic_id, $to_forum_id, $subject)
*/
function merge_posts($topic_id, $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 (!$to_topic_id)
{
@ -689,7 +689,7 @@ function merge_posts($topic_id, $to_topic_id)
'redirect' => $redirect,
't' => $topic_id)
);
$success_msg = $return_link = '';
$return_link = '';
if (confirm_box(true))
{

View file

@ -523,7 +523,7 @@ class mcp_warn
function add_warning($user_row, $warning, $send_pm = true, $post_id = 0)
{
global $phpEx, $phpbb_root_path, $config, $phpbb_log;
global $template, $db, $user, $auth;
global $db, $user;
if ($send_pm)
{

View file

@ -798,8 +798,6 @@ class bbcode_firstpass extends bbcode
*/
function bbcode_quote($in)
{
global $config, $user;
$in = str_replace("\r\n", "\n", str_replace('\"', '"', trim($in)));
if (!$in)

View file

@ -530,7 +530,6 @@ class ucp_groups
{
// Handle avatar
$driver_name = $phpbb_avatar_manager->clean_driver_name($request->variable('avatar_driver', ''));
$config_name = preg_replace('#^avatar\.driver.#', '', $driver_name);
if (in_array($driver_name, $avatar_drivers) && !$request->is_set_post('avatar_delete'))
{
@ -619,7 +618,6 @@ class ucp_groups
}
else if (!$group_id)
{
$group_name = $request->variable('group_name', '', true);
$group_desc_data = array(
'text' => '',
'allow_bbcode' => true,

View file

@ -598,7 +598,7 @@ function compose_pm($id, $mode, $action, $user_folders = array())
$enable_urls = true;
}
$enable_magic_url = $drafts = false;
$drafts = false;
// User own some drafts?
if ($auth->acl_get('u_savedrafts') && $action != 'delete')
@ -739,16 +739,6 @@ function compose_pm($id, $mode, $action, $user_folders = array())
$enable_urls = (isset($_POST['disable_magic_url'])) ? 0 : 1;
$enable_sig = (!$config['allow_sig'] ||!$config['allow_sig_pm']) ? false : ((isset($_POST['attach_sig'])) ? true : false);
if ($submit)
{
$status_switch = (($enable_bbcode+1) << 8) + (($enable_smilies+1) << 4) + (($enable_urls+1) << 2) + (($enable_sig+1) << 1);
$status_switch = ($status_switch != $check_value);
}
else
{
$status_switch = 1;
}
// Parse Attachments - before checksum is calculated
$message_parser->parse_attachments('fileupload', $action, 0, $submit, $preview, $refresh, true);

View file

@ -610,7 +610,7 @@ function define_check_option($hardcoded, $check_option, $check_lang)
*/
function define_action_option($hardcoded, $action_option, $action_lang, $folder)
{
global $db, $template, $user;
global $template;
$l_action = $s_action_options = '';
if ($hardcoded)
@ -721,7 +721,6 @@ function define_cond_option($hardcoded, $cond_option, $rule_option, $global_rule
// Define Condition
$condition = $global_rule_conditions[$rule_option];
$current_value = '';
switch ($condition)
{

View file

@ -506,7 +506,9 @@ class ucp_register
break;
}
$timezone_selects = phpbb_timezone_select($template, $user, $data['tz'], true);
// Assign template vars for timezone select
phpbb_timezone_select($template, $user, $data['tz'], true);
$template->assign_vars(array(
'ERROR' => (sizeof($error)) ? implode('<br />', $error) : '',
'USERNAME' => $data['username'],

View file

@ -561,7 +561,7 @@ function phpbb_copy_table_fields()
*/
function phpbb_convert_authentication($mode)
{
global $db, $src_db, $same_db, $convert, $user, $config, $cache;
global $db, $src_db, $same_db, $convert, $config;
if ($mode == 'start')
{

View file

@ -628,7 +628,6 @@ function utf8_new_case_fold_nfkc($text, $option = 'full')
"\xF0\x9D\x9E\xBB" => "\xCF\x83",
"\xF0\x9D\x9F\x8A" => "\xCF\x9D",
);
global $phpbb_root_path, $phpEx;
// do the case fold
$text = utf8_new_case_fold($text, $option);

View file

@ -535,7 +535,7 @@ class migrator
}
// Reverse the step that was run
$result = $this->run_step($reverse_step, false, !$revert);
$this->run_step($reverse_step, false, !$revert);
}
// rethrow the exception

View file

@ -594,7 +594,6 @@ class fulltext_native extends \phpbb\search\base
$id_ary = array();
$sql_where = array();
$group_by = false;
$m_num = 0;
$w_num = 0;

View file

@ -501,7 +501,6 @@ class fulltext_postgres extends \phpbb\search\base
$sql_select = ($type == 'posts') ? 'p.post_id' : 'DISTINCT t.topic_id';
$sql_from = ($join_topic) ? TOPICS_TABLE . ' t, ' : '';
$field = ($type == 'posts') ? 'post_id' : 'topic_id';
$sql_author = (sizeof($author_ary) == 1) ? ' = ' . $author_ary[0] : 'IN (' . implode(', ', $author_ary) . ')';
if (sizeof($author_ary) && $author_name)
{
@ -526,7 +525,6 @@ class fulltext_postgres extends \phpbb\search\base
$sql_where_options .= ($sort_days) ? ' AND p.post_time >= ' . (time() - ($sort_days * 86400)) : '';
$sql_where_options .= $sql_match_where;
$tmp_sql_match = array();
$sql_match = str_replace(',', " || ' ' ||", $sql_match);
$tmp_sql_match = "to_tsvector ('" . $this->db->sql_escape($this->config['fulltext_postgres_ts_name']) . "', " . $sql_match . ") @@ to_tsquery ('" . $this->db->sql_escape($this->config['fulltext_postgres_ts_name']) . "', '" . $this->db->sql_escape($this->tsearch_query) . "')";
@ -838,7 +836,7 @@ class fulltext_postgres extends \phpbb\search\base
GROUP BY t.topic_id, $sort_by_sql[$sort_key]";
}
$result = $this->db->sql_query($sql_count);
$this->db->sql_query($sql_count);
$result_count = (int) $this->db->sql_fetchfield('result_count');
if (!$result_count)

View file

@ -489,8 +489,6 @@ class fulltext_sphinx
$id_ary = array();
$join_topic = ($type != 'posts');
// Sorting
if ($type == 'topics')

View file

@ -494,7 +494,7 @@ class session
*/
function session_create($user_id = false, $set_admin = false, $persist_login = false, $viewonline = true)
{
global $SID, $_SID, $db, $config, $cache, $phpbb_root_path, $phpEx, $phpbb_container, $phpbb_dispatcher;
global $SID, $_SID, $db, $config, $cache, $phpbb_container, $phpbb_dispatcher;
$this->data = array();

View file

@ -489,7 +489,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

@ -747,8 +747,6 @@ class user extends \phpbb\session
*/
function leave_newly_registered()
{
global $db;
if (empty($this->data['user_new']))
{
return false;