bf290f81cefa9db968caeb0368abae06c9781158
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) 
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) */
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) 
31) if ($_GET['action'] == 'new')
32) {
33)   system_failure('not implemented');
34)   /*
bernd Primärer Useraccount kann d...

bernd authored 16 years ago

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

bernd authored 16 years ago

37)       filter_shell($_POST['password']) == '')
38)   {
39)     input_error('Sie müssen alle Felder ausfüllen!');
40)   }
41)   else
42)   {
43)     create_jabber_account($_POST['local'], $_POST['domain'], $_POST['password']);
44)     if (! $debugmode)
bernd Falsche Umleitung

bernd authored 13 years ago

45)       header('Location: account');
bernd Systemuser-Modul hinzugefügt

bernd authored 16 years ago

46)   }
47)   */
48) }
bernd Überarbeitetes Systemuser-M...

bernd authored 14 years ago

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

bernd authored 16 years ago

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

bernd authored 14 years ago

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

bernd authored 16 years ago

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

bernd authored 14 years ago

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

bernd authored 16 years ago

57) 
bernd Überarbeitetes Systemuser-M...

bernd authored 14 years ago

58)   //if (! strong_password($_POST['newpass']))
59)   //  input_error('Das Passwort ist zu einfach');
60)   //else
61)   if ($_POST['newpass1'] == '' ||
62)       $_POST['newpass1'] != $_POST['newpass2'])
63)   {
64)     input_error('Bitte zweimal ein neues Passwort eingeben!');
65)     $error = true;
66)   }
67)   else
bernd Systemuser-Modul hinzugefügt

bernd authored 16 years ago

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

bernd authored 14 years ago

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

bernd authored 16 years ago

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

bernd authored 14 years ago

73)   if (! ($debugmode || $error))
bernd Falsche Umleitung

bernd authored 13 years ago

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

bernd authored 14 years ago

75) }
76) elseif ($_GET['action'] == 'edit')
77) {
78)   check_form_token('systemuser_edit');
bernd Erlaube Änderung von Name u...

bernd authored 14 years ago

79)   $account = NULL;
80)   if ($role & ROLE_CUSTOMER)
81)     $account = get_account_details($_REQUEST['uid']);
82)   else
83)     $account = get_account_details($_SESSION['userinfo']['uid'], $_SESSION['userinfo']['customerno']);
bernd Überarbeitetes Systemuser-M...

bernd authored 14 years ago

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

bernd authored 14 years ago

85)   if ($role & ROLE_CUSTOMER)
86)   {
87)     $customerquota = get_customer_quota();
88)     $maxquota = $customerquota['max'] - $customerquota['assigned'] + $account['quota'];
89)    
90)     $quota = (int) $_POST['quota'];
91)     if ($quota > $maxquota) 
92)       system_failure("Sie können diesem Account maximal {$maxquota} MB Speicherplatz zuweisen.");
93)     $account['quota'] = $quota;
94)   }
bernd Überarbeitetes Systemuser-M...

bernd authored 14 years ago

95) 
96)   if ($_POST['defaultname'] == 1)
97)     $account['name'] = NULL;
98)   else
99)     $account['name'] = filter_input_general($_POST['fullname']);
100)   
101)   $shells = available_shells();
102)   if (isset($shells[$_POST['shell']]))
103)     $account['shell'] = $_POST['shell'];
bernd Fehlermeldung, wenn ungülti...

bernd authored 14 years ago

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

bernd authored 16 years ago

107) 
bernd Überarbeitetes Systemuser-M...

bernd authored 14 years ago

108)   set_account_details($account);
Bernd Wurst Redirect non-customer users...

Bernd Wurst authored 11 years ago

109)   if (! ($debugmode || $error)) {
110)     $location = 'myaccount';
111)     if ($_SESSION['role'] & ROLE_CUSTOMER) {
112)       $location = 'account';
113)     }
114)     header('Location: '.$location);
115)   }
bernd Systemuser-Modul hinzugefügt

bernd authored 16 years ago

116)   
117) }
118) elseif ($_GET['action'] == 'delete')
119) {
120)   system_failure("Benutzeraccounts zu löschen ist momentan nicht über diese Oberfläche möglich. Bitte wenden Sie sich an einen Administrator.");
121)   /*
122)   $account_string = filter_input_general( $account['local'].'@'.$account['domain'] );
123)   $sure = user_is_sure();
124)   if ($sure === NULL)
125)   {
bernd * alle internen Links sinnv...

bernd authored 15 years ago

126)     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

127)   }
128)   elseif ($sure === true)
129)   {
130)     delete_jabber_account($account['id']);
131)     if (! $debugmode)
bernd Falsche Umleitung

bernd authored 13 years ago

132)       header("Location: account");
bernd Systemuser-Modul hinzugefügt

bernd authored 16 years ago

133)   }
134)   elseif ($sure === false)
135)   {
136)     if (! $debugmode)
bernd Falsche Umleitung

bernd authored 13 years ago

137)       header("Location: account");