bd90f09031f3ac9b017430bd5dacd924cf844179
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 Su-Login für Admins

bernd authored 16 years ago

18) require_once('inc/debug.php');
19) 
20) require_once('session/start.php');
21) require_once('su.php');
22) 
23) require_role(ROLE_SYSADMIN);
24) 
Bernd Wurst su-Modul auf jQuery umgeste...

Bernd Wurst authored 11 years ago

25) if (isset($_GET['do']))
bernd AJAXified

bernd authored 15 years ago

26) {
Bernd Wurst su-Modul auf jQuery umgeste...

Bernd Wurst authored 11 years ago

27)   if ($_SESSION['su_ajax_timestamp'] < time() - 30) {
28)     system_failure("Die su-Auswahl ist schon abgelaufen!");
29)   }
30)   $type = $_GET['do'][0];
31)   $id = (int) substr($_GET['do'], 1);
bernd AJAXified

bernd authored 15 years ago

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

bernd authored 15 years ago

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

bernd authored 13 years ago

34)   $_SESSION['admin_user'] = $admin_user;
Bernd Wurst su-Modul auf jQuery umgeste...

Bernd Wurst authored 11 years ago

35)   if ($type == 'c') {
36)     $role = find_role($id, '', True);
37)     setup_session($role, $id);
38)   } elseif ($type == 'u') {
39)     $role = find_role($id, '', True);
40)     setup_session($role, $id);
bernd AJAXified

bernd authored 15 years ago

41)   } else {
42)     system_failure('unknown type');
43)   }
44) 
45)   header('Location: ../../go/index/index');
46)   die();
47) }
48) 
bernd Su-Login für Admins

bernd authored 16 years ago

49) if (isset($_POST['submit']))
50) {
51)   check_form_token('su_su');
52)   $id = (int) $_POST['destination'];
53)   $role = find_role($id, '', True);
54)   setup_session($role, $id);
55) 
bernd eliminate .php extensions f...

bernd authored 15 years ago

56)   header('Location: ../../go/index/index');
bernd Su-Login für Admins

bernd authored 16 years ago

57)   die();
58) }
59) 
bernd Benutze überall title() sta...

bernd authored 13 years ago

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

bernd authored 16 years ago

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

bernd authored 13 years ago

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

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

bernd authored 16 years ago

64) 
bernd AJAXified

bernd authored 15 years ago

65) $debug = '';
66) if ($debugmode)
67)   $debug = 'debug&amp;';
68) 
Bernd Wurst su-Modul auf jQuery umgeste...

Bernd Wurst authored 11 years ago

69) html_header('
70) <link rel="stylesheet" href="http://code.jquery.com/ui/1.10.0/themes/base/jquery-ui.css">
71) <script type="text/javascript" src="http://code.jquery.com/jquery-1.9.0.js" ></script>
72) <script type="text/javascript" src="http://code.jquery.com/ui/1.10.0/jquery-ui.js" ></script>
bernd AJAXified

bernd authored 15 years ago

73) ');
74) 
Bernd Wurst su-Modul auf jQuery umgeste...

Bernd Wurst authored 11 years ago

75) output('<label for="query"><strong>Suchtext:</strong></label> <input type="text" id="query" />
76) <input type="hidden" id="query_id" name="query_id" />
77) ');
78) output('
79) <script>
80) $("#query").autocomplete({
81)     source: "su_ajax",
82)     select: function( event, ui ) {
83)       if (ui.item) {
84)         window.location.href = "?do="+ui.item.id;
85)       }
86) }
87)  });
88) </script>');
bernd AJAXified

bernd authored 15 years ago

89) 
bernd Einige Dummheiten repariert...

bernd authored 14 years ago

90) /*
bernd AJAXified

bernd authored 15 years ago

91) 
92) 
bernd Su-Login für Admins

bernd authored 16 years ago

93) $users = list_system_users();
94) $options = '';
95) foreach ($users as $user)
96) {
97)   $options .= "  <option value=\"{$user->uid}\">{$user->username} ({$user->uid})</option>\n";
98) }
99) 
bernd eliminate .php extensions f...

bernd authored 15 years ago

100) output(html_form('su_su', 'su', '', '<p>Benutzer auswählen:
bernd Viele XHTML-Fehler korrigie...

bernd authored 16 years ago

101) <select name="destination" size="1">
bernd Su-Login für Admins

bernd authored 16 years ago

102) '.$options.'
103) </select>
104) <input type="submit" name="submit" value="zum Benutzer wechseln" />
bernd Viele XHTML-Fehler korrigie...

bernd authored 16 years ago

105) </p>
bernd Su-Login für Admins

bernd authored 16 years ago

106) '));
107) 
108) $customers = list_customers();
109) $options = '';
110) foreach ($customers as $customer)
111) {
bernd Einige Dummheiten repariert...

bernd authored 14 years ago

112)   $options .= "  <option value=\"{$customer->id}\">{$customer->id} - ".htmlspecialchars($customer->name)."</option>\n";
bernd Su-Login für Admins

bernd authored 16 years ago

113) }
114) 
bernd eliminate .php extensions f...

bernd authored 15 years ago

115) output(html_form('su_su', 'su', '', '<p>Kunde auswählen:
bernd Viele XHTML-Fehler korrigie...

bernd authored 16 years ago

116) <select name="destination" size="1">
bernd Su-Login für Admins

bernd authored 16 years ago

117) '.$options.'
118) </select>
119) <input type="submit" name="submit" value="zum Kunden wechseln" />
bernd Viele XHTML-Fehler korrigie...

bernd authored 16 years ago

120) </p>
bernd Su-Login für Admins

bernd authored 16 years ago

121) '));
122) 
bernd Einige Dummheiten repariert...

bernd authored 14 years ago

123) */