If $CFG->forcetimezone is not empty, don't allow users to change the timezone from
their profiles, and instead show a disabled menu with the forced timezone selected. Also, fixed a get_string (reading from wrong lang file).
This commit is contained in:
+9
-3
@@ -99,9 +99,15 @@
|
||||
$usernew->htmleditor = clean_param($usernew->htmleditor, PARAM_INT);
|
||||
$usernew->emailstop = clean_param($usernew->emailstop, PARAM_INT);
|
||||
|
||||
// Some replaces to prevent SQL injections
|
||||
$usernew->timezone = str_replace(';', '', $usernew->timezone);
|
||||
$usernew->timezone = str_replace('\'', '', $usernew->timezone);
|
||||
if(!empty($CFG->forcetimezone) && isset($usernew->timezone)) {
|
||||
// Don't allow changing this in any way if a timezone is forced
|
||||
unset($usernew->timezone);
|
||||
}
|
||||
else {
|
||||
// Some replaces to prevent SQL injections
|
||||
$usernew->timezone = str_replace(';', '', $usernew->timezone);
|
||||
$usernew->timezone = str_replace('\'', '', $usernew->timezone);
|
||||
}
|
||||
|
||||
foreach ($usernew as $key => $data) {
|
||||
$usernew->$key = addslashes(clean_text(stripslashes(trim($usernew->$key)), FORMAT_MOODLE));
|
||||
|
||||
Reference in New Issue
Block a user