* $Author:: $ *
* -------------------------------------------------------------------- *
* Copyright (c) 2003 - 2009 by Roland Haeder *
- * Copyright (c) 2009 - 2011 by Mailer Developer Team *
+ * Copyright (c) 2009 - 2012 by Mailer Developer Team *
* For more information visit: http://mxchange.org *
* *
* This program is free software; you can redistribute it and/or modify *
while ($content = SQL_FETCHARRAY($result_refs)) {
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'level=' . $content['level'] . ',percents=' . $content['percents'] . ' - LOOP START!');
// Reset ref depths
- initReferalSystem();
+ initReferralSystem();
// Init array
$refids = getArrayFromRefbackLevel($userid, $content['level']);
* call. If you do so, you will check the wrong direction, $userid
* is always bigger than $refid.
*/
- //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'userid=' . $userid . ',refid=' . makeNullToZero($refid) . ' - CALLING getRefbackPercents()');
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'userid=' . $userid . ',refid=' . convertNullToZero($refid) . ' - CALLING getRefbackPercents()');
$content['refback_percents'] = getRefbackPercents($refid, $userid);
- //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'userid=' . $userid . ',refid=' . makeNullToZero($refid) . ',refback_percents=' . $content['refback_percents']);
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'userid=' . $userid . ',refid=' . convertNullToZero($refid) . ',refback_percents=' . $content['refback_percents']);
// Some percents given?
if ($content['refback_percents'] > 0) {
// Something must have been updated
if (SQL_HASZEROAFFECTED()) {
// Please report this bug
- debug_report_bug(__FUNCTION__, __LINE__, 'Nothing has been updated in user_refs,userid=' . $userid . ',refid=' . makeNullToZero($refid) . ',refbackPoints=' . $refbackPoints);
+ reportBug(__FUNCTION__, __LINE__, 'Nothing has been updated in user_refs,userid=' . $userid . ',refid=' . convertNullToZero($refid) . ',refbackPoints=' . $refbackPoints);
} // END - if
// Add points again, but only directly
- //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'refbackPoints=' . $refbackPoints . ',userid=' . $userid . ',ref=' . $ref . ',refid=' . makeNullToZero($refid) . ' - REFBACK-UPDATE! (' . SQL_AFFECTEDROWS() . ')');
- addPointsThroughReferalSystem(sprintf("refback:%s", $refid), $userid, $refbackPoints);
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'refbackPoints=' . $refbackPoints . ',userid=' . $userid . ',ref=' . $ref . ',refid=' . convertNullToZero($refid) . ' - REFBACK-UPDATE! (' . SQL_AFFECTEDROWS() . ')');
+ addPointsThroughReferralSystem(sprintf("refback:%s", $refid), $userid, $refbackPoints);
// Reduce points if refid is found
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'userid=' . $userid . ',refid=' . $refid . ',ref=' . $ref . ' - REDUCING?');
* "Getter" for refback percents
*
* @param $userid "Current" user's userid
- * @param $refid $userid has this userid as referal
+ * @param $refid $userid has this userid as referral
* @return $percents Refback percents $userid has given to $refid
*/
function getRefbackPercents ($userid, $refid) {
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'userid=' . $userid . ',refid=' . $refid . ' - ENTERED!');
if ((!isValidUserId($userid)) || (!isValidUserId($refid))) {
// userid and/or refid is invalid
- debug_report_bug(__FUNCTION__, __LINE__, 'userid=' . makeNullToZero($userid) . ', refid=' . makeNullToZero($refid) . ' - Both must be > 0');
+ reportBug(__FUNCTION__, __LINE__, 'userid=' . convertNullToZero($userid) . ', refid=' . convertNullToZero($refid) . ' - Both must be > 0');
} elseif ($userid == $refid) {
// Skip identical ids
return 0;
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'userid=' . $userid . ',refid=' . $refid . ',percents=' . $GLOBALS['refback_percents'][$userid][$refid]);
} else {
// Please report all findings
- debug_report_bug(__FUNCTION__, __LINE__, 'userid=' . $userid . ',refid=' . $refid . ' - No entry found. :-(');
+ reportBug(__FUNCTION__, __LINE__, 'userid=' . $userid . ',refid=' . $refid . ' - No entry found. :-(');
}
// Free result
// "Getter" for userid array which will return only one entry
function getArrayFromRefbackLevel ($refid, $level) {
- //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'refid=' . makeNullToZero($refid) . ',level=' . $level . ' - ENTERED!');
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'refid=' . convertNullToZero($refid) . ',level=' . $level . ' - ENTERED!');
// Init userids
$userIds = array();
if (!SQL_HASZERONUMS($result)) {
// Add all
while ($content = SQL_FETCHARRAY($result)) {
- //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'refid=' . makeNullToZero($refid) . ',level=' . $level . ',userid=' . $content['userid']);
- $userIds[] = $content['userid'];
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'refid=' . convertNullToZero($refid) . ',level=' . $level . ',userid=' . $content['userid']);
+ array_push($userIds, $content['userid']);
} // END - while
} // END - if
SQL_FREERESULT($result);
// Return array
- //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'refid=' . makeNullToZero($refid) . ',userIds()=' . count($userIds) . ' - EXIT!');
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'refid=' . convertNullToZero($refid) . ',userIds()=' . count($userIds) . ' - EXIT!');
return $userIds;
}
// Prepare email content
$content['refback_percents'] = $percents;
- $content['refback_note'] = $note;
+ $content['refback_notice'] = $note;
// Load member email template
$mail = loadEmailTemplate('member_refback', $content, $content['refid']);
return $status;
}
-// Checks wether refback is enabled
+// Checks whether refback is enabled
function isRefbackEnabled () {
// Do we have cache?
if (!isset($GLOBALS[__FUNCTION__])) {