} // END - while
// Handle bonus points
- handleBonusPoints(getConfig('bonus_stats'));
+ handleBonusPoints(getConfig('bonus_stats'), $content['userid']);
} // END - if
// Free memory
), __FUNCTION__, __LINE__);
if ((isExtensionInstalledAndNewer('bonus', '0.3.5')) && (getBonusMode() != 'ADD') && ($points > 0)) {
- handleBonusPoints($points);
+ handleBonusPoints($points, $userid);
} // END - if
}
return $OUT;
}
-//
-function handleBonusPoints ($mode) {
+// Hanle any bonus points the given user shall become
+function handleBonusPoints ($mode, $userid) {
// Shall we add bonus points?
if (!isBonusRallyeActive()) {
return;
$return = false;
// Switch to jackpot-mode when no UID is supplied but userid-mode is selected
- if ((getBonusMode() == 'UID') && (getBonusUserid() == '0') && (isExtensionActive('jackpot'))) {
+ if ((getBonusMode() == 'UID') && ($userid == '0') && (isExtensionActive('jackpot'))) {
// Update database & config
updateConfiguration('bonus_mode', 'JACKPOT');
} // END - if
}
// Check his amount first
- $total = getTotalPoints(getBonusUserid());
+ $total = getTotalPoints($userid);
// Subtract points from...
switch (getBonusMode()) {
break;
case 'JACKPOT': // ... jackpot
- if ((isExtensionActive('jackpot')) && (subtractPointsFromJackpot($points) === false) && (isValidUserId(getBonusUserid()))) {
+ if ((isExtensionActive('jackpot')) && (subtractPointsFromJackpot($points) === false) && (isValidUserId($userid))) {
if ($total >= $points) {
// Subtract points from userid's account
- $return = subtractPointsFromJackpot('bonus_payout_jackpot', getBonusUserid(), $points);
+ $return = subtractPointsFromJackpot('bonus_payout_jackpot', $userid, $points);
} // END - if
} // END - if
break;
case 'UID': // ... userid's account
if ($total >= $points) {
// Subtract points from userid's account
- $return = subtractPoints('bonus_payout_userid', getBonusUserid(), $points);
+ $return = subtractPoints('bonus_payout_userid', $userid, $points);
} elseif (isExtensionActive('jackpot')) {
// Try to subtract from jackpot
$return = subtractPointsFromJackpot($points);
// Check wether the user is allowed to book more URLs
function SURFBAR_IF_USER_BOOK_MORE_URLS ($userid = NULL) {
// Is this admin and userid is zero or does the user has some URLs left to book?
- return ((($userid == '0') && (isAdmin())) || (SURFBAR_GET_TOTAL_USER_URLS($userid, '', array('REJECTED')) < getSurfbarMaxOrder()));
+ return (((is_null($userid)) && (isAdmin())) || (SURFBAR_GET_TOTAL_USER_URLS($userid, '', array('REJECTED')) < getSurfbarMaxOrder()));
}
// Get total amount of URLs of given status for current user
function SURFBAR_GET_TOTAL_USER_URLS ($userid = NULL, $status = '', $exclude = '') {
// Is the user 0 and user is logged in?
- if (($userid == '0') && (isMember())) {
+ if ((is_null($userid)) && (isMember())) {
// Then use this userid
$userid = getMemberId();
- } elseif ($userid == '0') {
+ } elseif (is_null($userid)) {
// Error!
return (getSurfbarMaxOrder() + 1);
}
// Subtract login bonus from userid's account or jackpot
if ((isExtensionInstalledAndNewer('bonus', '0.3.5')) && (getBonusMode() != 'ADD')) {
- handleBonusPoints('login_bonus');
+ handleBonusPoints('login_bonus', $userid);
} // END - if
} // END - if
} // END - if
$data['inserted'] = '0';
// User id set?
- if ((isMemberIdSet()) && ($userid == '0')) {
+ if ((isMemberIdSet()) && (is_null($userid))) {
$userid = getMemberId();
} // END - if
array(bigintval($refid)), __FILE__, __LINE__);
// Subtract points from system
- handleBonusPoints(getConfig('bonus_ref'));
+ handleBonusPoints(getConfig('bonus_ref'), $refid);
} // END - if
// Add one-time referal bonus over referal system or directly
if (isGetRequestParameterSet('pid')) {
// First let's get the member's id
- $result = SQL_QUERY_ESC("SELECT userid, target_account, payout_total, payout_timestamp, password FROM `{?_MYSQL_PREFIX?}_user_payouts` WHERE `id`=%s LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT `userid`, `target_account`, `payout_total`, `payout_timestamp`, `password` FROM `{?_MYSQL_PREFIX?}_user_payouts` WHERE `id`=%s LIMIT 1",
array(getRequestParameter('pid')), __FILE__, __LINE__);
list($userid, $tuserid, $points, $tstamp, $tpass) = SQL_FETCHROW($result);
SQL_FREERESULT($result);
array(bigintval($content['sender'])), __FILE__, __LINE__);
// Subtract bonus points from system
- handleBonusPoints(getConfig('bonus_order'));
+ handleBonusPoints(getConfig('bonus_order'), $content['sender']);
} // END - if
// Load email template
list($pool, $sender, $notify) = SQL_FETCHROW($result_mailid);
// Correct notification switch in non-bonus mails
- if (($notify != 'Y') && ($notify != 'N')) $notify = 'N';
+ if (($notify != 'Y') && ($notify != 'N')) {
+ $notify = 'N';
+ } // END - if
// Set sender to 0 when we have a bonus mail
- if ($ltype == 'BONUS') $sender = '0';
+ if ($ltype == 'BONUS') {
+ $sender = '0';
+ } // END - if
// Is the user id valid?
if (fetchUserData($userId) === true) {