aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/functions_user.php
diff options
context:
space:
mode:
authorNils Adermann <naderman@naderman.de>2014-05-02 15:54:10 +0200
committerNils Adermann <naderman@naderman.de>2014-05-02 15:54:10 +0200
commit97e651a4917778bd4294073d254c8735b7b1f4df (patch)
tree6fb005f38a35a2ebd2388300df5f79312deb4865 /phpBB/includes/functions_user.php
parentd52c2d1b5caf1382d178e55eff311ceddf4b392f (diff)
parentd14aed0819f2314ab0da1787aa7228025a6a024c (diff)
downloadforums-97e651a4917778bd4294073d254c8735b7b1f4df.tar
forums-97e651a4917778bd4294073d254c8735b7b1f4df.tar.gz
forums-97e651a4917778bd4294073d254c8735b7b1f4df.tar.bz2
forums-97e651a4917778bd4294073d254c8735b7b1f4df.tar.xz
forums-97e651a4917778bd4294073d254c8735b7b1f4df.zip
Merge remote-tracking branch 'github-exreaction/ticket/8323' into develop-ascraeus
* github-exreaction/ticket/8323: [ticket/8323] Cache auth request [ticket/8323] Combine into a single query [ticket/8323] Comments on phpbb_get_banned_user_ids input for test [ticket/8323] More readability in test case [ticket/8323] Comments [ticket/8323] dataProvider for the test; better test data [ticket/8323] Comments [ticket/8323] Unit test for phpbb_get_banned_user_ids [ticket/8323] Comments for inactive reasons in constants.php [ticket/8323] Only disable administrative deactivated accounts from receiving PMs [ticket/8323] Allow temporarily banned users to receive PMs, but not a notification [ticket/8323] Correct PM notification settings (only notify those who can receive them) [ticket/8323] Cleanup viewtopic code (not sure how this mess happened) [ticket/8323] Allow sending PMs to temporarily banned users [ticket/8323] Do not allow sending PMs to Inactive users [ticket/8323] Hide the Send PM link if users cannot receive the PM [ticket/8323] Correcting the comment [ticket/8323] Do not allow sending of Private Messages to users who are banned [ticket/8323] Remove code used for testing [ticket/8323] Do not allow sending of Private Messages to users who do not have permission to read private messages Conflicts: phpBB/language/en/ucp.php
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 dcc0d727a1..0dd1708c55 100644
--- a/phpBB/includes/functions_user.php
+++ b/phpBB/includes/functions_user.php
@@ -3455,9 +3455,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;
@@ -3469,9 +3472,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))
{