From: Roland Häder Date: Sat, 1 Dec 2012 12:28:05 +0000 (+0000) Subject: Added more missing wrappers X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=0bf0f6a180c9869b4551076337965260bf2104ad;p=mailer.git Added more missing wrappers --- diff --git a/inc/filter/bonus_filter.php b/inc/filter/bonus_filter.php index 0403890eae..d3ef5f112d 100644 --- a/inc/filter/bonus_filter.php +++ b/inc/filter/bonus_filter.php @@ -51,7 +51,7 @@ function FILTER_ADD_LOGIN_BONUS ($filterData) { // 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 @@ -110,11 +110,11 @@ function FILTER_ADD_BONUS_POINTS_USER_COLUMNS ($add = '') { } // 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!'); diff --git a/inc/libs/bonus_functions.php b/inc/libs/bonus_functions.php index 3bed18ebe6..7b3e26ddd3 100644 --- a/inc/libs/bonus_functions.php +++ b/inc/libs/bonus_functions.php @@ -79,7 +79,7 @@ function addTurboBonus ($mid, $userid, $type) { // 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()); @@ -222,7 +222,7 @@ function handleBonusPoints ($mode, $userid) { if ($mode == 'login_bonus') { // Login bonus detected - $points = getConfig('login_bonus'); + $points = getLoginBonus(); } else { // Direct points supplied $points = $mode; @@ -376,6 +376,18 @@ function getLoginBonus () { 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? @@ -508,5 +520,65 @@ function getBonusEnableNotify () { 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] ?> diff --git a/inc/libs/mediadata_functions.php b/inc/libs/mediadata_functions.php index c1240a8171..55ff7d7fbb 100644 --- a/inc/libs/mediadata_functions.php +++ b/inc/libs/mediadata_functions.php @@ -117,5 +117,33 @@ function getMediadataEntry ($key) { 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] ?> diff --git a/inc/libs/task_functions.php b/inc/libs/task_functions.php index b1243ce216..b905d249c3 100644 --- a/inc/libs/task_functions.php +++ b/inc/libs/task_functions.php @@ -333,7 +333,7 @@ ORDER BY $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 diff --git a/inc/libs/user_functions.php b/inc/libs/user_functions.php index 255ad5ce4c..41c52078e2 100644 --- a/inc/libs/user_functions.php +++ b/inc/libs/user_functions.php @@ -1205,5 +1205,17 @@ function getApSubidsSince () { 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] ?> diff --git a/inc/modules/admin/what-config_bonus.php b/inc/modules/admin/what-config_bonus.php index 048e7b6196..fdbcd3cc12 100644 --- a/inc/modules/admin/what-config_bonus.php +++ b/inc/modules/admin/what-config_bonus.php @@ -63,7 +63,7 @@ if (isFormSent('save_config')) { // 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 @@ -81,7 +81,7 @@ if (isFormSent('save_config')) { $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 = '
    '; diff --git a/inc/modules/guest/what-mediadata.php b/inc/modules/guest/what-mediadata.php index 3262dfe6c7..df1d0e8d75 100644 --- a/inc/modules/guest/what-mediadata.php +++ b/inc/modules/guest/what-mediadata.php @@ -65,7 +65,7 @@ $content['mt_start'] = generateDateTime(getMtStart(), '3'); $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 diff --git a/inc/mysql-manager.php b/inc/mysql-manager.php index b22cde7b39..737d06a99d 100644 --- a/inc/mysql-manager.php +++ b/inc/mysql-manager.php @@ -1055,7 +1055,7 @@ function countSumTotalData ($search, $tableName, $lookFor = 'id', $whereStatemen 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'; } diff --git a/inc/wrapper-functions.php b/inc/wrapper-functions.php index 3d3e6ebc9b..f2fc6b72be 100644 --- a/inc/wrapper-functions.php +++ b/inc/wrapper-functions.php @@ -1351,7 +1351,7 @@ function getDateTimeFromRepository () { 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 @@ -1368,7 +1368,7 @@ function getYear ($timestamp = NULL) { 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(); @@ -1604,7 +1604,7 @@ function isRandomReferralIdEnabled () { // 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 @@ -2663,18 +2663,6 @@ function isExtensionTask ($content) { 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?