Rewrites not to init config in config-functions.php (some still remain, many untested)
authorRoland Häder <roland@mxchange.org>
Fri, 30 Oct 2009 08:47:22 +0000 (08:47 +0000)
committerRoland Häder <roland@mxchange.org>
Fri, 30 Oct 2009 08:47:22 +0000 (08:47 +0000)
18 files changed:
doubler.php
inc/config-functions.php
inc/databases.php
inc/db/lib-mysql3.php
inc/extensions/ext-other.php
inc/filters.php
inc/functions.php
inc/header.php
inc/language-functions.php
inc/language/de.php
inc/modules/admin.php
inc/modules/admin/admin-inc.php
inc/mysql-connect.php
inc/mysql-manager.php
inc/session.php
inc/wrapper-functions.php
install/tables.sql
mailid_top.php

index 5fd52022b57b6bb2268b91ea14f27ac76513e772..791dc3e025881aefc00a0cef03c5d71397b34c3e 100644 (file)
@@ -84,7 +84,8 @@ $userid = 0;
 
 // If no account was found set default refid and status to CONFIRMED
 if (empty($GLOBALS['refid'])) {
 
 // If no account was found set default refid and status to CONFIRMED
 if (empty($GLOBALS['refid'])) {
-       $GLOBALS['refid'] = getConfig('def_refid');
+       // Determine referal id again
+       $GLOBALS['refid'] = determineReferalId();
        $status = 'CONFIRMED';
 } // END - if
 
        $status = 'CONFIRMED';
 } // END - if
 
