Merge branch 'MDL-53357-dont-break-urls' of https://github.com/brendanheywood/moodle

This commit is contained in:
Eloy Lafuente (stronk7) 2016-03-22 02:25:40 +01:00
commit c572ac8f3a
2 changed files with 7 additions and 4 deletions

View file

@ -20,13 +20,15 @@ $focus = '';
// now we'll deal with the case that the admin has submitted the form with changed settings
if ($data = data_submitted() and confirm_sesskey()) {
if (admin_write_settings($data)) {
$statusmsg = get_string('changessaved');
redirect($PAGE->url, get_string('changessaved'), null, \core\output\notification::NOTIFY_SUCCESS);
}
if (!empty($adminroot->errors)) {
$errormsg = get_string('errorwithsettings', 'admin');
$firsterror = reset($adminroot->errors);
$focus = $firsterror->id;
} else {
redirect($PAGE->url);
}
}

View file

@ -36,7 +36,7 @@ $errormsg = '';
if ($data = data_submitted() and confirm_sesskey()) {
if (admin_write_settings($data)) {
$statusmsg = get_string('changessaved');
redirect($PAGE->url, get_string('changessaved'), null, \core\output\notification::NOTIFY_SUCCESS);
}
if (empty($adminroot->errors)) {
@ -44,6 +44,7 @@ if ($data = data_submitted() and confirm_sesskey()) {
case 'site': redirect("$CFG->wwwroot/");
case 'admin': redirect("$CFG->wwwroot/$CFG->admin/");
}
redirect($PAGE->url);
} else {
$errormsg = get_string('errorwithsettings', 'admin');
$firsterror = reset($adminroot->errors);
@ -72,7 +73,7 @@ if (empty($SITE->fullname)) {
// ---------------------------------------------------------------------------------------------------------------
echo '<form action="settings.php" method="post" id="adminsettings">';
echo '<form action="' . $PAGE->url . '" method="post" id="adminsettings">';
echo '<div class="settingsform clearfix">';
echo html_writer::input_hidden_params($PAGE->url);
echo '<input type="hidden" name="sesskey" value="'.sesskey().'" />';
@ -116,7 +117,7 @@ if (empty($SITE->fullname)) {
// ---------------------------------------------------------------------------------------------------------------
echo '<form action="settings.php" method="post" id="adminsettings">';
echo '<form action="' . $PAGE->url . '" method="post" id="adminsettings">';
echo '<div class="settingsform clearfix">';
echo html_writer::input_hidden_params($PAGE->url);
echo '<input type="hidden" name="sesskey" value="'.sesskey().'" />';