);
// One day
-$_CONFIG['one_day'] = 60*60*24;
+setConfigEntry('one_day', (60*60*24));
//
// Timestamp for yesterday, today ... all at 00:00 am
// 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;
$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 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
- $_CONFIG['db_hits_run']++;
+ incrementConfigEntry('db_hits_run');
}
// Return the 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
-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
-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
-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;
//* 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'))));
} // END - if
// Update variables to prevent errors
- $_CONFIG['doubler_used'] += $points;
+ incrementConfigEntry('doubler_used', $points);
$DOUBLER_POINTS -= $points;
// Prepare array
// 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') == "")) {
$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", "");
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);
// 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"
- 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');
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) {
array($scrambleString), __FILE__, __LINE__);
// Also remember it in config
- $_CONFIG['pass_scramble'] = $scrambleString;
+ setConfigEntry('pass_scramble', $scrambleString);
unset($scrambleString);
} // END - if
array($masterSalt), __FILE__, __LINE__);
// Also remember it in config
- $_CONFIG['master_salt'] = $masterSalt;
+ setConfigEntry('master_salt', $masterSalt);
unset($masterSalt);
} // END - if
} // 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
// 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") {
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(
} // 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), "+");
$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))
$_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!
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"))) {
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));
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));
// 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
// 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);
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
// 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'))
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")) {
// Reset surfbar counter
UPDATE_CONFIG("surfbar_monthly_counter", "0");
-$_CONFIG['surfbar_monthly_counter'] = 0;
//
?>
// 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',", $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
+ // @TODO Find a way for updating $_CONFIG here
$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));
}
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
//
// 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);
//
?>
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")) {
// Reset the surfbar counter
UPDATE_CONFIG("surfbar_weekly_counter", "0");
-$_CONFIG['surfbar_weekly_counter'] = 0;
//
?>
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)) {