bf1049d98f1a667cd64dc1626538facd33c55709
bernd Systemuser-Modul hinzugefügt

bernd authored 16 years ago

1) <?php
2) 
3) require_once('session/start.php');
4) 
5) require_once('useraccounts.php');
6) 
7) require_once('inc/security.php');
8) 
9) 
bernd Erlaube Änderung von Name u...

bernd authored 14 years ago

10) require_role(array(ROLE_CUSTOMER, ROLE_SYSTEMUSER));
11) 
12) $role = $_SESSION['role'];
bernd Systemuser-Modul hinzugefügt

bernd authored 16 years ago

13) 
14) require_once("inc/debug.php");
15) global $debugmode;
16) 
17) if ($_GET['action'] == 'new')
18) {
19)   system_failure('not implemented');
20)   /*
bernd Primärer Useraccount kann d...

bernd authored 16 years ago

21)   check_form_token('systemuser_new');
22)   if (filter_input_username($_POST['username']) == '' ||
bernd Systemuser-Modul hinzugefügt

bernd authored 16 years ago

23)       filter_shell($_POST['password']) == '')
24)   {
25)     input_error('Sie müssen alle Felder ausfüllen!');
26)   }
27)   else
28)   {
29)     create_jabber_account($_POST['local'], $_POST['domain'], $_POST['password']);
30)     if (! $debugmode)
bernd eliminate .php extensions f...

bernd authored 15 years ago

31)       header('Location: accounts');
bernd Systemuser-Modul hinzugefügt

bernd authored 16 years ago

32)   }
33)   */
34) }
bernd Überarbeitetes Systemuser-M...

bernd authored 14 years ago

35) elseif ($_GET['action'] == 'pwchange')
bernd Systemuser-Modul hinzugefügt

bernd authored 16 years ago

36) {
bernd Erlaube Änderung von Name u...

bernd authored 14 years ago

37)   if (! $role & ROLE_CUSTOMER)
38)     system_failure("Zum Ändern Ihres Passworts verwenden Sie bitte die Funktion im Hauptmenü!");
bernd Systemuser-Modul hinzugefügt

bernd authored 16 years ago

39)   $error = false;
bernd Überarbeitetes Systemuser-M...

bernd authored 14 years ago

40)   check_form_token('systemuser_pwchange');
41)   if (customer_useraccount($_REQUEST['uid']))
42)     system_failure('Zum Ändern dieses Passworts verwenden Sie bitte die Funktion im Hauptmenü!');
bernd Primärer Useraccount kann d...

bernd authored 16 years ago

43) 
bernd Überarbeitetes Systemuser-M...

bernd authored 14 years ago

44)   //if (! strong_password($_POST['newpass']))
45)   //  input_error('Das Passwort ist zu einfach');
46)   //else
47)   if ($_POST['newpass1'] == '' ||
48)       $_POST['newpass1'] != $_POST['newpass2'])
49)   {
50)     input_error('Bitte zweimal ein neues Passwort eingeben!');
51)     $error = true;
52)   }
53)   else
bernd Systemuser-Modul hinzugefügt

bernd authored 16 years ago

54)   {
bernd Überarbeitetes Systemuser-M...

bernd authored 14 years ago

55)     $user = get_account_details($_REQUEST['uid']);
56)     # set_systemuser_password kommt aus den Session-Funktionen!
57)     set_systemuser_password($user['uid'], $_POST['newpass1']);
bernd Systemuser-Modul hinzugefügt

bernd authored 16 years ago

58)   }
bernd Überarbeitetes Systemuser-M...

bernd authored 14 years ago

59)   if (! ($debugmode || $error))
60)     header('Location: accounts');
61) }
62) elseif ($_GET['action'] == 'edit')
63) {
64)   check_form_token('systemuser_edit');
bernd Erlaube Änderung von Name u...

bernd authored 14 years ago

65)   $account = NULL;
66)   if ($role & ROLE_CUSTOMER)
67)     $account = get_account_details($_REQUEST['uid']);
68)   else
69)     $account = get_account_details($_SESSION['userinfo']['uid'], $_SESSION['userinfo']['customerno']);
bernd Überarbeitetes Systemuser-M...

bernd authored 14 years ago

70) 
bernd Erlaube Änderung von Name u...

bernd authored 14 years ago

71)   if ($role & ROLE_CUSTOMER)
72)   {
73)     $customerquota = get_customer_quota();
74)     $maxquota = $customerquota['max'] - $customerquota['assigned'] + $account['quota'];
75)    
76)     $quota = (int) $_POST['quota'];
77)     if ($quota > $maxquota) 
78)       system_failure("Sie können diesem Account maximal {$maxquota} MB Speicherplatz zuweisen.");
79)     $account['quota'] = $quota;
80)   }
bernd Überarbeitetes Systemuser-M...

bernd authored 14 years ago

81) 
82)   if ($_POST['defaultname'] == 1)
83)     $account['name'] = NULL;
84)   else
85)     $account['name'] = filter_input_general($_POST['fullname']);
86)   
87)   $shells = available_shells();
88)   if (isset($shells[$_POST['shell']]))
89)     $account['shell'] = $_POST['shell'];
bernd Fehlermeldung, wenn ungülti...

bernd authored 14 years ago

90)   else
91)     if (isset($_POST['shell']) && $_POST['shell'] != '')
92)       system_failure('Ungültige Shell');
bernd Systemuser-Modul hinzugefügt

bernd authored 16 years ago

93) 
bernd Überarbeitetes Systemuser-M...

bernd authored 14 years ago

94)   set_account_details($account);
bernd Erlaube Änderung von Name u...

bernd authored 14 years ago

95)   $target = 'accounts';
96)   if (! ($role & ROLE_CUSTOMER))
97)     $target = 'myaccount';
bernd Systemuser-Modul hinzugefügt

bernd authored 16 years ago

98)   if (! ($debugmode || $error))
bernd Erlaube Änderung von Name u...

bernd authored 14 years ago

99)     header('Location: '.$target);
bernd Systemuser-Modul hinzugefügt

bernd authored 16 years ago

100)   
101) }
102) elseif ($_GET['action'] == 'delete')
103) {
104)   system_failure("Benutzeraccounts zu löschen ist momentan nicht über diese Oberfläche möglich. Bitte wenden Sie sich an einen Administrator.");
105)   /*
106)   $account_string = filter_input_general( $account['local'].'@'.$account['domain'] );
107)   $sure = user_is_sure();
108)   if ($sure === NULL)
109)   {
bernd * alle internen Links sinnv...

bernd authored 15 years ago

110)     are_you_sure("action=delete&account={$_GET['account']}", "Möchten Sie den Account »{$account_string}« wirklich löschen?");
bernd Systemuser-Modul hinzugefügt

bernd authored 16 years ago

111)   }
112)   elseif ($sure === true)
113)   {
114)     delete_jabber_account($account['id']);
115)     if (! $debugmode)
bernd eliminate .php extensions f...

bernd authored 15 years ago

116)       header("Location: accounts");
bernd Systemuser-Modul hinzugefügt

bernd authored 16 years ago

117)   }
118)   elseif ($sure === false)
119)   {
120)     if (! $debugmode)
bernd eliminate .php extensions f...

bernd authored 15 years ago

121)       header("Location: accounts");