From: skodak Date: Thu, 26 Oct 2006 08:55:56 +0000 (+0000) Subject: Cron.php workaround for IE & RFC2616 - MDL-7221; merged from MOODLE_17_STABLE X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=58e8f85ba6f40d331c6e1d26ed57964d5a790a24;p=moodle.git Cron.php workaround for IE & RFC2616 - MDL-7221; merged from MOODLE_17_STABLE --- diff --git a/admin/cron.php b/admin/cron.php index 4f17ce9568..b890c35cdf 100644 --- a/admin/cron.php +++ b/admin/cron.php @@ -53,7 +53,14 @@ moodle_setlocale(); /// send mime type and encoding - @header('Content-Type: text/plain; charset='.current_charset()); + if (check_browser_version('MSIE')) { + //ugly IE hack to work around downloading instead of viewing + @header('Content-Type: text/html; charset='.current_charset()); + echo ""; //<pre> is not good enough for us here + } else { + //send proper plaintext header + @header('Content-Type: text/plain; charset='.current_charset()); + } /// Start output log @@ -334,4 +341,9 @@ $difftime = microtime_diff($starttime, microtime()); mtrace("Execution took ".$difftime." seconds"); +/// finishe the IE hack + if (check_browser_version('MSIE')) { + echo ""; + } + ?> diff --git a/lib/moodlelib.php b/lib/moodlelib.php index a810e153fd..8aa10b815c 100644 --- a/lib/moodlelib.php +++ b/lib/moodlelib.php @@ -5208,12 +5208,12 @@ function check_php_version($version='4.1.0') { * @return bool */ function check_browser_version($brand='MSIE', $version=5.5) { - $agent = $_SERVER['HTTP_USER_AGENT']; - - if (empty($agent)) { + if (empty($_SERVER['HTTP_USER_AGENT'])) { return false; } + $agent = $_SERVER['HTTP_USER_AGENT']; + switch ($brand) { case 'Firefox': /// Mozilla Firefox browsers