]> git.mjollnir.org Git - moodle.git/commitdiff
weblib: Let redirect() take a moodle_url object.
authortjhunt <tjhunt>
Wed, 15 Jul 2009 04:05:05 +0000 (04:05 +0000)
committertjhunt <tjhunt>
Wed, 15 Jul 2009 04:05:05 +0000 (04:05 +0000)
lib/weblib.php

index cf319a86f25abd6c918eaadc4bad40292f131168..570b0c4c582e04896bbcf831aa2f273c17d3d8c8 100644 (file)
@@ -4695,7 +4695,7 @@ function notice_yesno ($message, $linkyes, $linkno, $optionsyes=NULL, $optionsno
  * <strong>Good practice:</strong> You should call this method before starting page
  * output by using any of the OUTPUT methods.
  *
- * @param string $url The URL to redirect to
+ * @param mixed $url either a string URL, or a moodle_url to redirect to
  * @param string $message The message to display to the user
  * @param int $delay The delay before redirecting
  * @return void
@@ -4703,6 +4703,10 @@ function notice_yesno ($message, $linkyes, $linkno, $optionsyes=NULL, $optionsno
 function redirect($url, $message='', $delay=-1) {
     global $OUTPUT, $SESSION, $CFG;
 
+    if ($url instanceof moodle_url) {
+        $url = $url->out(false, array(), false);
+    }
+
     if (!empty($CFG->usesid) && !isset($_COOKIE[session_name()])) {
        $url = $SESSION->sid_process_url($url);
     }