7f815276981e366df7e6f3b6ccb92ebeca624fb3
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) 
Bernd Wurst Copyright year update

Bernd Wurst authored 6 years ago

5) Written 2008-2018 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) 
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) 
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

11) You should have received a copy of the CC0 Public Domain Dedication along with this software. If not, see
Bernd Wurst Added license tags for CC0,...

Bernd Wurst authored 12 years ago

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

bernd authored 16 years ago

16) 
17) require_once('session/start.php');
18) 
19) require_once('useraccounts.php');
20) 
21) require_once('inc/security.php');
22) 
23) 
bernd Erlaube Änderung von Name u...

bernd authored 14 years ago

24) require_role(array(ROLE_CUSTOMER, ROLE_SYSTEMUSER));
25) 
26) $role = $_SESSION['role'];
bernd Systemuser-Modul hinzugefügt

bernd authored 16 years ago

27) 
28) require_once("inc/debug.php");
29) global $debugmode;
30) 
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

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

bernd authored 16 years ago

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

Hanno authored 5 years ago

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

bernd authored 16 years ago

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

Hanno authored 5 years ago

40) else
bernd Systemuser-Modul hinzugefügt

bernd authored 16 years ago

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

Hanno authored 5 years ago

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

bernd authored 13 years ago

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

bernd authored 14 years ago

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

Hanno authored 5 years ago

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

Hanno authored 5 years ago

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

Hanno authored 5 years ago

85)         $quota = (int) $_POST['quota'];
86)         if ($quota > $maxquota) {
87)             system_failure("Sie können diesem Account maximal {$maxquota} MB Speicherplatz zuweisen.");
88)         }
89)         $account['quota'] = $quota;
90)     }
91) 
92)     if ($_POST['defaultname'] == 1) {
93)         $account['name'] = null;
94)     } else {
95)         $account['name'] = filter_input_general($_POST['fullname']);
Bernd Wurst Redirect non-customer users...

Bernd Wurst authored 11 years ago

96)     }
Hanno remove whitespace in empty...

Hanno authored 5 years ago

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

Hanno authored 5 years ago

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

Bernd Wurst authored 5 years ago

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

Hanno authored 5 years ago

107)         $location = 'myaccount';
108)         if ($_SESSION['role'] & ROLE_CUSTOMER) {
109)             $location = 'account';
110)         }
111)         header('Location: '.$location);
112)     }
113) } elseif ($_GET['action'] == 'delete') {
114)     system_failure("Benutzeraccounts zu löschen ist momentan nicht über diese Oberfläche möglich. Bitte wenden Sie sich an einen Administrator.");
115) /*
116) $account_string = filter_input_general( $account['local'].'@'.$account['domain'] );
117) $sure = user_is_sure();
118) if ($sure === NULL)
119) {
120)   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

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

Hanno authored 5 years ago

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

bernd authored 16 years ago

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

Hanno authored 5 years ago

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