From abdcbb162a05b7e1157957a4b465b736dc657983 Mon Sep 17 00:00:00 2001 From: Alex Date: Thu, 26 Nov 2015 01:29:53 +0300 Subject: [PATCH] fix PHP Notice: Undefined index: HTTP_ACCEPT_LANGUAGE --- include/limesurvey/config.php | 3 +-- lang.inc.php | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/include/limesurvey/config.php b/include/limesurvey/config.php index 47646944..681316a0 100644 --- a/include/limesurvey/config.php +++ b/include/limesurvey/config.php @@ -67,8 +67,7 @@ $debug = 0; // Set this to 1 if you are looking f // LimeSurvey developers: Set this to 3 to circumvent the restriction to remove the installation directory and full access to standard templates // or to change the password. If you set it to 3 then PHP STRICT warnings will be shown additionally. -$defaultlang = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2); -if (empty($defaultlang)) $defaultlang = DEFAULT_LOCALE; +$defaultlang = isset($_SERVER["HTTP_ACCEPT_LANGUAGE"]) ? substr($_SERVER["HTTP_ACCEPT_LANGUAGE"],0,2) : DEFAULT_LOCALE; $defaulttemplate = "quexs"; $siteadminemail = "quexs@acspri.org.au"; diff --git a/lang.inc.php b/lang.inc.php index 5644455e..e4a5c4e3 100644 --- a/lang.inc.php +++ b/lang.inc.php @@ -63,8 +63,7 @@ function TQ_($msg) } -$locale = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2); -if (empty($locale)) $locale = DEFAULT_LOCALE; +$locale = isset($_SERVER["HTTP_ACCEPT_LANGUAGE"]) ? substr($_SERVER["HTTP_ACCEPT_LANGUAGE"],0,2) : DEFAULT_LOCALE; T_setlocale(LC_MESSAGES, $locale); T_bindtextdomain($locale, dirname(__FILE__)."/locale"); T_bind_textdomain_codeset($locale, 'UTF-8');