aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--langs.inc.php2
-rw-r--r--localeDetection.class.php9
2 files changed, 7 insertions, 4 deletions
diff --git a/langs.inc.php b/langs.inc.php
index 7180c9a1e..59f89b910 100644
--- a/langs.inc.php
+++ b/langs.inc.php
@@ -112,7 +112,7 @@ function relocate($langs, $page = '', $default_locale = 'en', $force_accept_lang
$relocate = sprintf('/%s/%s', $locale->getCompatibleLocale(), $page);
$relocate = str_replace('//', '/', $relocate);
- if ('cli' != PHP_SAPI && do_redirect) {
+ if ('cli' != PHP_SAPI && $do_redirect) {
header('Location: ' . $relocate);
}
diff --git a/localeDetection.class.php b/localeDetection.class.php
index d1b20357d..d2a3a089d 100644
--- a/localeDetection.class.php
+++ b/localeDetection.class.php
@@ -27,9 +27,12 @@ class ChooseLocale
public function __construct($list=array('en-US'), $force_http_accept_language = null)
{
- $this -> HTTPAcceptLang = is_null($force_http_accept_language) ?
- $_SERVER['HTTP_ACCEPT_LANGUAGE'] :
- $force_http_accept_language;
+ if (null !== $force_http_accept_language) {
+ $this -> HTTPAcceptLang = $force_http_accept_language;
+ } else if (!empty($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
+ $this -> HTTPAcceptLang = $_SERVER['HTTP_ACCEPT_LANGUAGE'];
+ }
+
$this -> supportedLocales = array_unique($list);
$this -> setDefaultLocale('en-US');
$this -> setCompatibleLocale();