-if (ereg(basename(__FILE__), $_SERVER['PHP_SELF'])) {
- $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
- require($INC);
-}
-
-// CFG: DEBUG-SQL (if enabled and DEBUG_MODE is enabled all SQL queries will be logged to debug.log)
-define('DEBUG_SQL', false);
-
-// Load library
-require_once(PATH."inc/db/lib.php");
-
-// Load general functions
-require_once(PATH."inc/functions.php"); // Non-database functions
-require_once(PATH."inc/extensions.php");
-require_once(PATH."inc/language.php");
-
-// Check if the user setups his MySQL stuff...
-if ((empty($MySQL['login'])) && (!isBooleanConstantAndTrue('mxchange_installing')) && (!isset($_GET['installing'])) && (isBooleanConstantAndTrue('mxchange_installed'))) {
- // No login entered and outside installation mode
- echo "<STRONG>".LANG_WARNING.":</STRONG> ";
- if (isBooleanConstantAndTrue('mxchange_installed')) {
- // You have changed my configuration file!
- die(DIE_CONFIG_CHANGED_YOU);
- } else {
- // Please run the installation script (maybe again)
- die(DIE_RUN_INSTALL_MYSQL);
- }
-} elseif ((!isBooleanConstantAndTrue('mxchange_installing')) && (!isset($_GET['installing'])) && (empty($MySQL['password'])) && (isBooleanConstantAndTrue('warn_no_pass'))) {
- // No database password entered!!!
- echo "<STRONG>".LANG_WARNING.":</STRONG> ".WARN_NULL_PASSWORD;
-}
-
-// Check if this file is writeable or read-only and warn the user
-if ((!isBooleanConstantAndTrue('mxchange_installing')) && (isBooleanConstantAndTrue('mxchange_installed'))) {
- // Check for write-permission for config.php and inc directory
- if (empty($GLOBALS['module'])) $GLOBALS['module'] = "index";
- if (($GLOBALS['module'] != "admin") && (isBooleanConstantAndTrue('admin_registered')) && (!isset($_SERVER['WINDIR']))) {
- if (is_INCWritable("config")) ADD_FATAL(FATAL_CONFIG_WRITABLE);
- if (is_INCWritable("dummy")) ADD_FATAL(FATAL_INC_WRITABLE);
- }
- $EXT_CSS_FILES = array();
-
- if ((!empty($MySQL['host'])) && (!empty($MySQL['login'])) && (!empty($MySQL['password'])) && (!empty($MySQL['dbase']))) {
- // Connect to DB
- global $link;
- $link = SQL_CONNECT($MySQL['host'], $MySQL['login'], $MySQL['password'], __FILE__, __LINE__);
-
- // Is the link valid?
- if (is_resource($link)) {
- // Choose the database
- global $db;
- $db = SQL_SELECT_DB($MySQL['dbase'], $link, __FILE__, __LINE__);
-
- // Is it a valid resource?
- if ($db === true) {
- // Load more include files
- require_once(PATH."inc/mysql-manager.php"); // Functions which interact with the database