0ea04e89856b9e21cffe1921cda1d8bc5d968ffd
2 require_once 'diogenes.common.inc.php';
3 require_once 'diogenes.admin.inc.php';
5 $page = new DiogenesAdmin
;
7 $action = isset($_REQUEST['action']) ?
$_REQUEST['action'] : "";
10 if (isset($_REQUEST['auth']) && isset($_REQUEST['username'])) {
11 $auth = $_REQUEST['auth'];
12 if ($uid = call_user_func(array($globals->session
,'getUserId'),$auth,$_REQUEST['username']))
13 $globals->db
->query("insert into diogenes_perm set alias='{$page->alias}',auth='$auth',uid='$uid',perms='user'");
15 $page->info(__("Could not find requested user")." '{$_REQUEST['username']}'");
19 if (isset($_REQUEST['auth']) && isset($_REQUEST['uid']))
20 $globals->db
->query("delete from diogenes_perm where alias='{$page->alias}' and auth='{$_REQUEST['auth']}' and uid='{$_REQUEST['uid']}' and perms='user'");
24 $page->assign('greeting',__("Users administration"));
25 $page->assign('msg_users',__("Registered users"));
26 $page->assign('msg_admins',__("Administrators"));
27 $page->assign('post',$page->script_self());
28 $page->assign('user',__("user"));
29 $page->assign('action',__("action"));
31 // retrieve the list of users
32 $res = $globals->db
->query("select uid,auth from diogenes_perm where alias='{$page->alias}' and perms='user'");
33 while (list($uid,$auth) = mysql_fetch_row($res)) {
34 $username = call_user_func(array($globals->session
,'getUsername'),$auth,$uid);
35 $page->append('users',array($username,$globals->tlabel
[$auth],array(__("remove"),"?action=remove&auth=$auth&uid=$uid")));
37 mysql_free_result($res);
39 // retrieve the list of admins
40 $res = $globals->db
->query("select uid,auth from diogenes_perm where alias='{$page->alias}' and perms='admin'");
41 while (list($uid,$auth) = mysql_fetch_row($res)) {
42 $username = call_user_func(array($globals->session
,'getUsername'),$auth,$uid);
43 $page->append('admins',array($username,$globals->tlabel
[$auth]));
45 mysql_free_result($res);
48 foreach ($globals->tauth
as $key=>$val)
49 $auths[$key]=$globals->tlabel
[$key];
50 $page->assign('auths',$auths);
51 $page->display('admin-users.tpl');