MDL-62571 mod_forum: fixed redirection URLs
authorMark Nelson <markn@moodle.com>
Thu, 31 May 2018 08:46:49 +0000 (16:46 +0800)
committerMark Nelson <markn@moodle.com>
Mon, 11 Jun 2018 10:29:58 +0000 (18:29 +0800)
mod/forum/post.php

index df0a726..84652e4 100644 (file)
@@ -350,7 +350,7 @@ if (!empty($forum)) {      // User is starting a new discussion in a forum
                 $event->add_record_snapshot('forum_discussions', $discussion);
                 $event->trigger();
 
-                redirect("view.php?f=$discussion->forum");
+                redirect(new moodle_url('/mod/forum/view.php', ['f' => $discussion->forum]));
 
             } else if (forum_delete_post($post, has_capability('mod/forum:deleteanypost', $modcontext),
                 $course, $cm, $forum)) {
@@ -845,7 +845,7 @@ if ($mform_post->is_cancelled()) {
 
     } else { // Adding a new discussion.
         // The location to redirect to after successfully posting.
-        $redirectto = new moodle_url('view.php', array('f' => $fromform->forum));
+        $redirectto = new moodle_url('/mod/forum/view.php', array('f' => $fromform->forum));
 
         $fromform->mailnow = empty($fromform->mailnow) ? 0 : 1;