5339d3a4905615e46df45dc7f237368a39fb1431
bernd webinterface => /webinterface

bernd authored 17 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 2 years 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 2 years 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 webinterface => /webinterface

bernd authored 17 years ago

13) 
bernd Logging aktiviert

bernd authored 17 years ago

14) require_once('inc/base.php');
Hanno Böck move crypt password hash ve...

Hanno Böck authored 1 year ago

15) require_once('inc/security.php');
bernd webinterface => /webinterface

bernd authored 17 years ago

16) require_once('inc/debug.php');
17) require_once('inc/error.php');
18) 
19) define('ROLE_ANONYMOUS', 0);
bernd Auch mailaccounts können si...

bernd authored 17 years ago

20) define('ROLE_MAILACCOUNT', 1);
bernd VMail-accounts können sich...

bernd authored 16 years ago

21) define('ROLE_VMAIL_ACCOUNT', 2);
22) define('ROLE_SYSTEMUSER', 4);
23) define('ROLE_CUSTOMER', 8);
24) define('ROLE_SYSADMIN', 16);
bernd Erlaube subusers, die nur Z...

bernd authored 14 years ago

25) define('ROLE_SUBUSER', 32);
bernd webinterface => /webinterface

bernd authored 17 years ago

26) 
27) 
28) // Gibt die Rolle aus, wenn das Passwort stimmt
29) 
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

30) function find_role($login, $password, $i_am_admin = false)
bernd webinterface => /webinterface

bernd authored 17 years ago

31) {
Bernd Wurst add brute force protection...

Bernd Wurst authored 5 years ago

32)     if (!$i_am_admin) {
33)         $failed = count_failed_logins();
34)         if ($failed > 5) {
35)             global $title;
36)             $title = '';
37)             system_failure("Zu viele fehlgeschlagenen Login-Versuche! Bitte warten Sie einige Minuten bis zum nächsten Versuch!");
38)         }
39)     }
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

40)     // Domain-Admin?  <not implemented>
41)     // System-User?
42)     $uid = (int) $login;
43)     if ($uid == 0) {
44)         $uid = null;
Bernd Wurst Beachte Groß- und Kleinshre...

Bernd Wurst authored 12 years ago

45)     }
Bernd Wurst merge passkeys feature

Bernd Wurst authored 1 year ago

46)     $result = db_query("SELECT uid, username, passwort AS password, kundenaccount AS `primary`, status, ((SELECT acc.uid FROM system.v_useraccounts AS acc LEFT JOIN system.gruppenzugehoerigkeit USING (uid) LEFT JOIN system.gruppen AS g ON (g.gid=gruppenzugehoerigkeit.gid) WHERE g.name='admin' AND acc.uid=u.uid) IS NOT NULL) AS admin FROM system.v_useraccounts AS u LEFT JOIN system.passwoerter USING(uid) WHERE u.uid=:uid OR username=:login LIMIT 1;", [":uid" => $uid, ":login" => $login]);
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

47)     if (@$result->rowCount() > 0) {
48)         $entry = $result->fetch(PDO::FETCH_OBJ);
49)         if (strcasecmp($entry->username, $login) == 0 && $entry->username != $login) {
50)             // MySQL matched (warum auch immer) ohne Beachtung der Schreibweise. Wir wollen aber case-sensitive sein.
51)             logger(LOG_WARNING, "session/checkuser", "login", "denying login to wrong cased username »{$login}«.");
52)             warning('Beachten Sie bei der Eingabe Ihrer Zugangsdaten bitte die Groß- und Kleinschreibung.');
53)             return null;
54)         }
55)         $db_password = $entry->password;
Hanno Böck Replace check_pw_hash with...

Hanno Böck authored 1 year ago

56)         if (($entry->status == 0 && password_verify($password, $db_password)) || $i_am_admin) {
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

57)             $role = ROLE_SYSTEMUSER;
58)             if ($entry->primary) {
59)                 $role = $role | ROLE_CUSTOMER;
60)             }
61)             if ($entry->admin) {
62)                 $role = $role | ROLE_SYSADMIN;
63)             }
64)             logger(LOG_INFO, "session/checkuser", "login", "logged in systemuser »{$login}«.");
65)             return $role;
66)         }
67)         logger(LOG_WARNING, "session/checkuser", "login", "wrong password for existing useraccount »{$login}«.");
68)     } else {
69)         logger(LOG_WARNING, "session/checkuser", "login", "did not find useraccount »{$login}«. trying other roles...");
bernd * Initialisierung der Sessi...

