]> git.mxchange.org Git - mailer.git/blobdiff - inc/functions.php
Fixes for a lot bug tickets. (Sorry for lame comment)
[mailer.git] / inc / functions.php
index 591f12976bfae3e57a08f8a04c7e0efa0747d1c8..fd8b2c5a9074c4fd388e3bb1999e6ed4f35ade1c 100644 (file)
@@ -137,6 +137,18 @@ function OUTPUT_HTML($HTML, $NEW_LINE = true) {
                        break;
                }
        } elseif ((_OB_CACHING == "on") && ($footer == 1)) {
+               // Headers already sent?
+               if (headers_sent()) {
+                       // Log this error
+                       DEBUG_LOG(__FUNCTION__, __LINE__, "Headers already sent! We need debug backtrace here.");
+
+                       // Output debug trace
+                       print("<stron>Headers are already sent!</strong><br />\n");
+                       print("Please report this error at <a href=\"http://bugs.mxchange.org\" rel=\"external\" target=\"_blank\">bugs.mxchange.org</a>:<pre>");
+                       debug_print_backtrace();
+                       die("</pre>Thank you for your help finding bugs.");
+               } // END - if
+
                // Output cached HTML code
                $OUTPUT = ob_get_contents();
 
@@ -2581,6 +2593,7 @@ function REVERT_COMMA ($str) {
        // Return float
        return $float;
 }
+
 // Handle menu-depending failed logins and return the rendered content
 function HANDLE_LOGIN_FAILTURES ($accessLevel) {
        // Default output is empty ;-)
@@ -2609,6 +2622,7 @@ function HANDLE_LOGIN_FAILTURES ($accessLevel) {
        // Return rendered content
        return $OUT;
 }
+
 // Rebuild cache
 function REBUILD_CACHE ($cache, $inc="") {
        global $cacheInstance, $CSS;
@@ -2638,6 +2652,7 @@ function REBUILD_CACHE ($cache, $inc="") {
                } // END - if
        } // END - if
 }
+
 // Purge admin menu cache
 function CACHE_PURGE_ADMIN_MENU ($id=0, $action="", $what="", $str="") {
        global $cacheInstance;
@@ -2656,8 +2671,9 @@ function CACHE_PURGE_ADMIN_MENU ($id=0, $action="", $what="", $str="") {
        }
 
        // Experiemental feature!
-       trigger_error("You have to delete the admin_*.cache files by yourself at this point.");
+       trigger_error("<strong>Experimental feature:</strong> You have to delete the admin_*.cache files by yourself at this point.");
 }
+
 // Translates the "pool type" into human-readable
 function TRANSLATE_POOL_TYPE ($type) {
        // Default type is unknown
@@ -2675,6 +2691,7 @@ function TRANSLATE_POOL_TYPE ($type) {
        // Return "translation"
        return $translated;
 }
+
 // "Getter" for remote IP number
 function GET_REMOTE_ADDR () {
        // Get remote ip from environment
@@ -2961,12 +2978,16 @@ function THEME_GET_ID ($name) {
        return $id;
 }
 
-// Increment or init with 1 the given config entry
-function incrementConfigEntry ($configEntry) {
+// Increment or init with given value or 1 as default the given config entry
+function incrementConfigEntry ($configEntry, $value=1) {
        global $_CONFIG;
 
        // Increment it if set or init it with 1
-       if (getConfig($configEntry) > 0) { $_CONFIG[$configEntry]++; } else { $_CONFIG[$configEntry] = 1; }
+       if (getConfig($configEntry) > 0) {
+               $_CONFIG[$configEntry] += $value;
+       } else {
+               $_CONFIG[$configEntry] = $value;
+       }
 }
 
 //////////////////////////////////////////////////