Merged fixes from stable

This commit is contained in:
moodler 2006-10-12 03:31:48 +00:00
parent 2df5f8f53d
commit c6d33fce5b
2 changed files with 35 additions and 31 deletions

View File

@ -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') . ' <br />' . $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') . ' <br />' . $errors);
}
} else {
error(get_string('confirmsesskeybad', 'error'));
}
}
// ---------------------------------------------------------------------------------------------------------------
echo '<form action="settings.php" method="post" name="adminsettings" id="adminsettings">';
echo '<input type="hidden" name="section" value="' . $PAGE->section . '" />';
echo '<input type="hidden" name="sesskey" value="' . $USER->sesskey . '" />';

View File

@ -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';