From 5fec728be9df3c9fc282cd0897c73ca5cfcfea5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mikel=20Mart=C3=ADn?= Date: Wed, 27 Sep 2023 14:07:14 +0200 Subject: [PATCH] MDL-79509 mod_wiki: Improve comment editing --- mod/wiki/editcomments.php | 3 +++ mod/wiki/pagelib.php | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/mod/wiki/editcomments.php b/mod/wiki/editcomments.php index 0a87d0d826b..5023bc75b5c 100644 --- a/mod/wiki/editcomments.php +++ b/mod/wiki/editcomments.php @@ -64,6 +64,9 @@ if ($action == 'edit') { if (!$comment = $DB->get_record('comments', array('id' => $commentid))) { throw new \moodle_exception('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 6f61dd06261..c6b0222afc9 100644 --- a/mod/wiki/pagelib.php +++ b/mod/wiki/pagelib.php @@ -835,7 +835,7 @@ class page_wiki_editcomment extends page_wiki { 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);