684364550af6d8a17296f8e00de2fd283842cebb
2 require_once 'diogenes.common.inc.php';
3 require_once 'diogenes.toplevel.inc.php';
5 $page = new $globals->toplevel(true
);
6 $page->assign('post',$page->script_self());
7 $page->assign('greeting', __("Site administrators"));
8 $page->assign('msg_site',__("site"));
9 $page->assign('msg_admin',__("administrator"));
10 $page->assign('msg_actions',__("actions"));
12 $action = isset($_REQUEST['action']) ?
$_REQUEST['action'] : "";
15 if (isset($_REQUEST['target']) && isset($_REQUEST['auth']) && isset($_REQUEST['username'])) {
16 $auth = $_REQUEST['auth'];
17 if ($uid = call_user_func(array($globals->session
,'getUserId'),$auth,$_REQUEST['username']))
18 $globals->db
->query("replace into diogenes_perm set alias='{$_REQUEST['target']}',auth='$auth',uid='$uid',perms='admin'");
20 $page->info(__("Could not find requested user")." '{$_REQUEST['username']}'");
25 if (isset($_REQUEST['target']) && isset($_REQUEST['uid']))
26 $globals->db
->query("replace into diogenes_perm set alias='{$_REQUEST['target']}',auth='{$_REQUEST['auth']}',uid='{$_REQUEST['uid']}',perms='user'");
30 if (isset($_REQUEST['target']) && isset($_REQUEST['uid']))
31 $globals->db
->query("delete from diogenes_perm where alias='{$_REQUEST['target']}' and auth='{$_REQUEST['auth']}' and uid='{$_REQUEST['uid']}'");
35 // add alias/username entries
37 $res = $globals->db
->query("select s.alias,s.vhost,auth,uid from diogenes_perm as p".
38 " left join diogenes_site as s on s.alias=p.alias".
39 " where p.perms='admin' order by alias,auth");
40 while (list($target,$vhost,$auth,$uid) = mysql_fetch_row($res)) {
41 $username = call_user_func(array($globals->session
,'getUsername'),$auth,$uid);
43 array(__("site users"), $page->urlBarrel($target,$vhost,"admin/users")),
44 array(__("demote to user"),"?action=demote&target=$target&auth=$auth&uid=$uid"),
45 array(__("remove"),"?action=remove&target=$target&auth=$auth&uid=$uid"),
46 array(__("view log"),"logger.php?logauth=$auth&loguser=$username")
49 $page->append('entries',array($odd ?
"odd" : "even",$target,$globals->tlabel
[$auth],$username,$actions));
52 mysql_free_result($res);
55 $res = $globals->db
->query("select alias from diogenes_site");
57 while (list($target) = mysql_fetch_row($res))
58 $sites[$target]=$target;
59 $page->assign('sites', $sites);
60 mysql_free_result($res);
63 foreach ($globals->tauth
as $key=>$val)
64 $auths[$key]=$globals->tlabel
[$key];
65 $page->assign('auths',$auths);
67 $page->display('toplevel-admins.tpl');