index 48e6d0a63af13b9b3f4831a41d78d7ea4c740714..5cbb77db720795f2ecd55b8fdcd638274cd0e81f 100644 (file)
@@ -51,32 +51,21 @@ function initConfig () {
 
        // Set a minimum of configuration, required to by-pass some error triggers in getConfig()
        $GLOBALS['config'] = array(
 
        // Set a minimum of configuration, required to by-pass some error triggers in getConfig()
        $GLOBALS['config'] = array(
-               'code_length'         => 0,
-               'patch_level'         => 0,
-               'last_update'         => time(),
-               'activate_xchange'    => 100,
-               'enable_mod_title'    => 'Y',
-               'update_filter_usage' => 'N',
-               'ADMIN_REGISTERED'    => 'N',
-               'MXCHANGE_INSTALLED'  => 'N',
-               'DEFAULT_LANG'        => 'de',
-               'DEFAULT_SALT_LENGTH' => 40,
-               'DEBUG_MODE'          => 'N',
-               'DEBUG_RESET'         => 'N',
-               'DEBUG_MONTHLY'       => 'N',
-               'DEBUG_WEEKLY'        => 'N',
-               'DEBUG_REGEX'         => 'N',
-               'ADMIN_REGISTERED'    => 'N',
-               'sql_count'           => 0,
                'sql_time'            => 0,
                'sql_time'            => 0,
+               'sql_count'           => 0,
                'num_templates'       => 0,
                'num_templates'       => 0,
-               'default_theme'       => 'default',
-               'verbose_sql'         => 'Y',
-               'def_refid'           => 0,
-               'ENABLE_BACKLINK'     => 'Y',
-               'display_debug_sqls'  => 'N',
+               // 'DEFAULT_SALT_LENGTH' => 40,
+               // 'DEBUG_MODE'          => 'N',
+               // 'DEBUG_RESET'         => 'N',
+               // 'DEBUG_MONTHLY'       => 'N',
+               // 'DEBUG_WEEKLY'        => 'N',
+               // 'DEBUG_REGEX'         => 'N',
+               // 'ADMIN_REGISTERED'    => 'N',
+               // 'verbose_sql'         => 'Y',
+               // 'ENABLE_BACKLINK'     => 'Y',
+               // 'display_debug_sqls'  => 'N',
                // Keep session_save_path to fall-back to php.ini setting
                // Keep session_save_path to fall-back to php.ini setting
-               'session_save_path'   => '',
+               // 'session_save_path'   => '',
                // For installation phase:
                'SMTP_HOSTNAME'       => '',
                'SMTP_USER'           => '',
                // For installation phase:
                'SMTP_HOSTNAME'       => '',
                'SMTP_USER'           => '',
index 15c81b861f9826e415ec50c90da91a63bc36e1a2..9eb216ce8fcb3ac88c1a1c9303f2cfa21b5aac0c 100644 (file)
@@ -99,12 +99,6 @@ setConfigEntry('CURRENT_DATE', generateDateTime(time(), 3));
 setConfigEntry('START_YDAY', makeTime(0, 0, 0, time() - getConfig('ONE_DAY')));
 setConfigEntry('START_TDAY', makeTime(0, 0, 0, time()));
 
 setConfigEntry('START_YDAY', makeTime(0, 0, 0, time() - getConfig('ONE_DAY')));
 setConfigEntry('START_TDAY', makeTime(0, 0, 0, time()));
 
-// Take a prime number which is long (if you know a longer one please try it out!)
-setConfigEntry('_PRIME', 591623);
-
-// Calculate "entropy" with the prime number (for code generation)
-setConfigEntry('_ADD', (getConfig('_PRIME') * getConfig('_PRIME') / (pi() * getConfig('code_length') + 1)));
-
 // HTTP-EOL
 setConfigEntry('HTTP_EOL', "\r\n");
 
 // HTTP-EOL
 setConfigEntry('HTTP_EOL', "\r\n");
 
index e11f335446711f138efd577d25edb2e31caa661e..465e0d5b2c790c602bbf58be38eab47c5244cdc9 100644 (file)
@@ -104,7 +104,7 @@ Query string:<br />
        incrementConfigEntry('sql_count');
 
        // Debug output
        incrementConfigEntry('sql_count');
 
        // Debug output
-       if ((getOutputMode() != 1) && (isDebugModeEnabled()) && (getConfig('DEBUG_SQL') == 'Y')) {
+       if ((getOutputMode() != 1) && (isDebugModeEnabled()) && (isConfigEntrySet('DEBUG_SQL')) && (getConfig('DEBUG_SQL') == 'Y')) {
                //
                // Debugging stuff...
                //
                //
                // Debugging stuff...
                //
index 5d0472bdad2c67a94978c99419b9794d564a932f..4f3b30d031cb23462f41246a11b043112328fc58 100644 (file)
@@ -42,10 +42,10 @@ if (!defined('__SECURITY')) {
 } // END - if
 
 // Version number
 } // END - if
 
 // Version number
-setThisExtensionVersion('0.2.4');
+setThisExtensionVersion('0.2.5');
 
 // Version history array (add more with , '0.1.0' and so on)
 
 // Version history array (add more with , '0.1.0' and so on)
-setExtensionVersionHistory(array('0.0', '0.0.1', '0.0.2', '0.0.3', '0.0.4', '0.0.5', '0.0.6', '0.0.7', '0.0.8', '0.0.9', '0.1.0', '0.1.1', '0.1.2', '0.1.3', '0.1.4', '0.1.5', '0.1.6', '0.1.7', '0.1.8', '0.1.9', '0.2.0', '0.2.1', '0.2.2', '0.2.3', '0.2.4'));
+setExtensionVersionHistory(array('0.0', '0.0.1', '0.0.2', '0.0.3', '0.0.4', '0.0.5', '0.0.6', '0.0.7', '0.0.8', '0.0.9', '0.1.0', '0.1.1', '0.1.2', '0.1.3', '0.1.4', '0.1.5', '0.1.6', '0.1.7', '0.1.8', '0.1.9', '0.2.0', '0.2.1', '0.2.2', '0.2.3', '0.2.4', '0.2.5'));
 
 // Keep this extension always active!
 setExtensionAlwaysActive('Y');
 
 // Keep this extension always active!
 setExtensionAlwaysActive('Y');
@@ -221,6 +221,13 @@ switch (getExtensionMode()) {
                                // Update notes (these will be set as task text!)
                                setExtensionUpdateNotes("Filter zum Anzeigen (Debug) von ausgef&uuml;hrten SQL-Anweisungen hinzugef&uuml;gt.");
                                break;
                                // Update notes (these will be set as task text!)
                                setExtensionUpdateNotes("Filter zum Anzeigen (Debug) von ausgef&uuml;hrten SQL-Anweisungen hinzugef&uuml;gt.");
                                break;
+
+                       case '0.2.5': // SQL queries for v0.2.5
+                               addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD `code_length` TINYINT(3) UNSIGNED NOT NULL DEFAULT 5");
+
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("Codel&auml;nge aus tables.sql rausgeholt.");
+                               break;
                }
                break;
 
                }
                break;
 
index f100892efe2a292be3a60ac8980fc1b5030ec2b0..f64b28f064ca6e480bd9c758930ca6a5e2823e2e 100644 (file)
@@ -327,6 +327,15 @@ function FILTER_UPDATE_LOGIN_DATA () {
 
 // Filter for initializing randomizer
 function FILTER_INIT_RANDOMIZER () {
 
 // Filter for initializing randomizer
 function FILTER_INIT_RANDOMIZER () {
+       // Only execute this filter if installed
+       if ((!isInstalled()) || (!isExtensionInstalledAndNewer('other', '0.2.5'))) return;
+
+       // Take a prime number which is long (if you know a longer one please try it out!)
+       setConfigEntry('_PRIME', 591623);
+
+       // Calculate "entropy" with the prime number (for code generation)
+       setConfigEntry('_ADD', (getConfig('_PRIME') * getConfig('_PRIME') / (pi() * getConfig('code_length') + 1)));
+
        // Simply init the randomizer with seed and _ADD value
        mt_srand(generateSeed() + getConfig('_ADD'));
 }
        // Simply init the randomizer with seed and _ADD value
        mt_srand(generateSeed() + getConfig('_ADD'));
 }
@@ -488,7 +497,7 @@ function FILTER_RUN_RESET_INCLUDES () {
        setIncludePool('reset', getArrayFromDirectory('inc/reset/', 'reset_'));
 
        // Update database
        setIncludePool('reset', getArrayFromDirectory('inc/reset/', 'reset_'));
 
        // Update database
-       if (getConfig('DEBUG_RESET') != 'Y') updateConfiguration('last_update', time());
+       if ((!isConfigEntrySet('DEBUG_RESET')) || (getConfig('DEBUG_RESET') != 'Y')) updateConfiguration('last_update', time());
 
        // Is the config entry set?
        if (isExtensionInstalledAndNewer('sql_patches', '0.4.2')) {
 
        // Is the config entry set?
        if (isExtensionInstalledAndNewer('sql_patches', '0.4.2')) {
@@ -623,6 +632,9 @@ function FILTER_TRIGGER_SENDING_POOL () {
 
 // Filter for checking and updating SVN revision
 function FILTER_CHECK_SVN_REVISION () {
 
 // Filter for checking and updating SVN revision
 function FILTER_CHECK_SVN_REVISION () {
+       // Only execute this filter if installed and all config entries are there
+       if ((!isInstalled()) || (!isConfigEntrySet('patch_level'))) return;
+
        // Check for patch level differences between databases and current hard-coded
        if ((getConfig('CURR_SVN_REVISION') > getConfig('patch_level')) || (getConfig('patch_level') == 'CURR_SVN_REVISION') || (getConfig('patch_ctime') == 'UNIX_TIMES')) {
                // Update database and CONFIG array
        // Check for patch level differences between databases and current hard-coded
        if ((getConfig('CURR_SVN_REVISION') > getConfig('patch_level')) || (getConfig('patch_level') == 'CURR_SVN_REVISION') || (getConfig('patch_ctime') == 'UNIX_TIMES')) {
                // Update database and CONFIG array
@@ -634,9 +646,12 @@ function FILTER_CHECK_SVN_REVISION () {
 
 // Filter for running daily reset
 function FILTER_RUN_DAILY_RESET () {
 
 // Filter for running daily reset
 function FILTER_RUN_DAILY_RESET () {
+       // Only execute this filter if installed
+       if ((!isInstalled()) || (!isAdminRegistered())) return;
+
        // Shall we run the reset scripts? If a day has changed, maybe also a week/month has changed... Simple! :D
        // 012    3              4             43        3         4432    2         3             3       21    1                    221    1                 221    1                  2          21    1             22     10
        // Shall we run the reset scripts? If a day has changed, maybe also a week/month has changed... Simple! :D
        // 012    3              4             43        3         4432    2         3             3       21    1                    221    1                 221    1                  2          21    1             22     10
-       if (((date('d', getConfig('last_update')) != date('d', time())) || (getConfig('DEBUG_RESET') == 'Y')) && (!isInstallationPhase()) && (isAdminRegistered()) && (!isGetRequestElementSet('register')) && (getOutputMode() != 1)) {
+       if (((date('d', getConfig('last_update')) != date('d', time())) || ((isConfigEntrySet('DEBUG_RESET')) && (getConfig('DEBUG_RESET') == 'Y'))) && (!isInstallationPhase()) && (isAdminRegistered()) && (!isGetRequestElementSet('register')) && (getOutputMode() != 1)) {
                // Tell every module we are in reset-mode!
                doReset();
        } // END - if
                // Tell every module we are in reset-mode!
                doReset();
        } // END - if
@@ -793,7 +808,7 @@ function FILTER_DISPLAY_COPYRIGHT () {
        // Shall we display the copyright notice?
        if ((!isGetRequestElementSet('frame')) && (basename($_SERVER['PHP_SELF']) != 'mailid_top.php') && ((getConfig('WRITE_FOOTER') == 'Y') || (isInstalling())) && ($GLOBALS['header_sent'] == 2)) {
                // Backlink enabled?
        // Shall we display the copyright notice?
        if ((!isGetRequestElementSet('frame')) && (basename($_SERVER['PHP_SELF']) != 'mailid_top.php') && ((getConfig('WRITE_FOOTER') == 'Y') || (isInstalling())) && ($GLOBALS['header_sent'] == 2)) {
                // Backlink enabled?
-               if ((getConfig('ENABLE_BACKLINK') == 'Y') || (isInstalling())) {
+               if (((isConfigEntrySet('ENABLE_BACKLINK')) && (getConfig('ENABLE_BACKLINK') == 'Y')) || (isInstalling())) {
                        // Copyright with backlink, thanks! :-)
                        loadTemplate('copyright_backlink');
                } else {
                        // Copyright with backlink, thanks! :-)
                        loadTemplate('copyright_backlink');
                } else {
index 2d4fcf45df00abd20358f9515859241ca8e889f6..620a4bbce0fe481ad3f9a2c4e3a09a2bc9799405 100644 (file)
@@ -2310,7 +2310,7 @@ function getCurrentTheme () {
        $ret = 'default';
 
        // Load default theme if not empty from configuration
        $ret = 'default';
 
        // Load default theme if not empty from configuration
-       if (getConfig('default_theme') != '') $ret = getConfig('default_theme');
+       if ((isConfigEntrySet('default_theme')) && (getConfig('default_theme') != '')) $ret = getConfig('default_theme');
 
        if (!isSessionVariableSet('mxchange_theme')) {
                // Set default theme
 
        if (!isSessionVariableSet('mxchange_theme')) {
                // Set default theme
@@ -2619,6 +2619,17 @@ function debug_get_printable_backtrace () {
 
 // Output a debug backtrace to the user
 function debug_report_bug ($message = '') {
 
 // Output a debug backtrace to the user
 function debug_report_bug ($message = '') {
+       // Is this already called?
+       if (isset($GLOBALS[__FUNCTION__])) {
+               // Other backtrace
+               print 'Message:'.$message.'<br />Backtrace:<pre>';
+               debug_print_backtrace();
+               die('</pre>');
+       } // END - if
+
+       // Set this function as called
+       $GLOBALS[__FUNCTION__] = true;
+
        // Init message
        $debug = '';
 
        // Init message
        $debug = '';
 
@@ -3203,7 +3214,7 @@ function determineReferalId () {
        }
 
        // Set cookie when default refid > 0
        }
 
        // Set cookie when default refid > 0
-       if (!isSessionVariableSet('refid') || (!empty($GLOBALS['refid'])) || ((getSession('refid') == 0) && (getConfig('def_refid') > 0))) {
+       if (!isSessionVariableSet('refid') || (!empty($GLOBALS['refid'])) || ((getSession('refid') == 0) && (isConfigEntrySet('def_refid')) && (getConfig('def_refid') > 0))) {
                // Set cookie
                setSession('refid', $GLOBALS['refid']);
        } // END - if
                // Set cookie
                setSession('refid', $GLOBALS['refid']);
        } // END - if
@@ -3491,8 +3502,25 @@ function mapModuleToTable ($moduleName) {
 
 // Add SQL debug data to array for later output
 function addSqlToDebug ($result, $sqlString, $timing, $F, $L) {
 
 // Add SQL debug data to array for later output
 function addSqlToDebug ($result, $sqlString, $timing, $F, $L) {
-       // Don't execute anything here if we don't need
-       if (getConfig('display_debug_sqls') != 'Y') return;
+       // Already executed?
+       if (isset($GLOBALS['debug_sqls'][$F][$L][$sqlString])) {
+               // Then abort here, we don't need to profile a query twice
+               return;
+       } // END - if
+
+       // Remeber this as profiled (or not, but we don't care here)
+       $GLOBALS['debug_sqls'][$F][$L][$sqlString] = true;
+
+       // Do we have cache?
+       if (!isset($GLOBALS['debug_sql_available'])) {
+               // Check it and cache it in $GLOBALS
+               $GLOBALS['debug_sql_available'] = ((isExtensionInstalledAndNewer('other', '0.2.2')) && (getConfig('display_debug_sqls') == 'Y'));
+       } // END - if
+       
+       // Don't execute anything here if we don't need or ext-other is missing
+       if ($GLOBALS['debug_sql_available'] === false) {
+               return;
+       } // END - if
 
        // Generate record
        $record = array(
 
        // Generate record
        $record = array(
index ce68e543888a0d9fd59473b1f0740b7dc5891420..34feadb23c9e766ac0ce013d410a40996a8de436 100644 (file)
@@ -48,7 +48,7 @@ if (($GLOBALS['header_sent'] != 1) && ($GLOBALS['header_sent'] != 2)) {
        // If not in CSS mode generate the header
        if (getOutputMode() != 1) {
                // Config and database connection valid?
        // If not in CSS mode generate the header
        if (getOutputMode() != 1) {
                // Config and database connection valid?
-               if ((isConfigLocalLoaded()) && (isConfigLoaded()) && (SQL_IS_LINK_UP()) && (isExtensionActive('sql_patches'))) {
+               if ((isConfigLocalLoaded()) && (isConfigLoaded()) && (SQL_IS_LINK_UP()) && (isExtensionInstalledAndNewer('sql_patches', '0.1.6'))) {
                        // Init title
                        $TITLE = '';
 
                        // Init title
                        $TITLE = '';
 
index 1936842e75f3d78e1fcc06993408753e1092fbc2..f2fe7a9536d422c83e12a0a6c2a53c94b503b724 100644 (file)
@@ -83,8 +83,11 @@ function getCurrentLanguage () {
 
 // "Getter" for language
 function getLanguage () {
 
 // "Getter" for language
 function getLanguage () {
+       // Default is 'de'. DO NOT CHANGE THIS!!!
+       $ret = 'de';
+
        // Set default return value to default language from config
        // Set default return value to default language from config
-       $ret = getConfig('DEFAULT_LANG');
+       if (isConfigEntrySet('DEFAULT_LANG')) $ret = getConfig('DEFAULT_LANG');
 
        // Init variable
        $lang = '';
 
        // Init variable
        $lang = '';
index 559cc0dcda00671900ad105b53c091a80c5bf3cb..dc9271d5c89cadb770f15c9dc8e45b4be13403d1 100644 (file)
@@ -1132,6 +1132,7 @@ addMessages(array(
        'ADMIN_EXT_TEXT_FILE_MISSING' => "Die Erweiterung <span class=\"data\">%s</span> hat keinen Beschreibungstext. Bitte melden Sie dies uns <a href=\"http://bugs.mxchange.org\" target=\"_blank\" title=\"Direkter Link zum Bug-Tracker\">im Bug-Tracker</a>.",
        'GUEST_STATS_NO_CLICKS' => "Keine Klicks in Ihrem {?mt_word?} verzeichnet.",
        'ADMIN_EXTENSIONS_REMOVED' => "Es wurden <span class=\"data\">%s</span> Erweiterungen aus Ihrem {?mt_word?} entfernt.",
        'ADMIN_EXT_TEXT_FILE_MISSING' => "Die Erweiterung <span class=\"data\">%s</span> hat keinen Beschreibungstext. Bitte melden Sie dies uns <a href=\"http://bugs.mxchange.org\" target=\"_blank\" title=\"Direkter Link zum Bug-Tracker\">im Bug-Tracker</a>.",
        'GUEST_STATS_NO_CLICKS' => "Keine Klicks in Ihrem {?mt_word?} verzeichnet.",
        'ADMIN_EXTENSIONS_REMOVED' => "Es wurden <span class=\"data\">%s</span> Erweiterungen aus Ihrem {?mt_word?} entfernt.",
+       'ADMIN_WARNING_SQL_PATCHES_MISSING' => "Ein essentielle Erweiterung <span=\"data\">sql_patches</span> ist noch nicht installiert. Bitte erledigen Sie dies bald, da Ihr {?mt_word?} sonst nicht funktioniert.",
 
        'MEMBER_MAIL_BONUS_CONFIRMED_ON' => "Sie haben diese Bonusmail <span class=\"data\">%s</span> best&auml;tigt.",
        'MEMBER_MAIL_NORMAL_CONFIRMED_ON' => "Sie haben diese Klickmail <span class=\"data\">%s</span> best&auml;tigt.",
 
        'MEMBER_MAIL_BONUS_CONFIRMED_ON' => "Sie haben diese Bonusmail <span class=\"data\">%s</span> best&auml;tigt.",
        'MEMBER_MAIL_NORMAL_CONFIRMED_ON' => "Sie haben diese Klickmail <span class=\"data\">%s</span> best&auml;tigt.",
index eda91788cfcc5ef8594aa4709a8739f6917d7994..0a26a6ff364642566e579ff847123b6c6982688e 100644 (file)
@@ -363,7 +363,7 @@ if (!isAdminRegistered()) {
                        } else {
                                // This little call constructs the whole default old and lacky menu system
                                // on left side. It also renders the content on right side
                        } else {
                                // This little call constructs the whole default old and lacky menu system
                                // on left side. It also renders the content on right side
-                               doAdminAction(getWhat());
+                               doAdminAction();
                        }
                        break;
 
                        }
                        break;
 
index 4cce611c952a78030bd4db5954dcc2ef7a297552..37af59ab4ce66ec8ea2bcc26a5b54e470d5b29d9 100644 (file)
@@ -238,7 +238,10 @@ function ifAdminCookiesAreValid ($admin, $password) {
 }
 
 // Do an admin action
 }
 
 // Do an admin action
-function doAdminAction ($what) {
+function doAdminAction () {
+       // Get default what
+       $what = getWhat();
+
        //* DEBUG: */ outputHtml(__LINE__."*".$what.'/'.getModule().'/'.getAction().'/'.getWhat()."*<br />");
 
        // Remove any spaces from variable
        //* DEBUG: */ outputHtml(__LINE__."*".$what.'/'.getModule().'/'.getAction().'/'.getWhat()."*<br />");
 
        // Remove any spaces from variable
@@ -269,6 +272,12 @@ function doAdminAction ($what) {
        // Tableset header
        loadTemplate('admin_main_header', false, $content);
 
        // Tableset header
        loadTemplate('admin_main_header', false, $content);
 
+       // Is sql_patches not yet installed?
+       if (!isExtensionInstalled('sql_patches')) {
+               // Output warning
+               loadTemplate('admin_settings_saved', false, getMessage('ADMIN_WARNING_SQL_PATCHES_MISSING'));
+       } // END - if
+
        // Check if action/what pair is valid
        $result_action = SQL_QUERY_ESC("SELECT
        `id`
        // Check if action/what pair is valid
        $result_action = SQL_QUERY_ESC("SELECT
        `id`
@@ -287,7 +296,8 @@ WHERE
                        )
                )
        )
                        )
                )
        )
-LIMIT 1", array($action, $what, $what), __FUNCTION__, __LINE__);
+LIMIT 1",
+               array($action, $what, $what), __FUNCTION__, __LINE__);
        if (SQL_NUMROWS($result_action) == 1) {
                // Is valid but does the inlcude file exists?
                $inc = sprintf("inc/modules/admin/action-%s.php", $action);
        if (SQL_NUMROWS($result_action) == 1) {
                // Is valid but does the inlcude file exists?
                $inc = sprintf("inc/modules/admin/action-%s.php", $action);
index d29d479a65eca35f0e4805e32c009356c8f1c965..42b6a887dc41966c7e792983c6961eedb17841f0 100644 (file)
@@ -69,10 +69,7 @@ initFatalMessages();
 initMessages();
 
 // Check if this file is writeable or read-only and warn the user
 initMessages();
 
 // Check if this file is writeable or read-only and warn the user
-if ((!isInstalling()) && (!isInstallationPhase())) {
-       // Load "databases" aka static arrays
-       loadIncludeOnce('inc/databases.php');
-
+if (!isInstalling()) {
        // Load database layer here
        loadIncludeOnce('inc/db/lib.php');
 
        // Load database layer here
        loadIncludeOnce('inc/db/lib.php');
 
@@ -112,6 +109,9 @@ if ((!isInstalling()) && (!isInstallationPhase())) {
                                // Run the init filter chain
                                runFilterChain('init');
 
                                // Run the init filter chain
                                runFilterChain('init');
 
+                               // Load "databases" aka static arrays
+                               loadIncludeOnce('inc/databases.php');
+
                                // Check module for permissions
                                $checkModule = checkModulePermissions();
 
                                // Check module for permissions
                                $checkModule = checkModulePermissions();
 
@@ -155,7 +155,7 @@ if ((!isInstalling()) && (!isInstallationPhase())) {
        if (!isOutputModeSet()) setOutputMode(0);
 
        // Include more
        if (!isOutputModeSet()) setOutputMode(0);
 
        // Include more
-       foreach (array('inc/databases.php','inc/db/lib.php','inc/session.php','inc/versions.php','inc/install-functions.php','inc/load_config.php') as $inc) {
+       foreach (array('inc/databases.php','inc/versions.php','inc/db/lib.php','inc/session.php','inc/install-functions.php','inc/load_config.php') as $inc) {
                // Load the include
                loadIncludeOnce($inc);
        } // END - foreach
                // Load the include
                loadIncludeOnce($inc);
        } // END - foreach
index 2b88cfbc83d96a54f261cf86457dfdb3120fe7d8..7c8d7b4947b49e6e4cec558ccde9637ee6459e08 100644 (file)
@@ -1641,11 +1641,17 @@ function FILTER_ACTIVATE_EXCHANGE () {
 // Deletes a user account with given reason
 function deleteUserAccount ($userid, $reason) {
        $points = 0;
 // Deletes a user account with given reason
 function deleteUserAccount ($userid, $reason) {
        $points = 0;
-       $result = SQL_QUERY_ESC("SELECT (SUM(p.points) - d.used_points) AS points
-FROM `{?_MYSQL_PREFIX?}_user_points` AS p
-LEFT JOIN `{?_MYSQL_PREFIX?}_user_data` AS d
-ON p.userid=d.userid
-WHERE p.userid=%s", array(bigintval($userid)), __FUNCTION__, __LINE__);
+       $result = SQL_QUERY_ESC("SELECT
+       (SUM(p.points) - d.used_points) AS points
+FROM
+       `{?_MYSQL_PREFIX?}_user_points` AS p
+LEFT JOIN
+       `{?_MYSQL_PREFIX?}_user_data` AS d
+ON
+       p.userid=d.userid
+WHERE
+       p.userid=%s",
+               array(bigintval($userid)), __FUNCTION__, __LINE__);
        if (SQL_NUMROWS($result) == 1) {
                // Save his points to add them to the jackpot
                list($points) = SQL_FETCHROW($result);
        if (SQL_NUMROWS($result) == 1) {
                // Save his points to add them to the jackpot
                list($points) = SQL_FETCHROW($result);
index 591cb1c4eea7cd076606943e592528ff1ecc8ae8..71e6eca53dd032accfae3f948e07d1aef4cb96f6 100644 (file)
 // Some security stuff...
 if (!defined('__SECURITY')) {
        die();
 // Some security stuff...
 if (!defined('__SECURITY')) {
        die();
-}
+} // END - if
 
 
-// Set session save path if set
-if (getConfig('session_save_path') != '') {
-       // Please make sure this valid!
-       session_save_path(getConfig('session_save_path'));
+// Is ext-sql_patches there and newer?
+if (isExtensionInstalledAndNewer('sql_patches', '0.5.3')) {
+       // Set session save path if set
+       if (getConfig('session_save_path') != '') {
+               // Please make sure this valid!
+               session_save_path(getConfig('session_save_path'));
+       } // END - if
 } // END - if
 
 } // END - if
 
+// Is a session id there?
 if (session_id() == '') {
        // Start the session
        session_start();
 if (session_id() == '') {
        // Start the session
        session_start();
index 236300372037b127ae81da81092a936139fb5aa3..882cd3aa9bd755a3a0554e4c3fc5dce28570aeb8 100644 (file)
@@ -286,7 +286,13 @@ function isInstalled () {
                $GLOBALS['is_installed'] = (
                (
                        // First is config
                $GLOBALS['is_installed'] = (
                (
                        // First is config
-                       getConfig('MXCHANGE_INSTALLED') == 'Y'
+                       (
+                               (
+                                       isConfigEntrySet('MXCHANGE_INSTALLED')
+                               ) && (
+                                       getConfig('MXCHANGE_INSTALLED') == 'Y'
+                               )
+                       )
                ) || (
                        // New config file found and loaded
                        isIncludeReadable(getConfig('CACHE_PATH') . 'config-local.php')
                ) || (
                        // New config file found and loaded
                        isIncludeReadable(getConfig('CACHE_PATH') . 'config-local.php')
@@ -312,7 +318,7 @@ function isInstalled () {
 
 // Check wether an admin is registered
 function isAdminRegistered () {
 
 // Check wether an admin is registered
 function isAdminRegistered () {
-       return (getConfig('ADMIN_REGISTERED') == 'Y');
+       return ((isConfigEntrySet('ADMIN_REGISTERED')) && (getConfig('ADMIN_REGISTERED') == 'Y'));
 }
 
 // Checks wether the reset mode is active
 }
 
 // Checks wether the reset mode is active
@@ -324,13 +330,13 @@ function isResetModeEnabled () {
 // Checks wether the debug mode is enabled
 function isDebugModeEnabled () {
        // Simply check it
 // Checks wether the debug mode is enabled
 function isDebugModeEnabled () {
        // Simply check it
-       return (getConfig('DEBUG_MODE') == 'Y');
+       return ((isConfigEntrySet('DEBUG_MODE')) && (getConfig('DEBUG_MODE') == 'Y'));
 }
 
 // Checks wether we shall debug regular expressions
 function isDebugRegExpressionEnabled () {
        // Simply check it
 }
 
 // Checks wether we shall debug regular expressions
 function isDebugRegExpressionEnabled () {
        // Simply check it
-       return (getConfig('DEBUG_REGEX') == 'Y');
+       return ((isConfigEntrySet('DEBUG_REGEX')) && (getConfig('DEBUG_REGEX') == 'Y'));
 }
 
 // Checks wether the cache instance is valid
 }
 
 // Checks wether the cache instance is valid
index 4169ca541557b1f59afbee39ce0ff281f1f74665..b8e4d02a93189ce9346c3eac7b735046a977a923 100644 (file)
@@ -58,7 +58,6 @@ CREATE TABLE `{?_MYSQL_PREFIX?}_config` (
   `resend_profile_update` BIGINT(20) UNSIGNED NOT NULL DEFAULT '172800',
   `patch_level` VARCHAR(100) NOT NULL DEFAULT '78',
   `patch_ctime` VARCHAR(10) NOT NULL DEFAULT 0,
   `resend_profile_update` BIGINT(20) UNSIGNED NOT NULL DEFAULT '172800',
   `patch_level` VARCHAR(100) NOT NULL DEFAULT '78',
   `patch_ctime` VARCHAR(10) NOT NULL DEFAULT 0,
-  `code_length` TINYINT(3) UNSIGNED NOT NULL DEFAULT 5,
   `guest_stats` ENUM('MEMBERS','MODULES','INACTIVE') NOT NULL DEFAULT 'MEMBERS',
   `ref_payout` TINYINT(3) UNSIGNED NOT NULL DEFAULT 5,
   `activate_xchange` BIGINT(20) UNSIGNED NOT NULL DEFAULT 100,
   `guest_stats` ENUM('MEMBERS','MODULES','INACTIVE') NOT NULL DEFAULT 'MEMBERS',
   `ref_payout` TINYINT(3) UNSIGNED NOT NULL DEFAULT 5,
   `activate_xchange` BIGINT(20) UNSIGNED NOT NULL DEFAULT 100,
index c5fab11c92e0ccf609f5005824d052a2f8abe86b..b63c9374179fc3c8de3eabd04631a61648bcb76e 100644 (file)
@@ -52,9 +52,12 @@ require('inc/config-global.php');
 // Set content type
 setContentType('text/html');
 
 // Set content type
 setContentType('text/html');
 
-// Is the extension active
+// Is the extension mailid active?
 redirectOnUninstalledExtension('mailid');
 
 redirectOnUninstalledExtension('mailid');
 
+// Is the extension other active?
+redirectOnUninstalledExtension('other');
+
 // Init variables
 $url_userid = 0;
 $url_bid = 0;
 // Init variables
 $url_userid = 0;
 $url_bid = 0;