bernd authored 17 years ago

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

Hanno authored 6 years ago

71) 
72)     // Customer?
73)     $customerno = (int) $login;
74)     $pass = sha1($password);
Hanno Böck Codingstyle PSR12 + array s...

Hanno Böck authored 3 years ago

75)     $result = db_query("SELECT passwort AS password FROM kundendaten.kunden WHERE status=0 AND id=:customerno AND passwort=:pass", [":customerno" => $customerno, ":pass" => $pass]);
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

76)     if ($i_am_admin) {
Hanno Böck Codingstyle PSR12 + array s...

Hanno Böck authored 3 years ago

77)         $result = db_query("SELECT passwort AS password FROM kundendaten.kunden WHERE status=0 AND id=?", [$customerno]);
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

78)     }
79)     if (@$result->rowCount() > 0) {
80)         return ROLE_CUSTOMER;
81)     }
82) 
83)     // Sub-User
84) 
Hanno Böck Codingstyle PSR12 + array s...

Hanno Böck authored 3 years ago

85)     $result = db_query("SELECT password FROM system.subusers WHERE username=?", [$login]);
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

86)     if (@$result->rowCount() > 0) {
87)         $entry = $result->fetch(PDO::FETCH_OBJ);
88)         $db_password = $entry->password;
Hanno Böck use real password hashes fo...

Hanno Böck authored 11 months ago

89)         if (legacy_pw_verify($password, $db_password) || $i_am_admin) {
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

90)             logger(LOG_INFO, "session/checkuser", "login", "logged in virtual subuser »{$login}«.");
91)             return ROLE_SUBUSER;
92)         }
93)         logger(LOG_WARNING, "session/checkuser", "login", "wrong password for existing subuser »{$login}«.");
94)     }
95) 
96) 
97)     // Mail-Account
98)     $account = $login;
Hanno Böck Fix not operator (!) spaces

Hanno Böck authored 1 year ago

99)     if (!strstr($account, '@')) {
Hanno Böck Spaces between string conca...

Hanno Böck authored 1 year ago

100)         $account .= '@' . config('masterdomain');
Bernd Wurst Login am Webiterface mit Go...

Bernd Wurst authored 12 years ago

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

Hanno authored 6 years ago

102)     if (!$i_am_admin && have_module('webmailtotp')) {
103)         require_once('modules/webmailtotp/include/totp.php');
104)         if (account_has_totp($account)) {
105)             if (check_webmail_password($account, $password)) {
106)                 $_SESSION['totp_username'] = $account;
107)                 $_SESSION['totp'] = true;
Bernd Wurst merge passkeys feature

Bernd Wurst authored 1 year ago

108)                 show_page('totp-login');
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

109)                 die();
110)             } else {
111)                 return null;
112)             }
113)         }
Bernd Wurst Login am Webiterface mit Go...

Bernd Wurst authored 12 years ago

114)     }
Hanno Böck Codingstyle PSR12 + array s...

Hanno Böck authored 3 years ago

115)     $result = db_query("SELECT cryptpass FROM mail.courier_mailaccounts WHERE account=?", [$account]);
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

116)     if (@$result->rowCount() > 0) {
117)         $entry = $result->fetch(PDO::FETCH_OBJ);
118)         $db_password = $entry->cryptpass;
Hanno Böck Replace check_pw_hash with...

Hanno Böck authored 1 year ago

119)         if (password_verify($password, $db_password) || $i_am_admin) {
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

120)             logger(LOG_INFO, "session/checkuser", "login", "logged in e-mail-account »{$account}«.");
121)             return ROLE_MAILACCOUNT;
122)         }
123)         logger(LOG_WARNING, "session/checkuser", "login", "wrong password for existing e-mail-account »{$account}«.");
bernd Auch mailaccounts können si...

