diff --git a/mod/lesson/editpage.php b/mod/lesson/editpage.php index e0b4bd3983a..05f062de9c4 100644 --- a/mod/lesson/editpage.php +++ b/mod/lesson/editpage.php @@ -32,8 +32,11 @@ $pageid = required_param('pageid', PARAM_INT); $id = required_param('id', PARAM_INT); // Course Module ID $qtype = optional_param('qtype', 0, PARAM_INT); $edit = optional_param('edit', false, PARAM_BOOL); -$returnto = optional_param('returnto', null, PARAM_URL); -if (empty($returnto)) { +$returnto = optional_param('returnto', null, PARAM_LOCALURL); + +if (!empty($returnto)) { + $returnto = new moodle_url($returnto); +} else { $returnto = new moodle_url('/mod/lesson/edit.php', array('id' => $id)); $returnto->set_anchor('lesson-' . $pageid); } diff --git a/mod/lesson/locallib.php b/mod/lesson/locallib.php index 6cf5026acd8..47ecf3ce820 100644 --- a/mod/lesson/locallib.php +++ b/mod/lesson/locallib.php @@ -581,7 +581,7 @@ function lesson_add_header_buttons($cm, $context, $extraeditbuttons=false, $less 'id' => $cm->id, 'pageid' => $lessonpageid, 'edit' => 1, - 'returnto' => $PAGE->url->out(false) + 'returnto' => $PAGE->url->out_as_local_url(false) )); $PAGE->set_button($OUTPUT->single_button($url, get_string('editpagecontent', 'lesson'))); } @@ -1320,7 +1320,7 @@ abstract class lesson_add_page_form_base extends moodleform { if (!empty($this->_customdata['returnto'])) { $mform->addElement('hidden', 'returnto', $this->_customdata['returnto']); - $mform->setType('returnto', PARAM_URL); + $mform->setType('returnto', PARAM_LOCALURL); } $mform->addElement('hidden', 'id');