From 880786d68610aff0c30573dc599af9e5b3ad56cf Mon Sep 17 00:00:00 2001 From: erangamapa Date: Thu, 21 Feb 2013 22:25:12 +0530 Subject: [PATCH] [ticket/11358] Removed redundant code and referred proper variable. Error was thrown when no users are selected before executing the code chunk which manually adds all the user to make the group default. Removed this code and referred $mark_ary instead of $name_ary which will not have selected user ids. PHPBB3-11358 --- phpBB/includes/acp/acp_groups.php | 42 ++----------------------------- 1 file changed, 2 insertions(+), 40 deletions(-) diff --git a/phpBB/includes/acp/acp_groups.php b/phpBB/includes/acp/acp_groups.php index dbe692aee0..af25d9d014 100644 --- a/phpBB/includes/acp/acp_groups.php +++ b/phpBB/includes/acp/acp_groups.php @@ -120,7 +120,7 @@ class acp_groups { trigger_error($user->lang['NO_GROUP'] . adm_back_link($this->u_action), E_USER_WARNING); } - else if (!$name_ary) + else if (empty($mark_ary)) { trigger_error($user->lang['NO_USERS'] . adm_back_link($this->u_action . '&action=list&g=' . $group_id), E_USER_WARNING); } @@ -128,45 +128,7 @@ class acp_groups if (confirm_box(true)) { $group_name = ($group_row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $group_row['group_name']] : $group_row['group_name']; - - if (!sizeof($mark_ary)) - { - $start = 0; - - do - { - $sql = 'SELECT user_id - FROM ' . USER_GROUP_TABLE . " - WHERE group_id = $group_id - ORDER BY user_id"; - $result = $db->sql_query_limit($sql, 200, $start); - - $mark_ary = array(); - if ($row = $db->sql_fetchrow($result)) - { - do - { - $mark_ary[] = $row['user_id']; - } - while ($row = $db->sql_fetchrow($result)); - - group_user_attributes('default', $group_id, $mark_ary, false, $group_name, $group_row); - - $start = (sizeof($mark_ary) < 200) ? 0 : $start + 200; - } - else - { - $start = 0; - } - $db->sql_freeresult($result); - } - while ($start); - } - else - { - group_user_attributes('default', $group_id, $mark_ary, false, $group_name, $group_row); - } - + group_user_attributes('default', $group_id, $mark_ary, false, $group_name, $group_row); trigger_error($user->lang['GROUP_DEFS_UPDATED'] . adm_back_link($this->u_action . '&action=list&g=' . $group_id)); } else