Browse code

Merge branch 'master' of zucker.schokokeks.org:webinterface

Bernd Wurst authored on22/12/2017 07:43:04
Showing4 changed files
... ...
@@ -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
 
... ...
@@ -51,7 +51,10 @@ function we_have_an_error()
51 51
 {
52 52
   global $input_error;
53 53
 
54
-  return (count($input_error) > 0);
54
+  if (isset($input_error))
55
+    return (count($input_error) > 0);
56
+  else
57
+    return 0;
55 58
 }
56 59
 
57 60
 
... ...
@@ -123,12 +126,14 @@ function require_role($roles)
123 126
 }
124 127
 
125 128
 
126
-function login_screen($why)
129
+function login_screen($why = NULL)
127 130
 {
128
-  if (have_module('index')) {
129
-    if (isset($_COOKIE['CLIENTCERT_AUTOLOGIN']) && $_COOKIE['CLIENTCERT_AUTOLOGIN'] == '1') {
130
-      require_once('modules/index/include/x509.php');
131
-      do_ajax_cert_login();
131
+  if (! $why) {
132
+    if (have_module('index')) {
133
+      if (isset($_COOKIE['CLIENTCERT_AUTOLOGIN']) && $_COOKIE['CLIENTCERT_AUTOLOGIN'] == '1') {
134
+        require_once('modules/index/include/x509.php');
135
+        do_ajax_cert_login();
136
+      }
132 137
     }
133 138
   }
134 139
   require_once('inc/theme.php');
... ...
@@ -53,11 +53,12 @@ if ($_GET['action'] == 'edit')
53 53
       $account['domain'] = (int) $_POST['domain'];
54 54
     }
55 55
     $account['password'] = $_POST['password'];
56
-    if (($account['password'] == '') && ($_POST['mailbox'] == 'yes'))
56
+
57
+    if (($account['password'] == '') && (isset($_POST['mailbox']) && $_POST['mailbox'] == 'yes'))
57 58
       system_failure("Sie haben ein leeres Passwort eingegeben!");
58 59
     if ($_POST['password'] == '**********')
59 60
       $account['password'] = '';
60
-    if ($_POST['mailbox'] != 'yes')
61
+    if (isset($_POST['mailbox']) && $_POST['mailbox'] != 'yes')
61 62
     {
62 63
       $account['password'] = NULL;
63 64
     }
... ...
@@ -167,7 +168,7 @@ if ($_GET['action'] == 'edit')
167 168
     if (count($account['forwards']) == 0) system_failure("Bitte mindestens eine Weiterleitungsadresse angeben.");
168 169
   }
169 170
 
170
-  if ((isset($_POST['forward']) && $_POST['forward']!='yes') && ($_POST['mailbox']!='yes'))
171
+  if ((isset($_POST['forward']) && $_POST['forward']!='yes') && (isset($_POST['mailbox']) && $_POST['mailbox']!='yes'))
171 172
     system_failure("Entweder eine Mailbox oder eine Weiterleitung muss angegeben werden!");
172 173
 
173 174
   DEBUG($account);
... ...
@@ -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 {