Browse Source

Fix warnings

Laurent Destailleur 1 năm trước cách đây
mục cha
commit
70e475d0ce
2 tập tin đã thay đổi với 6 bổ sung4 xóa
  1. 4 2
      htdocs/core/tpl/login.tpl.php
  2. 2 2
      htdocs/main.inc.php

+ 4 - 2
htdocs/core/tpl/login.tpl.php

@@ -64,7 +64,9 @@ if (!empty($conf->dol_use_jmobile)) {
 }
 
 $php_self = empty($php_self) ? dol_escape_htmltag($_SERVER['PHP_SELF']) : $php_self;
-$php_self .= dol_escape_htmltag($_SERVER["QUERY_STRING"]) ? '?'.dol_escape_htmltag($_SERVER["QUERY_STRING"]) : '';
+if (!empty($_SERVER["QUERY_STRING"]) && dol_escape_htmltag($_SERVER["QUERY_STRING"])) {
+	$php_self .= '?'.dol_escape_htmltag($_SERVER["QUERY_STRING"]);
+}
 if (!preg_match('/mainmenu=/', $php_self)) {
 	$php_self .= (preg_match('/\?/', $php_self) ? '&' : '?').'mainmenu=home';
 }
@@ -136,7 +138,7 @@ $(document).ready(function () {
 
 <div class="login_center center"<?php
 if (empty($conf->global->ADD_UNSPLASH_LOGIN_BACKGROUND)) {
-	$backstyle = 'background: linear-gradient('.($conf->browser->layout == 'phone' ? '0deg' : '4deg').', rgb(240,240,240) 52%, rgb('.$colorbackhmenu1.') 52.1%);';
+	$backstyle = 'background: linear-gradient('.((!empty($conf->browser->layout) && $conf->browser->layout == 'phone') ? '0deg' : '4deg').', rgb(240,240,240) 52%, rgb('.$colorbackhmenu1.') 52.1%);';
 	// old style:  $backstyle = 'background-image: linear-gradient(rgb('.$colorbackhmenu1.',0.3), rgb(240,240,240));';
 	$backstyle = getDolGlobalString('MAIN_LOGIN_BACKGROUND_STYLE', $backstyle);
 	print empty($conf->global->MAIN_LOGIN_BACKGROUND) ? ' style="background-size: cover; background-position: center center; background-attachment: fixed; background-repeat: no-repeat; '.$backstyle.'"' : '';

+ 2 - 2
htdocs/main.inc.php

@@ -898,7 +898,7 @@ if (!defined('NOLOGIN')) {
 				//top_httphead();
 				return 'ERROR_NOT_LOGGED';
 			} else {
-				if ($_SERVER["HTTP_USER_AGENT"] == 'securitytest') {
+				if (!empty($_SERVER["HTTP_USER_AGENT"]) && $_SERVER["HTTP_USER_AGENT"] == 'securitytest') {
 					http_response_code(401); // It makes easier to understand if session was broken during security tests
 				}
 				dol_loginfunction($langs, $conf, (!empty($mysoc) ? $mysoc : ''));	// This include http headers
@@ -1663,7 +1663,7 @@ function top_htmlhead($head, $title = '', $disablejs = 0, $disablehead = 0, $arr
 		}
 		$hookmanager->initHooks(array("main"));
 
-		$ext = 'layout='.$conf->browser->layout.'&amp;version='.urlencode(DOL_VERSION);
+		$ext = 'layout='.(empty($conf->browser->layout) ? '' : $conf->browser->layout).'&amp;version='.urlencode(DOL_VERSION);
 
 		print "<head>\n";