You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
50 lines
1.3 KiB
50 lines
1.3 KiB
14 years ago
|
<?php
|
||
|
/*
|
||
|
*
|
||
|
* @copyright (c) 2010 animegame.eu
|
||
|
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public Licence
|
||
|
*
|
||
|
*/
|
||
|
|
||
|
//Konstanten
|
||
|
define("Admin", 1);
|
||
|
define("Tester", 2);
|
||
|
|
||
|
include_once($_SERVER['DOCUMENT_ROOT'].'ag/include/parse.inc.php');
|
||
|
|
||
|
function getUserGroups($user) {
|
||
|
$qry = null;
|
||
|
$groups = array();
|
||
|
|
||
|
//prüfen welcher wert für user steht (id oder name)
|
||
|
if(validateInteger($user, null) != null) {
|
||
|
$test = 'SELECT ug.gruppe_name, ug.gruppe_id FROM user_gruppe_zuordnung as ugz
|
||
|
INNER JOIN user_gruppe as ug ON ugz.gruppe_id=ug.gruppe_id
|
||
|
WHERE ugz.user_id = \''.$user.'\'';
|
||
|
$qry = mysql_query($test);
|
||
|
} else if (validateString($user) != null) {
|
||
|
$test = 'SELECT ug.gruppe_name, ug.gruppe_id FROM user_gruppe_zuordnung as ugz
|
||
|
INNER JOIN user_gruppe as ug ON ugz.gruppe_id=ug.gruppe_id
|
||
|
INNER JOIN user as u ON u.id=ugz.user_id
|
||
|
WHERE u.nickname = \''.$user.'\'';
|
||
|
$qry = mysql_query($test);
|
||
|
}
|
||
|
|
||
|
$i = 0;
|
||
|
while ($result = mysql_fetch_assoc($qry)) {
|
||
|
$groups[$i] = array("gruppe_id" => $result['gruppe_id'], "gruppe_name" => $result['gruppe_name']);
|
||
|
$i++;
|
||
|
}
|
||
|
|
||
|
return $groups;
|
||
|
}
|
||
|
|
||
|
function isUserInGroup($usergroup, $group) {
|
||
|
for($i = 0; $i < count($usergroup); $i++) {
|
||
|
if(in_array($group, $usergroup[$i])) {
|
||
|
return true;
|
||
|
}
|
||
|
}
|
||
|
return false;
|
||
|
}
|
||
|
?>
|