bernd authored 17 years ago

124)     }
Hanno remove whitespace in empty...

Hanno authored 6 years ago

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

Hanno authored 6 years ago

126)     // virtueller Mail-Account
127)     $account = $login;
Hanno Böck Codingstyle PSR12 + array s...

Hanno Böck authored 3 years ago

128)     $result = db_query("SELECT cryptpass FROM mail.courier_virtual_accounts WHERE account=?", [$account]);
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

129)     if (@$result->rowCount() > 0) {
130)         $entry = $result->fetch(PDO::FETCH_OBJ);
131)         $db_password = $entry->cryptpass;
Hanno Böck Replace check_pw_hash with...

Hanno Böck authored 1 year ago

132)         if (password_verify($password, $db_password) || $i_am_admin) {
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

133)             logger(LOG_INFO, "session/checkuser", "login", "logged in virtual e-mail-account »{$account}«.");
134)             return ROLE_VMAIL_ACCOUNT;
135)         }
136)         logger(LOG_WARNING, "session/checkuser", "login", "wrong password for existing virtual e-mail-account »{$account}«.");
bernd VMail-accounts können sich...

bernd authored 16 years ago

137)     }
Hanno remove whitespace in empty...

Hanno authored 6 years ago

138) 
bernd Auch mailaccounts können si...

bernd authored 17 years ago

139) 
140) 
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

141)     // Nothing?
142)     return null;
bernd webinterface => /webinterface

bernd authored 17 years ago

143) }
144) 
Bernd Wurst show a warning on the start...

Bernd Wurst authored 4 years ago

145) function is_locked()
146) {
147)     $result = null;
148)     if (isset($_SESSION['customerinfo']['customerno'])) {
Hanno Böck Codingstyle PSR12 + array s...

Hanno Böck authored 3 years ago

149)         $result = db_query("SELECT gesperrt FROM kundendaten.kunden WHERE id=?", [$_SESSION['customerinfo']['customerno']]);
Bernd Wurst show a warning on the start...

Bernd Wurst authored 4 years ago

150)     } elseif (isset($_SESSION['userinfo']['uid'])) {
Hanno Böck Codingstyle PSR12 + array s...

Hanno Böck authored 3 years ago

151)         $result = db_query("SELECT (SELECT gesperrt FROM kundendaten.kunden WHERE id=useraccounts.kunde) AS gesperrt FROM system.useraccounts WHERE uid=?", [$_SESSION['userinfo']['uid']]);
Bernd Wurst show a warning on the start...

Bernd Wurst authored 4 years ago

152)     }
153)     if ($result) {
154)         $line = $result->fetch();
155)         if ($line['gesperrt'] == 1) {
156)             return true;
157)         }
158)     }
159)     return false;
160) }
161) 
bernd webinterface => /webinterface

bernd authored 17 years ago

162) 
bernd * Initialisierung der Sessi...

bernd authored 17 years ago

163) function get_customer_info($customer)
bernd webinterface => /webinterface

bernd authored 17 years ago

164) {
Hanno Böck Fix not operator (!) spaces

Hanno Böck authored 1 year ago

165)     if (!$_SESSION['role'] & ROLE_CUSTOMER) {
Hanno Böck Codingstyle PSR12 + array s...

Hanno Böck authored 3 years ago

166)         return [];
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

167)     }
Hanno Böck Codingstyle PSR12 + array s...

Hanno Böck authored 3 years ago

168)     $ret = [];
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

169)     $customerno = (int) $customer;
170)     if ($customerno != 0) {
Hanno Böck Spaces between string conca...

Hanno Böck authored 1 year ago

171)         DEBUG('Looking up customerinfo for customer no. ' . $customerno);
Hanno Böck Codingstyle PSR12 + array s...

Hanno Böck authored 3 years ago

172)         $result = db_query("SELECT id, anrede, firma, CONCAT_WS(' ', vorname, nachname) AS name, COALESCE(email,email_rechnung,email_extern) AS email FROM kundendaten.kunden WHERE id=?", [$customerno]);
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

173)     } else {
174)         $username = $customer;
Hanno Böck Spaces between string conca...

Hanno Böck authored 1 year ago

