changes to cert login stuff
schokokeks.org web services

schokokeks.org web services commited on 2017-12-01 14:00:04
Zeige 3 geänderte Dateien mit 5 Einfügungen und 16 Löschungen.

... ...
@@ -29,22 +29,9 @@ require_once('inc/base.php');
29 29
 require_once('inc/debug.php');
30 30
 require_once('inc/error.php');
31 31
 require_once('inc/theme.php');
32
+require_once('modules/index/include/x509.php');
32 33
 
33 34
 
34
-function get_logins_by_cert($cert) 
35
-{
36
-	$result = db_query("SELECT type,username,startpage FROM system.clientcert WHERE cert=? ORDER BY type,username", array($cert));
37
-	if ($result->rowCount() < 1)
38
-		return NULL;
39
-	else {
40
-		$ret = array();
41
-		while ($row = $result->fetch()) {
42
-			$ret[] = $row;
43
-		}
44
-		return $ret;
45
-	}
46
-}
47
-
48 35
 DEBUG('$_SERVER:');
49 36
 DEBUG($_SERVER);
50 37
 
... ...
@@ -123,14 +123,16 @@ function require_role($roles)
123 123
 }
124 124
 
125 125
 
126
-function login_screen($why)
126
+function login_screen($why = NULL)
127 127
 {
128
+  if (! $why) {
128 129
     if (have_module('index')) {
129 130
       if (isset($_COOKIE['CLIENTCERT_AUTOLOGIN']) && $_COOKIE['CLIENTCERT_AUTOLOGIN'] == '1') {
130 131
         require_once('modules/index/include/x509.php');
131 132
         do_ajax_cert_login();
132 133
       }
133 134
     }
135
+  }
134 136
   require_once('inc/theme.php');
135 137
   if ($why) {
136 138
     warning($why);
... ...
@@ -24,7 +24,7 @@ function do_ajax_cert_login() {
24 24
 
25 25
 function get_logins_by_cert($cert) 
26 26
 {
27
-	$result = db_query("SELECT type,username,startpage FROM system.clientcert WHERE cert=?", array($cert));
27
+	$result = db_query("SELECT type,username,startpage FROM system.clientcert WHERE cert=? ORDER BY type,username", array($cert));
28 28
 	if ($result->rowCount() < 1)
29 29
 		return NULL;
30 30
 	else {
31 31