]> git.mxchange.org Git - mailer.git/blobdiff - inc/mysql-connect.php
Heavily rewritten API:
[mailer.git] / inc / mysql-connect.php
index ad62a503e465398de0261406629f8cf3f7e1144c..f52848abc04bb0db01758ac92c0ba85d5d5511af 100644 (file)
@@ -43,9 +43,12 @@ define('DEBUG_SQL', false);
 // Load database library
 require_once(PATH."inc/db/lib.php");
 
 // Load database library
 require_once(PATH."inc/db/lib.php");
 
-// // Non-database functions
+// Non-database functions
 require_once(PATH."inc/functions.php");  
 
 require_once(PATH."inc/functions.php");  
 
+// Filter functions
+require_once(PATH."inc/filters.php");  
+
 // Functions which interact with the database
 require_once(PATH."inc/mysql-manager.php");
 
 // Functions which interact with the database
 require_once(PATH."inc/mysql-manager.php");
 
@@ -71,7 +74,7 @@ function __errorHandler ($errno, $errstr, $errfile, $errline) {
                die("Error message written to debug.log. Please try to call <a href=\"".URL."\">the main page</a> to continue.");
        } else {
                // No debug extension found
                die("Error message written to debug.log. Please try to call <a href=\"".URL."\">the main page</a> to continue.");
        } else {
                // No debug extension found
-               print("Please report this error at <a href=\"http://forum.mxchange.org\" target=\"_blank\">forum.mxchange.org</a>:<pre>");
+               print("Please report this error at <a href=\"http://forum.mxchange.org\" rel=\"external\" target=\"_blank\">forum.mxchange.org</a>:<pre>");
                debug_print_backtrace();
                die("</pre>Thank you for your help finding bugs.");
        }
                debug_print_backtrace();
                die("</pre>Thank you for your help finding bugs.");
        }
@@ -80,6 +83,15 @@ function __errorHandler ($errno, $errstr, $errfile, $errline) {
 // Set error handler
 set_error_handler('__errorHandler');
 
 // Set error handler
 set_error_handler('__errorHandler');
 
+// Call-back function for running shutdown functions
+function __run_shutdown_filter () {
+       // Call the filter chain 'shutdown'
+       RUN_FILTER('shutdown', null, false);
+}
+
+// Register shutdown hook
+register_shutdown_function('__run_shutdown_filter');
+
 // Check if the user setups his MySQL stuff...
 if ((empty($MySQL['login'])) && (!defined('mxchange_installing')) && (!isset($_GET['installing'])) && (isBooleanConstantAndTrue('mxchange_installed'))) {
        // No login entered and outside installation mode
 // Check if the user setups his MySQL stuff...
 if ((empty($MySQL['login'])) && (!defined('mxchange_installing')) && (!isset($_GET['installing'])) && (isBooleanConstantAndTrue('mxchange_installed'))) {
        // No login entered and outside installation mode
@@ -133,8 +145,8 @@ if ((!isBooleanConstantAndTrue('mxchange_installing')) && (isBooleanConstantAndT
                                // Loading patching system is required here...
                                require_once(PATH."inc/patch-system.php"); // Initialize patch system
 
                                // Loading patching system is required here...
                                require_once(PATH."inc/patch-system.php"); // Initialize patch system
 
-                               // Functions which are related to themes
-                               require_once(PATH."inc/theme-manager.php");
+                               // Session management
+                               require_once(PATH."inc/session.php");
 
                                // Run daily reset
                                require_once(PATH."inc/check-reset.php");
 
                                // Run daily reset
                                require_once(PATH."inc/check-reset.php");
@@ -241,7 +253,7 @@ if ((!isBooleanConstantAndTrue('mxchange_installing')) && (isBooleanConstantAndT
 
        // Include required files
        require_once(PATH."inc/databases.php");
 
        // Include required files
        require_once(PATH."inc/databases.php");
-       require_once(PATH."inc/theme-manager.php");
+       require_once(PATH."inc/session.php");
 
        // Check if we are in installation routine
        $installPhp = basename($_SERVER['PHP_SELF']);
 
        // Check if we are in installation routine
        $installPhp = basename($_SERVER['PHP_SELF']);
@@ -253,29 +265,31 @@ if ((!isBooleanConstantAndTrue('mxchange_installing')) && (isBooleanConstantAndT
        // Double-check installation mode
        if ((!isBooleanConstantAndTrue('mxchange_installed')) || (!isBooleanConstantAndTrue('admin_registered'))) {
                // Check for file permissions
        // Double-check installation mode
        if ((!isBooleanConstantAndTrue('mxchange_installed')) || (!isBooleanConstantAndTrue('admin_registered'))) {
                // Check for file permissions
-               if (!is_INCWritable("config")) {
+               if (!IS_INC_WRITEABLE("config")) {
                        ADD_FATAL(CONFIG_IS_WRITE_PROTECTED);
                        ADD_FATAL(CONFIG_IS_WRITE_PROTECTED);
-               }
-               if (!is_INCWritable("dummy")) {
+               } // END - if
+               if (!IS_INC_WRITEABLE("dummy")) {
                        ADD_FATAL(DUMMY_IS_WRITE_PROTECTED);
                        ADD_FATAL(DUMMY_IS_WRITE_PROTECTED);
-               }
-               if (!is_INCWritable(".secret/dummy")) {
+               } // END - if
+               if (!IS_INC_WRITEABLE(".secret/dummy")) {
                        ADD_FATAL(SECRET_IS_WRITE_PROTECTED);
                        ADD_FATAL(SECRET_IS_WRITE_PROTECTED);
-               }
+               } // END - if
        } // END - if
 }
 
        } // END - if
 }
 
+// Init filter system
+INIT_FILTER_SYSTEM();
+
 // Any fatal messages?
 if (!is_array($FATAL)) $FATAL = array();
 // Any fatal messages?
 if (!is_array($FATAL)) $FATAL = array();
-if (((sizeof($FATAL) > 0) || (!empty($FATAL[0]))) && (isBooleanConstantAndTrue('mxchange_installed')) && (!defined('mxchange_installing')) && ($CSS != "1"))
-{
+if (((sizeof($FATAL) > 0) || (!empty($FATAL[0]))) && (isBooleanConstantAndTrue('mxchange_installed')) && (!defined('mxchange_installing')) && ($CSS != "1")) {
        // One or more fatal error(s) occur during connect...
        include (PATH."inc/header.php");
        include (PATH."inc/fatal_errors.php");
        unset($FATAL);
        include (PATH."inc/footer.php");
        exit;
        // One or more fatal error(s) occur during connect...
        include (PATH."inc/header.php");
        include (PATH."inc/fatal_errors.php");
        unset($FATAL);
        include (PATH."inc/footer.php");
        exit;
-}
+} // END - if
 
 //
 ?>
 
 //
 ?>