[ticket/9687] Fix bugs when banning and add TODO's

PHPBB3-9687
This commit is contained in:
Oliver Schramm 2018-09-30 04:13:12 +02:00 committed by Marc Alexander
parent 728b200cd9
commit 64ab1fc24c
No known key found for this signature in database
GPG key ID: 50E0D2423696F995
4 changed files with 6 additions and 5 deletions

View file

@ -36,6 +36,6 @@ services:
- '@dbal.conn'
- '@log'
- '@user'
- '%tables.users'
- '%tables.users%'
tags:
- { name: ban.type }

View file

@ -180,9 +180,10 @@ class manager
}
}
// TODO: Prevent logging out founders
$sql = 'SELECT user_id
FROM ' . $this->users_table . '
WHERE ' . $this->db->sql_in_set('u.' . $user_column, $ban_items_sql) . $ban_or_like;
WHERE ' . $this->db->sql_in_set('u.' . $user_column, $ban_items_sql, false, true) . $ban_or_like;
$result = $this->db->sql_query($sql);
$user_ids = [];

View file

@ -60,13 +60,13 @@ class email extends base
{
throw new runtime_exception(); // TODO
}
$regex = '#^.*?@*|(([a-z0-9\-]+\.)+([a-z]{2,3}))$#i';
$regex = '#^.*?@.*|(([a-z0-9\-]+\.)+([a-z]{2,3}))$#i';
$ban_items = [];
foreach ($items as $item)
{
$item = trim($item);
if (strlen($item) > 100 || preg_match($regex, $item) || in_array($item, $this->excluded))
if (strlen($item) > 100 || !preg_match($regex, $item) || in_array($item, $this->excluded))
{
continue;
}

View file

@ -166,7 +166,7 @@ class user extends base
$sql_usernames = [];
$sql_or_like = [];
foreach ($items as $item)
foreach ($items as $item) // TODO: Prevent banning Anonymous
{
$cleaned_username = utf8_clean_string($item);
if (stripos($cleaned_username, '*') === false)