diff --git a/phpBB/admin/admin_permissions.php b/phpBB/admin/admin_permissions.php
index 565a77e037..a78f5aff98 100644
--- a/phpBB/admin/admin_permissions.php
+++ b/phpBB/admin/admin_permissions.php
@@ -238,13 +238,13 @@ if ( !empty($forum_id) || $mode == 'administrators' )
- |
- |
- |
+ |
+ |
+ |
sql_query($sql);
- $auth_options = array();
- while ( $row = $db->sql_fetchrow($result) )
+ $where_user_sql = '';
+ if ( !empty($HTTP_POST_VARS['users']) )
{
- $auth_options[] = $row;
+ if ( is_array($HTTP_POST_VARS['users']) )
+ {
+ foreach ($HTTP_POST_VARS['users'] as $user_id)
+ {
+ $where_user_sql .= ( ( $where_user_sql != '' ) ? ', ' : '' ) . intval($user_id);
+ }
+ }
+ else
+ {
+ $where_user_sql = intval($HTTP_POST_VARS['users']);
+ }
+
+ $where_user_sql = " AND u.user_id IN ($where_user_sql)";
}
- $sql = "SELECT u.user_id, u.username, ao.auth_option
- FROM " . USERS_TABLE . " u, " . ACL_USERS_TABLE . " au, " . ACL_OPTIONS_TABLE . " ao
- WHERE ao.auth_type LIKE 'admin'
- AND au.auth_option_id = ao.auth_option_id
- AND u.user_id = au.user_id
- ORDER BY u.username, u.user_regdate ASC";
- $result = $db->sql_query($sql);
+ $discrete_user_sql = ( empty($HTTP_POST_VARS['discrete']) || empty($HTTP_POST_VARS['users']) || is_array($HTTP_POST_VARS['users']) ) ? ' DISTINCT ' : 'ao.auth_option, ';
- $auth_users = array();
- while ( $row = $db->sql_fetchrow($result) )
+ $where_groups_sql = '';
+ if ( !empty($HTTP_POST_VARS['groups']) )
{
- $auth_users[$row['auth_option']] .= '';
- }
+ if ( is_array($HTTP_POST_VARS['groups']) )
+ {
+ foreach ($HTTP_POST_VARS['groups'] as $group_id)
+ {
+ $where_groups_sql .= ( ( $where_groups_sql != '' ) ? ', ' : '' ) . intval($group_idf);
+ }
+ }
+ else
+ {
+ $where_groups_sql = intval($HTTP_POST_VARS['groups']);
+ }
- $sql = "SELECT g.group_id, g.group_name, ao.auth_option
- FROM " . GROUPS_TABLE . " g, " . ACL_GROUPS_TABLE . " ag, " . ACL_OPTIONS_TABLE . " ao
- WHERE ao.auth_type LIKE 'admin'
- AND ag.auth_option_id = ao.auth_option_id
- AND g.group_id = ag.group_id
- ORDER BY g.group_name ASC";
- $result = $db->sql_query($sql);
-
- $auth_groups = array();
- while ( $row = $db->sql_fetchrow($result) )
- {
- $auth_groups[$row['auth_option']] .= '';
+ $where_groups_sql = " AND g.group_id IN ($where_groups_sql)";
}
?>
-