X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Flibs%2Fbonus_functions.php;h=155196386b1743194dacf46a1c0588440a6c615e;hb=cd926dbdfbb2b3b16ecc932f17ecf4f367bc73e4;hp=c6768029f0219a4162909c4c336b4cbefb002ffc;hpb=b0b5a841a592386c3e21724c216db5d1f451ede7;p=mailer.git
diff --git a/inc/libs/bonus_functions.php b/inc/libs/bonus_functions.php
index c6768029f0..155196386b 100644
--- a/inc/libs/bonus_functions.php
+++ b/inc/libs/bonus_functions.php
@@ -65,7 +65,7 @@ function addTurboBonus ($mid, $userid, $type) {
default:
logDebugMessage(__FUNCTION__, __LINE__, sprintf("Invalid type %s detected.", $type));
break;
- }
+ } // END - switch
// Is a column name set?
if (empty($column)) {
@@ -128,7 +128,7 @@ function addBonusRanks ($data, $type, $userid) {
array(
$type,
$data,
- $userid
+ bigintval($userid)
), __FUNCTION__, __LINE__);
// Entry found?
@@ -140,9 +140,7 @@ function addBonusRanks ($data, $type, $userid) {
$self = true;
// Transfer data to template
- $GLOBALS['ranking_content']['yr_level'] = $GLOBALS['ranking_content']['level'];
- $GLOBALS['ranking_content']['yr_points'] = translateComma($GLOBALS['ranking_content']['points']);
- $GLOBALS['ranking_content']['yr_tmark'] = generateDateTime($GLOBALS['ranking_content']['timemark'], 1);
+ $GLOBALS['ranking_content']['timemark'] = generateDateTime($GLOBALS['ranking_content']['timemark'], 1);
// Load template
$GLOBALS['ranking_content']['own'] = loadTemplate('show_bonus_yr', true, $GLOBALS['ranking_content']);
@@ -199,14 +197,14 @@ LIMIT 1",
if ($self === false) {
// If current user was not found set constant
- $GLOBALS['ranking_content']['rankings'] = '{--BONUS_RANK_YOU_ARE_404--}';
+ $GLOBALS['ranking_content']['rankings'] = '{--MEMBER_BONUS_RANK_YOU_ARE_404--}';
} // END - if
} else {
// No entries found!
// @TODO Move this HTML to a template
$OUT = '
- ' . getMaskedMessage('BONUS_NO_RANKS', $data) . '
+ ' . getMaskedMessage('MEMBER_BONUS_NO_RANKS', $data) . '
|
';
}
@@ -235,7 +233,7 @@ function handleBonusPoints ($mode) {
}
// Check his amount first
- $total = countSumTotalData(getBonusUserId(), 'user_points', 'points') - countSumTotalData(getBonusUserId(), 'user_data', 'used_points');
+ $total = getTotalPoints(getBonusUserId());
// Subtract points from...
switch (getConfig('bonus_mode')) {
@@ -263,7 +261,7 @@ function handleBonusPoints ($mode) {
// Purges expired fast-click bonus entries
function purgeExpiredTurboBonus() {
// Remove entries
- $result = SQL_QUERY("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_bonus_turbo` WHERE `timemark` < (UNIX_TIMESTAMP() - {?bonus_timeout?})", __FUNCTION__, __LINE__);
+ $result = SQL_QUERY('DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_bonus_turbo` WHERE `timemark` < (UNIX_TIMESTAMP() - {?bonus_timeout?})', __FUNCTION__, __LINE__);
if (SQL_AFFECTEDROWS() > 0) {
// Send out email to admin
@@ -271,9 +269,9 @@ function purgeExpiredTurboBonus() {
} // END - if
}
-///////////////////////////////////////////////////////////////////////////////
-// Only filter functions
-///////////////////////////////////////////////////////////////////////////////
+//-----------------------------------------------------------------------------
+// Filter Functions
+//-----------------------------------------------------------------------------
// Filter for adding login bonus to the user's account
function FILTER_ADD_LOGIN_BONUS () {
@@ -307,13 +305,17 @@ LIMIT 1',
if (($bonus === true) && (getRequestParameter('mode') == 'bonus')) {
// Output message with added points
- $GLOBALS['message'] .= '{--BONUS_LOGIN_BONUS_ADDED--}
';
+ $GLOBALS['message'] .= '{--MEMBER_BONUS_LOGIN_BONUS_ADDED--}
';
} elseif (isExtensionActive('bonus')) {
// No login bonus added!
- $GLOBALS['message'] .= '{--BONUS_LOGIN_BONUS_NOT_ADDED--}
';
+ $GLOBALS['message'] .= '{--MEMBER_BONUS_LOGIN_BONUS_NOT_ADDED--}
';
}
}
+//-----------------------------------------------------------------------------
+// Wrapper Functions
+//-----------------------------------------------------------------------------
+
// Determines wether the "bonus rallye" is active
function isBonusRallyeActive () {
// Do we have cache?
@@ -326,5 +328,17 @@ function isBonusRallyeActive () {
return $GLOBALS['bonus_rallye_active'];
}
+// Determines wether the "bonus new_member_notify" is active
+function isBonusNewMemberNotifyEnabled () {
+ // Do we have cache?
+ if (!isset($GLOBALS['bonus_new_member_notify_active'])) {
+ // Just determine it
+ $GLOBALS['bonus_new_member_notify_active'] = (getConfig('bonus_new_member_notify') == 'Y');
+ } // END - if
+
+ // Return cache
+ return $GLOBALS['bonus_new_member_notify_active'];
+}
+
// [EOF]
?>