From 13ad4e12e12d6dad3ba597908cd0f571ece49847 Mon Sep 17 00:00:00 2001 From: skodak Date: Tue, 5 Sep 2006 21:51:31 +0000 Subject: [PATCH] fix for bug MDL-5403 , you can now force redirect with 0 delay even when header already printed --- lib/weblib.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/weblib.php b/lib/weblib.php index 7aeb8589040..cd9767d2be1 100644 --- a/lib/weblib.php +++ b/lib/weblib.php @@ -4272,7 +4272,7 @@ function notice_yesno ($message, $linkyes, $linkno) { * the correct input) and then encode for where it's needed * echo ""; */ -function redirect($url, $message='', $delay='0') { +function redirect($url, $message='', $delay=-1) { global $CFG; @@ -4292,13 +4292,16 @@ function redirect($url, $message='', $delay='0') { /// when no message and header printed yet, try to redirect if (empty($message) and !defined('HEADER_PRINTED')) { + if ($delay == -1) { + $delay = 0; + } echo ''; echo ''; // To cope with Mozilla bug die; } - if (empty($delay)) { - $delay = 3; // if there is something already printed or message to display wait min 3 seconds + if ($delay == -1) { + $delay = 3; // if no delay specified wait 3 seconds } if (! defined('HEADER_PRINTED')) { print_header('', '', '', '', '');