]> git.mxchange.org Git - mailer.git/blobdiff - inc/mysql-connect.php
First batch of fixed language ids (renamed, see ticket #219)
[mailer.git] / inc / mysql-connect.php
index 8243597d6629cef12ed24e8bb615e0c7d14ee839..12dd105bb298da0153e46a7f2a4cdda4a99bfdf0 100644 (file)
  * $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 - 2009 by Roland Haeder                           *
- * Copyright (c) 2009, 2010 by Mailer Developer Team                    *
- * For more information visit: http://www.mxchange.org                  *
+ * Copyright (c) 2009 - 2011 by Mailer Developer Team                   *
+ * For more information visit: http://mxchange.org                      *
  *                                                                      *
  * This program is free software; you can redistribute it and/or modify *
  * it under the terms of the GNU General Public License as published by *
@@ -43,7 +41,7 @@ if (!defined('__SECURITY')) {
 } // END - if
 
 // Load more function libraries or includes
-foreach (array('request-functions', 'session-functions', 'code-functions', 'language-functions', 'sql-functions', 'expression-functions', 'filter-functions','revision-functions', 'filters', 'mysql-manager', 'extensions-functions', 'handler') as $lib) {
+foreach (array('request-functions', 'session-functions', 'code-functions', 'language-functions', 'sql-functions', 'expression-functions', 'filter-functions', 'revision-functions', 'filters', 'mysql-manager', 'extensions-functions', 'handler') as $lib) {
        // Load special functions
        loadIncludeOnce('inc/' . $lib . '.php');
 } // END - foreach
@@ -64,13 +62,15 @@ initRequest();
 initMemberId();
 
 // Set important header_sent
-if (!isset($GLOBALS['header_sent'])) $GLOBALS['header_sent'] = '0';
+if (!isset($GLOBALS['header_sent'])) {
+       $GLOBALS['header_sent'] = '0';
+} // END - if
 
 // Init fatal messages
 initFatalMessages();
 
-// Init message system
-initMessages();
+// Init repository data sub-system
+initRepositoryData();
 
 // Enable HTML templates by default
 enableTemplateHtml();
@@ -83,6 +83,9 @@ if ((!isInstalling()) && (!isInstallationPhase())) {
        // Load database layer here
        loadIncludeOnce('inc/db/lib.php');
 
+       // Init message system
+       initMessages();
+
        // CSS array
        initExtensionCssFiles();
 
@@ -97,7 +100,7 @@ if ((!isInstalling()) && (!isInstallationPhase())) {
 
                        // Is it a valid resource?
                        if (SQL_SELECT_DB($GLOBALS['mysql']['dbase'], __FILE__, __LINE__) === true) {
-                               // This is required for extension 'optimize' to work
+                               // Set database name (required for ext-optimize and isSqlTableCreated())
                                setConfigEntry('__DB_NAME', $GLOBALS['mysql']['dbase']);
 
                                // Remove MySQL array from namespace
@@ -105,38 +108,24 @@ if ((!isInstalling()) && (!isInstallationPhase())) {
 
                                // Load cache
                                loadIncludeOnce('inc/load_cache.php');
-
-                               // Check module for permissions
-                               $checkModule = checkModulePermissions();
-
-                               // Admin module should be accessable by guests to login
-                               if ((getModule() == 'admin') && ($checkModule == 'admin_only')) {
-                                       // This is fine and can be ignored
-                               } elseif ($checkModule != 'done') {
-                                       // Not fine!
-                                       logDebugMessage(__FILE__, __LINE__, sprintf("Check of module %s results in unexpected value: %s",
-                                               getModule(),
-                                               $checkModule
-                                       ));
-                               }
                        } else {
                                // Wrong database?
-                               addFatalMessage(__FILE__, __LINE__, '{--WRONG_DB_SELECTED--}');
+                               debug_report_bug(__FILE__, __LINE__, 'Wrong database selected.');
                        }
                } else {
                        // No link to database!
-                       addFatalMessage(__FILE__, __LINE__, '{--NO_DB_LINK--}');
+                       debug_report_bug(__FILE__, __LINE__, 'Database link is not yet up.');
                }
        } else {
-               // Maybe you forgot to enter your MySQL data?
-               addFatalMessage(__FILE__, __LINE__, '{--MYSQL_DATA_MISSING--}');
+               // Maybe you forgot to enter your database login?
+               debug_report_bug(__FILE__, __LINE__, 'Database login is missing.');
        }
 } else {
        // Default output is 'direct' for HTML output
        setConfigEntry('OUTPUT_MODE', 'direct');
 
        // This hack prevents a backtrace in CSS output
-       if (getScriptOutputMode() == 1) {
+       if (isCssOutputMode()) {
                // Problem with config so set output mode
                setConfigEntry('OUTPUT_MODE', 'render');
        } // END - if
@@ -144,21 +133,21 @@ if ((!isInstalling()) && (!isInstallationPhase())) {
        // CFG: DATABASE-TYPE
        setConfigEntry('_DB_TYPE', 'mysql3');
 
+       // Load database layer here
+       loadIncludeOnce('inc/db/lib.php');
+
+       // Init message system
+       initMessages();
+
        // Include more
-       foreach (array('inc/db/lib.php','inc/databases.php','inc/session.php','inc/versions.php','inc/install-functions.php','inc/load_config.php') as $inc) {
+       foreach (array('databases', 'session', 'versions', 'install-functions', 'load_config', 'load_cache') as $inc) {
                // Load the include
-               loadIncludeOnce($inc);
+               loadIncludeOnce('inc/' . $inc . '.php');
        } // END - foreach
 
-       // Load cache
-       loadIncludeOnce('inc/load_cache.php');
-
-       // Run the init filter chain
-       runFilterChain('init');
-
-       // Are we installation routine?
-       if ((!isInstalling()) && (getScriptOutputMode() != 1) && (getScriptOutputMode() != -1)) {
-               // You have to install first!
+       // Check wether we are in installation routine
+       if ((!isInstalling()) && (!isCssOutputMode()) && (!isRawOutputMode())) {
+               // Redirect to the URL
                redirectToUrl('install.php');
        } // END - if
 }