959b506af2fc132379f324ee84307ebbc9dfb061
bernd Su-Login für Admins

bernd authored 16 years ago

1) <?php
2) 
bernd AJAXified

bernd authored 15 years ago

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

bernd authored 16 years ago

4) require_once('inc/debug.php');
5) 
6) require_once('session/start.php');
7) require_once('su.php');
8) 
9) require_role(ROLE_SYSADMIN);
10) 
bernd AJAXified

bernd authored 15 years ago

11) if (isset($_GET['type']))
12) {
13)   check_form_token('su_su_ajax', $_GET['formtoken']);
14)   $role = NULL;
bernd back-to-admin feature

bernd authored 15 years ago

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

bernd authored 13 years ago

16)   $_SESSION['admin_user'] = $admin_user;
bernd AJAXified

bernd authored 15 years ago

17)   if ($_GET['type'] == 'customer') {
18)     $role = find_role($_GET['id'], '', True);
19)     setup_session($role, $_GET['id']);
20)   } elseif ($_GET['type'] == 'systemuser') {
21)     $role = find_role($_GET['uid'], '', True);
22)     setup_session($role, $_GET['uid']);
23)   } else {
24)     system_failure('unknown type');
25)   }
26) 
27)   header('Location: ../../go/index/index');
28)   die();
29) }
30) 
bernd Su-Login für Admins

bernd authored 16 years ago

31) if (isset($_POST['submit']))
32) {
33)   check_form_token('su_su');
34)   $id = (int) $_POST['destination'];
35)   $role = find_role($id, '', True);
36)   setup_session($role, $id);
37) 
bernd eliminate .php extensions f...

bernd authored 15 years ago

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

bernd authored 16 years ago

39)   die();
40) }
41) 
bernd Benutze überall title() sta...

bernd authored 13 years ago

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

bernd authored 16 years ago

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

bernd authored 13 years ago

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

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

bernd authored 16 years ago

46) 
bernd AJAXified

bernd authored 15 years ago

47) $debug = '';
48) if ($debugmode)
49)   $debug = 'debug&amp;';
50) 
51) html_header('<script type="text/javascript" src="'.$prefix.'js/ajax.js" ></script>
52) <script type="text/javascript">
53) 
54) function doRequest() {
55)   ajax_request(\'su_ajax\', \''.$debug.'q=\'+document.getElementById(\'query\').value, got_response)
56) }
57) 
58) function keyPressed() {
59)   if(window.mytimeout) window.clearTimeout(window.mytimeout);
60)   window.mytimeout = window.setTimeout(doRequest, 500);
61)   return true;
62) }
63) 
64) function got_response() {
65)   if (xmlHttp.readyState == 4) {
66)     document.getElementById(\'response\').innerHTML = xmlHttp.responseText;
67)   }
68) }
69) 
70) </script>
71) ');
72) 
73) output(html_form('su_su_ajax', '', '', '<strong>Suchtext:</strong> <input type="text" id="query" onkeyup="keyPressed()" />
74) '));
75) output('<div id="response"></div>
76) <div style="height: 3em;">&#160;</div>');
77) 
bernd Einige Dummheiten repariert...

bernd authored 14 years ago

78) /*
bernd AJAXified

bernd authored 15 years ago

79) 
80) 
bernd Su-Login für Admins

bernd authored 16 years ago

81) $users = list_system_users();
82) $options = '';
83) foreach ($users as $user)
84) {
85)   $options .= "  <option value=\"{$user->uid}\">{$user->username} ({$user->uid})</option>\n";
86) }
87) 
bernd eliminate .php extensions f...

bernd authored 15 years ago

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

bernd authored 16 years ago

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

bernd authored 16 years ago

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

bernd authored 16 years ago

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

bernd authored 16 years ago

94) '));
95) 
96) $customers = list_customers();
97) $options = '';
98) foreach ($customers as $customer)
99) {
bernd Einige Dummheiten repariert...

bernd authored 14 years ago

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

bernd authored 16 years ago

101) }
102) 
bernd eliminate .php extensions f...

bernd authored 15 years ago

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

bernd authored 16 years ago

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

bernd authored 16 years ago

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

bernd authored 16 years ago

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

bernd authored 16 years ago

109) '));
110) 
bernd Einige Dummheiten repariert...

bernd authored 14 years ago

111) */