1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-08 17:56:52 +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:
Tristan Darricau
2016-01-09 17:53:04 +01:00
106 changed files with 240 additions and 454 deletions

View File

@@ -30,7 +30,7 @@ class ucp_activate
function main($id, $mode)
{
global $config, $phpbb_root_path, $phpEx, $request;
global $db, $user, $auth, $template, $phpbb_container, $phpbb_log, $phpbb_dispatcher;
global $db, $user, $auth, $phpbb_container, $phpbb_log, $phpbb_dispatcher;
$user_id = $request->variable('u', 0);
$key = $request->variable('k', '');

View File

@@ -36,7 +36,6 @@ class ucp_attachments
$sort_dir = $request->variable('sd', 'a');
$delete = (isset($_POST['delete'])) ? true : false;
$confirm = (isset($_POST['confirm'])) ? true : false;
$delete_ids = array_keys($request->variable('attachment', array(0)));
if ($delete && sizeof($delete_ids))

View File

@@ -36,7 +36,7 @@ class ucp_confirm
function main($id, $mode)
{
global $db, $user, $phpbb_root_path, $config, $phpEx, $phpbb_container, $request;
global $config, $phpbb_container, $request;
$captcha = $phpbb_container->get('captcha.factory')->get_instance($config['captcha_plugin']);
$captcha->init($request->variable('type', 0));

View File

@@ -38,8 +38,6 @@ class ucp_groups
$mark_ary = $request->variable('mark', array(0));
$submit = $request->variable('submit', false, false, \phpbb\request\request_interface::POST);
$delete = $request->variable('delete', false, false, \phpbb\request\request_interface::POST);
$error = $data = array();
/** @var \phpbb\group\helper $group_helper */
$group_helper = $phpbb_container->get('group_helper');
@@ -462,11 +460,8 @@ class ucp_groups
trigger_error($user->lang['NOT_LEADER_OF_GROUP'] . $return_page);
}
$file_uploads = (@ini_get('file_uploads') || strtolower(@ini_get('file_uploads')) == 'on') ? true : false;
$user->add_lang(array('acp/groups', 'acp/common'));
$data = $submit_ary = array();
$update = (isset($_POST['update'])) ? true : false;
$error = array();
@@ -535,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'))
{
@@ -624,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

@@ -99,7 +99,7 @@ class ucp_login_link
else
{
// Finish login
$result = $user->session_create($login_result['user_row']['user_id'], false, false, true);
$user->session_create($login_result['user_row']['user_id'], false, false, true);
// Perform a redirect as the account has been linked
$this->perform_redirect();
@@ -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

@@ -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);
@@ -1062,7 +1052,6 @@ function compose_pm($id, $mode, $action, $user_folders = array())
}
// Now Build the address list
$plain_address_field = '';
foreach ($address_list as $type => $adr_ary)
{
foreach ($adr_ary as $id => $field)

View File

@@ -24,7 +24,7 @@ if (!defined('IN_PHPBB'))
*/
function message_options($id, $mode, $global_privmsgs_rules, $global_rule_conditions)
{
global $phpbb_root_path, $phpEx, $user, $template, $auth, $config, $db, $request;
global $phpbb_root_path, $phpEx, $user, $template, $config, $db, $request;
$redirect_url = append_sid("{$phpbb_root_path}ucp.$phpEx", "i=pm&amp;mode=options");
@@ -80,7 +80,6 @@ function message_options($id, $mode, $global_privmsgs_rules, $global_rule_condit
if (check_form_key('ucp_pm_options'))
{
$folder_name = $request->variable('foldername', '', true);
$msg = '';
if ($folder_name)
{
@@ -611,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)
@@ -722,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

@@ -41,9 +41,6 @@ function view_folder($id, $mode, $folder_id, $folder)
$color_rows = array('marked', 'replied');
// only show the friend/foe color rows if the module is enabled
$zebra_enabled = false;
$_module = new p_master();
$_module->list_modules('ucp');
$_module->set_active('zebra');

View File

@@ -24,7 +24,7 @@ if (!defined('IN_PHPBB'))
*/
function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row)
{
global $user, $template, $auth, $db, $cache, $phpbb_container;
global $user, $template, $auth, $db, $phpbb_container;
global $phpbb_root_path, $request, $phpEx, $config, $phpbb_dispatcher;
$user->add_lang(array('viewtopic', 'memberlist'));
@@ -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
$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

@@ -29,7 +29,7 @@ class ucp_prefs
function main($id, $mode)
{
global $config, $db, $user, $auth, $template, $phpbb_dispatcher, $phpbb_root_path, $phpEx, $request;
global $config, $db, $user, $auth, $template, $phpbb_dispatcher, $request;
$submit = (isset($_POST['submit'])) ? true : false;
$error = $data = array();

View File

@@ -31,13 +31,12 @@ class ucp_profile
function main($id, $mode)
{
global $cache, $config, $db, $user, $auth, $template, $phpbb_root_path, $phpEx;
global $config, $db, $user, $auth, $template, $phpbb_root_path, $phpEx;
global $request, $phpbb_container, $phpbb_log, $phpbb_dispatcher;
$user->add_lang('posting');
$submit = $request->variable('submit', false, false, \phpbb\request\request_interface::POST);
$delete = $request->variable('delete', false, false, \phpbb\request\request_interface::POST);
$error = $data = array();
$s_hidden_fields = '';
@@ -430,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

@@ -29,7 +29,7 @@ class ucp_register
function main($id, $mode)
{
global $config, $db, $user, $auth, $template, $phpbb_root_path, $phpEx;
global $config, $db, $user, $template, $phpbb_root_path, $phpEx;
global $request, $phpbb_container, $phpbb_dispatcher;
//
@@ -484,7 +484,6 @@ class ucp_register
$s_hidden_fields = array_merge($s_hidden_fields, $captcha->get_hidden_fields());
}
$s_hidden_fields = build_hidden_fields($s_hidden_fields);
$confirm_image = '';
// Visual Confirmation - Show images
if ($config['enable_confirm'])
@@ -507,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

@@ -30,7 +30,7 @@ class ucp_remind
function main($id, $mode)
{
global $config, $phpbb_root_path, $phpEx, $request;
global $db, $user, $auth, $template, $phpbb_container;
global $db, $user, $template, $phpbb_container;
if (!$config['allow_password_reset'])
{

View File

@@ -25,7 +25,7 @@ class ucp_zebra
function main($id, $mode)
{
global $config, $db, $user, $auth, $template, $phpbb_root_path, $phpEx, $request, $phpbb_dispatcher;
global $db, $user, $auth, $template, $phpbb_root_path, $phpEx, $request, $phpbb_dispatcher;
$submit = (isset($_POST['submit']) || isset($_GET['add']) || isset($_GET['remove'])) ? true : false;
$s_hidden_fields = '';