MDL-79350 core: Do not store lang in session when readonly

This commit is contained in:
Dale Davies 2023-09-18 13:37:57 +01:00
parent 0a09e482e4
commit ce1f9ec96a

View File

@ -10210,8 +10210,14 @@ function setup_lang_from_browser() {
// Clean it properly for include.
$lang = strtolower(clean_param($lang, PARAM_SAFEDIR));
if (get_string_manager()->translation_exists($lang, false)) {
// Lang exists, set it in session.
$SESSION->lang = $lang;
// If the translation for this language exists then try to set it
// for the rest of the session, if this is a read only session then
// we can only set it temporarily in $CFG.
if (defined('READ_ONLY_SESSION') && !empty($CFG->enable_read_only_sessions)) {
$CFG->lang = $lang;
} else {
$SESSION->lang = $lang;
}
// We have finished. Go out.
break;
}