Merge branch 'MDL-49985_master' of git://github.com/markn86/moodle
authorAndrew Nicols <andrew@nicols.co.uk>
Wed, 6 May 2015 03:11:21 +0000 (11:11 +0800)
committerAndrew Nicols <andrew@nicols.co.uk>
Wed, 6 May 2015 03:11:21 +0000 (11:11 +0800)
Conflicts:
mod/forum/post.php

1  2 
lib/moodlelib.php
mod/choice/view.php
mod/forum/post.php

Simple merge
Simple merge
@@@ -117,8 -116,10 +117,10 @@@ if (!empty($forum)) {      // User is s
              if (!is_enrolled($coursecontext)) {
                  if (enrol_selfenrol_available($course->id)) {
                      $SESSION->wantsurl = qualified_me();
 -                    $SESSION->enrolcancel = $_SERVER['HTTP_REFERER'];
 +                    $SESSION->enrolcancel = clean_param($_SERVER['HTTP_REFERER'], PARAM_LOCALURL);
-                     redirect($CFG->wwwroot.'/enrol/index.php?id='.$course->id, get_string('youneedtoenrol'));
+                     redirect(new moodle_url('/enrol/index.php', array('id' => $course->id,
+                         'returnurl' => '/mod/forum/view.php?f=' . $forum->id)),
+                         get_string('youneedtoenrol'));
                  }
              }
          }
          if (!isguestuser()) {
              if (!is_enrolled($coursecontext)) {  // User is a guest here!
                  $SESSION->wantsurl = qualified_me();
 -                $SESSION->enrolcancel = $_SERVER['HTTP_REFERER'];
 +                $SESSION->enrolcancel = clean_param($_SERVER['HTTP_REFERER'], PARAM_LOCALURL);
-                 redirect(new moodle_url('/enrol/index.php', array(
-                                             'id' => $course->id,
-                                             'returnurl' => new moodle_url('/mod/forum/view.php',
-                                                                           array('f' => $forum->id))
-                                        )),
-                          get_string('youneedtoenrol'));
+                 redirect(new moodle_url('/enrol/index.php', array('id' => $course->id,
+                     'returnurl' => '/mod/forum/view.php?f=' . $forum->id)),
+                     get_string('youneedtoenrol'));
              }
          }
          print_error('nopostforum', 'forum');