63a0529b21bfd97a4ef395e8d3d3f513526357c6
bernd Systemuser-Modul hinzugefügt

bernd authored 16 years ago

1) <?php
2) 
3) require_once("inc/debug.php");
4) require_once("inc/db_connect.php");
5) 
6) require_role(ROLE_CUSTOMER);
7) 
8) 
9) function customer_may_have_useraccounts()
10) {
11)   $customerno = (int) $_SESSION['customerinfo']['customerno'];
12)   $result = db_query("SELECT COUNT(*) FROM system.useraccounts WHERE kunde={$customerno}");
13)   return (mysql_num_rows($result) > 0);
14) }
15) 
bernd nicht mehr der user mit der...

bernd authored 16 years ago

16) function customer_useraccount($uid) {
17)   $uid = (int) $uid;
18)   $customerno = (int) $_SESSION['customerinfo']['customerno'];
19)   $result = db_query("SELECT 1 FROM system.useraccounts WHERE kunde={$customerno} AND uid={$uid} AND kundenaccount=1");
20)   return mysql_num_rows($result) > 0;
21) }
bernd Systemuser-Modul hinzugefügt

bernd authored 16 years ago

22) 
bernd Primärer Useraccount kann d...

bernd authored 16 years ago

23) function primary_useraccount()
24) {
25)   if (! ($_SESSION['role'] & ROLE_SYSTEMUSER))
26)     return NULL;
27)   $customerno = (int) $_SESSION['customerinfo']['customerno'];
28)   $result = db_query("SELECT MIN(uid) AS uid FROM system.useraccounts WHERE kunde={$customerno}");
29)   $uid = mysql_fetch_object($result)->uid;
30)   DEBUG("primary useraccount: {$uid}");
31)   return $uid;
32) }
33) 
34) 
bernd Systemuser-Modul hinzugefügt

bernd authored 16 years ago

35) 
36) function list_useraccounts()
37) {
38)   $customerno = (int) $_SESSION['customerinfo']['customerno'];
bernd softquota -> quota

bernd authored 16 years ago

39)   $result = db_query("SELECT uid,username,name,erstellungsdatum,quota FROM system.useraccounts WHERE kunde={$customerno}");
bernd Systemuser-Modul hinzugefügt

bernd authored 16 years ago

40)   $ret = array();
41)   while ($item = mysql_fetch_object($result))
42)   {
43)     DEBUG('Useraccount: '.print_r($item, true));
44)     array_push($ret, $item);
45)   }
46)   return $ret;
47) }
48) 
49) 
50) function get_account_details($uid)
51) {
52)   $uid = (int) $uid;
53)   $customerno = (int) $_SESSION['customerinfo']['customerno'];
bernd softquota -> quota

bernd authored 16 years ago

54)   $result = db_query("SELECT uid,username,name FROM system.useraccounts WHERE kunde={$customerno} AND uid={$uid}");
bernd Systemuser-Modul hinzugefügt

bernd authored 16 years ago

55)   if (mysql_num_rows($result) == 0)
56)     system_failure("Cannot find the requestes useraccount (for this customer).");
57)   return mysql_fetch_array($result);
58) }
59) 
60) 
61) 
62) function set_systemuser_details($uid, $fullname, $quota)
63) {
64)   $uid = (int) $uid;
65)   $customerno = (int) $_SESSION['customerinfo']['customerno'];
bernd XSS-Fehler

bernd authored 16 years ago

66)   $fullname = maybe_null(mysql_real_escape_string(filter_input_general($fullname)));
bernd Systemuser-Modul hinzugefügt

bernd authored 16 years ago

67)   $quota = (int) $quota;
68) 
69)   db_query("UPDATE system.useraccounts SET name={$fullname} WHERE kunde={$customerno} AND uid={$uid} LIMIT 1");
bernd eliminate .php extensions f...

bernd authored 15 years ago

70)   logger("modules/systemuser/include/useraccounts", "systemuser", "updated real name for uid {$uid}");