175)         DEBUG('looking up customer info for username ' . $username);
Hanno Böck Codingstyle PSR12 + array s...

Hanno Böck authored 3 years ago

176)         $result = db_query("SELECT id, anrede, firma, CONCAT_WS(' ', vorname, nachname) AS name, COALESCE(email,email_rechnung,email_extern) AS email FROM kundendaten.kunden AS k JOIN system.v_useraccounts AS u ON (u.kunde=k.id) WHERE u.username=?", [$username]);
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

177)     }
178)     if (@$result->rowCount() == 0) {
179)         system_failure("Konnte Kundendaten nicht auslesen!");
180)     }
181)     $data = $result->fetch();
182)     DEBUG($data);
183)     $ret['customerno'] = $data['id'];
184)     $ret['title'] = $data['anrede'];
185)     $ret['company'] = $data['firma'];
186)     $ret['name'] = $data['name'];
187)     $ret['email'] = $data['email'];
Hanno remove whitespace in empty...

Hanno authored 6 years ago

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

Hanno authored 6 years ago

189)     return $ret;
bernd webinterface => /webinterface

bernd authored 17 years ago

190) }
191) 
192) 
bernd Erlaube subusers, die nur Z...

bernd authored 14 years ago

193) function get_subuser_info($username)
194) {
Hanno Böck Codingstyle PSR12 + array s...

Hanno Böck authored 3 years ago

195)     $result = db_query("SELECT uid, modules FROM system.subusers WHERE username=?", [$username]);
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

196)     if ($result->rowCount() < 1) {
197)         logger(LOG_ERR, "session/checkuser", "login", "error reading subuser's data: »{$username}«");
198)         system_failure('Das Auslesen Ihrer Benutzerdaten ist fehlgeschlagen. Bitte melden Sie dies einem Administrator');
199)     }
200)     $data = $result->fetch();
201)     $userinfo = get_user_info($data['uid']);
202)     $userinfo['modules'] = $data['modules'];
203)     return $userinfo;
bernd Erlaube subusers, die nur Z...

bernd authored 14 years ago

204) }
205) 
206) 
bernd webinterface => /webinterface

bernd authored 17 years ago

207) function get_user_info($username)
208) {
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

209)     $result = db_query("SELECT kunde AS customerno, username, uid, homedir, name, server
Hanno Böck Codingstyle PSR12 + array s...

Hanno Böck authored 3 years ago

210)                       FROM system.v_useraccounts WHERE username=:username OR uid=:username", [":username" => $username]);
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

211)     if ($result->rowCount() < 1) {
212)         logger(LOG_ERR, "session/checkuser", "login", "error reading user's data: »{$username}«");
213)         system_failure('Das Auslesen Ihrer Benutzerdaten ist fehlgeschlagen. Bitte melden Sie dies einem Administrator');
214)     }
215)     $val = @$result->fetch(PDO::FETCH_OBJ);
Hanno Böck Codingstyle PSR12 + array s...

Hanno Böck authored 3 years ago

216)     return [
bernd webinterface => /webinterface

bernd authored 17 years ago

217)           'username'      => $val->username,
218)           'customerno'    => $val->customerno,
219)           'uid'           => $val->uid,
220)           'homedir'       => $val->homedir,
bernd IPv6-Option nur anzeigen we...

bernd authored 14 years ago

221)           'server'        => $val->server,
bernd webinterface => /webinterface

bernd authored 17 years ago

222)           'name'          => $val->name,
Hanno Böck Codingstyle PSR12 + array s...

Hanno Böck authored 3 years ago

223)           ];
bernd webinterface => /webinterface

bernd authored 17 years ago

224) }
225) 
bernd Kunden-Status wird benutzt...

bernd authored 17 years ago

226) function set_customer_verified($customerno)
227) {
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

228)     $customerno = (int) $customerno;
Hanno Böck Codingstyle PSR12 + array s...

Hanno Böck authored 3 years ago

229)     db_query("UPDATE kundendaten.kunden SET status=0 WHERE id=?", [$customerno]);
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

230)     logger(LOG_INFO, "session/checkuser", "register", "set customer's status to 0.");
bernd Kunden-Status wird benutzt...

