More fixes for redirect vs. regular output, thanks to wernisman
[mailer.git] / inc / functions.php
index d81847800247afa6b9d8babb914eee11fe86bf88..95d143c2a33e1dcde41e965dd93ac032694a99c5 100644 (file)
@@ -85,7 +85,7 @@ function outputHtml ($htmlCode, $newLine = true) {
                                app_die(__FUNCTION__, __LINE__, '<strong>{--FATAL_ERROR--}:</strong> {--LANG_NO_RENDER_DIRECT--}');
                                break;
                } // END - switch
-       } elseif (getPhpCaching() == 'on') {
+       } elseif ((getPhpCaching() == 'on') && ((!isset($GLOBALS['header'])) || (count($GLOBALS['header']) == 0))) {
                // Output cached HTML code
                $GLOBALS['output'] = ob_get_contents();
 
@@ -121,6 +121,9 @@ function outputHtml ($htmlCode, $newLine = true) {
 
                // Output code here, DO NOT REMOVE! ;-)
                outputRawCode($GLOBALS['output']);
+       } else {
+               // And flush all headers
+               flushHeaders();
        }
 }
 
@@ -170,12 +173,18 @@ function compileFinalOutput () {
 
        // Compress it?
        if (!empty($_SERVER['HTTP_ACCEPT_ENCODING']) && (strpos('gzip', $_SERVER['HTTP_ACCEPT_ENCODING']) !== null)) {
-               // Compress it
+               // Compress it for HTTP gzip
                $GLOBALS['output'] = gzencode($GLOBALS['output'], 9, true);
 
                // Add header
                sendHeader('Content-Encoding: gzip');
-       } // END - if
+       } elseif (!empty($_SERVER['HTTP_ACCEPT_ENCODING']) && (strpos('deflate', $_SERVER['HTTP_ACCEPT_ENCODING']) !== null)) {
+               // Compress it for HTTP deflate
+               $GLOBALS['output'] = gzcompress($GLOBALS['output'], 9);
+
+               // Add header
+               sendHeader('Content-Encoding: deflate');
+       }
 
        // Add final length
        sendHeader('Content-Length: ' . strlen($GLOBALS['output']));
@@ -3823,7 +3832,6 @@ function encodeUrl ($url, $outputMode = '0') {
 
                // Add it to URL
                if (session_id() != '') {
-                       die($url);
                        $url .= $seperator . session_name() . '=' . session_id();
                } // END - if
        } // END - if