cd6247f792c22de8a24d67c10925355fcece13c1
Bernd Wurst Subusers-Modul in einer ers...

Bernd Wurst authored 12 years ago

1) <?php
Bernd Wurst Added license tags for CC0,...

Bernd Wurst authored 12 years ago

2) /*
3) This file belongs to the Webinterface of schokokeks.org Hosting
4) 
5) Written 2008-2012 by schokokeks.org Hosting, namely
6)   Bernd Wurst <bernd@schokokeks.org>
7)   Hanno Böck <hanno@schokokeks.org>
8) 
9) To the extent possible under law, the author(s) have dedicated all copyright and related and neighboring rights to this software to the public domain worldwide. This software is distributed without any warranty.
10) 
11) You should have received a copy of the CC0 Public Domain Dedication along with this software. If not, see 
12) http://creativecommons.org/publicdomain/zero/1.0/
13) 
14) Nevertheless, in case you use a significant part of this code, we ask (but not require, see the license) that you keep the authors' names in place and return your changes to the public. We would be especially happy if you tell us what you're going to do with this code.
15) */
16) 
Bernd Wurst changed subusers module to...

Bernd Wurst authored 12 years ago

17) require_role(ROLE_SYSTEMUSER);
Bernd Wurst Subusers-Modul in einer ers...

Bernd Wurst authored 12 years ago

18) require_once("inc/base.php");
19) require_once("inc/security.php");
20) require_once("inc/debug.php");
21) 
22) 
23) function list_subusers()
24) {
25)   $uid = (int) $_SESSION['userinfo']['uid'];
26)   $result = db_query("SELECT id, username, modules FROM system.subusers WHERE uid={$uid}");
27)   $subusers = array();
28)   while ($item = mysql_fetch_assoc($result))
29)   {
30)     $item['modules'] = explode(',', $item['modules']);
31)     $subusers[] = $item;
32)   }
33)   DEBUG($subusers);
34)   return $subusers;
35) }
36) 
37) 
38) function load_subuser($id) {
39)   $id = (int) $id;
40)   $uid = (int) $_SESSION['userinfo']['uid'];
41)   
42)   $result = db_query("SELECT id, username, modules FROM system.subusers WHERE uid={$uid} AND id={$id}");
43)   $item = mysql_fetch_assoc($result);
44)   $item['modules'] = explode(',', $item['modules']);
45)   return $item;
46) }
47) 
48) 
49) function available_modules()
50) {
51)   $modules = array();
bernd Lese Modul-Infos aus den in...

bernd authored 12 years ago

52)   $allmodules = get_modules_info();
53) 
54)   // Das su-Modul ist hierfuer unwichtig
55)   unset($allmodules['su']);
56) 
57)   foreach ($allmodules as $modname => $modinfo)
Bernd Wurst Subusers-Modul in einer ers...

Bernd Wurst authored 12 years ago

58)   {
bernd Lese Modul-Infos aus den in...

bernd authored 12 years ago

59)     if (isset($modinfo['permission']))
60)       $modules[$modname] = $modinfo['permission'];