bernd authored 17 years ago

231) }
232) 
233) function set_customer_lastlogin($customerno)
234) {
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

235)     $customerno = (int) $customerno;
Hanno Böck Codingstyle PSR12 + array s...

Hanno Böck authored 3 years ago

236)     db_query("UPDATE kundendaten.kunden SET lastlogin=NOW() WHERE id=?", [$customerno]);
bernd Kunden-Status wird benutzt...

bernd authored 17 years ago

237) }
238) 
bernd webinterface => /webinterface

bernd authored 17 years ago

239) function set_customer_password($customerno, $newpass)
240) {
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

241)     $customerno = (int) $customerno;
242)     $newpass = sha1($newpass);
Hanno Böck Codingstyle PSR12 + array s...

Hanno Böck authored 3 years ago

243)     db_query("UPDATE kundendaten.kunden SET passwort=:newpass WHERE id=:customerno", [":newpass" => $newpass, ":customerno" => $customerno]);
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

244)     logger(LOG_INFO, "session/checkuser", "pwchange", "changed customer's password.");
bernd Passwort-Ändern geht jetzt...

bernd authored 14 years ago

245) }
246) 
247) function set_subuser_password($subuser, $newpass)
248) {
Hanno Böck Codingstyle PSR12 + array s...

Hanno Böck authored 3 years ago

249)     $args = [":subuser" => $subuser,
Bernd Wurst * Weitere Module auf prepar...

Bernd Wurst authored 10 years ago

250)                 ":uid" => (int) $_SESSION['userinfo']['uid'],
Hanno Böck use real password hashes fo...

Hanno Böck authored 11 months ago

251)                 ":newpass" => gen_pw_hash($newpass), ];
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

252)     db_query("UPDATE system.subusers SET password=:newpass WHERE username=:subuser AND uid=:uid", $args);
253)     logger(LOG_INFO, "session/checkuser", "pwchange", "changed subuser's password.");
bernd webinterface => /webinterface

bernd authored 17 years ago

254) }
255) 
256) function set_systemuser_password($uid, $newpass)
257) {
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

258)     $uid = (int) $uid;
259)     require_once('inc/base.php');
Hanno Böck move crypt password hash ve...

Hanno Böck authored 1 year ago

260)     $newpass = gen_pw_hash($newpass);
Hanno Böck Codingstyle PSR12 + array s...

Hanno Böck authored 3 years ago

261)     db_query("UPDATE system.passwoerter SET passwort=:newpass WHERE uid=:uid", [":newpass" => $newpass, ":uid" => $uid]);
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

262)     logger(LOG_INFO, "session/checkuser", "pwchange", "changed user's password.");
bernd webinterface => /webinterface

bernd authored 17 years ago

263) }
264) 
bernd * Initialisierung der Sessi...

bernd authored 17 years ago

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

Hanno authored 6 years ago

266) function user_for_mailaccount($account)
Bernd Wurst Zeige User-Infos beim Login...

Bernd Wurst authored 11 years ago

267) {
Hanno Böck Codingstyle PSR12 + array s...

Hanno Böck authored 3 years ago

268)     $result = db_query("SELECT uid FROM mail.courier_mailaccounts WHERE account=?", [$account]);
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

269)     if ($result->rowCount() != 1) {
270)         system_failure('Diese Adresse ist herrenlos?!');
271)     }
272)     $tmp = $result->fetch();
273)     return $tmp['uid'];
Bernd Wurst Zeige User-Infos beim Login...

Bernd Wurst authored 11 years ago

274) }
275) 
276) function user_for_vmail_account($account)
277) {
Hanno Böck Codingstyle PSR12 + array s...

Hanno Böck authored 3 years ago

278)     $result = db_query("SELECT useraccount FROM mail.v_vmail_accounts WHERE CONCAT_WS('@', local, domainname)=?", [$account]);
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

279)     if ($result->rowCount() != 1) {
280)         system_failure('Diese Adresse ist herrenlos?!');
281)     }
282)     $tmp = $result->fetch();
283)     return $tmp['useraccount'];
Bernd Wurst Zeige User-Infos beim Login...

Bernd Wurst authored 11 years ago

