diff --git a/user/edit.html b/user/edit.html
index b1ba05d32d0..f19aa72623b 100644
--- a/user/edit.html
+++ b/user/edit.html
@@ -234,7 +234,7 @@ if (isadmin()) {
-->
- | : |
+ : |
prefix.'timezone GROUP BY name');
@@ -260,7 +260,12 @@ if (isadmin()) {
$presets[sprintf("%.1f", $i)] = $tzstring;
}
}
- choose_from_menu($presets, 'timezone', $user->timezone, get_string('serverlocaltime'), '', '99');
+ if(!empty($CFG->forcetimezone)) {
+ choose_from_menu($presets, 'timezone', $CFG->forcetimezone, get_string('serverlocaltime'), '', '99', false, true);
+ }
+ else {
+ choose_from_menu($presets, 'timezone', $user->timezone, get_string('serverlocaltime'), '', '99');
+ }
?>
|
diff --git a/user/edit.php b/user/edit.php
index 2efef16a66e..bfb172cceaf 100644
--- a/user/edit.php
+++ b/user/edit.php
@@ -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));