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

[ticket/10684] Send notifications for users with stale bans

PHPBB3-10684
This commit is contained in:
rxu
2012-03-08 14:57:47 +08:00
parent d67fae0f09
commit 025de9ee19
2 changed files with 48 additions and 17 deletions

View File

@@ -3587,4 +3587,33 @@ function remove_newly_registered($user_id, $user_data = false)
return $user_data['group_id'];
}
/**
* Get a list of banned users' ids, ignoring stale buns which were not wiped yet.
*
* @return array Array of banned users' ids if any, empty array otherwise
*/
function phpbb_get_banned_users_ids()
{
global $db;
// Get banned User ID's
// Ignore stale bans which were not wiped yet
$banned_ids_list = array();
$sql = 'SELECT ban_userid
FROM ' . BANLIST_TABLE . '
WHERE ban_userid <> 0
AND ban_exclude <> 1
AND (ban_end > ' . time() . '
OR ban_end = 0)';
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
{
$user_id = (int) $row['ban_userid'];
$banned_ids_list[$user_id] = $user_id;
}
$db->sql_freeresult($result);
return $banned_ids_list;
}
?>