]> git.mxchange.org Git - mailer.git/blobdiff - inc/functions.php
Migration of stelzi's commit 1022 with some changes so we have a nicer code. See...
[mailer.git] / inc / functions.php
index 64e185bdec56a990499f7ae4018c482ea523da91..b9decbaac6d40711fb02e40b93b2ed486c0f5837 100644 (file)
@@ -79,7 +79,6 @@ function OUTPUT_HTML ($HTML, $newLine = true) {
 
                default:
                        // Huh, something goes wrong or maybe you have edited config.php ???
-                       DEBUG_LOG(__FUNCTION__, __LINE__, sprintf("Invalid renderer %s detected.", getConfig('OUTPUT_MODE')));
                        app_die(__FUNCTION__, __LINE__, "<strong>{--FATAL_ERROR--}:</strong> {--LANG_NO_RENDER_DIRECT--}");
                        break;
                }
@@ -2248,20 +2247,29 @@ function fixDeletedCookies ($cookies) {
 
 // Output error messages in a fasioned way and die...
 function app_die ($F, $L, $msg) {
-       // Load header
-       loadIncludeOnce('inc/header.php');
+       // Check if Script is already dieing and not let it kill itself another 1000 times
+       if (!isset($GLOBALS['app_died'])) {
+               // Make sure, that the script realy realy diese here and now
+               $GLOBALS['app_died'] = true;
 
-       // Prepare message for output
-       $msg = sprintf(getMessage('MXCHANGE_HAS_DIED'), basename($F), $L, $msg);
+               // Load header
+               loadIncludeOnce('inc/header.php');
 
-       // Load the message template
-       LOAD_TEMPLATE('admin_settings_saved', false, $msg);
+               // Prepare message for output
+               $msg = sprintf(getMessage('MXCHANGE_HAS_DIED'), basename($F), $L, $msg);
 
-       // Load footer
-       loadIncludeOnce('inc/footer.php');
+               // Load the message template
+               LOAD_TEMPLATE('admin_settings_saved', false, $msg);
 
-       // Exit explicitly
-       shutdown();
+               // Load footer
+               loadIncludeOnce('inc/footer.php');
+
+               // Exit explicitly
+               shutdown();
+       } else {
+               // Script tried to kill itself twice
+               debug_report_bug('Script wanted to kill itself more than once! Raw message=' . $msg . ', file/function=' . $F . ', line=' . $L);
+       }
 }
 
 // Display parsing time and number of SQL queries in footer