diff --git a/mod/wiki/editcomments.php b/mod/wiki/editcomments.php index ebdddb4cbf615..4abb33a522063 100644 --- a/mod/wiki/editcomments.php +++ b/mod/wiki/editcomments.php @@ -64,6 +64,9 @@ if (!$comment = $DB->get_record('comments', array('id' => $commentid))) { print_error('invalidcomment'); } + if ($USER->id != $comment->userid) { + throw new \moodle_exception('cannotviewpage', 'wiki'); + } } $editcomments->set_page($page); diff --git a/mod/wiki/pagelib.php b/mod/wiki/pagelib.php index 16b9e22918581..58c608d64ad2a 100644 --- a/mod/wiki/pagelib.php +++ b/mod/wiki/pagelib.php @@ -835,7 +835,7 @@ private function edit_comment_form($com) { if ($this->format == 'html') { $com->action = 'edit'; - $com->entrycomment_editor['text'] = $com->content; + $com->entrycomment_editor['text'] = clean_text($com->content, $this->format); $com->commentoptions = array('trusttext' => true, 'maxfiles' => 0); $this->form->set_data($com);