From 395bba9500d521facc09719b9d405c747858f972 Mon Sep 17 00:00:00 2001 From: hecht Date: Thu, 1 Sep 2011 08:25:37 +0000 Subject: [PATCH] fix for user groups! --- ag/include/designfunctions.inc.php | 21 +++++++++++---------- ag/include/usergroup.inc.php | 10 +++++----- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/ag/include/designfunctions.inc.php b/ag/include/designfunctions.inc.php index ee7161f..194ec2c 100644 --- a/ag/include/designfunctions.inc.php +++ b/ag/include/designfunctions.inc.php @@ -19,17 +19,18 @@ function displayUserLink($userid, $username = NULL, $clanpre = NULL, $clansu = N function displayUserNameByID($userid, $showClanTags = TRUE){ if($userid === null){return '';} - $sql = 'select nickname, user.id as userid, clan.clanz_pre, clan.clanz_suff, ads, gm from user left join clan on user.clan = clan.id where user.id = '.$userid; + + $groups = getUserGroups($userid); + + $sql = 'select nickname, user.id as userid, clan.clanz_pre, clan.clanz_suff from user left join clan on user.clan = clan.id where user.id = '.$userid; $user_info = mysql_fetch_assoc(mysql_query($sql)); - if($user_info['gm'] != 'nein'){ - if($user_info['gm'] == 'ja'){ - $color = 'style="color:'.$GLOBALS['COLOR_GM'].'"'; - } else if($user_info['gm'] == 'et'){ - $color = 'style="color:'.$GLOBALS['COLOR_DEVELOPER'].'"'; - } else if($user_info['gm'] == 'ka'){ - $color = 'style="color:'.$GLOBALS['COLOR_CREATIVE'].'"'; - } - } else if($user_info['ads'] == 1){ + if(isUserInGroup(groups, admin)){ + $color = 'style="color:'.$GLOBALS['COLOR_GM'].'"'; + } else if(isUserInGroup(groups, entwickler)){ + $color = 'style="color:'.$GLOBALS['COLOR_DEVELOPER'].'"'; + } else if(isUserInGroup(groups, designer)){ + $color = 'style="color:'.$GLOBALS['COLOR_CREATIVE'].'"'; + } else if(isUserInGroup(groups, Werbung_an)){ $color = 'style="color:'.$GLOBALS['COLOR_SUPPORTER'].'"'; } else{ $color = ''; diff --git a/ag/include/usergroup.inc.php b/ag/include/usergroup.inc.php index 28b5abb..07b8ab9 100644 --- a/ag/include/usergroup.inc.php +++ b/ag/include/usergroup.inc.php @@ -26,13 +26,13 @@ function getUserGroups($user) { if(is_numeric($user)) { $test = 'SELECT ug.gruppen_name, ug.gruppen_id FROM user_gruppe_zuordnung as ugz INNER JOIN user_gruppe as ug ON ugz.gruppen_id=ug.gruppen_id - WHERE ugz.user_id = \''.$user.'\''; + WHERE ugz.user_id = \''.$user.'\''; $qry = mysql_query($test); } else if (validateString($user) != null) { $test = 'SELECT ug.gruppen_name, ug.gruppen_id FROM user_gruppe_zuordnung as ugz - INNER JOIN user_gruppe as ug ON ugz.gruppen_id=ug.gruppen_id - INNER JOIN user as u ON u.id=ugz.user_id - WHERE u.nickname = \''.$user.'\''; + INNER JOIN user_gruppe as ug ON ugz.gruppen_id=ug.gruppen_id + INNER JOIN user as u ON u.id=ugz.user_id + WHERE u.nickname = \''.$user.'\''; $qry = mysql_query($test); } @@ -45,7 +45,7 @@ function getUserGroups($user) { return $groups; } -function isUserInGroup($usergrouparray, $group) { +function isUserInGroup(array $usergrouparray, $group) { for($i = 0; $i < count($usergrouparray); $i++) { if($usergrouparray[$i]['gruppen_id'] == $group) { return true;