diff --git a/admin/settings.php b/admin/settings.php
index f0756ef80a7..65ad4d30a1d 100644
--- a/admin/settings.php
+++ b/admin/settings.php
@@ -49,37 +49,6 @@ if (!($root->check_access())) {
$CFG->pagepath = 'admin/setting/'.$section;
-// WRITING SUBMITTED DATA (IF ANY) -------------------------------------------------------------------------------
-
-if ($data = data_submitted()) {
- if (confirm_sesskey()) {
- $olddbsessions = !empty($CFG->dbsessions);
- $errors = $root->write_settings((array)$data);
- //force logout if dbsession setting changes
- if ($olddbsessions != !empty($CFG->dbsessions)) {
- require_logout();
- }
- if (empty($errors)) {
- switch ($return) {
- case 'site':
- redirect("$CFG->wwwroot/");
- case 'admin':
- redirect("$CFG->wwwroot/$CFG->admin/");
- default:
- // following redirect should display confirmation message because it redirects
- // to the same page, user might not know if save button worked
- redirect("$CFG->wwwroot/$CFG->admin/settings.php?section=" . $PAGE->section, get_string('changessaved'),2);
- }
- } else {
- error(get_string('errorwithsettings', 'admin') . '
' . $errors);
- }
- } else {
- error(get_string('confirmsesskeybad', 'error'));
- die;
- }
-}
-
-// ---------------------------------------------------------------------------------------------------------------
if (!empty($SITE->fullname)) {
@@ -105,6 +74,38 @@ if (!empty($SITE->fullname)) {
}
+
+// WRITING SUBMITTED DATA (IF ANY) -------------------------------------------------------------------------------
+
+if ($data = data_submitted()) {
+ if (confirm_sesskey()) {
+ $olddbsessions = !empty($CFG->dbsessions);
+ $errors = $root->write_settings((array)$data);
+ //force logout if dbsession setting changes
+ if ($olddbsessions != !empty($CFG->dbsessions)) {
+ require_logout();
+ }
+ if (empty($errors)) {
+ switch ($return) {
+ case 'site':
+ redirect("$CFG->wwwroot/");
+ case 'admin':
+ redirect("$CFG->wwwroot/$CFG->admin/");
+ default:
+ notify(get_string('changessaved'));
+ }
+ } else {
+ notify(get_string('errorwithsettings', 'admin') . '
' . $errors);
+ }
+ } else {
+ error(get_string('confirmsesskeybad', 'error'));
+ }
+}
+
+// ---------------------------------------------------------------------------------------------------------------
+
+
+
echo '