From d102a61e2294bb19e156f07ae1612e115254bebc Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Wed, 11 Mar 2015 20:50:05 +0100 Subject: [PATCH 1/3] Fix Undefined index: HTTP_ACCEPT_LANGUAGE fixes #8370 --- library/Icinga/Application/Web.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/library/Icinga/Application/Web.php b/library/Icinga/Application/Web.php index 45dbc7e875..16f8d51310 100644 --- a/library/Icinga/Application/Web.php +++ b/library/Icinga/Application/Web.php @@ -314,13 +314,15 @@ protected function detectTimezone() protected function detectLocale() { $auth = Manager::getInstance(); - if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE']) && !$auth->isAuthenticated() - || ($locale = $auth->getUser()->getPreferences()->getValue('icingaweb', 'language')) === null + if ($auth->isAuthenticated() + && ($locale = $auth->getUser()->getPreferences()->getValue('icingaweb', 'language')) !== null ) { - $locale = Translator::getPreferredLocaleCode($_SERVER['HTTP_ACCEPT_LANGUAGE']); + return $locale; } - - return $locale; + if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) { + return Translator::getPreferredLocaleCode($_SERVER['HTTP_ACCEPT_LANGUAGE']); + } + return Translator::DEFAULT_LOCALE; } /** From 7fe4b3d7ab007790252a7ca365605209a44b54ab Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Wed, 11 Mar 2015 21:55:04 +0100 Subject: [PATCH 2/3] Fix PHPDoc of Web::detectLocale() --- library/Icinga/Application/Web.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/library/Icinga/Application/Web.php b/library/Icinga/Application/Web.php index 16f8d51310..b365252f05 100644 --- a/library/Icinga/Application/Web.php +++ b/library/Icinga/Application/Web.php @@ -307,9 +307,11 @@ protected function detectTimezone() /** * Setup internationalization using gettext * - * Uses the preferred user language or the configured default and system default, respectively. + * Uses the preferred user language or the browser suggested language or our default. * - * @return self + * @return string Detected locale code + * + * @see Translator::DEFAULT_LOCALE For the the default locale code. */ protected function detectLocale() { From 83443a5dc4b48c67fcaae9d3e7fcc3fafc0d00a2 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Thu, 12 Mar 2015 00:52:19 +0100 Subject: [PATCH 3/3] Use -1 for last update of the menu We must not rely on the server time minus an offset for the last update of the menu to trigger an immediate update of the menu because the server time may be behind the current time. fixes #8694 --- application/layouts/scripts/parts/navigation.phtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/layouts/scripts/parts/navigation.phtml b/application/layouts/scripts/parts/navigation.phtml index 2136c0fd56..92273e4b4a 100644 --- a/application/layouts/scripts/parts/navigation.phtml +++ b/application/layouts/scripts/parts/navigation.phtml @@ -21,7 +21,7 @@ if (! $this->auth()->isAuthenticated()) { -