Migration of stelzi's commit 1022 with some changes so we have a nicer code. See...
[mailer.git] / inc / fatal_errors.php
index 96a7d8539eb39de32922d865aa1654d63bf4feac..3ff6ec562ebf971879cc27dba211697d83f89d38 100644 (file)
  * -------------------------------------------------------------------- *
  * Kurzbeschreibung  : Gibt fatale Fehler aus                           *
  * -------------------------------------------------------------------- *
- *                                                                      *
+ * $Revision::                                                        $ *
+ * $Date::                                                            $ *
+ * $Tag:: 0.2.1-FINAL                                                 $ *
+ * $Author::                                                          $ *
+ * Needs to be in all Files and every File needs "svn propset           *
+ * svn:keywords Date Revision" (autoprobset!) at least!!!!!!            *
  * -------------------------------------------------------------------- *
  * Copyright (c) 2003 - 2008 by Roland Haeder                           *
  * For more information visit: http://www.mxchange.org                  *
 
 // Some security stuff...
 if (!defined('__SECURITY')) {
-       $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
+       $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), '/inc') + 4) . '/security.php';
        require($INC);
 }
 
-if ((sizeof($FATAL) > 0) || (!empty($FATAL[0])))
-{
+if (getTotalFatalErrors() > 0) {
+       // Load config here
+       loadIncludeOnce('inc/load_config.php');
+
        // Main div container
-       LOAD_TEMPLATE("fatal_header");
+       LOAD_TEMPLATE('fatal_header');
 
        // Set unset variable
-       if (empty($check)) $check = "";
-       if (isBooleanConstantAndTrue('mxchange_installing')) {
+       if (empty($check)) $check = '';
+       if ((isInstalling()) || (!isInstalled())) {
                // While we are installing ouput other header than while it is installed... :-)
-               $OUT = "";
-               foreach ($FATAL as $key => $value) {
+               $OUT = '';
+               foreach (getFatalArray() as $key => $value) {
                        // Prepare content for the template
                        $content = array(
                                'key'   => ($key + 1),
@@ -55,15 +62,15 @@ if ((sizeof($FATAL) > 0) || (!empty($FATAL[0])))
                        );
 
                        // Load row template
-                       $OUT .= LOAD_TEMPLATE("install_fatal_row", true, $content);
+                       $OUT .= LOAD_TEMPLATE('install_fatal_row', true, $content);
                }
 
                // Load main template
-               LOAD_TEMPLATE("install_fatal_table", false, $OUT);
-       } elseif (isBooleanConstantAndTrue('mxchange_installed')) {
+               LOAD_TEMPLATE('install_fatal_table', false, $OUT);
+       } elseif (isInstalled()) {
                // Display all runtime fatal errors
-               $OUT = "";
-               foreach ($FATAL as $key => $value) {
+               $OUT = '';
+               foreach (getFatalArray() as $key => $value) {
                        // Prepare content for the template
                        $content = array(
                                'key'   => ($key + 1),
@@ -71,21 +78,26 @@ if ((sizeof($FATAL) > 0) || (!empty($FATAL[0])))
                        );
 
                        // Load row template
-                       $OUT .= LOAD_TEMPLATE("runtime_fatal_row", true, $content);
+                       $OUT .= LOAD_TEMPLATE('runtime_fatal_row', true, $content);
                }
 
                // Load main template
-               mxchange_die(LOAD_TEMPLATE("runtime_fatal_table", true, $OUT));
+               LOAD_TEMPLATE('runtime_fatal_table', false, $OUT);
+
+               // Abort here
+               shutdown();
        }
-       $CORR = FATAL_REPORT_ERRORS;
+
+       // Message to regular users (non-admin)
+       $CORR = getMessage('FATAL_REPORT_ERRORS');
 
        // PHP warnings fixed
-       if ($check == "done") {
-               if (IS_ADMIN()) $CORR = FATAL_CORRECT_ERRORS;
-       }
+       if ($check == 'done') {
+               if (IS_ADMIN()) $CORR = getMessage('FATAL_CORRECT_ERRORS');
+       } // END - if
 
        // Load footer template
-       LOAD_TEMPLATE("fatal_footer", false, $CORR);
+       LOAD_TEMPLATE('fatal_footer', false, $CORR);
 }
 
 //