]> git.mjollnir.org Git - moodle.git/commitdiff
I hope final fix for warnings when using error() after print_header() with buffering...
authorskodak <skodak>
Sun, 14 May 2006 17:23:29 +0000 (17:23 +0000)
committerskodak <skodak>
Sun, 14 May 2006 17:23:29 +0000 (17:23 +0000)
lib/cookieless.php
lib/weblib.php

index c4f8766a5f448a53741aa21ff6feb894b58262e0..dc3209393aff523b9ba48ae54ccc5e9ff5760f2b 100644 (file)
@@ -1,4 +1,4 @@
-<?php
+<?php  // $Id$
 /**
 * Enable cookieless sessions by including $CFG->usesid=true;
 * in config.php.
@@ -116,7 +116,7 @@ function sid_start_ob(){
             }
         }
     }
-    ini_set("session.use_trans_sid", "true"); // try and turn on trans_sid
+    @ini_set("session.use_trans_sid", "true"); // try and turn on trans_sid
     if (ini_get("session.use_trans_sid")!=0 ){ 
         // use trans sid as its available
         ini_set("url_rewriter.tags", "a=href,area=href,script=src,link=href," 
index efb1141b2518bcc6d66368ac41dc8815ad0c64d0..11bef1a194d9fa8698161a077df8281e83c4ce83 100644 (file)
@@ -4029,6 +4029,12 @@ function print_scale_menu_helpbutton($courseid, $scale) {
 function error ($message, $link='') {
     global $CFG, $SESSION;
 
+    // flush all buffers so that we know if headers were already sent
+    while (@ob_end_flush());
+    // reenable SID rewrite if needed
+    if (!empty($CFG->usesid) and empty($_COOKIE['MoodleSession'.$CFG->sessioncookie])) {
+        sid_start_ob();
+    }
     if (!headers_sent()) {
         //header not yet printed
         @header('HTTP/1.0 404 Not Found');