284) }
285) 
286) 
Bernd Wurst Speichere Login-Methode in...

Bernd Wurst authored 1 year ago

287) function setup_session($role, $useridentity, $loginmethod = 'password')
bernd * Initialisierung der Sessi...

bernd authored 17 years ago

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

Hanno authored 6 years ago

289)     session_regenerate_id();
Bernd Wurst Speichere Login-Methode in...

Bernd Wurst authored 1 year ago

290)     $_SESSION['loginmethod'] = $loginmethod;
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

291)     $_SESSION['role'] = $role;
292)     if ($role & ROLE_SUBUSER) {
293)         DEBUG("We are a sub-user");
294)         $info = get_subuser_info($useridentity);
295)         $_SESSION['userinfo'] = $info;
296)         $_SESSION['restrict_modules'] = explode(',', $info['modules']);
297)         $_SESSION['role'] = ROLE_SYSTEMUSER | ROLE_SUBUSER;
298)         $_SESSION['subuser'] = $useridentity;
Hanno Böck Codingstyle PSR12 + array s...

Hanno Böck authored 3 years ago

299)         $data = db_query("SELECT kundenaccount FROM system.useraccounts WHERE username=?", [$info['username']]);
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

300)         if ($entry = $data->fetch()) {
301)             if ($entry['kundenaccount'] == 1) {
302)                 $customer = get_customer_info($_SESSION['userinfo']['username']);
303)                 $_SESSION['customerinfo'] = $customer;
304)                 $_SESSION['role'] = ROLE_SYSTEMUSER | ROLE_CUSTOMER | ROLE_SUBUSER;
305)             }
306)         }
307)         logger(LOG_INFO, "session/start", "login", "logged in user »{$info['username']}«");
Bernd Wurst Subuser sollen nicht automa...

Bernd Wurst authored 11 years ago

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

Hanno authored 6 years ago

309)     if ($role & ROLE_SYSTEMUSER) {
310)         DEBUG("We are system user");
311)         $info = get_user_info($useridentity);
312)         $_SESSION['userinfo'] = $info;
313)         logger(LOG_INFO, "session/start", "login", "logged in user »{$info['username']}«");
314)         $useridentity = $info['customerno'];
315)     }
316)     if ($role & ROLE_CUSTOMER) {
317)         $info = get_customer_info($useridentity);
318)         $_SESSION['customerinfo'] = $info;
319)         if (!isset($_SESSION['admin_user'])) {
320)             set_customer_lastlogin($info['customerno']);
321)         }
322)         logger(LOG_INFO, "session/start", "login", "logged in customer no »{$info['customerno']}«");
323)     }
324)     if ($role & ROLE_MAILACCOUNT) {
325)         $id = $useridentity;
Hanno Böck Fix not operator (!) spaces

Hanno Böck authored 1 year ago

326)         if (!strstr($id, '@')) {
Hanno Böck Spaces between string conca...

Hanno Böck authored 1 year ago

327)             $id .= '@' . config('masterdomain');
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

328)         }
329)         $uid = user_for_mailaccount($id);
330)         $_SESSION['mailaccount'] = $id;
331)         $_SESSION['userinfo'] = get_user_info($uid);
332)         DEBUG("We are mailaccount: {$_SESSION['mailaccount']}");
333)     }
334)     if ($role & ROLE_VMAIL_ACCOUNT) {
335)         $id = $useridentity;
336)         $uid = user_for_vmail_account($id);
337)         $_SESSION['mailaccount'] = $id;
338)         $_SESSION['userinfo'] = get_user_info($uid);
339)         DEBUG("We are virtual mailaccount: {$_SESSION['mailaccount']}");
bernd Setze lastlogin nur bei Nic...

bernd authored 13 years ago

340)     }
Hanno Böck Fix not operator (!) spaces

Hanno Böck authored 1 year ago

341)     if (!($role & ROLE_CUSTOMER)) {
Hanno Böck Codingstyle PSR12 + array s...

Hanno Böck authored 3 years ago

342)         $_SESSION['customerinfo'] = [];
Bernd Wurst Lösche alte Kundendaten aus...

Bernd Wurst authored 5 years ago

343)     }