fix for user groups!

main
hecht 13 years ago
parent 9813e7c62f
commit 395bba9500

@ -19,17 +19,18 @@ function displayUserLink($userid, $username = NULL, $clanpre = NULL, $clansu = N
function displayUserNameByID($userid, $showClanTags = TRUE){ function displayUserNameByID($userid, $showClanTags = TRUE){
if($userid === null){return '';} 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)); $user_info = mysql_fetch_assoc(mysql_query($sql));
if($user_info['gm'] != 'nein'){ if(isUserInGroup(groups, admin)){
if($user_info['gm'] == 'ja'){ $color = 'style="color:'.$GLOBALS['COLOR_GM'].'"';
$color = 'style="color:'.$GLOBALS['COLOR_GM'].'"'; } else if(isUserInGroup(groups, entwickler)){
} else if($user_info['gm'] == 'et'){ $color = 'style="color:'.$GLOBALS['COLOR_DEVELOPER'].'"';
$color = 'style="color:'.$GLOBALS['COLOR_DEVELOPER'].'"'; } else if(isUserInGroup(groups, designer)){
} else if($user_info['gm'] == 'ka'){ $color = 'style="color:'.$GLOBALS['COLOR_CREATIVE'].'"';
$color = 'style="color:'.$GLOBALS['COLOR_CREATIVE'].'"'; } else if(isUserInGroup(groups, Werbung_an)){
}
} else if($user_info['ads'] == 1){
$color = 'style="color:'.$GLOBALS['COLOR_SUPPORTER'].'"'; $color = 'style="color:'.$GLOBALS['COLOR_SUPPORTER'].'"';
} else{ } else{
$color = ''; $color = '';

@ -26,13 +26,13 @@ function getUserGroups($user) {
if(is_numeric($user)) { if(is_numeric($user)) {
$test = 'SELECT ug.gruppen_name, ug.gruppen_id FROM user_gruppe_zuordnung as ugz $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_gruppe as ug ON ugz.gruppen_id=ug.gruppen_id
WHERE ugz.user_id = \''.$user.'\''; WHERE ugz.user_id = \''.$user.'\'';
$qry = mysql_query($test); $qry = mysql_query($test);
} else if (validateString($user) != null) { } else if (validateString($user) != null) {
$test = 'SELECT ug.gruppen_name, ug.gruppen_id FROM user_gruppe_zuordnung as ugz $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_gruppe as ug ON ugz.gruppen_id=ug.gruppen_id
INNER JOIN user as u ON u.id=ugz.user_id INNER JOIN user as u ON u.id=ugz.user_id
WHERE u.nickname = \''.$user.'\''; WHERE u.nickname = \''.$user.'\'';
$qry = mysql_query($test); $qry = mysql_query($test);
} }
@ -45,7 +45,7 @@ function getUserGroups($user) {
return $groups; return $groups;
} }
function isUserInGroup($usergrouparray, $group) { function isUserInGroup(array $usergrouparray, $group) {
for($i = 0; $i < count($usergrouparray); $i++) { for($i = 0; $i < count($usergrouparray); $i++) {
if($usergrouparray[$i]['gruppen_id'] == $group) { if($usergrouparray[$i]['gruppen_id'] == $group) {
return true; return true;

Loading…
Cancel
Save