90328d5f150b6afc1b307a13caaa1ff929d73248
bernd Su-Login für Admins

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 Updated copyright notice (2...

Bernd Wurst authored 11 years ago

5) Written 2008-2013 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 Su-Login für Admins

bernd authored 16 years ago

16) 
bernd AJAXified

bernd authored 15 years ago

17) require_once('inc/base.php');
Bernd Wurst Suche auch bei unvollständi...

Bernd Wurst authored 11 years ago

18) require_once('inc/security.php');
bernd Su-Login für Admins

bernd authored 16 years ago

19) require_once('inc/debug.php');
20) 
21) require_once('session/start.php');
22) require_once('su.php');
23) 
24) require_role(ROLE_SYSADMIN);
25) 
Bernd Wurst Erlaube auch das Absenden d...

Bernd Wurst authored 11 years ago

26) 
27) function su($type, $id) {
bernd AJAXified

bernd authored 15 years ago

28)   $role = NULL;
bernd back-to-admin feature

bernd authored 15 years ago

29)   $admin_user = $_SESSION['userinfo']['username'];
bernd Setze lastlogin nur bei Nic...

bernd authored 13 years ago

30)   $_SESSION['admin_user'] = $admin_user;
Bernd Wurst Erlaube auch das Absenden d...

Bernd Wurst authored 11 years ago

31)   $role = find_role($id, '', True);
32)   if (!$role) {
33)     unset($_SESSION['admin_user']);
Bernd Wurst Suche auch bei unvollständi...

Bernd Wurst authored 11 years ago

34)     return False;
Bernd Wurst Erlaube auch das Absenden d...

Bernd Wurst authored 11 years ago

35)   }
36)   setup_session($role, $id);
Bernd Wurst su-Modul auf jQuery umgeste...

Bernd Wurst authored 11 years ago

37)   if ($type == 'c') {
Bernd Wurst Erlaube auch das Absenden d...

Bernd Wurst authored 11 years ago

38)     if (! (ROLE_CUSTOMER & $_SESSION['role'])) {
39)       session_destroy();
40)       system_failure('Es wurde ein "su" zu einem Kundenaccount angefordert, das war aber kein Kundenaccount!');
41)     }
Bernd Wurst su-Modul auf jQuery umgeste...

Bernd Wurst authored 11 years ago

42)   } elseif ($type == 'u') {
Bernd Wurst Erlaube auch das Absenden d...

Bernd Wurst authored 11 years ago

43)     if (! (ROLE_SYSTEMUSER & $_SESSION['role'])) {
44)       session_destroy();
45)       system_failure('Es wurde ein "su" zu einem Benutzeraccount angefordert, das war aber kein Benutzeraccount!');
46)     }
47)   } elseif ($type) {
48)     // wenn type leer ist, dann ist es auch egal
bernd AJAXified

bernd authored 15 years ago

49)     system_failure('unknown type');
50)   }
51) 
Bernd Wurst Erlaube auch das Absenden d...

Bernd Wurst authored 11 years ago

52)   redirect('../../go/index/index');
bernd AJAXified

bernd authored 15 years ago

53)   die();
54) }
55) 
Bernd Wurst Erlaube auch das Absenden d...

Bernd Wurst authored 11 years ago

56) if (isset($_GET['do']))
bernd Su-Login für Admins

bernd authored 16 years ago

57) {
Bernd Wurst Erlaube auch das Absenden d...

Bernd Wurst authored 11 years ago

58)   if ($_SESSION['su_ajax_timestamp'] < time() - 30) {
59)     system_failure("Die su-Auswahl ist schon abgelaufen!");
60)   }
61)   $type = $_GET['do'][0];
62)   $id = (int) substr($_GET['do'], 1);
63)   su($type, $id);
64) }
bernd Su-Login für Admins

bernd authored 16 years ago

65) 
Bernd Wurst Suche auch bei unvollständi...

Bernd Wurst authored 11 years ago

66) $search = NULL;
Bernd Wurst Erlaube auch das Absenden d...

Bernd Wurst authored 11 years ago

67) if (isset($_POST['query']))
68) {
69)   check_form_token('su_su');
70)   $id = filter_input_general($_POST['query']);
Bernd Wurst Suche auch bei unvollständi...

Bernd Wurst authored 11 years ago

71)   if (! su(NULL, $id)) {
72)     $search = $_POST['query'];
73)   }
bernd Su-Login für Admins

bernd authored 16 years ago

74) }
75) 
bernd Benutze überall title() sta...

bernd authored 13 years ago

76) title("Benutzer wechseln");
bernd Su-Login für Admins

bernd authored 16 years ago

77) 
bernd Benutze überall title() sta...

bernd authored 13 years ago

78) output('<p>Hiermit können Sie (als Admin) das Webinterface mit den Rechten eines beliebigen anderen Benutzers benutzen.</p>
bernd Viele XHTML-Fehler korrigie...

bernd authored 16 years ago

79) ');
bernd Su-Login für Admins

bernd authored 16 years ago

80) 
bernd AJAXified

bernd authored 15 years ago

81) $debug = '';
82) if ($debugmode)
83)   $debug = 'debug&amp;';
84) 
Bernd Wurst Nutze zentrales JQuery

Bernd Wurst authored 10 years ago

85) require_once('inc/jquery.php');
Bernd Wurst JQuery/-UI integriert und V...

Bernd Wurst authored 10 years ago

86) // lädt die JS-Datei mit gleichem basename
87) javascript();
bernd AJAXified

bernd authored 15 years ago

88) 
Bernd Wurst Cookie-based autologin when...

Bernd Wurst authored 11 years ago

89) output(html_form('su_su', '', '', '<p><label for="query"><strong>Suchtext:</strong></label> <input type="text" name="query" id="query" /> <input type="submit" value="Suchen" /></p>
Bernd Wurst Erlaube auch das Absenden d...

Bernd Wurst authored 11 years ago

90) '));
bernd AJAXified

bernd authored 15 years ago

91)