foreach ($cacheArray['ref_system']['userid'] as $id => $u_id) {
// Do we have a ref for this user?
//* DEBUG: */ echo "id={$id},u_id={$u_id},uid={$uid},old={$old},level={$cacheArray['ref_system']['level'][$id]}<br />\n";
- if (($u_id == $uid) && ($cacheArray['ref_system']['level'][$id] == 1)) {
+ if (($u_id == $uid) && (($cacheArray['ref_system']['level'][$id] == 1 && EXT_IS_ACTIVE("refback")) || ($cacheArray['ref_system']['level'][$id] == 0 && GET_EXT_VERSION("refback") == ""))) {
//* DEBUG: */ echo "uid matches!<br />\n";
- foreach ($cacheArray['ref_depths']['level'] as $level) {
- if (($level == $cacheArray['ref_system']['level'][$id]) && ($level == 1)) {
- // Level does exist so abort here
- $cnt = $cacheArray['ref_system']['counter'][$id];
- //* DEBUG: */ echo "*".$uid."/".$cnt."*<br />";
- break;
- } elseif ($level > 1) {
- // Not interesting here...
- break;
- }
- }
+ // Entry found!
+ $cnt = $cacheArray['ref_system']['counter'][$id];
+ //* DEBUG: */ echo "*".$uid."/".$cnt."*<br />";
+ break;
+ } // END - if
+ } // END - foreach
- // Abort also here!
- if ($cnt > 0) break;
- }
- }
//* DEBUG: */ echo "<PRE>";
//* DEBUG: */ print_r($cacheArray['ref_system']);
//* DEBUG: */ echo "</PRE>";
// Remove old refs
//* DEBUG: */ echo "+".$cnt."/".$old."+<br />";
$cnt -= $old;
- }
+ } // END - if
} else {
// Load current refs from database
$result_ref = SQL_QUERY_ESC("SELECT DISTINCT SUM(s.counter) AS cnt