Script rewritten to setConfigEntry(), getConfig() and incrementConfigEntry()
authorRoland Häder <roland@mxchange.org>
Sat, 21 Feb 2009 03:03:11 +0000 (03:03 +0000)
committerRoland Häder <roland@mxchange.org>
Sat, 21 Feb 2009 03:03:11 +0000 (03:03 +0000)
26 files changed:
inc/databases.php
inc/db/lib-mysql3.php
inc/doubler_send.php
inc/extensions/ext-sql_patches.php
inc/functions.php
inc/gen_sql_patches.php
inc/libs/bonus_functions.php
inc/libs/rallye_functions.php
inc/libs/surfbar_functions.php
inc/libs/wernis_functions.php
inc/libs/yoomedia_functions.php
inc/modules/admin.php
inc/modules/admin/what-config_beg.php
inc/modules/admin/what-config_bonus.php
inc/modules/admin/what-list_user.php
inc/modules/admin/what-theme_edit.php
inc/modules/guest/action-online.php
inc/modules/guest/what-stats.php
inc/modules/member/what-points.php
inc/monthly/monthly_surfbar.php
inc/mysql-manager.php
inc/patch-system.php
inc/reset/reset_surfbar.php
inc/stylesheet.php
inc/weekly/weekly_surfbar.php
index.php

index d50dd36e3ee8c7e357e16967b972acddb8536e06..df92e0ae1f264bd93f5aea38eb9962a814df0b22 100644 (file)
@@ -86,7 +86,7 @@ $REPLACER = array(
 );
 
 // One day
 );
 
 // One day
-$_CONFIG['one_day'] = 60*60*24;
+setConfigEntry('one_day', (60*60*24));
 
 //
 // Timestamp for yesterday, today ... all at 00:00 am
 
 //
 // Timestamp for yesterday, today ... all at 00:00 am
