]> git.mjollnir.org Git - moodle.git/commitdiff
Cron.php workaround for IE & RFC2616 - MDL-7221; merged from MOODLE_17_STABLE
authorskodak <skodak>
Thu, 26 Oct 2006 08:55:56 +0000 (08:55 +0000)
committerskodak <skodak>
Thu, 26 Oct 2006 08:55:56 +0000 (08:55 +0000)
admin/cron.php
lib/moodlelib.php

index 4f17ce956819c35142c328bdc380c3e0064f787b..b890c35cdfb351c4c690a6c767b6f8750260704f 100644 (file)
     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 "<xmp>"; //<pre> is not good enough for us here
+    } else {
+        //send proper plaintext header
+        @header('Content-Type: text/plain; charset='.current_charset());
+    }
 
 /// Start output log
 
     $difftime = microtime_diff($starttime, microtime());
     mtrace("Execution took ".$difftime." seconds"); 
 
+/// finishe the IE hack
+    if (check_browser_version('MSIE')) {
+        echo "</xmp>";
+    }
+
 ?>
index a810e153fd0555134ec1be48363bac79abf3c1f5..8aa10b815c9afe097114ec3350da35e2ca3fd1ac 100644 (file)
@@ -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