diff --git a/phpBB/includes/acp/acp_attachments.php b/phpBB/includes/acp/acp_attachments.php
index 92363b0ff9..5fa1f0beb3 100644
--- a/phpBB/includes/acp/acp_attachments.php
+++ b/phpBB/includes/acp/acp_attachments.php
@@ -272,15 +272,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 .= '';
- $ips[$row['site_id']] = $value;
}
}
$db->sql_freeresult($result);
@@ -353,7 +351,6 @@ class acp_attachments
break;
case 'extensions':
-
if ($submit || isset($_POST['add_extension_check']))
{
if ($submit)
@@ -422,30 +419,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));
}
}
@@ -747,7 +741,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'])
{
@@ -770,7 +764,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)
{
@@ -819,8 +813,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))
@@ -1131,6 +1125,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'];
diff --git a/phpBB/includes/acp/acp_bbcodes.php b/phpBB/includes/acp/acp_bbcodes.php
index 3c0371a3a7..edf044e0aa 100644
--- a/phpBB/includes/acp/acp_bbcodes.php
+++ b/phpBB/includes/acp/acp_bbcodes.php
@@ -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);
diff --git a/phpBB/includes/acp/acp_forums.php b/phpBB/includes/acp/acp_forums.php
index ba3901f67a..077c037484 100644
--- a/phpBB/includes/acp/acp_forums.php
+++ b/phpBB/includes/acp/acp_forums.php
@@ -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 = '&mode=setting_forum_local&forum_id[]=' . $forum_data['forum_id'];
- $action = append_sid($this->u_action . "&parent_id={$this->parent_id}&f={$forum_data['forum_id']}&action=copy_perm");
-
- $l_acl = sprintf($user->lang['COPY_TO_ACL'], '', '');
-
- $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 . '&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),
- ));
- }
-
}
diff --git a/phpBB/includes/acp/acp_icons.php b/phpBB/includes/acp/acp_icons.php
index 6429424983..b0be8b6135 100644
--- a/phpBB/includes/acp/acp_icons.php
+++ b/phpBB/includes/acp/acp_icons.php
@@ -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);
@@ -148,7 +147,7 @@ class acp_icons
case 'add':
$smilies = $default_row = array();
- $smiley_options = $order_list = $add_order_list = '';
+ $smiley_options = '';
if ($action == 'add' && $mode == 'smilies')
{
diff --git a/phpBB/includes/acp/acp_logs.php b/phpBB/includes/acp/acp_logs.php
index b98cd64f49..4e5c1f3f88 100644
--- a/phpBB/includes/acp/acp_logs.php
+++ b/phpBB/includes/acp/acp_logs.php
@@ -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');
diff --git a/phpBB/includes/acp/acp_main.php b/phpBB/includes/acp/acp_main.php
index 80e102db21..5fac9de7ef 100644
--- a/phpBB/includes/acp/acp_main.php
+++ b/phpBB/includes/acp/acp_main.php
@@ -197,7 +197,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
@@ -226,6 +225,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
diff --git a/phpBB/includes/acp/acp_modules.php b/phpBB/includes/acp/acp_modules.php
index fb0c09055e..8b09dfa911 100644
--- a/phpBB/includes/acp/acp_modules.php
+++ b/phpBB/includes/acp/acp_modules.php
@@ -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 . '&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 . '&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 . '&parent_id=' . $this->parent_id));
}
}
else
@@ -364,12 +359,8 @@ class acp_modules
trigger_error($msg . adm_back_link($this->u_action . '&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 . '&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 . '&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('
', $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('
', $errors),
- 'SUCCESS' => false,
- ));
- }
-
- $template->assign_vars(array(
- 'S_ERROR' => true,
- 'ERROR_MSG' => implode('
', $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 = '';
diff --git a/phpBB/includes/acp/acp_permissions.php b/phpBB/includes/acp/acp_permissions.php
index 80c65cfd6f..fdab868068 100644
--- a/phpBB/includes/acp/acp_permissions.php
+++ b/phpBB/includes/acp/acp_permissions.php
@@ -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'])
{
diff --git a/phpBB/includes/acp/acp_profile.php b/phpBB/includes/acp/acp_profile.php
index 49da7d84a4..a234a511b9 100644
--- a/phpBB/includes/acp/acp_profile.php
+++ b/phpBB/includes/acp/acp_profile.php
@@ -344,10 +344,10 @@ class acp_profile
$s_hidden_fields = '';
}
- 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);
}
diff --git a/phpBB/includes/acp/acp_prune.php b/phpBB/includes/acp/acp_prune.php
index c5f7789de8..705d8ed62d 100644
--- a/phpBB/includes/acp/acp_prune.php
+++ b/phpBB/includes/acp/acp_prune.php
@@ -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 = '';
diff --git a/phpBB/includes/acp/acp_storage.php b/phpBB/includes/acp/acp_storage.php
index f6dce91ff9..2f651f0e18 100644
--- a/phpBB/includes/acp/acp_storage.php
+++ b/phpBB/includes/acp/acp_storage.php
@@ -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;
diff --git a/phpBB/includes/mcp/mcp_main.php b/phpBB/includes/mcp/mcp_main.php
index 5ca5d22d66..df6fe9f95b 100644
--- a/phpBB/includes/mcp/mcp_main.php
+++ b/phpBB/includes/mcp/mcp_main.php
@@ -594,11 +594,6 @@ function mcp_move_topic($topic_ids)
$topic_data = phpbb_get_topic_data($topic_ids);
$leave_shadow = (isset($_POST['move_leave_shadow'])) ? true : false;
- $forum_sync_data = array();
-
- $forum_sync_data[$forum_id] = current($topic_data);
- $forum_sync_data[$to_forum_id] = $forum_data;
-
$topics_moved = $topics_moved_unapproved = $topics_moved_softdeleted = 0;
$posts_moved = $posts_moved_unapproved = $posts_moved_softdeleted = 0;
@@ -636,12 +631,8 @@ function mcp_move_topic($topic_ids)
}
$shadow_topics = 0;
- $forum_ids = array($to_forum_id);
foreach ($topic_data as $topic_id => $row)
{
- // Get the list of forums to resync
- $forum_ids[] = $row['forum_id'];
-
// We add the $to_forum_id twice, because 'forum_id' is updated
// when the topic is moved again later.
$phpbb_log->add('mod', $user->data['user_id'], $user->ip, 'LOG_MOVE', false, array(
@@ -1202,7 +1193,7 @@ function mcp_delete_post($post_ids, $is_soft = false, $soft_delete_reason = '',
$post_data = phpbb_get_post_data($post_ids);
- foreach ($post_data as $id => $row)
+ foreach ($post_data as $row)
{
$post_username = ($row['poster_id'] == ANONYMOUS && !empty($row['post_username'])) ? $row['post_username'] : $row['username'];
$phpbb_log->add('mod', $user->data['user_id'], $user->ip, 'LOG_DELETE_POST', false, array(
@@ -1741,7 +1732,7 @@ function mcp_fork_topic($topic_ids)
$config->increment('num_topics', count($new_topic_id_list), false);
$config->increment('num_posts', $total_posts, false);
- foreach ($new_topic_id_list as $topic_id => $new_topic_id)
+ foreach ($new_topic_id_list as $new_topic_id)
{
$phpbb_log->add('mod', $user->data['user_id'], $user->ip, 'LOG_FORK', false, array(
'forum_id' => $to_forum_id,
diff --git a/phpBB/includes/mcp/mcp_pm_reports.php b/phpBB/includes/mcp/mcp_pm_reports.php
index eecfe9cbc8..63fabb35db 100644
--- a/phpBB/includes/mcp/mcp_pm_reports.php
+++ b/phpBB/includes/mcp/mcp_pm_reports.php
@@ -135,6 +135,7 @@ class mcp_pm_reports
ORDER BY filetime DESC';
$result = $db->sql_query($sql);
+ $attachments = [];
while ($row = $db->sql_fetchrow($result))
{
$attachments[] = $row;
@@ -242,12 +243,10 @@ class mcp_pm_reports
ORDER BY $sort_order_sql";
$result = $db->sql_query_limit($sql, $config['topics_per_page'], $start);
- $i = 0;
$report_ids = array();
while ($row = $db->sql_fetchrow($result))
{
$report_ids[] = $row['report_id'];
- $row_num[$row['report_id']] = $i++;
}
$db->sql_freeresult($result);
diff --git a/phpBB/includes/mcp/mcp_post.php b/phpBB/includes/mcp/mcp_post.php
index 3f399dd0c6..f8e316c0ca 100644
--- a/phpBB/includes/mcp/mcp_post.php
+++ b/phpBB/includes/mcp/mcp_post.php
@@ -129,7 +129,7 @@ function mcp_post_details($id, $mode, $action)
// Set some vars
$users_ary = $usernames_ary = array();
- $attachments = $extensions = array();
+ $attachments = array();
$post_id = $post_info['post_id'];
// Get topic tracking info
diff --git a/phpBB/includes/mcp/mcp_queue.php b/phpBB/includes/mcp/mcp_queue.php
index eebb8e4fc4..bff8412cb6 100644
--- a/phpBB/includes/mcp/mcp_queue.php
+++ b/phpBB/includes/mcp/mcp_queue.php
@@ -369,7 +369,6 @@ class mcp_queue
$user->add_lang(array('viewtopic', 'viewforum'));
$topic_id = $request->variable('t', 0);
- $forum_info = array();
// If 'sort' is set, "Go" was pressed which is located behind the forums