1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-31 05:50:42 +02:00

Merge pull request #6225 from rubencm/ticket/16790

[ticket/16790] Remove unused code
This commit is contained in:
Marc Alexander
2022-12-09 21:17:23 +01:00
committed by GitHub
34 changed files with 93 additions and 278 deletions

View File

@@ -273,15 +273,13 @@ class acp_attachments
$result = $db->sql_query($sql);
$defined_ips = '';
$ips = array();
while ($row = $db->sql_fetchrow($result))
{
$value = ($row['site_ip']) ? $row['site_ip'] : $row['site_hostname'];
$value = $row['site_ip'] ?: $row['site_hostname'];
if ($value)
{
$defined_ips .= '<option' . (($row['ip_exclude']) ? ' class="sep"' : '') . ' value="' . $row['site_id'] . '">' . $value . '</option>';
$ips[$row['site_id']] = $value;
}
}
$db->sql_freeresult($result);
@@ -354,7 +352,6 @@ class acp_attachments
break;
case 'extensions':
if ($submit || isset($_POST['add_extension_check']))
{
if ($submit)
@@ -423,30 +420,27 @@ class acp_attachments
if ($add_extension && $add)
{
$sql = 'SELECT extension_id
FROM ' . EXTENSIONS_TABLE . "
WHERE extension = '" . $db->sql_escape($add_extension) . "'";
$result = $db->sql_query($sql);
if ($row = $db->sql_fetchrow($result))
{
$error[] = sprintf($user->lang['EXTENSION_EXIST'], $add_extension);
}
$db->sql_freeresult($result);
if (!count($error))
{
$sql = 'SELECT extension_id
FROM ' . EXTENSIONS_TABLE . "
WHERE extension = '" . $db->sql_escape($add_extension) . "'";
$result = $db->sql_query($sql);
$sql_ary = array(
'group_id' => $add_extension_group,
'extension' => $add_extension
);
if ($row = $db->sql_fetchrow($result))
{
$error[] = sprintf($user->lang['EXTENSION_EXIST'], $add_extension);
}
$db->sql_freeresult($result);
$db->sql_query('INSERT INTO ' . EXTENSIONS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary));
if (!count($error))
{
$sql_ary = array(
'group_id' => $add_extension_group,
'extension' => $add_extension
);
$db->sql_query('INSERT INTO ' . EXTENSIONS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary));
$phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_ATTACH_EXT_ADD', false, array($add_extension));
}
$phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_ATTACH_EXT_ADD', false, array($add_extension));
}
}
@@ -750,7 +744,7 @@ class acp_attachments
$imglist = array_values($imglist);
$imglist = $imglist[0];
foreach ($imglist as $key => $img)
foreach ($imglist as $img)
{
if (!$ext_group_row['upload_icon'])
{
@@ -773,7 +767,7 @@ class acp_attachments
$i = 0;
$assigned_extensions = '';
foreach ($extensions as $num => $row)
foreach ($extensions as $row)
{
if ($row['group_id'] == $group_id && $group_id)
{
@@ -822,8 +816,8 @@ class acp_attachments
ORDER BY left_id ASC';
$result = $db->sql_query($sql, 600);
$right = $cat_right = $padding_inc = 0;
$padding = $forum_list = $holding = '';
$right = $cat_right = 0;
$padding = $holding = '';
$padding_store = array('0' => '');
while ($row = $db->sql_fetchrow($result))
@@ -1150,6 +1144,8 @@ class acp_attachments
WHERE ' . $db->sql_in_set('attach_id', $delete_files) . '
AND is_orphan = 0';
$result = $db->sql_query($sql);
$deleted_filenames = [];
while ($row = $db->sql_fetchrow($result))
{
$deleted_filenames[] = $row['real_filename'];

View File

@@ -216,15 +216,6 @@ class acp_bbcodes
}
}
if (substr($data['bbcode_tag'], -1) === '=')
{
$test = substr($data['bbcode_tag'], 0, -1);
}
else
{
$test = $data['bbcode_tag'];
}
if (strlen($data['bbcode_tag']) > 16)
{
trigger_error($user->lang['BBCODE_TAG_TOO_LONG'] . adm_back_link($this->u_action), E_USER_WARNING);

View File

@@ -1224,7 +1224,7 @@ class acp_forums
if ($action_subforums == 'delete')
{
$rows = get_forum_branch($row['forum_id'], 'children', 'descending', false);
$forum_ids = [];
foreach ($rows as $_row)
{
// Do not remove the forum id we are about to change. ;)
@@ -2183,29 +2183,4 @@ class acp_forums
adm_page_footer();
}
/**
* Display copy permission page
* Not used at the moment - we will have a look at it for 3.0.7
*/
function copy_permission_page($forum_data)
{
global $phpEx, $phpbb_admin_path, $template, $user;
$acl_url = '&amp;mode=setting_forum_local&amp;forum_id[]=' . $forum_data['forum_id'];
$action = append_sid($this->u_action . "&amp;parent_id={$this->parent_id}&amp;f={$forum_data['forum_id']}&amp;action=copy_perm");
$l_acl = sprintf($user->lang['COPY_TO_ACL'], '<a href="' . append_sid("{$phpbb_admin_path}index.$phpEx", 'i=permissions' . $acl_url) . '">', '</a>');
$this->tpl_name = 'acp_forums_copy_perm';
$template->assign_vars(array(
'U_ACL' => append_sid("{$phpbb_admin_path}index.$phpEx", 'i=permissions' . $acl_url),
'L_ACL_LINK' => $l_acl,
'L_BACK_LINK' => adm_back_link($this->u_action . '&amp;parent_id=' . $this->parent_id),
'S_COPY_ACTION' => $action,
'S_FORUM_OPTIONS' => make_forum_select($forum_data['parent_id'], $forum_data['forum_id'], false, false, false),
));
}
}

View File

@@ -40,7 +40,6 @@ class acp_icons
$action = (isset($_POST['edit'])) ? 'edit' : $action;
$action = (isset($_POST['import'])) ? 'import' : $action;
$icon_id = $request->variable('id', 0);
$submit = $request->is_set_post('submit', false);
$form_key = 'acp_icons';
add_form_key($form_key);
@@ -162,7 +161,7 @@ class acp_icons
case 'add':
$smilies = $default_row = array();
$smiley_options = $order_list = $add_order_list = '';
$smiley_options = '';
if ($action == 'add' && $mode == 'smilies')
{

View File

@@ -21,7 +21,7 @@ if (!defined('IN_PHPBB'))
class acp_logs
{
var $u_action;
public $u_action;
function main($id, $mode)
{
@@ -45,7 +45,6 @@ class acp_logs
$sort_dir = $request->variable('sd', 'd');
$this->tpl_name = 'acp_logs';
$this->log_type = constant('LOG_' . strtoupper($mode));
/* @var $pagination \phpbb\pagination */
$pagination = $phpbb_container->get('pagination');

View File

@@ -204,7 +204,6 @@ class acp_main
}
// Resync post counts
$start = $max_post_id = 0;
// 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
@@ -233,6 +232,7 @@ class acp_main
$step = ($config['num_posts']) ? (max((int) ($config['num_posts'] / 5), 20000)) : 20000;
$db->sql_query('UPDATE ' . USERS_TABLE . ' SET user_posts = 0');
$start = 0;
while ($start < $max_post_id)
{
$sql = 'SELECT COUNT(post_id) AS num_posts, poster_id

View File

@@ -75,7 +75,6 @@ class acp_modules
$this->parent_id = $request->variable('parent_id', 0);
$module_id = $request->variable('m', 0);
$action = $request->variable('action', '');
$errors = array();
switch ($action)
{
@@ -249,12 +248,8 @@ class acp_modules
trigger_error($msg . adm_back_link($this->u_action . '&amp;parent_id=' . $this->parent_id), E_USER_WARNING);
}
if (!count($errors))
{
$module_manager->remove_cache_file($this->module_class);
trigger_error($user->lang['MODULE_ADDED'] . adm_back_link($this->u_action . '&amp;parent_id=' . $this->parent_id));
}
$module_manager->remove_cache_file($this->module_class);
trigger_error($user->lang['MODULE_ADDED'] . adm_back_link($this->u_action . '&amp;parent_id=' . $this->parent_id));
}
}
else
@@ -364,12 +359,8 @@ class acp_modules
trigger_error($msg . adm_back_link($this->u_action . '&amp;parent_id=' . $this->parent_id), E_USER_WARNING);
}
if (!count($errors))
{
$module_manager->remove_cache_file($this->module_class);
trigger_error((($action == 'add') ? $user->lang['MODULE_ADDED'] : $user->lang['MODULE_EDITED']) . adm_back_link($this->u_action . '&amp;parent_id=' . $this->parent_id));
}
$module_manager->remove_cache_file($this->module_class);
trigger_error((($action == 'add') ? $user->lang['MODULE_ADDED'] : $user->lang['MODULE_EDITED']) . adm_back_link($this->u_action . '&amp;parent_id=' . $this->parent_id));
}
// Category/not category?
@@ -430,38 +421,11 @@ class acp_modules
array_change_key_case($module_data, CASE_UPPER))
);
if (count($errors))
{
$template->assign_vars(array(
'S_ERROR' => true,
'ERROR_MSG' => implode('<br />', $errors))
);
}
return;
break;
}
// Default management page
if (count($errors))
{
if ($request->is_ajax())
{
$json_response = new \phpbb\json_response;
$json_response->send(array(
'MESSAGE_TITLE' => $user->lang('ERROR'),
'MESSAGE_TEXT' => implode('<br />', $errors),
'SUCCESS' => false,
));
}
$template->assign_vars(array(
'S_ERROR' => true,
'ERROR_MSG' => implode('<br />', $errors))
);
}
if (!$this->parent_id)
{
$navigation = strtoupper($this->module_class);
@@ -605,7 +569,7 @@ class acp_modules
ORDER BY left_id ASC";
$result = $db->sql_query($sql);
$right = $iteration = 0;
$right = 0;
$padding_store = array('0' => '');
$module_list = $padding = '';

View File

@@ -1060,11 +1060,11 @@ class acp_permissions
foreach ($hold_ary as $group_id => $forum_ary)
{
$groups[$group_id]['auth_setting'] = $hold_ary[$group_id][$forum_id][$permission];
$groups[$group_id]['auth_setting'] = $forum_ary[$forum_id][$permission];
}
unset($hold_ary);
foreach ($groups as $id => $row)
foreach ($groups as $row)
{
switch ($row['auth_setting'])
{

View File

@@ -344,10 +344,10 @@ class acp_profile
$s_hidden_fields = '<input type="hidden" name="field_id" value="' . $field_id . '" />';
}
else
else // action = create
{
// We are adding a new field, define basic params
$lang_options = $field_row = array();
$lang_options = array();
$field_type = $request->variable('field_type', '');
@@ -475,41 +475,6 @@ class acp_profile
$cp->vars[$key] = $var;
}
// step 3 - all arrays
if ($action == 'edit')
{
// Get language entries
$sql = 'SELECT *
FROM ' . PROFILE_FIELDS_LANG_TABLE . '
WHERE lang_id <> ' . $this->edit_lang_id . "
AND field_id = $field_id
ORDER BY option_id ASC";
$result = $db->sql_query($sql);
$l_lang_options = array();
while ($row = $db->sql_fetchrow($result))
{
$l_lang_options[$row['lang_id']][$row['option_id']] = $row['lang_value'];
}
$db->sql_freeresult($result);
$sql = 'SELECT lang_id, lang_name, lang_explain, lang_default_value
FROM ' . PROFILE_LANG_TABLE . '
WHERE lang_id <> ' . $this->edit_lang_id . "
AND field_id = $field_id
ORDER BY lang_id ASC";
$result = $db->sql_query($sql);
$l_lang_name = $l_lang_explain = $l_lang_default_value = array();
while ($row = $db->sql_fetchrow($result))
{
$l_lang_name[$row['lang_id']] = $row['lang_name'];
$l_lang_explain[$row['lang_id']] = $row['lang_explain'];
$l_lang_default_value[$row['lang_id']] = $row['lang_default_value'];
}
$db->sql_freeresult($result);
}
foreach ($exclude[3] as $key)
{
$cp->vars[$key] = $request->variable($key, array(0 => ''), true);
@@ -670,7 +635,7 @@ class acp_profile
// Build options based on profile type
$options = $profile_field->get_options($this->lang_defs['iso'][$config['default_lang']], $cp->vars);
foreach ($options as $num => $option_ary)
foreach ($options as $option_ary)
{
$template->assign_block_vars('option', $option_ary);
}

View File

@@ -110,6 +110,7 @@ class acp_prune
if ($row = $db->sql_fetchrow($result))
{
$prune_ids = array();
$p_result = [];
$p_result['topics'] = 0;
$p_result['posts'] = 0;
$log_data = '';

View File

@@ -21,7 +21,7 @@ if (!defined('IN_PHPBB'))
class acp_storage
{
/** @var \phpbb\config $config */
/** @var \phpbb\config\config $config */
protected $config;
/** @var \phpbb\language\language $lang */
@@ -33,9 +33,6 @@ class acp_storage
/** @var \phpbb\template\template */
protected $template;
/** @var \phpbb\user */
protected $user;
/** @var \phpbb\di\service_collection */
protected $provider_collection;
@@ -70,7 +67,6 @@ class acp_storage
$this->lang = $phpbb_container->get('language');
$this->request = $phpbb_container->get('request');
$this->template = $phpbb_container->get('template');
$this->user = $phpbb_container->get('user');
$this->provider_collection = $phpbb_container->get('storage.provider_collection');
$this->storage_collection = $phpbb_container->get('storage.storage_collection');
$this->phpbb_root_path = $phpbb_root_path;