mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-30 21:40:43 +02:00
Merge pull request #4058 from marc1706/ticket/13454
[ticket/13454] Remove unused variables, globals, and parameters * marc1706/ticket/13454: [ticket/13454] Add excessively removed code back [ticket/13454] Remove more unused variables [ticket/13454] Remove double semi-colons [ticket/13454] Remove unused variables [ticket/13454] Fix code sniffer complaints [ticket/13454] Fix a few issues introduced by overdeleting stuff [ticket/13454] Remove unused variables [ticket/13454] Remove unused variables [ticket/13454] Remove unused variables [ticket/13454] Remove unused variables
This commit is contained in:
@@ -97,13 +97,12 @@ class gd
|
||||
|
||||
if ($config['captcha_gd_3d_noise'])
|
||||
{
|
||||
$xoffset = mt_rand(0,9);
|
||||
$noise_bitmaps = $this->captcha_noise_bg_bitmaps();
|
||||
for ($i = 0; $i < $code_len; ++$i)
|
||||
{
|
||||
$noise[$i] = new char_cube3d($noise_bitmaps, mt_rand(1, sizeof($noise_bitmaps['data'])));
|
||||
|
||||
list($min, $max) = $noise[$i]->range();
|
||||
$noise[$i]->range();
|
||||
//$box = $noise[$i]->dimensions($sizes[$i]);
|
||||
}
|
||||
$xoffset = 0;
|
||||
@@ -151,8 +150,6 @@ class gd
|
||||
*/
|
||||
function wave($img)
|
||||
{
|
||||
global $config;
|
||||
|
||||
$period_x = mt_rand(12,18);
|
||||
$period_y = mt_rand(7,14);
|
||||
$amp_x = mt_rand(5,10);
|
||||
|
@@ -23,8 +23,6 @@ class gd_wave
|
||||
|
||||
function execute($code, $seed)
|
||||
{
|
||||
global $starttime;
|
||||
|
||||
// seed the random generator
|
||||
mt_srand($seed);
|
||||
|
||||
@@ -77,7 +75,6 @@ class gd_wave
|
||||
// TODO
|
||||
$background = imagecolorallocate($img, mt_rand(155, 255), mt_rand(155, 255), mt_rand(155, 255));
|
||||
imagefill($img, 0, 0, $background);
|
||||
$black = imagecolorallocate($img, 0, 0, 0);
|
||||
|
||||
$random = array();
|
||||
$fontcolors = array();
|
||||
@@ -155,7 +152,7 @@ class gd_wave
|
||||
// rather than recalculating from absolute coordinates
|
||||
// What we cache into the $img_buffer contains the raised text coordinates.
|
||||
$img_pos_prev = $img_buffer[0][0] = array($box['upper_left']['x'], $box['upper_left']['y']);
|
||||
$cur_height = $prev_height = $this->wave_height(0, 0, $subdivision_factor);
|
||||
$prev_height = $this->wave_height(0, 0, $subdivision_factor);
|
||||
$full_x = $plane_x * $subdivision_factor;
|
||||
$full_y = $plane_y * $subdivision_factor;
|
||||
|
||||
|
@@ -34,7 +34,7 @@ abstract class captcha_abstract
|
||||
|
||||
function init($type)
|
||||
{
|
||||
global $config, $db, $user, $request;
|
||||
global $config, $request;
|
||||
|
||||
// read input
|
||||
$this->confirm_id = $request->variable('confirm_id', '');
|
||||
@@ -56,8 +56,6 @@ abstract class captcha_abstract
|
||||
|
||||
function execute_demo()
|
||||
{
|
||||
global $user;
|
||||
|
||||
$this->code = gen_rand_string_friendly(mt_rand(CAPTCHA_MIN_CHARS, CAPTCHA_MAX_CHARS));
|
||||
$this->seed = hexdec(substr(unique_id(), 4, 10));
|
||||
|
||||
@@ -117,7 +115,7 @@ abstract class captcha_abstract
|
||||
|
||||
function get_demo_template($id)
|
||||
{
|
||||
global $config, $user, $template, $request, $phpbb_admin_path, $phpEx;
|
||||
global $config, $template, $request, $phpbb_admin_path, $phpEx;
|
||||
|
||||
$variables = '';
|
||||
|
||||
@@ -153,7 +151,7 @@ abstract class captcha_abstract
|
||||
|
||||
function garbage_collect($type)
|
||||
{
|
||||
global $db, $config;
|
||||
global $db;
|
||||
|
||||
$sql = 'SELECT DISTINCT c.session_id
|
||||
FROM ' . CONFIRM_TABLE . ' c
|
||||
@@ -193,7 +191,7 @@ abstract class captcha_abstract
|
||||
|
||||
function validate()
|
||||
{
|
||||
global $config, $db, $user;
|
||||
global $user;
|
||||
|
||||
if (!$user->is_setup())
|
||||
{
|
||||
|
@@ -53,18 +53,11 @@ class gd extends captcha_abstract
|
||||
|
||||
function acp_page($id, &$module)
|
||||
{
|
||||
global $db, $user, $auth, $template, $phpbb_log, $request;
|
||||
global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx;
|
||||
global $user, $template, $phpbb_log, $request;
|
||||
global $config;
|
||||
|
||||
$user->add_lang('acp/board');
|
||||
|
||||
$config_vars = array(
|
||||
'enable_confirm' => 'REG_ENABLE',
|
||||
'enable_post_confirm' => 'POST_ENABLE',
|
||||
'confirm_refresh' => 'CONFIRM_REFRESH',
|
||||
'captcha_gd' => 'CAPTCHA_GD',
|
||||
);
|
||||
|
||||
$module->tpl_name = 'captcha_gd_acp';
|
||||
$module->page_title = 'ACP_VC_SETTINGS';
|
||||
$form_key = 'acp_captcha';
|
||||
|
@@ -35,7 +35,7 @@ class gd_wave extends captcha_abstract
|
||||
|
||||
function acp_page($id, &$module)
|
||||
{
|
||||
global $config, $db, $template, $user;
|
||||
global $user;
|
||||
|
||||
trigger_error($user->lang['CAPTCHA_NO_OPTIONS'] . adm_back_link($module->u_action));
|
||||
}
|
||||
|
@@ -1012,7 +1012,7 @@ abstract class driver implements driver_interface
|
||||
*/
|
||||
function sql_report($mode, $query = '')
|
||||
{
|
||||
global $cache, $starttime, $phpbb_root_path, $phpbb_path_helper, $user;
|
||||
global $cache, $starttime, $phpbb_root_path, $phpbb_path_helper;
|
||||
global $request;
|
||||
|
||||
if (is_object($request) && !$request->variable('explain', false))
|
||||
|
@@ -84,8 +84,6 @@ class oracle extends \phpbb\db\driver\driver
|
||||
* but I assume its because the Oracle extension provides a direct method to access it
|
||||
* without a query.
|
||||
*/
|
||||
|
||||
$use_cache = false;
|
||||
/*
|
||||
global $cache;
|
||||
|
||||
|
@@ -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();
|
||||
|
@@ -118,7 +118,7 @@ class release_3_0_5_rc1 extends container_aware_migration
|
||||
$result = $this->db->sql_query($sql);
|
||||
|
||||
// Skip first row, this is our original auth option we want to preserve
|
||||
$row = $this->db->sql_fetchrow($result);
|
||||
$this->db->sql_fetchrow($result);
|
||||
|
||||
while ($row = $this->db->sql_fetchrow($result))
|
||||
{
|
||||
|
@@ -45,7 +45,6 @@ class update_custom_bbcodes_with_idn extends \phpbb\db\migration\migration
|
||||
$sql_ary = array();
|
||||
while ($row = $this->db->sql_fetchrow($result))
|
||||
{
|
||||
$data = array();
|
||||
if (preg_match('/(URL|LOCAL_URL|RELATIVE_URL)/', $row['bbcode_match']))
|
||||
{
|
||||
$data = $bbcodes->build_regexp($row['bbcode_match'], $row['bbcode_tpl']);
|
||||
|
@@ -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
|
||||
|
@@ -1116,7 +1116,7 @@ class tools implements tools_interface
|
||||
}
|
||||
|
||||
// Get type
|
||||
list($column_type, $orig_column_type) = $this->get_column_type($column_data[0]);
|
||||
list($column_type) = $this->get_column_type($column_data[0]);
|
||||
|
||||
// Adjust default value if db-dependent specified
|
||||
if (is_array($column_data[1]))
|
||||
|
@@ -97,7 +97,6 @@ class remote extends base
|
||||
|
||||
$url['path'] = implode('', $url['path']);
|
||||
$upload_ary['name'] = utf8_basename($url['path']) . (($ext) ? '.' . $ext : '');
|
||||
$filename = $url['path'];
|
||||
$filesize = 0;
|
||||
|
||||
$remote_max_filesize = $this->get_max_file_size();
|
||||
|
@@ -117,7 +117,7 @@ class validate extends \phpbb\console\command\command
|
||||
|
||||
try
|
||||
{
|
||||
$config = $processor->processConfiguration($configuration, $config);
|
||||
$processor->processConfiguration($configuration, $config);
|
||||
}
|
||||
catch (Exception $e)
|
||||
{
|
||||
|
@@ -19,7 +19,6 @@ use phpbb\install\helper\navigation\navigation_provider;
|
||||
use Symfony\Component\HttpFoundation\StreamedResponse;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use phpbb\install\helper\iohandler\factory;
|
||||
use phpbb\install\controller\helper;
|
||||
use phpbb\template\template;
|
||||
use phpbb\request\request_interface;
|
||||
use phpbb\install\installer;
|
||||
|
@@ -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&mode=overview') : append_sid("{$this->phpbb_root_path}memberlist.{$this->php_ext}", 'mode=viewprofile');
|
||||
|
||||
|
@@ -66,7 +66,7 @@ class report_handler_post extends report_handler
|
||||
'reported_post_enable_magic_url' => $this->report_data['enable_magic_url'],
|
||||
);
|
||||
|
||||
$report_id = $this->create_report($report_data);
|
||||
$this->create_report($report_data);
|
||||
|
||||
$sql = 'UPDATE ' . POSTS_TABLE . '
|
||||
SET post_reported = 1
|
||||
|
@@ -172,7 +172,6 @@ class type_cast_helper implements \phpbb\request\type_cast_helper_interface
|
||||
}
|
||||
|
||||
list($default_key, $default_value) = each($default);
|
||||
$value_type = gettype($default_value);
|
||||
$key_type = gettype($default_key);
|
||||
|
||||
$_var = $var;
|
||||
|
@@ -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))
|
||||
@@ -597,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;
|
||||
|
||||
@@ -1328,7 +1324,6 @@ class fulltext_native extends \phpbb\search\base
|
||||
$match[] = '#\[\/?[a-z0-9\*\+\-]+(?:=.*?)?(?::[a-z])?(\:?[0-9a-z]{5,})\]#';
|
||||
|
||||
$min = $this->word_length['min'];
|
||||
$max = $this->word_length['max'];
|
||||
|
||||
$isset_min = $min - 1;
|
||||
|
||||
@@ -1737,7 +1732,7 @@ class fulltext_native extends \phpbb\search\base
|
||||
protected function cleanup($text, $allowed_chars = null, $encoding = 'utf-8')
|
||||
{
|
||||
static $conv = array(), $conv_loaded = array();
|
||||
$words = $allow = array();
|
||||
$allow = array();
|
||||
|
||||
// Convert the text to UTF-8
|
||||
$encoding = strtolower($encoding);
|
||||
|
@@ -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)
|
||||
|
@@ -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);
|
||||
}
|
||||
@@ -490,8 +489,6 @@ class fulltext_sphinx
|
||||
|
||||
$id_ary = array();
|
||||
|
||||
$join_topic = ($type != 'posts');
|
||||
|
||||
// Sorting
|
||||
|
||||
if ($type == 'topics')
|
||||
|
@@ -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();
|
||||
|
||||
@@ -883,7 +883,7 @@ class session
|
||||
*/
|
||||
function session_kill($new_session = true)
|
||||
{
|
||||
global $SID, $_SID, $db, $config, $phpbb_root_path, $phpEx, $phpbb_container, $phpbb_dispatcher;
|
||||
global $SID, $_SID, $db, $phpbb_container, $phpbb_dispatcher;
|
||||
|
||||
$sql = 'DELETE FROM ' . SESSIONS_TABLE . "
|
||||
WHERE session_id = '" . $db->sql_escape($this->session_id) . "'
|
||||
@@ -975,7 +975,7 @@ class session
|
||||
*/
|
||||
function session_gc()
|
||||
{
|
||||
global $db, $config, $phpbb_root_path, $phpEx, $phpbb_container, $phpbb_dispatcher;
|
||||
global $db, $config, $phpbb_container, $phpbb_dispatcher;
|
||||
|
||||
$batch_size = 10;
|
||||
|
||||
@@ -1226,7 +1226,7 @@ class session
|
||||
|
||||
if ($banned && !$return)
|
||||
{
|
||||
global $template, $phpbb_root_path, $phpEx;
|
||||
global $phpbb_root_path, $phpEx;
|
||||
|
||||
// If the session is empty we need to create a valid one...
|
||||
if (empty($this->session_id))
|
||||
@@ -1403,7 +1403,7 @@ class session
|
||||
*/
|
||||
function set_login_key($user_id = false, $key = false, $user_ip = false)
|
||||
{
|
||||
global $config, $db;
|
||||
global $db;
|
||||
|
||||
$user_id = ($user_id === false) ? $this->data['user_id'] : $user_id;
|
||||
$user_ip = ($user_ip === false) ? $this->ip : $user_ip;
|
||||
@@ -1413,7 +1413,7 @@ class session
|
||||
|
||||
$sql_ary = array(
|
||||
'key_id' => (string) md5($key_id),
|
||||
'last_ip' => (string) $this->ip,
|
||||
'last_ip' => (string) $user_ip,
|
||||
'last_login' => (int) time()
|
||||
);
|
||||
|
||||
@@ -1450,7 +1450,7 @@ class session
|
||||
*/
|
||||
function reset_login_keys($user_id = false)
|
||||
{
|
||||
global $config, $db;
|
||||
global $db;
|
||||
|
||||
$user_id = ($user_id === false) ? (int) $this->data['user_id'] : (int) $user_id;
|
||||
|
||||
|
@@ -28,8 +28,6 @@ class includejs extends \phpbb\template\twig\node\includeasset
|
||||
*/
|
||||
protected function append_asset(\Twig_Compiler $compiler)
|
||||
{
|
||||
$config = $this->environment->get_phpbb_config();
|
||||
|
||||
$compiler
|
||||
->raw("<script type=\"text/javascript\" src=\"' . ")
|
||||
->raw("\$asset_file")
|
||||
|
@@ -50,6 +50,7 @@ class parser implements \phpbb\textformatter\parser_interface
|
||||
|
||||
$this->dispatcher = $dispatcher;
|
||||
$this->parser = $parser;
|
||||
|
||||
$parser = $this;
|
||||
|
||||
/**
|
||||
@@ -195,7 +196,7 @@ class parser implements \phpbb\textformatter\parser_interface
|
||||
$errors = array();
|
||||
foreach ($this->parser->getLogger()->get() as $entry)
|
||||
{
|
||||
list($type, $msg, $context) = $entry;
|
||||
list(, $msg, $context) = $entry;
|
||||
|
||||
if ($msg === 'Tag limit exceeded')
|
||||
{
|
||||
|
@@ -233,6 +233,7 @@ class renderer implements \phpbb\textformatter\renderer_interface
|
||||
{
|
||||
$xml = $this->quote_helper->inject_metadata($xml);
|
||||
}
|
||||
|
||||
$renderer = $this;
|
||||
|
||||
/**
|
||||
|
@@ -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');
|
||||
@@ -490,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');
|
||||
|
@@ -747,8 +747,6 @@ class user extends \phpbb\session
|
||||
*/
|
||||
function leave_newly_registered()
|
||||
{
|
||||
global $db;
|
||||
|
||||
if (empty($this->data['user_new']))
|
||||
{
|
||||
return false;
|
||||
|
Reference in New Issue
Block a user