SQL-Debug eingebaut

isUserInGroup überarbeitet
main
radiskull 13 years ago
parent 3300e7bf91
commit f194f795df

@ -8,6 +8,7 @@
include_once (ROOT_PATH . '/include/defines.inc.php');
include_once(ROOT_PATH.'/include/parse.inc.php');
include_once(ROOT_PATH.'/include/sqlwrapper.inc.php');
//Konstanten
defineIfNotDefined('ADMIN', 1);
@ -28,13 +29,13 @@ function getUserGroups($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.'\'';
$qry = mysql_query($test);
$qry = db_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.'\'';
$qry = mysql_query($test);
$qry = db_query($test);
}
$i = 0;
@ -46,6 +47,9 @@ function getUserGroups($user) {
}
function isUserInGroup(array $usergrouparray, $group) {
if($group == null || count($usergrouparray) == 0 || $usergrouparray == null) {
return false;
}
for($i = 0; $i < count($usergrouparray); $i++) {
if($usergrouparray[$i]['gruppen_id'] == $group) {
return true;
@ -59,7 +63,7 @@ function removeUserFromGroup($user, $group) {
if ($group !== NULL && $group >= 0) {
$qry = 'DELETE FROM user_gruppe_zuordnung WHERE user_id in (SELECT id FROM user WHERE nickname = \''.$user.
'\') AND gruppen_id = '.$group.';';
mysql_query($qry);
db_query($qry);
return true;
}
}
@ -71,7 +75,7 @@ function addUserToGroup($user, $group) {
if ($group !== NULL && $group >= 0) {
$qry = 'INSERT INTO user_gruppe_zuordnung(user_id, gruppen_id)
VALUES((SELECT id FROM user WHERE nickname = \''.$user.'\'), '.$group.');';
mysql_query($qry);
db_query($qry);
return true;
}
}

Loading…
Cancel
Save