From: tjhunt Date: Wed, 15 Jul 2009 04:05:05 +0000 (+0000) Subject: weblib: Let redirect() take a moodle_url object. X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=366c74994c891140883c6e881e302b046b64c52e;p=moodle.git weblib: Let redirect() take a moodle_url object. --- diff --git a/lib/weblib.php b/lib/weblib.php index cf319a86f2..570b0c4c58 100644 --- a/lib/weblib.php +++ b/lib/weblib.php @@ -4695,7 +4695,7 @@ function notice_yesno ($message, $linkyes, $linkno, $optionsyes=NULL, $optionsno * Good practice: 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); }