// "Walk" through all level
while (list($level, $perc) = SQL_FETCHROW($result_refs)) {
// Reset ref depths
- $DEPTH = -1;
+ unset($DEPTH);
- // "Walk through all refids
+ // "Walk" through all refids
//* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):uid={$uid},ref={$ref},level={$level},points={$points}<br />\n";
foreach (GET_REFBACK_USERID_ARRAY($uid, $level) as $refid) {
// Skip level zero or if both are the same
// Some percents given?
if ($percents > 0) {
//* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):points={$points},perc={$perc},percents={$percents},level={$level}<br />\n";
- // Get points for refback
+ // Calculate points for refback
$refback = $points * ($perc / 100) * ($percents / 100);
// Update refback table ("refid" and "uid" must be exchanged!)
// Add points again, but only directly
//* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):refback={$refback}<br />\n";
- ADD_POINTS_REFSYSTEM($uid, $refback, false, "0", false, "direct");
+ ADD_POINTS_REFSYSTEM(sprintf("refback:%s", $refid), $uid, $refback, false, "0", false, "direct");
// Reduce points if refid is found
if ($refid == $ref) {
if ((($cacheArray['up_refid'][$cacheArray['back_level']] == $uid) || ($cacheArray['up_refid'][$cacheArray['back_level']] == 0)) && (GET_EXT_VERSION("cache") >= "0.1.2") && (!isset($cacheArray['back_cached']))) {
// Remove cache here
//* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):uid={$uid},ref={$cacheArray['up_refid'][$cacheArray['back_level']]} - CACHE!<br />\n";
- if ($cacheInstance->cache_file("refback", true)) $cacheInstance->cache_destroy();
+ if ($cacheInstance->loadCacheFile("refback")) $cacheInstance->destroyCacheFile();
$cacheArray['back_cached'] = 1;
} // END - if