From 224aa404f6c8f0014a0dc48b9776ff431b8d4f48 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 24 Jul 2009 08:49:51 +0000 Subject: [PATCH] Fix bug #47825 - Banning an already banned user states to be successful, but has no effect - Patch by Pyramide Authorised by: AcydBurn git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9840 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/includes/functions_user.php | 12 +++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 22eda7e24b..b8d233ca13 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -171,6 +171,7 @@
  • [Fix] Preserve newlines in template files (one newline had been always dropped after a template variable due to PHP's handling of closing tags)
  • [Fix] Be less strict with FTP daemons when getting directory filelists. (Bug #46295)
  • [Fix] Fix set_custom_template for database-stored styles (Bug #40515 - Patch by nickvergessen)
  • +
  • [Fix] Banning an already banned user states to be successful, but has no effect (Bug #47825 - Patch by Pyramide)
  • [Change] Change the data format of the default file ACM to be more secure from tampering and have better performance.
  • [Change] Add index on log_time to the log table to prevent slowdown on boards with many log entries. (Bug #44665 - Patch by bantu)
  • [Change] Template engine now permits to a limited extent variable includes.
  • diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php index c69c27c9d7..e8584239ad 100644 --- a/phpBB/includes/functions_user.php +++ b/phpBB/includes/functions_user.php @@ -1016,7 +1016,17 @@ function user_ban($mode, $ban, $ban_len, $ban_len_other, $ban_exclude, $ban_reas } while ($row = $db->sql_fetchrow($result)); - $banlist_ary = array_unique(array_diff($banlist_ary, $banlist_ary_tmp)); + $banlist_ary_tmp = array_intersect($banlist_ary, $banlist_ary_tmp); + + if (sizeof($banlist_ary_tmp)) + { + // One or more entities are already banned/excluded, delete the existing bans, so they can be re-inserted with the given new length + $sql = 'DELETE FROM ' . BANLIST_TABLE . ' + WHERE ' . $db->sql_in_set($type, $banlist_ary_tmp) . ' + AND ban_exclude = ' . (int) $ban_exclude; + $db->sql_query($sql); + } + unset($banlist_ary_tmp); } $db->sql_freeresult($result);