Browse code

Suche auch bei unvollständiger Eingabe

Bernd Wurst authored on22/01/2013 08:27:11
Showing3 changed files
... ...
@@ -15,6 +15,7 @@ Nevertheless, in case you use a significant part of this code, we ask (but not r
15 15
 */
16 16
 
17 17
 require_once('inc/base.php');
18
+require_once('class/customer.php');
18 19
 
19 20
 function list_system_users()
20 21
 {
... ...
@@ -15,6 +15,7 @@ Nevertheless, in case you use a significant part of this code, we ask (but not r
15 15
 */
16 16
 
17 17
 require_once('inc/base.php');
18
+require_once('inc/security.php');
18 19
 require_once('inc/debug.php');
19 20
 
20 21
 require_once('session/start.php');
... ...
@@ -30,7 +31,7 @@ function su($type, $id) {
30 31
   $role = find_role($id, '', True);
31 32
   if (!$role) {
32 33
     unset($_SESSION['admin_user']);
33
-    return;
34
+    return False;
34 35
   }
35 36
   setup_session($role, $id);
36 37
   if ($type == 'c') {
... ...
@@ -62,11 +63,14 @@ if (isset($_GET['do']))
62 63
   su($type, $id);
63 64
 }
64 65
 
66
+$search = NULL;
65 67
 if (isset($_POST['query']))
66 68
 {
67 69
   check_form_token('su_su');
68 70
   $id = filter_input_general($_POST['query']);
69
-  su(NULL, $id);
71
+  if (! su(NULL, $id)) {
72
+    $search = $_POST['query'];
73
+  }
70 74
 }
71 75
 
72 76
 title("Benutzer wechseln");
... ...
@@ -100,6 +104,13 @@ $("#query").autocomplete({
100 104
  });
101 105
 </script>');
102 106
 
107
+if ($search) {
108
+  $allentries = build_results($search);
109
+  foreach ($allentries as $entry) {
110
+    output("  <p><a href=\"?do=".filter_input_general($entry['id'])."\">".filter_input_general($entry['value'])."</a></p>");
111
+  }
112
+}
113
+
103 114
 /*
104 115
 
105 116
 
... ...
@@ -15,12 +15,12 @@ Nevertheless, in case you use a significant part of this code, we ask (but not r
15 15
 */
16 16
 
17 17
 require_once('inc/base.php');
18
+require_once('inc/security.php');
18 19
 require_once('inc/debug.php');
19 20
 
20 21
 require_once('session/start.php');
21 22
 require_once('su.php');
22 23
 
23
-require_once('class/customer.php');
24 24
 
25 25
 require_role(ROLE_SYSADMIN);
26 26