Fixes for ref level in refback
authorRoland Häder <roland@mxchange.org>
Sun, 28 Sep 2008 01:35:19 +0000 (01:35 +0000)
committerRoland Häder <roland@mxchange.org>
Sun, 28 Sep 2008 01:35:19 +0000 (01:35 +0000)
inc/databases.php
inc/mysql-manager.php

index 38743f11d9b13ac23dfbcb0575f500e19dc57e02..97529671745fe24c15a19d981a65811c20dafe81 100644 (file)
@@ -113,7 +113,7 @@ define('USAGE_BASE', "usage");
 define('SERVER_URL', "http://www.mxchange.org");
 
 // This current patch level
-define('CURR_SVN_REVISION', "410");
+define('CURR_SVN_REVISION', "411");
 
 // Take a prime number which is long (if you know a longer one please try it out!)
 define('_PRIME', 591623);
index 13023de6f474a755580431277c8d434c19ba6e56..84d2a4ddbfee90768fd295b2aebe63f4ff7cd29f 100644 (file)
@@ -1268,6 +1268,9 @@ function ADD_POINTS_REFSYSTEM($uid, $points, $send_notify=false, $rid="0", $lock
 function ADD_REFBACK_POINTS ($uid, $ref, $points) {
        global $DEPTH, $cacheArray;
 
+       // Backup and reset ref depth
+       $cacheArray['depth'][$uid][$ref] = $DEPTH; $DEPTH = -1;
+
        // Init points
        $return = $points;
 
@@ -1287,11 +1290,8 @@ function ADD_REFBACK_POINTS ($uid, $ref, $points) {
                        $refback = $points * $percents / 100;
        
                        // Add points again, but only directly
-                       //* DEBUG: */ echo __FUNCTION__.":refback={$refback},depth={$DEPTH}<br />\n";
-                       $cacheArray['depth'][$uid][$ref] = $DEPTH; $DEPTH = -1;
+                       //* DEBUG: */ echo __FUNCTION__.":refback={$refback}<br />\n";
                        ADD_POINTS_REFSYSTEM($uid, $refback, false, "0", false, "direct");
-                       $DEPTH = $cacheArray['depth'][$uid][$ref];
-                       //* DEBUG: */ echo __FUNCTION__.":depth={$DEPTH} - RESTORE!<br />\n";
 
                        // Reduce points if refid is found
                        if ($refid == $ref) {
@@ -1302,6 +1302,9 @@ function ADD_REFBACK_POINTS ($uid, $ref, $points) {
                } // END - if
        } // END foreach
 
+       // Restore ref depth
+       $DEPTH = $cacheArray['depth'][$uid][$ref];
+
        // Return them
        return $return;
 }