From 70e475d0ce5605c99b768cdd1723611387e69a34 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 24 Oct 2023 15:40:36 +0200 Subject: [PATCH] Fix warnings --- htdocs/core/tpl/login.tpl.php | 6 ++++-- htdocs/main.inc.php | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/htdocs/core/tpl/login.tpl.php b/htdocs/core/tpl/login.tpl.php index 4ab2d41045d..f59777d4899 100644 --- a/htdocs/core/tpl/login.tpl.php +++ b/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 () {
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.'"' : ''; diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 4e4adcdf2ba..1bcc398cd40 100644 --- a/htdocs/main.inc.php +++ b/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.'&version='.urlencode(DOL_VERSION); + $ext = 'layout='.(empty($conf->browser->layout) ? '' : $conf->browser->layout).'&version='.urlencode(DOL_VERSION); print "\n";