From 6ec7ca0f07a866af5bf7af9ef0faaa8da4f127ad Mon Sep 17 00:00:00 2001 From: skodak Date: Mon, 11 Sep 2006 20:41:49 +0000 Subject: [PATCH] fixed handling of selected language in installer; fixed selection of session language --- lib/setup.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/lib/setup.php b/lib/setup.php index 49758f8c1d..46d0b25fbb 100644 --- a/lib/setup.php +++ b/lib/setup.php @@ -535,15 +535,18 @@ $CFG->os = PHP_OS; /// in the language file. Otherwise, if the admin hasn't specified a locale /// then use the one from the default language. Otherwise (and this is the /// majority of cases), use the stored locale specified by admin. - - if ($lang = optional_param('lang', PARAM_SAFEDIR)) { - if (!detect_munged_arguments($lang, 0) and (file_exists($CFG->dataroot .'/lang/'. $lang) or - file_exists($CFG->dirroot .'/lang/'. $lang))) { + if ($SESSION !== NULL and $lang = optional_param('lang', false, PARAM_SAFEDIR)) { + if (file_exists($CFG->dataroot .'/lang/'. $lang) or file_exists($CFG->dirroot .'/lang/'. $lang)) { $SESSION->lang = $lang; } } + unset($lang); if (empty($CFG->lang)) { - $CFG->lang = !empty($CFG->unicodedb) ? 'en_utf8' : 'en'; + if (empty($SESSION->lang)) { + $CFG->lang = !empty($CFG->unicodedb) ? 'en_utf8' : 'en'; + } else { + $CFG->lang = $SESSION->lang; + } } // set default locale - might be changed again later in require_login() -- 2.39.5