* $Date:: $ *
* $Tag:: 0.2.1-FINAL $ *
* $Author:: $ *
- * Needs to be in all Files and every File needs "svn propset *
- * svn:keywords Date Revision" (autoprobset!) at least!!!!!! *
* -------------------------------------------------------------------- *
* Copyright (c) 2003 - 2009 by Roland Haeder *
- * Copyright (c) 2009, 2010 by Mailer Developer Team *
+ * Copyright (c) 2009 - 2011 by Mailer Developer Team *
* For more information visit: http://www.mxchange.org *
* *
* This program is free software; you can redistribute it and/or modify *
} else {
// Debug log
//* DEBUG: */ print(__FUNCTION__ . '(<font color="#0000aa">' . __LINE__."</font>): NO ENTRY FOUND! :-(<br />");
- logDebugMessage(__FUNCTION__, __LINE__, 'userid=' . $userid . ',ref=' . $ref . ' - No entry found! :-(');
+ logDebugMessage(__FUNCTION__, __LINE__, 'userid=' . $userid . ',ref=' . $ref . ' - No entry found. :-(');
}
// Free result
}
// "Getter" for userid array which will return only one entry
-function getArrayFromRefbackLevel ($rid, $level) {
+function getArrayFromRefbackLevel ($refid, $level) {
//* DEBUG: */ print("----------------------- <font color=\"#00aa00\">".__FUNCTION__." - ENTRY</font> ------------------------<ul><li>\n");
- //* DEBUG: */ print(__FUNCTION__ . '(<font color="#0000aa">' . __LINE__."</font>):rid={$rid},level={$level}<br />");
+ //* DEBUG: */ print(__FUNCTION__ . '(<font color="#0000aa">' . __LINE__."</font>):refid={$refid},level={$level}<br />");
// Init userids
$userIds = array();
`refid`=%s AND `level`=%s
ORDER BY
`userid` ASC",
- array($rid, $level), __FUNCTION__, __LINE__);
+ array($refid, $level), __FUNCTION__, __LINE__);
// Entries found?
//* DEBUG: */ print(__FUNCTION__ . '(<font color="#0000aa">' . __LINE__."</font>):numRows=".SQL_NUMROWS($result)."<br />");
- if (SQL_NUMROWS($result) > 0) {
+ if (!SQL_HASZERONUMS($result)) {
// Add all
while ($content = SQL_FETCHARRAY($result)) {
- //* DEBUG: */ print(__FUNCTION__ . '(<font color="#0000aa">' . __LINE__."</font>):rid={$rid},level={$level},userid={$content['userid']}<br />");
+ //* DEBUG: */ print(__FUNCTION__ . '(<font color="#0000aa">' . __LINE__."</font>):refid={$refid},level={$level},userid={$content['userid']}<br />");
$userIds[] = $content['userid'];
} // END - while
} // END - if
SQL_FREERESULT($result);
// Return array
- //* DEBUG: */ print(__FUNCTION__ . '(<font color="#0000aa">' . __LINE__."</font>):rid={$rid},count()=".count($userIds)."<br />");
+ //* DEBUG: */ print(__FUNCTION__ . '(<font color="#0000aa">' . __LINE__."</font>):refid={$refid},count()=".count($userIds)."<br />");
//* DEBUG: */ print("</li></ul>----------------------- <font color=\"#aa0000\">".__FUNCTION__." - EXIT</font> ------------------------<br />");
return $userIds;
}
// When no entry was updated then we have to create it here
//* DEBUG: */ print(__FUNCTION__ . '(<font color="#0000aa">' . __LINE__."</font>):found=".SQL_NUMROWS($result_refid)."<br />");
- if (SQL_NUMROWS($result_refid) > 0) {
+ if (!SQL_HASZERONUMS($result_refid)) {
// Load all refids
while (list($GLOBALS['refback_refid'][$GLOBALS['refback_level']]) = SQL_FETCHROW($result_refid)) {
// Remmber userid
array(bigintval($userid), $GLOBALS['refback_level'], bigintval($GLOBALS['refback_refid'][$GLOBALS['refback_level']])), __FUNCTION__, __LINE__);
// Move to next referal level and count his counter one up!
- $GLOBALS['refback_level']++; updateRefbackTable($GLOBALS['refback_refid'][($GLOBALS['refback_level'] - 1)]);
+ $GLOBALS['refback_level']++;
+ updateRefbackTable($GLOBALS['refback_refid'][($GLOBALS['refback_level'] - 1)]);
} // END - if
// Do we have another level here?
array(bigintval($userid), bigintval($level)), __FUNCTION__, __LINE__);
// Are there some entries?
- if (SQL_NUMROWS($result) > 0) {
+ if (!SQL_HASZERONUMS($result)) {
// Fetch all entries
while ($row = SQL_FETCHARRAY($result)) {
// Add row
function updateMemberRefbackPercents ($id, $percents) {
//* DEBUG: */ print("----------------------- <font color=\"#00aa00\">".__FUNCTION__." - ENTRY</font> ------------------------<ul><li>\n");
// Default status is failed
- $status['message'] = getMessage('MEMBER_REFBACK_ERROR_GENERAL');
+ $status['message'] = '{--MEMBER_REFBACK_ERROR_GENERAL--}';
// Do some sanity-checks
if (!isMember()) {
// No member!
- $status['message'] = getMessage('MEMBER_REFBACK_ERROR_NO_MEMBER');
+ $status['message'] = '{--MEMBER_REFBACK_ERROR_NO_MEMBER--}';
return $status;
} elseif (''.$id.'' != ''.($id + 0).'') {
// No number!
- $status['message'] = getMessage('MEMBER_REFBACK_ERROR_INVALID_ID_NUMBER');
+ $status['message'] = '{--MEMBER_REFBACK_ERROR_INVALID_ID_NUMBER--}';
return $status;
} elseif (($percents < 0) || ($percents > 100)) {
// Percentage is not valid!
- $status['message'] = getMessage('MEMBER_REFBACK_ERROR_INVALID_PERCENTAGE');
+ $status['message'] = '{--MEMBER_REFBACK_ERROR_INVALID_PERCENTAGE--}';
return $status;
}
// Is this valid?
if (count($dummy) == 0) {
// id does not belong to user!
- $status['message'] = getMessage('MEMBER_REFBACK_ERROR_ID_MISMATCH');
+ $status['message'] = '{--MEMBER_REFBACK_ERROR_ID_MISMATCH--}';
return $status;
} // END - if
array($percents, $id, getMemberId()), __FUNCTION__, __LINE__);
// Entry updated?
- if (SQL_AFFECTEDROWS() < 1) {
+ if (SQL_HASZEROAFFECTED()) {
// Entry not updated!
- $status['message'] = getMessage('MEMBER_REFBACK_ERROR_NOT_UPDATED');
+ $status['message'] = '{--MEMBER_REFBACK_ERROR_NOT_UPDATED--}';
return $status;
} // END - if
$mail = loadEmailTemplate('member_refback', $dummy, $dummy['refid']);
// Send email to user
- sendEmail($dummy['refid'], getMessage('MEMBER_REFBACK_SUBJECT'), $mail);
+ sendEmail($dummy['refid'], '{--MEMBER_REFBACK_SUBJECT--}', $mail);
// Send admin notification
- sendAdminNotification(getMessage('ADMIN_REFBACK_SUBJECT'), 'admin_refback', $dummy, getMemberId());
+ sendAdminNotification('{--ADMIN_REFBACK_SUBJECT--}', 'admin_refback', $dummy, getMemberId());
// All fine!
$status['ok'] = true;
return $status;
}
+// Checks wether refback is enabled
+function isRefbackEnabled () {
+ // Do we have cache?
+ if (!isset($GLOBALS[__FUNCTION__])) {
+ // Determine it
+ $GLOBALS[__FUNCTION__] = (getConfig('refback_enabled') == 'Y');
+ } // END - if
+
+ // Return cache
+ return $GLOBALS[__FUNCTION__];
+}
+
// [EOF]
?>