aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/functions_user.php
diff options
context:
space:
mode:
authorNathan <exreaction@phpbb.com>2012-07-10 09:58:10 -0500
committerNathan <exreaction@phpbb.com>2012-07-10 12:34:40 -0500
commit362ba43f18c07c70855e72ebfaea222e04af1183 (patch)
treea18462f3194d687e7e13c42b90d2af8daff0cd8d /phpBB/includes/functions_user.php
parent0f4956b280468e8890b1c84df41d7bb1eb2447c5 (diff)
downloadforums-362ba43f18c07c70855e72ebfaea222e04af1183.tar
forums-362ba43f18c07c70855e72ebfaea222e04af1183.tar.gz
forums-362ba43f18c07c70855e72ebfaea222e04af1183.tar.bz2
forums-362ba43f18c07c70855e72ebfaea222e04af1183.tar.xz
forums-362ba43f18c07c70855e72ebfaea222e04af1183.zip
[ticket/8323] Allow sending PMs to temporarily banned users
Added an argument to the phpbb_get_banned_user_ids() function to allow specifying a banned end time (default true for current functionality, false for only permanent bans, timestamp to find banned until a specified time) PHPBB3-8323
Diffstat (limited to 'phpBB/includes/functions_user.php')
-rw-r--r--phpBB/includes/functions_user.php26
1 files changed, 23 insertions, 3 deletions
diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php
index 9b102b7387..8533e47bc4 100644
--- a/phpBB/includes/functions_user.php
+++ b/phpBB/includes/functions_user.php
@@ -3668,9 +3668,12 @@ function remove_newly_registered($user_id, $user_data = false)
*
* @param array $user_ids Array of users' ids to check for banning,
* leave empty to get complete list of banned ids
+* @param bool|int $ban_end Bool True to get users currently banned
+* Bool False to only get permanently banned users
+* Int Unix timestamp to get users banned until that time
* @return array Array of banned users' ids if any, empty array otherwise
*/
-function phpbb_get_banned_user_ids($user_ids = array())
+function phpbb_get_banned_user_ids($user_ids = array(), $ban_end = true)
{
global $db;
@@ -3682,9 +3685,26 @@ function phpbb_get_banned_user_ids($user_ids = array())
$sql = 'SELECT ban_userid
FROM ' . BANLIST_TABLE . "
WHERE $sql_user_ids
- AND ban_exclude <> 1
- AND (ban_end > " . time() . '
+ AND ban_exclude <> 1";
+
+ if ($ban_end === true)
+ {
+ // Banned currently
+ $sql .= " AND (ban_end > " . time() . '
+ OR ban_end = 0)';
+ }
+ else if ($ban_end === false)
+ {
+ // Permanently banned
+ $sql .= " AND ban_end = 0";
+ }
+ else
+ {
+ // Banned until a specified time
+ $sql .= " AND (ban_end > " . (int) $ban_end . '
OR ban_end = 0)';
+ }
+
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
{