debug_report_bug() does call app_die() again (internal TODO), nicer template for...
[mailer.git] / inc / functions.php
index d81847800247afa6b9d8babb914eee11fe86bf88..8928e602fa428c51ab064641ff281a61e17d5e90 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']));
@@ -2199,10 +2208,10 @@ function app_die ($F, $L, $message) {
                $message = sprintf(getMessage('MXCHANGE_HAS_DIED'), basename($F), $L, $message);
 
                // Better log this message away
-               logDebugMessage($F, $L, $message);
+               if ($F != 'debug_report_bug') logDebugMessage($F, $L, $message);
 
                // Load the message template
-               loadTemplate('admin_settings_saved', false, $message);
+               loadTemplate('app_die_message', false, $message);
 
                // Load footer
                loadIncludeOnce('inc/footer.php');
@@ -2578,8 +2587,7 @@ function debug_report_bug ($message = '', $sendEmail = true) {
        } // END - if
 
        // And abort here
-       // @TODO This cannot be rewritten to app_die(), try to find a solution for this.
-       die($debug);
+       app_die(__FUNCTION__, __LINE__, $debug);
 }
 
 // Generates a ***weak*** seed
@@ -3823,7 +3831,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