Fix operator precedence when detecting the default locale

fixes #8370
This commit is contained in:
Johannes Meyer 2015-03-04 08:28:30 +01:00
parent e2887df03e
commit 6e61980dd2

View File

@ -314,12 +314,12 @@ class Web extends ApplicationBootstrap
protected function detectLocale() protected function detectLocale()
{ {
$auth = Manager::getInstance(); $auth = Manager::getInstance();
if (! $auth->isAuthenticated() if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE']) && !$auth->isAuthenticated()
|| ($locale = $auth->getUser()->getPreferences()->getValue('icingaweb', 'language')) === null || ($locale = $auth->getUser()->getPreferences()->getValue('icingaweb', 'language')) === null
&& isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])
) { ) {
$locale = Translator::getPreferredLocaleCode($_SERVER['HTTP_ACCEPT_LANGUAGE']); $locale = Translator::getPreferredLocaleCode($_SERVER['HTTP_ACCEPT_LANGUAGE']);
} }
return $locale; return $locale;
} }