diff options
author | Andreas Fischer <bantu@phpbb.com> | 2012-03-22 18:14:13 +0100 |
---|---|---|
committer | Andreas Fischer <bantu@phpbb.com> | 2012-03-22 18:14:13 +0100 |
commit | 57eb50812f138296085b51b74079037c2efe1c43 (patch) | |
tree | d81cc2f2eef1ed7095d2c8ca803e269c230b912a /phpBB/includes/functions_user.php | |
parent | 1337f861235436efa3ca21ad7cd35d28849bde18 (diff) | |
parent | 5a9dd1994fc20aaebe3145540b630826d7333998 (diff) | |
download | forums-57eb50812f138296085b51b74079037c2efe1c43.tar forums-57eb50812f138296085b51b74079037c2efe1c43.tar.gz forums-57eb50812f138296085b51b74079037c2efe1c43.tar.bz2 forums-57eb50812f138296085b51b74079037c2efe1c43.tar.xz forums-57eb50812f138296085b51b74079037c2efe1c43.zip |
Merge remote-tracking branch 'rxu/ticket/10684' into develop-olympus
* rxu/ticket/10684:
[ticket/10684] Adjust function and parameter name, minor changes.
[ticket/10684] Rename function phpbb_get_banned_users_ids() parameter
[ticket/10684] Remove intval mapping for array keys
[ticket/10684] Adjust pm_notifications() to handle stale bans
[ticket/10684] Cast user_id to integer
[ticket/10684] Refactor $sql_ignore_users array update
[ticket/10684] Remove isset() for $sql_ignore_users update
[ticket/10684] Fix 2 typos in comment lines.
[ticket/10684] Send notifications for users with stale bans
Diffstat (limited to 'phpBB/includes/functions_user.php')
-rw-r--r-- | phpBB/includes/functions_user.php | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php index 6b5cca8abb..10fb57ea97 100644 --- a/phpBB/includes/functions_user.php +++ b/phpBB/includes/functions_user.php @@ -3587,4 +3587,37 @@ function remove_newly_registered($user_id, $user_data = false) return $user_data['group_id']; } +/** +* Gets user ids of currently banned registered users. +* +* @param array $user_ids Array of users' ids to check for banning, +* leave empty to get complete list of banned ids +* @return array Array of banned users' ids if any, empty array otherwise +*/ +function phpbb_get_banned_user_ids($user_ids = array()) +{ + global $db; + + $sql_user_ids = (!empty($user_ids)) ? $db->sql_in_set('ban_userid', $user_ids) : 'ban_userid <> 0'; + + // 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 $sql_user_ids + 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; +} + ?>
\ No newline at end of file |