]> git.mxchange.org Git - mailer.git/blobdiff - inc/mysql-connect.php
Several more constants rewritten to getConfig()
[mailer.git] / inc / mysql-connect.php
index 91dc03e9e2bd6163f8f5c75467f20daae2b39560..3eac524730132966fe8dfc0741aa5cbe5c91daa7 100644 (file)
@@ -42,14 +42,8 @@ if (!defined('__SECURITY')) {
        require($INC);
 }
 
-// Non-database functions
-require('inc/functions.php');
-
-// Wrapper functions
-require('inc/wrapper-functions.php');
-
 // Load more function libraries or includes
-foreach (array('request-functions', 'session-functions', 'config-functions', 'code-functions', 'inc-functions', 'language-functions', 'filters', 'mysql-manager', 'extensions', 'db/lib', 'handler', 'hooks') as $lib) {
+foreach (array('functions', 'request-functions', 'session-functions', 'code-functions', 'inc-functions', 'language-functions', 'filters', 'mysql-manager', 'extensions', 'handler', 'hooks') as $lib) {
        // Load special functions
        loadIncludeOnce('inc/' . $lib . '.php');
 } // END - foreach
@@ -57,6 +51,9 @@ foreach (array('request-functions', 'session-functions', 'config-functions', 'co
 // Set error handler
 set_error_handler('__errorHandler');
 
+// Disable block-mode by default
+enableBlockMode(false);
+
 // Init error handler
 initErrorHandler();
 
@@ -64,7 +61,7 @@ initErrorHandler();
 initRequest();
 
 // Set important header_sent
-$GLOBALS['header_sent'] = 0;
+if (!isset($GLOBALS['header_sent'])) $GLOBALS['header_sent'] = 0;
 
 // Init fatal messages
 initFatalMessages();
@@ -77,6 +74,9 @@ if ((!isInstalling()) && (isInstalled())) {
        // Load configuration file(s) here
        loadIncludeOnce('inc/load_config.php');
 
+       // Load database layer here
+       loadIncludeOnce('inc/db/lib.php');
+
        // Check for write-permission for config.php and inc directory
        if (!isModuleSet()) setModule(REQUEST_GET('module'));
        if (!isModuleSet()) setModule('index');
@@ -157,9 +157,15 @@ if ((!isInstalling()) && (isInstalled())) {
                                // Update sending pool
                                if ((getOutputMode() != '1') && (getOutputMode() != '-1')) loadIncludeOnce('inc/pool-update.php'); // Sends out mails in configureable steps
 
-                               // Load all active extension including language files when not upgrading.
-                               // Check module for testing and count one click
-                               if (checkModulePermissions(getModule()) == 'done') countModuleHit(getModule());
+                               // Check module for permissions
+                               $checkModule = checkModulePermissions(getModule());
+                               if ($checkModule != 'done') {
+                                       // Not fine!
+                                       DEBUG_LOG(__FILE__, __LINE__, sprintf("Check of module %s results in unpexted value: %s",
+                                               getModule(),
+                                               $checkModule
+                                       ));
+                               } // END - if
 
                                // Shall we activate the exchange?
                                if (getConfig('activate_xchange') > 0) activateExchange();
@@ -167,10 +173,10 @@ if ((!isInstalling()) && (isInstalled())) {
                                // Is the extension sql_patches installed and at least 0.3.6?
                                if (GET_EXT_VERSION('sql_patches') >= '0.3.6') {
                                        // Generate random number
-                                       define('RAND_NUMBER', generateRandomCode(10, mt_rand(10000,32766), getUserId(), ''));
+                                       setConfigEntry('RAND_NUMBER', generateRandomCode(10, mt_rand(10000, 32766), getUserId(), ''));
                                } else {
                                        // Generate weak (!!!) code
-                                       define('RAND_NUMBER', mt_rand(1000000, 9999999));
+                                       setConfigEntry('RAND_NUMBER', mt_rand(1000000, 9999999));
                                }
                        } else {
                                // Wrong database?