From 431e494ae43257bea251a59ed6b2a4bb20eb7fd4 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Thu, 6 Apr 2006 17:15:45 +0000 Subject: To all people having their bug status set to fixed: SF pserver CVS access is currently down, therefore the snapshots are still out of date. - fix a bunch of bugs - is no longer allowed in template (.html) files - changed layout of private message screens (folders are menu items) - removed unread mode for private messages - added new feature to template engine - "jump out of loop" or "loop another loop within my loop" :D (will be documented within the coding guidelines) - added autologin field to sessions - check session length checks - added add_log statement to sessions to track session valid to invalid changes if ip/browser change depending on config settings (only debug) - added multibyte support for various variables (exception at the moment is usernames which needs some discussion) - hopefully not broke something. :/ git-svn-id: file:///svn/phpbb/trunk@5765 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions_user.php | 55 ++++++++++++++++++--------------------- 1 file changed, 26 insertions(+), 29 deletions(-) (limited to 'phpBB/includes/functions_user.php') diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php index 0b0adbcee5..4795348189 100644 --- a/phpBB/includes/functions_user.php +++ b/phpBB/includes/functions_user.php @@ -1253,12 +1253,7 @@ function group_delete($group_id, $group_name = false) if (!$group_name) { - $sql = 'SELECT group_name - FROM ' . GROUPS_TABLE . " - WHERE group_id = $group_id"; - $result = $db->sql_query($sql); - $group_name = (string) $db->sql_fetchfield('group_name'); - $db->sql_freeresult($result); + $group_name = get_group_name($group_id); } $start = 0; @@ -1403,17 +1398,7 @@ function group_user_add($group_id, $user_id_ary = false, $username_ary = false, if (!$group_name) { - $sql = 'SELECT group_name - FROM ' . GROUPS_TABLE . " - WHERE group_id = $group_id"; - $result = $db->sql_query($sql); - - if (!extract($db->sql_fetchrow($result))) - { - trigger_error("Could not obtain name of group $group_id", E_USER_ERROR); - } - - $db->sql_freeresult($result); + $group_name = get_group_name($group_id); } $log = ($leader) ? 'LOG_MODS_ADDED' : 'LOG_USERS_ADDED'; @@ -1526,12 +1511,7 @@ function group_user_del($group_id, $user_id_ary = false, $username_ary = false, if (!$group_name) { - $sql = 'SELECT group_name - FROM ' . GROUPS_TABLE . " - WHERE group_id = $group_id"; - $result = $db->sql_query($sql); - $group_name = (string) $db->sql_fetchfield('group_name'); - $db->sql_freeresult($result); + $group_name = get_group_name($group_id); } $log = 'LOG_GROUP_REMOVE'; @@ -1590,12 +1570,7 @@ function group_user_attributes($action, $group_id, $user_id_ary = false, $userna if (!$group_name) { - $sql = 'SELECT group_name - FROM ' . GROUPS_TABLE . " - WHERE group_id = $group_id"; - $result = $db->sql_query($sql); - $group_name = (string) $db->sql_fetchfield('group_name'); - $db->sql_freeresult($result); + $group_name = get_group_name($group_id); } add_log('admin', $log, $group_name, implode(', ', $username_ary)); @@ -1653,6 +1628,28 @@ function group_set_user_default($group_id, $user_id_ary, $group_attributes = fal $db->sql_query($sql); } +/** +* Get group name +*/ +function get_group_name($group_id) +{ + global $db, $user; + + $sql = 'SELECT group_name, group_type + FROM ' . GROUPS_TABLE . ' + WHERE group_id = ' . (int) $group_id; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if (!$row) + { + return ''; + } + + return ($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['group_name']] : $row['group_name']; +} + /** * Obtain either the members of a specified group, the groups the specified user is subscribed to * or checking if a specified user is in a specified group -- cgit v1.2.1