// Bonus is not given by default ;-)
$bonus = FALSE;
- if ((isExtensionInstalledAndNewer('sql_patches', '0.2.8')) && (isBonusRallyeActive()) && (getConfig('include_bonus_login') == 'Y')) {
+ if ((isExtensionInstalledAndNewer('sql_patches', '0.2.8')) && (isBonusRallyeActive()) && (getIncludeBonusLogin() == 'Y')) {
// Update last login if far enougth away
// @TODO This query isn't right, it will only update if the user was for a longer time away!
SQL_QUERY_ESC('UPDATE
} // END - if
// Add more columns only when the corresponding configuration is enabled, too
- if (getConfig('include_bonus_click') == 'Y') $add .= ' + `turbo_bonus`';
- if (getConfig('include_bonus_login') == 'Y') $add .= ' + `login_bonus`';
- if (getConfig('include_bonus_order') == 'Y') $add .= ' + `bonus_order`';
- if (getConfig('include_bonus_stats') == 'Y') $add .= ' + `bonus_stats`';
- if (getConfig('include_bonus_ref') == 'Y') $add .= ' + `bonus_ref`';
+ if (getIncludeBonusClick() == 'Y') $add .= ' + `turbo_bonus`';
+ if (getIncludeBonusLogin() == 'Y') $add .= ' + `login_bonus`';
+ if (getIncludeBonusOrder() == 'Y') $add .= ' + `bonus_order`';
+ if (getIncludeBonusRef() == 'Y') $add .= ' + `bonus_ref`';
+ if (getIncludeBonusStats() == 'Y') $add .= ' + `bonus_stats`';
// Return $add
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Done!');
// Which rank?
if ($rank == 1) {
// First rank!
- $points = getConfig('turbo_bonus');
+ $points = getTurboBonus();
} else {
// Anything else so let's explode all entered rank points
$test = explode(';', getTurboRates());
if ($mode == 'login_bonus') {
// Login bonus detected
- $points = getConfig('login_bonus');
+ $points = getLoginBonus();
} else {
// Direct points supplied
$points = $mode;
return $GLOBALS[__FUNCTION__];
}
+// Getter for turbo_bonus
+function getTurboBonus () {
+ // Is there cache?
+ if (!isset($GLOBALS[__FUNCTION__])) {
+ // Determine it
+ $GLOBALS[__FUNCTION__] = getConfig('turbo_bonus');
+ } // END - if
+
+ // Return cache
+ return $GLOBALS[__FUNCTION__];
+}
+
// Getter for bonus_ref
function getBonusRef () {
// Is there cache?
return $GLOBALS[__FUNCTION__];
}
+// Getter for include_bonus_click
+function getIncludeBonusClick () {
+ // Is there cache?
+ if (!isset($GLOBALS[__FUNCTION__])) {
+ // Determine it
+ $GLOBALS[__FUNCTION__] = getConfig('include_bonus_click');
+ } // END - if
+
+ // Return cache
+ return $GLOBALS[__FUNCTION__];
+}
+
+// Getter for include_bonus_login
+function getIncludeBonusLogin () {
+ // Is there cache?
+ if (!isset($GLOBALS[__FUNCTION__])) {
+ // Determine it
+ $GLOBALS[__FUNCTION__] = getConfig('include_bonus_login');
+ } // END - if
+
+ // Return cache
+ return $GLOBALS[__FUNCTION__];
+}
+
+// Getter for include_bonus_order
+function getIncludeBonusOrder () {
+ // Is there cache?
+ if (!isset($GLOBALS[__FUNCTION__])) {
+ // Determine it
+ $GLOBALS[__FUNCTION__] = getConfig('include_bonus_order');
+ } // END - if
+
+ // Return cache
+ return $GLOBALS[__FUNCTION__];
+}
+
+// Getter for include_bonus_Ref
+function getIncludeBonusRef () {
+ // Is there cache?
+ if (!isset($GLOBALS[__FUNCTION__])) {
+ // Determine it
+ $GLOBALS[__FUNCTION__] = getConfig('include_bonus_ref');
+ } // END - if
+
+ // Return cache
+ return $GLOBALS[__FUNCTION__];
+}
+
+// Getter for include_bonus_stats
+function getIncludeBonusStats () {
+ // Is there cache?
+ if (!isset($GLOBALS[__FUNCTION__])) {
+ // Determine it
+ $GLOBALS[__FUNCTION__] = getConfig('include_bonus_stats');
+ } // END - if
+
+ // Return cache
+ return $GLOBALS[__FUNCTION__];
+}
+
// [EOF]
?>
return $value;
}
+// ----------------------------------------------------------------------------
+// Wrapper functions for configuration entries
+// ----------------------------------------------------------------------------
+
+// Getter for 'mt_start'
+function getMtStart () {
+ // Is the cache entry set?
+ if (!isset($GLOBALS[__FUNCTION__])) {
+ // No, so determine it
+ $GLOBALS[__FUNCTION__] = getConfig('mt_start');
+ } // END - if
+
+ // Return cached entry
+ return $GLOBALS[__FUNCTION__];
+}
+
+// Getter for 'mt_stage'
+function getMtStage () {
+ // Is the cache entry set?
+ if (!isset($GLOBALS[__FUNCTION__])) {
+ // No, so determine it
+ $GLOBALS[__FUNCTION__] = getConfig('mt_stage');
+ } // END - if
+
+ // Return cached entry
+ return $GLOBALS[__FUNCTION__];
+}
+
// [EOF]
?>
$add = runFilterChain('add_bonus_points_user_columns', '');
// Active rallye, so add more point columns, if not empty
- $pointsColumns = '`turbo_bonus`';
+ $pointsColumns = '';
if (!empty($add)) {
$pointsColumns = '(0' . $add . ')';
} // END - if
return $GLOBALS[__FUNCTION__];
}
+// Getter for 'select_user_zero_refid' config entry
+function getSelectUserZeroRefid () {
+ // Is there cache?
+ if (!isset($GLOBALS[__FUNCTION__])) {
+ // Determine it
+ $GLOBALS[__FUNCTION__] = getConfig('select_user_zero_refid');
+ } // END - if
+
+ // Return cache
+ return $GLOBALS[__FUNCTION__];
+}
+
// [EOF]
?>
// Automatically calculate bonus points for ranks 2 and 3 when not set
if (!isPostRequestElementSet('turbo_rates')) {
- setPostRequestElement('turbo_rates', ''.round(getConfig('turbo_bonus') / 2).';'.round(getConfig('turbo_bonus') / 4).'');
+ setPostRequestElement('turbo_rates', ''.round(getTurboBonus() / 2).';'.round(getTurboBonus() / 4).'');
} // END - if
// Save data
$RANKS = explode(';', getTurboRates());
// Automatically calculate bonus points for ranks 2 and 3 when not set
- if (getTurboRates() == '') $RANKS = array(round(getConfig('turbo_bonus') / 2), round(getConfig('turbo_bonus') / 4));
+ if (getTurboRates() == '') $RANKS = array(round(getTurboBonus() / 2), round(getTurboBonus() / 4));
// Generate list
$OUT = '<ol start="2">';
$PROJECTED = '0';
if ($content['user_count'] > 0) {
// @TODO Find a better formular than this one
- $PROJECTED = round((time() - getMtStart()) / $content['user_count'] * getConfig('mt_stage') + getMtStart());
+ $PROJECTED = round((time() - getMtStart()) / $content['user_count'] * getMtStage() + getMtStart());
} // END - if
// Generate timestamp
if ((empty($data['res'])) && ($lookFor != 'counter') && ($lookFor != 'id') && ($lookFor != 'userid') && ($lookFor != 'rallye_id')) {
// Float number
$data['res'] = '0.00000';
- } elseif (''.$data['res'].'' == '') {
+ } elseif ('' . $data['res'] . '' == '') {
// Fix empty result
$data['res'] = '0';
}
function getYear ($timestamp = NULL) {
// Is it cached?
if (!isset($GLOBALS[__FUNCTION__][$timestamp])) {
- // null is time()
+ // If NULL is set, use time()
if (is_null($timestamp)) {
$timestamp = time();
} // END - if
function getMonth ($timestamp = NULL) {
// Is it cached?
if (!isset($GLOBALS[__FUNCTION__][$timestamp])) {
- // If null is set, use time()
+ // If NULL is set, use time()
if (is_null($timestamp)) {
// Use time() which is current timestamp
$timestamp = time();
// Is there cache?
if (!isset($GLOBALS[__FUNCTION__])) {
// Determine it
- $GLOBALS[__FUNCTION__] = ((isExtensionInstalledAndNewer('user', '0.3.4')) && (getConfig('select_user_zero_refid') == 'Y'));
+ $GLOBALS[__FUNCTION__] = ((isExtensionInstalledAndNewer('user', '0.3.4')) && (getSelectUserZeroRefid() == 'Y'));
} // END - if
// Return cache
return $GLOBALS[__FUNCTION__][$content['task_type'] . '_' . $content['infos']];
}
-// Getter for 'mt_start'
-function getMtStart () {
- // Is the cache entry set?
- if (!isset($GLOBALS[__FUNCTION__])) {
- // No, so determine it
- $GLOBALS[__FUNCTION__] = getConfig('mt_start');
- } // END - if
-
- // Return cached entry
- return $GLOBALS[__FUNCTION__];
-}
-
// Checks whether ALLOW_TESTER_ACCOUNTS is set
function ifTesterAccountsAllowed () {
// Is the cache entry set?