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 '
'; echo ''; echo ''; diff --git a/lang/en_utf8/admin.php b/lang/en_utf8/admin.php index 978010ee5cd..8fa3ec01d51 100644 --- a/lang/en_utf8/admin.php +++ b/lang/en_utf8/admin.php @@ -16,6 +16,9 @@ $string['security'] = 'Security'; $string['userlist'] = 'Browse list of users'; $string['courses'] = 'Courses'; $string['location'] = 'Location'; +$string['errorwithsettings'] = 'Some settings were not changed due to an error:'; +$string['errorsetting'] = 'Could not save setting:'; +$string['validateerror'] = 'This value was not valid: '; $string['coursemgmt'] = 'Add/edit courses'; $string['debugging'] = 'Debugging'; $string['plugins'] = 'Modules';