dcc202fb249a446ac15c7cf413b9f1b4a3f31b58
bernd Systemuser-Modul hinzugefügt

bernd authored 16 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) 
Hanno Böck Change license from CC0 to...

Hanno Böck authored 1 year ago

5) Written by schokokeks.org Hosting, namely
Bernd Wurst Added license tags for CC0,...

Bernd Wurst authored 12 years ago

6)   Bernd Wurst <bernd@schokokeks.org>
7)   Hanno Böck <hanno@schokokeks.org>
8) 
Hanno Böck Change license from CC0 to...

Hanno Böck authored 1 year ago

9) This code is published under a 0BSD license.
Bernd Wurst Added license tags for CC0,...

Bernd Wurst authored 12 years ago

10) 
11) 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.
12) */
bernd Systemuser-Modul hinzugefügt

bernd authored 16 years ago

13) 
14) require_once('session/start.php');
15) 
16) require_once('useraccounts.php');
17) 
18) require_once('inc/security.php');
19) 
20) 
Hanno Böck Codingstyle PSR12 + array s...

Hanno Böck authored 2 years ago

21) require_role([ROLE_CUSTOMER, ROLE_SYSTEMUSER]);
bernd Erlaube Änderung von Name u...

bernd authored 14 years ago

22) 
23) $role = $_SESSION['role'];
bernd Systemuser-Modul hinzugefügt

bernd authored 16 years ago

24) 
25) require_once("inc/debug.php");
26) global $debugmode;
27) 
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

28) if ($_GET['action'] == 'new') {
29)     system_failure('not implemented');
30) /*
31) check_form_token('systemuser_new');
32) if (filter_input_username($_POST['username']) == '' ||
33)     filter_shell($_POST['password']) == '')
bernd Systemuser-Modul hinzugefügt

bernd authored 16 years ago

34) {
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

35)   input_error('Sie müssen alle Felder ausfüllen!');
bernd Systemuser-Modul hinzugefügt

bernd authored 16 years ago

36) }
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

37) else
bernd Systemuser-Modul hinzugefügt

bernd authored 16 years ago

38) {
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

39)   create_jabber_account($_POST['local'], $_POST['domain'], $_POST['password']);
40)   if (! $debugmode)
bernd Falsche Umleitung

bernd authored 13 years ago

41)     header('Location: account');
bernd Überarbeitetes Systemuser-M...

bernd authored 14 years ago

42) }
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

43) */
44) } elseif ($_GET['action'] == 'pwchange') {
45)     if (! $role & ROLE_CUSTOMER) {
46)         system_failure("Zum Ändern Ihres Passworts verwenden Sie bitte die Funktion im Hauptmenü!");
47)     }
48)     $error = false;
49)     check_form_token('systemuser_pwchange');
50)     if (customer_useraccount($_REQUEST['uid'])) {
51)         system_failure('Zum Ändern dieses Passworts verwenden Sie bitte die Funktion im Hauptmenü!');
52)     }
53) 
54)     //if (! strong_password($_POST['newpass']))
55)     //  input_error('Das Passwort ist zu einfach');
56)     //else
57)     if ($_POST['newpass1'] == '' ||
58)       $_POST['newpass1'] != $_POST['newpass2']) {
59)         input_error('Bitte zweimal ein neues Passwort eingeben!');
60)         $error = true;
61)     } else {
62)         $user = get_account_details($_REQUEST['uid']);
63)         # set_systemuser_password kommt aus den Session-Funktionen!
64)         set_systemuser_password($user['uid'], $_POST['newpass1']);
65)     }
66)     if (! ($debugmode || $error)) {
67)         header('Location: account');
68)     }
69) } elseif ($_GET['action'] == 'edit') {
70)     check_form_token('systemuser_edit');
71)     $account = null;
72)     if ($role & ROLE_CUSTOMER) {
73)         $account = get_account_details($_REQUEST['uid']);
74)     } else {
75)         $account = get_account_details($_SESSION['userinfo']['uid'], $_SESSION['userinfo']['customerno']);
76)     }
77) 
78)     if ($role & ROLE_CUSTOMER) {
79)         $customerquota = get_customer_quota();
80)         $maxquota = $customerquota['max'] - $customerquota['assigned'] + $account['quota'];
Hanno remove whitespace in empty...

Hanno authored 5 years ago

81) 
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

82)         $quota = (int) $_POST['quota'];
83)         if ($quota > $maxquota) {
84)             system_failure("Sie können diesem Account maximal {$maxquota} MB Speicherplatz zuweisen.");
85)         }
86)         $account['quota'] = $quota;
87)     }
88) 
89)     if ($_POST['defaultname'] == 1) {
90)         $account['name'] = null;
91)     } else {
Bernd Wurst Umstellung von filter_input...

Bernd Wurst authored 4 years ago

92)         $account['name'] = filter_input_oneline($_POST['fullname']);
Bernd Wurst Redirect non-customer users...

Bernd Wurst authored 11 years ago

93)     }
Hanno remove whitespace in empty...

Hanno authored 5 years ago

94) 
Bernd Wurst add feature to disable SSH...

Bernd Wurst authored 3 years ago

95)     if (isset($_POST['passwordlogin'])) {
96)         $account['passwordlogin'] = (int) $_POST['passwordlogin'];
97)     }
98) 
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

99)     $shells = available_shells();
100)     if (isset($shells[$_POST['shell']])) {
101)         $account['shell'] = $_POST['shell'];
102)     } elseif (isset($_POST['shell']) && $_POST['shell'] != '') {
103)         system_failure('Ungültige Shell');
104)     }
105) 
106)     set_account_details($account);
Bernd Wurst unneeded variable

Bernd Wurst authored 5 years ago

107)     if (! ($debugmode)) {
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

108)         $location = 'myaccount';
109)         if ($_SESSION['role'] & ROLE_CUSTOMER) {
110)             $location = 'account';
111)         }
112)         header('Location: '.$location);
113)     }
114) } elseif ($_GET['action'] == 'delete') {
115)     system_failure("Benutzeraccounts zu löschen ist momentan nicht über diese Oberfläche möglich. Bitte wenden Sie sich an einen Administrator.");
116) /*
Bernd Wurst Umstellung von filter_input...

Bernd Wurst authored 4 years ago

117) $account_string = filter_output_html($account['local'].'@'.$account['domain']);
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

118) $sure = user_is_sure();
119) if ($sure === NULL)
120) {
121)   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

122) }
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

123) elseif ($sure === true)
bernd Systemuser-Modul hinzugefügt

bernd authored 16 years ago

124) {
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

125)   delete_jabber_account($account['id']);
126)   if (! $debugmode)
127)     header("Location: account");
128) }
129) elseif ($sure === false)
130) {
131)   if (! $debugmode)
132)     header("Location: account");
133) }
134) */
135) } else {
136)     system_failure("Unimplemented action");