index 90db1da0b7c895dbf5487ff908f58ba9e5e19394..58bdc436b241c7b869fadfe1709d57d813c18dc1 100644 (file)
@@ -39,7 +39,7 @@ if (!defined('__SECURITY')) {
 
 // SQL queries
 function SQL_QUERY ($sql_string, $F, $L) {
 
 // SQL queries
 function SQL_QUERY ($sql_string, $F, $L) {
-       global $link, $CSS, $_CONFIG, $OK;
+       global $link, $CSS, $OK;
 
        // Link is up?
        if (!is_resource($link)) return false;
 
        // Link is up?
        if (!is_resource($link)) return false;
@@ -67,7 +67,7 @@ Query string:<br />
        $queryTime = $querytimeAfter - $querytimeBefore;
 
        // Save last successfull query
        $queryTime = $querytimeAfter - $querytimeBefore;
 
        // Save last successfull query
-       $_CONFIG['db_last_query'] = $sql_string;
+       setConfigEntry('db_last_query', $sql_string);
 
        // Count this query
        incrementConfigEntry('sql_count');
 
        // Count this query
        incrementConfigEntry('sql_count');
@@ -92,10 +92,10 @@ Query string:<br />
        // Count DB hits
        if (getConfig('db_hits_run') == null) {
                // Count in dummy variable
        // Count DB hits
        if (getConfig('db_hits_run') == null) {
                // Count in dummy variable
-               $_CONFIG['db_hits_run'] = 1;
+               setConfigEntry('db_hits_run', 1);
        } else {
                // Count to config array
        } else {
                // Count to config array
-               $_CONFIG['db_hits_run']++;
+               incrementConfigEntry('db_hits_run');
        }
 
        // Return the result
        }
 
        // Return the result
@@ -176,28 +176,26 @@ function SQL_FETCHARRAY($res, $nr=0, $remove_numerical=true) {
 }
 
 // SQL result
 }
 
 // SQL result
-function SQL_RESULT($res, $row, $field) {
+function SQL_RESULT ($res, $row, $field) {
        $result = mysql_result($res, $row, $field);
        return $result;
 }
 // SQL connect
        $result = mysql_result($res, $row, $field);
        return $result;
 }
 // SQL connect
-function SQL_CONNECT($host, $login, $password, $F, $L) {
+function SQL_CONNECT ($host, $login, $password, $F, $L) {
        $connect = mysql_connect($host, $login, $password) or addFatalMessage($F." (".$L."):".mysql_error());
        return $connect;
 }
 // SQL select database
        $connect = mysql_connect($host, $login, $password) or addFatalMessage($F." (".$L."):".mysql_error());
        return $connect;
 }
 // SQL select database
-function SQL_SELECT_DB($dbName, $link, $F, $L) {
-       $select = false;
-       if (is_resource($link)) {
-               $select = mysql_select_db($dbName, $link) or addFatalMessage($F." (".$L."):".mysql_error());
-       }
-       return $select;
+function SQL_SELECT_DB ($dbName, $link, $F, $L) {
+       // Is there still a valid link? If not, skip it.
+       if (!is_resource($link)) return false;
+
+       return mysql_select_db($dbName, $link) or addFatalMessage($F." (".$L."):".mysql_error());
 }
 // SQL close link
 }
 // SQL close link
-function SQL_CLOSE(&$link, $F, $L) {
-       global $_CONFIG, $cacheInstance, $cacheArray;
+function SQL_CLOSE (&$link, $F, $L) {
+       global $cacheInstance, $cacheArray;
 
 
-       // Is there still a valid link?
        if (!is_resource($link)) {
                // Skip double close
                return false;
        if (!is_resource($link)) {
                // Skip double close
                return false;
@@ -207,7 +205,7 @@ function SQL_CLOSE(&$link, $F, $L) {
        //* DEBUG: */ echo "DB=".getConfig('db_hits').",CACHE=".getConfig('cache_hits')."<br />\n";
        if ((GET_EXT_VERSION("cache") >= "0.0.7") && (getConfig('db_hits') > 0) && (getConfig('cache_hits') > 0) && (is_object($cacheInstance))) {
                // Add new hits
        //* DEBUG: */ echo "DB=".getConfig('db_hits').",CACHE=".getConfig('cache_hits')."<br />\n";
        if ((GET_EXT_VERSION("cache") >= "0.0.7") && (getConfig('db_hits') > 0) && (getConfig('cache_hits') > 0) && (is_object($cacheInstance))) {
                // Add new hits
-               $_CONFIG['db_hits'] += getConfig('db_hits_run');
+               incrementConfigEntry('db_hits', getConfig('db_hits_run'));
 
                // Update counter for db/cache
                UPDATE_CONFIG(array("db_hits", "cache_hits"), array(bigintval(getConfig('db_hits')), bigintval(getConfig('cache_hits'))));
 
                // Update counter for db/cache
                UPDATE_CONFIG(array("db_hits", "cache_hits"), array(bigintval(getConfig('db_hits')), bigintval(getConfig('cache_hits'))));
index bdf6d7b2826641db4636cdd686d0eca4c1e4bbfc..1fd505799d8808144097bc225d72958b3f79e67a 100644 (file)
@@ -133,7 +133,7 @@ if (((SQL_NUMROWS($result_total) > 0) && (getConfig('doubler_sent_all') == "Y"))
                        } // END - if
 
                        // Update variables to prevent errors
                        } // END - if
 
                        // Update variables to prevent errors
-                       $_CONFIG['doubler_used'] += $points;
+                       incrementConfigEntry('doubler_used', $points);
                        $DOUBLER_POINTS -= $points;
 
                        // Prepare array
                        $DOUBLER_POINTS -= $points;
 
                        // Prepare array
index fb72b89c8bfe852b55c20758540da4113090c909..80a91853bf4ced8f99e8ae5e484cc3600b088b45 100644 (file)
@@ -727,7 +727,7 @@ default: // Do stuff when extension is loaded
        // When the sql_patches is not installed we cannot load it's configuration... *sigh*
        if (GET_EXT_VERSION("sql_patches") != '') {
                // Init key
        // When the sql_patches is not installed we cannot load it's configuration... *sigh*
        if (GET_EXT_VERSION("sql_patches") != '') {
                // Init key
-               $_CONFIG['secret_key'] = "";
+               setConfigEntry('secret_key', "");
 
                // Read key from secret file
                if ((getConfig('file_hash') == "") || (getConfig('master_salt') == "") || (getConfig('pass_scramble') == "")) {
 
                // Read key from secret file
                if ((getConfig('file_hash') == "") || (getConfig('master_salt') == "") || (getConfig('pass_scramble') == "")) {
@@ -753,7 +753,7 @@ default: // Do stuff when extension is loaded
                        $hashFile = sprintf("%sinc/.secret/.%s", constant('PATH'), getConfig('file_hash'));
                        if (FILE_READABLE($hashFile)) {
                                // Read file
                        $hashFile = sprintf("%sinc/.secret/.%s", constant('PATH'), getConfig('file_hash'));
                        if (FILE_READABLE($hashFile)) {
                                // Read file
-                               $_CONFIG['secret_key'] = READ_FILE($hashFile);
+                               setConfigEntry('secret_key', READ_FILE($hashFile));
                        } else {
                                // Remove it from database
                                UPDATE_CONFIG("file_hash", "");
                        } else {
                                // Remove it from database
                                UPDATE_CONFIG("file_hash", "");
@@ -771,11 +771,11 @@ default: // Do stuff when extension is loaded
                define('_MAX'    , getConfig('rand_no'));
        } else {
                // Set some lame ( ;-) ) default settings
                define('_MAX'    , getConfig('rand_no'));
        } else {
                // Set some lame ( ;-) ) default settings
-               $_CONFIG['def_refid'] = 0;
-               $_CONFIG['enable_title_deco'] = "N";
-               $_CONFIG['title_mod_show']    = "Y";
-               $_CONFIG['title_middle']      = "-";
-               // @TODO Can we remove this? $_CONFIG['verbose_sql']       = "N";
+               setConfigEntry('def_refid'] = 0;
+               setConfigEntry('enable_title_deco', = "N");
+               setConfigEntry('title_mod_show'   , = "Y");
+               setConfigEntry('title_middle'     , = "-");
+               // @TODO Can we remove this? setConfigEntry('verbose_sql'        , "N");
                define('MT_WORD' , DEFAULT_MT_WORD );
                define('MT_WORD2', DEFAULT_MT_WORD2);
                define('MT_WORD3', DEFAULT_MT_WORD3);
                define('MT_WORD' , DEFAULT_MT_WORD );
                define('MT_WORD2', DEFAULT_MT_WORD2);
                define('MT_WORD3', DEFAULT_MT_WORD3);
index 6f668fc188a1775352b19ec101e1b93074eb1597..492bd3e90c4e59d0f2ea4f9c3b9ea2ced0ff7274 100644 (file)
@@ -583,10 +583,8 @@ function MAKE_DATETIME ($time, $mode="0")
 
 // Translates the american decimal dot into a german comma
 function TRANSLATE_COMMA ($dotted, $cut=true, $max=0) {
 
 // Translates the american decimal dot into a german comma
 function TRANSLATE_COMMA ($dotted, $cut=true, $max=0) {
-       global $_CONFIG;
-
        // Default is 3 you can change this in admin area "Misc -> Misc Options"
        // Default is 3 you can change this in admin area "Misc -> Misc Options"
-       if (getConfig('max_comma') == null) $_CONFIG['max_comma'] = "3";
+       if (getConfig('max_comma') == null) setConfigEntry('max_comma', "3");
 
        // Use from config is default
        $maxComma = getConfig('max_comma');
 
        // Use from config is default
        $maxComma = getConfig('max_comma');
@@ -2867,6 +2865,17 @@ function getConfig ($entry) {
        return $value;
 }
 
        return $value;
 }
 
+// Setter for $_CONFIG entries
+function setConfigEntry ($entry, $value) {
+       global $_CONFIG;
+
+       // Secure the entry name
+       $entry = SQL_ESCAPE($entry);
+
+       // And set it
+       $_CONFIG[$entry] = $value;
+}
+
 // @TODO Rewrite all language constants to this function.
 // "Getter" for language strings
 function getMessage ($messageId) {
 // @TODO Rewrite all language constants to this function.
 // "Getter" for language strings
 function getMessage ($messageId) {
index 0c9afaab5c6131cac397fb96c565a5354e42e06c..1a7c1fc7951b04528f5df70cf7af11e416328fb1 100644 (file)
@@ -50,7 +50,7 @@ if (getConfig('pass_scramble') == "") {
                array($scrambleString), __FILE__, __LINE__);
 
        // Also remember it in config
                array($scrambleString), __FILE__, __LINE__);
 
        // Also remember it in config
-       $_CONFIG['pass_scramble'] = $scrambleString;
+       setConfigEntry('pass_scramble', $scrambleString);
        unset($scrambleString);
 } // END - if
 
        unset($scrambleString);
 } // END - if
 
@@ -65,7 +65,7 @@ if (getConfig('master_salt') == "") {
                array($masterSalt), __FILE__, __LINE__);
 
        // Also remember it in config
                array($masterSalt), __FILE__, __LINE__);
 
        // Also remember it in config
-       $_CONFIG['master_salt'] = $masterSalt;
+       setConfigEntry('master_salt', $masterSalt);
        unset($masterSalt);
 } // END - if
 
        unset($masterSalt);
 } // END - if
 
@@ -109,8 +109,12 @@ if (getConfig('file_hash') == "") {
                } // END - if
 
                // Also update configuration
                } // END - if
 
                // Also update configuration
-               $_CONFIG['secret_key'] = $secretKey; unset($secretKey);
-               $_CONFIG['file_hash']  = $file_hash; unset($file_hash);
+               setConfigEntry('secret_key', $secretKey);
+               setConfigEntry('file_hash' , $file_hash);
+
+               // Remove variables
+               unset($secretKey);
+               unset($file_hash);
        } // END - if
 } // END - if
 
        } // END - if
 } // END - if
 
index 68ac09ada8360a0b6dbe58180dbe8ba14a1b9716..5ceee1324997971c3911fa6e26505e4f55a7c0f6 100644 (file)
@@ -195,11 +195,8 @@ function BONUS_POINTS_HANDLER ($MODE) {
 
        // Switch to jackpot-mode when no UID is supplied but userid-mode is selected
        if ((getConfig('bonus_mode') == "UID") && (getConfig('bonus_uid') == "0")) {
 
        // Switch to jackpot-mode when no UID is supplied but userid-mode is selected
        if ((getConfig('bonus_mode') == "UID") && (getConfig('bonus_uid') == "0")) {
-               // Update database
-               UPDATE_CONFIG(array('bonus_mode'), array("JACKPOT"));
-
-               // Update configuration
-               $_CONFIG['bonus_mode'] = "JACKPOT";
+               // Update database & config
+               UPDATE_CONFIG('bonus_mode', "JACKPOT");
        } // END - if
 
        if ($MODE == "login_bonus") {
        } // END - if
 
        if ($MODE == "login_bonus") {
index 25146a04db8888ff1d71beaadb4afb2eb446c15f..c09d6c5d6d7eb0597f40c06ae72bc2aa1cc56354 100644 (file)
@@ -517,7 +517,7 @@ function RALLYE_LOAD_USERS_ARRAY ($rallye) {
        global $_CONFIG;
 
        // Fix zero points to 0.00000
        global $_CONFIG;
 
        // Fix zero points to 0.00000
-       if (getConfig('ref_payout') == "0") $_CONFIG['ref_payout'] = "0.00000";
+       if (getConfig('ref_payout') == "0") setConfigEntry('ref_payout', "0.00000");
 
        // Init multi array
        $users = array(
 
        // Init multi array
        $users = array(
index d981c7bf56f8ca977ca00cd0bec593dc459f9557..2dffd31ac940d5a143cec34c20e9a18604eb7e1e 100644 (file)
@@ -1048,10 +1048,10 @@ function SURFBAR_UPDATE_INSERT_STATS_RECORD () {
        } // END - if
 
        // Update total/daily/weekly/monthly counter
        } // END - if
 
        // Update total/daily/weekly/monthly counter
-       $_CONFIG['surfbar_total_counter']++;
-       $_CONFIG['surfbar_daily_counter']++;
-       $_CONFIG['surfbar_weekly_counter']++;
-       $_CONFIG['surfbar_monthly_counter']++;
+       incrementConfigEntry('surfbar_total_counter');
+       incrementConfigEntry('surfbar_daily_counter');
+       incrementConfigEntry('surfbar_weekly_counter');
+       incrementConfigEntry('surfbar_monthly_counter');
 
        // Update config as well
        UPDATE_CONFIG(array("surfbar_total_counter", "surfbar_daily_counter", "surfbar_weekly_counter", "surfbar_monthly_counter"), array(1,1,1,1), "+");
 
        // Update config as well
        UPDATE_CONFIG(array("surfbar_total_counter", "surfbar_daily_counter", "surfbar_weekly_counter", "surfbar_monthly_counter"), array(1,1,1,1), "+");
index 0fbc50f3fa04b276a8137997d1d771029e036298..7809ce6461476475e3ea7af55146550be27af15c 100644 (file)
@@ -274,7 +274,7 @@ function WERNIS_EXECUTE_PAYOUT ($wdsId, $amount) {
        $requestData = array(
                'sub_request'   => "send",
                't_uid'                 => getConfig('wernis_refid'),
        $requestData = array(
                'sub_request'   => "send",
                't_uid'                 => getConfig('wernis_refid'),
-               't_md5'                 => $_CONFIG['wernis_pass_md5'],
+               't_md5'                 => getConfig('wernis_pass_md5'),
                'r_uid'                 => bigintval($wdsId),
                'amount'                => bigintval($amount),
                'purpose'               => urlencode(base64_encode($purpose))
                'r_uid'                 => bigintval($wdsId),
                'amount'                => bigintval($amount),
                'purpose'               => urlencode(base64_encode($purpose))
index 08334e4ef3e0604f3b9ea1cc96636b0451cee1b9..4b234a24638af97de7c6e6b1a74fa5ff8471f2a4 100644 (file)
@@ -51,11 +51,11 @@ function YOOMEDIA_TEST_CONFIG ($data) {
        $_CONFIG = merge_array($_CONFIG, $data);
 
        // Temporary allow maximum
        $_CONFIG = merge_array($_CONFIG, $data);
 
        // Temporary allow maximum
-       $_CONFIG['yoomedia_tm_max_reload']    = 1000;
-       $_CONFIG['yoomedia_tm_min_wait']      = 0;
-       $_CONFIG['yoomedia_tm_clicks_remain'] = 10;
-       $_CONFIG['yoomedia_tm_min_pay']       = 0;
-       $_CONFIG['yoomedia_erotic_allowed']   = 1;
+       setConfigEntry('yoomedia_tm_max_reload'   , 1000);
+       setConfigEntry('yoomedia_tm_min_wait'     , 0);
+       setConfigEntry('yoomedia_tm_clicks_remain', 10);
+       setConfigEntry('yoomedia_tm_min_pay'      , 0);
+       setConfigEntry('yoomedia_erotic_allowed'  , 1);
 
        // Query the API with a test request without couting it
        // If zero reply comes back the data is invalid!
 
        // Query the API with a test request without couting it
        // If zero reply comes back the data is invalid!
index f61c4edc50a10d4f90e943c28c206f21a655cd13..30d4372fbcdc1a60432d6942b98d6139adcc7073 100644 (file)
@@ -344,7 +344,7 @@ if (!isBooleanConstantAndTrue('admin_registered')) {
                define('__ACL_ALLOW', RUN_FILTER('check_admin_acl'));
 
                // When type of admin menu is not set fallback to old menu system
                define('__ACL_ALLOW', RUN_FILTER('check_admin_acl'));
 
                // When type of admin menu is not set fallback to old menu system
-               if (getConfig('admin_menu') == null) $_CONFIG['admin_menu'] = "OLD";
+               if (getConfig('admin_menu') == null) setConfigEntry('admin_menu', "OLD");
 
                // Check for version and switch between old menu system and new "intelligent menu system"
                if ((ADMIN_CHECK_MENU_MODE() == "NEW") && (FILE_READABLE(PATH."inc/modules/admin/lasys-inc.php"))) {
 
                // Check for version and switch between old menu system and new "intelligent menu system"
                if ((ADMIN_CHECK_MENU_MODE() == "NEW") && (FILE_READABLE(PATH."inc/modules/admin/lasys-inc.php"))) {
index c17cde08f60ad3e71a6f92a424dfb6b0d01c6fb7..6bc51b7e8d8b4a25c5a64136065e1d9d91dad151 100644 (file)
@@ -50,9 +50,9 @@ if (isset($_POST['ok'])) {
        ADMIN_SAVE_SETTINGS($_POST);
 
        // Remember new settings
        ADMIN_SAVE_SETTINGS($_POST);
 
        // Remember new settings
-       $_CONFIG['beg_rallye']        = $_POST['beg_rallye'];
-       $_CONFIG['beg_ral_en_notify'] = $_POST['beg_ral_en_notify'];
-       $_CONFIG['beg_ral_di_notify'] = $_POST['beg_ral_di_notify'];
+       setConfigEntry('beg_rallye'       , $_POST['beg_rallye']);
+       setConfigEntry('beg_ral_en_notify', $_POST['beg_ral_en_notify']);
+       setConfigEntry('beg_ral_di_notify', $_POST['beg_ral_di_notify']);
 } else {
        // Prepare constants for the template
        define('__BEG_POINTS'           , TRANSLATE_COMMA(getConfig('beg_points')      , false));
 } else {
        // Prepare constants for the template
        define('__BEG_POINTS'           , TRANSLATE_COMMA(getConfig('beg_points')      , false));
index eacf938ace1f6b4002ed56fcb9cc0d3dbf3b3f01..b50b55ee0a70876195a67509884bef489aeb6d7c 100644 (file)
@@ -64,9 +64,9 @@ if (isset($_POST['ok'])) {
        ADMIN_SAVE_SETTINGS($_POST);
 
        // Remember new settings
        ADMIN_SAVE_SETTINGS($_POST);
 
        // Remember new settings
-       $_CONFIG['bonus_active']    = $_POST['bonus_active'];
-       $_CONFIG['bonus_en_notify'] = $_POST['bonus_en_notify'];
-       $_CONFIG['bonus_di_notify'] = $_POST['bonus_di_notify'];
+       setConfigEntry('bonus_active'   , $_POST['bonus_active']);
+       setConfigEntry('bonus_en_notify', $_POST['bonus_en_notify']);
+       setConfigEntry('bonus_di_notify', $_POST['bonus_di_notify']);
 } else {
        // Prepare contants for the template
        define('__LOGIN_VALUE' , TRANSLATE_COMMA(getConfig('login_bonus')        , false));
 } else {
        // Prepare contants for the template
        define('__LOGIN_VALUE' , TRANSLATE_COMMA(getConfig('login_bonus')        , false));
index 5dd98324190aa360eda3294b8ce5c2407a625de0..9e5e57b1923df9cd260a5857576b2ffbadf4c0c1 100644 (file)
@@ -237,7 +237,7 @@ LIMIT 1",
 
        // Calculate page count (0.5 fixes a bug with page count)
        if (getConfig('user_limit') == 0) {
 
        // Calculate page count (0.5 fixes a bug with page count)
        if (getConfig('user_limit') == 0) {
-               $_CONFIG['user_limit'] = 100;
+               setConfigEntry('user_limit', 100);
                LOAD_TEMPLATE("admin_settings_saved", false, EXTENSION_WARNING_USER_LIMIT);
        } // END - if
 
                LOAD_TEMPLATE("admin_settings_saved", false, EXTENSION_WARNING_USER_LIMIT);
        } // END - if
 
index 47d341b66f8237e8bb610b3a73f3462dbf4daa69..6270d149aa564f79b433d88b6ee4f1233fbb5989 100644 (file)
@@ -87,7 +87,7 @@ if ($SEL > 0) {
        // Set it in config and current theme as well
        global $currTheme;
        $currTheme = $POST['default_theme'];
        // Set it in config and current theme as well
        global $currTheme;
        $currTheme = $POST['default_theme'];
-       $_CONFIG['default_theme'] = $POST['default_theme'];
+       setConfigEntry('default_theme', $POST['default_theme']);
 
        // Save theme
        ADMIN_SAVE_SETTINGS($POST);
 
        // Save theme
        ADMIN_SAVE_SETTINGS($POST);
index 3cc337bc613b37701b086369c0b58c85920edbd6..a9be0cc9d6d6a90bb1a89d7898c8269ad2d2255e 100644 (file)
@@ -52,8 +52,6 @@ $total      = SQL_NUMROWS($result_guests) + SQL_NUMROWS($result_members) + SQL_N
 if (getConfig('mad_count') < $total) {
        // Update counter
        UPDATE_CONFIG(array("mad_timestamp", "mad_count"), array(time(), $total));
 if (getConfig('mad_count') < $total) {
        // Update counter
        UPDATE_CONFIG(array("mad_timestamp", "mad_count"), array(time(), $total));
-       $_CONFIG['mad_count'] = $total;
-       $_CONFIG['last_mad']  = time();
 } // END - if
 
 // Put all values in constants for the template
 } // END - if
 
 // Put all values in constants for the template
index 495e4e0ff71eb45ff24912aecda845ea193810e0..1348afd9eea77034a617dec716d96a186d77e1fc 100644 (file)
@@ -43,9 +43,23 @@ ADD_DESCR("guest", __FILE__);
 // Derterminate which stats we want and set mode and title for the link below stats block
 if (!isset($_GET['mode'])) $_GET['mode'] = strtolower(getConfig('guest_stats'));
 switch ($_GET['mode']) {
 // Derterminate which stats we want and set mode and title for the link below stats block
 if (!isset($_GET['mode'])) $_GET['mode'] = strtolower(getConfig('guest_stats'));
 switch ($_GET['mode']) {
-       case "members" : $_CONFIG['guest_stats'] = "MEMBERS"; $lmode = "modules"; $ltitle = GUEST_STATS_MODULES; break;
-       case "modules" : $_CONFIG['guest_stats'] = "MODULES"; $lmode = "members"; $ltitle = GUEST_STATS_MEMBERS; break;
-       case "inactive": $_CONFIG['guest_stats'] = "INACTIVE"; $lmode = "inactive"; $ltitle = GUEST_STATS_INACTIVE; break;
+       case "members" :
+               setConfigEntry('guest_stats', "MEMBERS");
+               $lmode = "modules";
+               $ltitle = getMessage('GUEST_STATS_MODULES');
+               break;
+
+       case "modules" :
+               setConfigEntry('guest_stats', "MODULES");
+               $lmode = "members";
+               $ltitle = getMessage('GUEST_STATS_MEMBERS');
+               break;
+
+       case "inactive":
+               setConfigEntry('guest_stats', "INACTIVE");
+               $lmode = "inactive";
+               $ltitle = getMessage('GUEST_STATS_INACTIVE');
+               break;
 }
 
 switch (getConfig('guest_stats'))
 }
 
 switch (getConfig('guest_stats'))
index 8480ee81b9497e4e1c0398181f36143bd040e053..da7b330b7f40a521be5dd6f6f02ca7b0f47d0bd1 100644 (file)
@@ -137,7 +137,7 @@ define('__TREF_VALUE' , $TREF);
 define('__TLOCK_VALUE', TRANSLATE_COMMA($TLOCK));
 
 // Fixes a bug when there is no bonus extension installed
 define('__TLOCK_VALUE', TRANSLATE_COMMA($TLOCK));
 
 // Fixes a bug when there is no bonus extension installed
-if (EXT_VERSION_IS_OLDER("bonus", "0.4.4")) $_CONFIG['bonus_active'] = "X";
+if (EXT_VERSION_IS_OLDER("bonus", "0.4.4")) setConfigEntry('bonus_active', "X");
 
 // Display login bonus and turbo-click bonus
 if ((GET_EXT_VERSION("bonus") >= "0.2.2") && (EXT_IS_ACTIVE("bonus")) && (getConfig('bonus_active') == "Y")) {
 
 // Display login bonus and turbo-click bonus
 if ((GET_EXT_VERSION("bonus") >= "0.2.2") && (EXT_IS_ACTIVE("bonus")) && (getConfig('bonus_active') == "Y")) {
index 658444343921586f76d1703da3de1ad678814ae8..1a099824b6d3e0734430f2801c6a62c0f2c01db2 100644 (file)
@@ -45,7 +45,6 @@ if (($CSS == 1) || (!defined('__DAILY_RESET'))) return;
 
 // Reset surfbar counter
 UPDATE_CONFIG("surfbar_monthly_counter", "0");
 
 // Reset surfbar counter
 UPDATE_CONFIG("surfbar_monthly_counter", "0");
-$_CONFIG['surfbar_monthly_counter'] = 0;
 
 //
 ?>
 
 //
 ?>
index 1539e82f8abab09da5cae208add7bf1c985929d4..6413d766877b4076ddb0a7e58799d0362b5eaf09 100644 (file)
@@ -1707,6 +1707,7 @@ function UPDATE_CONFIG ($entries, $values, $updateMode="") {
                        // Update mode set?
                        if (!empty($updateMode)) {
                                // Update entry
                        // Update mode set?
                        if (!empty($updateMode)) {
                                // Update entry
+                               // @TODO Find a way for updating $_CONFIG here
                                $all .= sprintf("%s=%s%s%s,", $entry, $entry, $updateMode, (float)$values[$idx]);
                        } else {
                                // Check if string or number
                                $all .= sprintf("%s=%s%s%s,", $entry, $entry, $updateMode, (float)$values[$idx]);
                        } else {
                                // Check if string or number
@@ -1721,14 +1722,21 @@ function UPDATE_CONFIG ($entries, $values, $updateMode="") {
                                        $all .= sprintf("%s='%s',", $entry, SQL_ESCAPE($values[$idx]));
                                }
                        }
                                        $all .= sprintf("%s='%s',", $entry, SQL_ESCAPE($values[$idx]));
                                }
                        }
+
+                       // Set it in $_CONFIG as well
+                       setConfigEntry($entry, $values[$idx]);
                } // END - foreach
 
                // Remove last comma
                $entries = substr($all, 0, -1);
        } elseif (!empty($updateMode)) {
                // Update mode set
                } // END - foreach
 
                // Remove last comma
                $entries = substr($all, 0, -1);
        } elseif (!empty($updateMode)) {
                // Update mode set
+               // @TODO Find a way for updating $_CONFIG here
                $entries .= sprintf("=%s%s%s", $entries, $updateMode, (float)$values);
        } else {
                $entries .= sprintf("=%s%s%s", $entries, $updateMode, (float)$values);
        } else {
+               // Set it in $_CONFIG first
+               setConfigEntry($entries, $values);
+
                // Regular entry to update
                $entries .= sprintf("='%s'", SQL_ESCAPE($values));
        }
                // Regular entry to update
                $entries .= sprintf("='%s'", SQL_ESCAPE($values));
        }
index e9be4551919aa110a7bdb968599dfeb78c941ebb..939f15ee621cef422f45e09537a31078e9909d41 100644 (file)
@@ -41,8 +41,8 @@ if (!defined('__SECURITY')) {
 if ((CURR_SVN_REVISION > getConfig('patch_level')) || (getConfig('patch_level') == "CURR_SVN_REVISION") || (getConfig('patch_ctime') == "UNIX_TIMES")) {
        // Update database and CONFIG array
        UPDATE_CONFIG(array("patch_level", "patch_ctime"), array(CURR_SVN_REVISION, "UNIX_TIMESTAMP()"));
 if ((CURR_SVN_REVISION > getConfig('patch_level')) || (getConfig('patch_level') == "CURR_SVN_REVISION") || (getConfig('patch_ctime') == "UNIX_TIMES")) {
        // Update database and CONFIG array
        UPDATE_CONFIG(array("patch_level", "patch_ctime"), array(CURR_SVN_REVISION, "UNIX_TIMESTAMP()"));
-       $_CONFIG['patch_level'] = CURR_SVN_REVISION;
-       $_CONFIG['patch_ctime'] = time();
+       setConfigEntry('patch_level', CURR_SVN_REVISION);
+       setConfigEntry('patch_ctime', time());
 } // END - if
 
 //
 } // END - if
 
 //
index 98d5c5600a2cf2578e343221ed1a541f1ea2cc08..dcd49ba3a1c75d5c272a17ac3966c4af2e47002f 100644 (file)
@@ -45,8 +45,8 @@ if (($CSS == 1) || (!defined('__DAILY_RESET'))) return;
 
 // Reset surfbar counter
 UPDATE_CONFIG(array("surfbar_daily_counter", "surfbar_yester_counter"), array(0, getConfig('surfbar_daily_counter')));
 
 // Reset surfbar counter
 UPDATE_CONFIG(array("surfbar_daily_counter", "surfbar_yester_counter"), array(0, getConfig('surfbar_daily_counter')));
-$_CONFIG['surfbar_yester_counter'] = getConfig('surfbar_daily_counter');
-$_CONFIG['surfbar_daily_counter'] = 0;
+setConfigEntry('surfbar_yester_counter', getConfig('surfbar_daily_counter'));
+setConfigEntry('surfbar_daily_counter' , 0);
 
 //
 ?>
 
 //
 ?>
index 4840655c2645ff9e6bb4bfa46ffaedf4b8ed67b9..5c56b5632070c09f748812e1dfbf7400a6bb4b53 100644 (file)
@@ -46,7 +46,7 @@ $STYLES = array(
 if ((basename($_SERVER['PHP_SELF']) == "install.php") || (!isBooleanConstantAndTrue('mxchange_installed')) || (isset($_GET['installing']))) $STYLES[] = "install.css";
 
 // When no CSS output-mode is set, set it to file-output
 if ((basename($_SERVER['PHP_SELF']) == "install.php") || (!isBooleanConstantAndTrue('mxchange_installed')) || (isset($_GET['installing']))) $STYLES[] = "install.css";
 
 // When no CSS output-mode is set, set it to file-output
-if (getConfig('css_php') == "") $_CONFIG['css_php'] = "FILE";
+if (getConfig('css_php') == null) setConfigEntry('css_php', "FILE");
 
 // Output CSS files or content or link to css.php ?
 if (($CSS == "1") || (getConfig('css_php') == "DIRECT")) {
 
 // Output CSS files or content or link to css.php ?
 if (($CSS == "1") || (getConfig('css_php') == "DIRECT")) {
index 7ff1ff36593f8260ec67dfca9ccda89527f2a857..098df63e95b3643c941792e2f065904397117b31 100644 (file)
@@ -45,7 +45,6 @@ if (($CSS == 1) || (!defined('__DAILY_RESET'))) return;
 
 // Reset the surfbar counter
 UPDATE_CONFIG("surfbar_weekly_counter", "0");
 
 // Reset the surfbar counter
 UPDATE_CONFIG("surfbar_weekly_counter", "0");
-$_CONFIG['surfbar_weekly_counter'] = 0;
 
 //
 ?>
 
 //
 ?>
index 9142d90b424af8d7cca30c3472d5211e43c28302..aed7b1e9c5aae036b64c9211ca9c2db32c9b7742 100644 (file)
--- a/index.php
+++ b/index.php
@@ -51,8 +51,8 @@ if (isBooleanConstantAndTrue('mxchange_installed')) {
        LOAD_INC("inc/header.php");
 
        // Fix missing array elements here
        LOAD_INC("inc/header.php");
 
        // Fix missing array elements here
-       if (getConfig('index_delay') == null)  $_CONFIG['index_delay']  = 0;
-       if (getConfig('index_cookie') == null) $_CONFIG['index_cookie'] = 0;
+       if (getConfig('index_delay') == null)  setConfigEntry('index_delay' , 0);
+       if (getConfig('index_cookie') == null) setConfigEntry('index_cookie', 0);
 
        // Check for cookies
        if ((isSessionVariableSet('visited')) || (getConfig('index_delay') == 0) || (getConfig('index_cookie') == 0)) {
 
        // Check for cookies
        if ((isSessionVariableSet('visited')) || (getConfig('index_delay') == 0) || (getConfig('index_cookie') == 0)) {