Skip to content

Commit

Permalink
Fix Undefined index: HTTP_ACCEPT_LANGUAGE
Browse files Browse the repository at this point in the history
fixes #8370
  • Loading branch information
lippserd committed Mar 11, 2015
1 parent ba0154a commit d102a61
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions library/Icinga/Application/Web.php
Expand Up @@ -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;
}

/**
Expand Down

0 comments on commit d102a61

Please sign in to comment.