]> git.mxchange.org Git - mailer.git/blobdiff - inc/libs/refback_functions.php
Templates rewritten/fixed, surfbar extended with per-entry reload lock
[mailer.git] / inc / libs / refback_functions.php
index fdb97da005f2e2eb292f07a1f8598b26ba8d15c8..e7a2b5987bf3b957f851c299611117299e4f089e 100644 (file)
@@ -54,9 +54,9 @@ function ADD_REFBACK_POINTS ($uid, $ref, $points, $ref_points) {
        // "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
@@ -69,7 +69,7 @@ function ADD_REFBACK_POINTS ($uid, $ref, $points, $ref_points) {
                        // 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!)
@@ -79,7 +79,7 @@ function ADD_REFBACK_POINTS ($uid, $ref, $points, $ref_points) {
 
                                // 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) {
@@ -123,7 +123,7 @@ function GET_REFBACK_PERCENTS ($uid, $ref) {
        } else {
                // Debug log
                //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>): NO ENTRY FOUND! :-(<br />\n";
-               DEBUG_LOG(__FUNCTION__.": uid={$uid},ref={$ref} - No entry found! :-(");
+               DEBUG_LOG(__FUNCTION__, __LINE__, " uid={$uid},ref={$ref} - No entry found! :-(");
        }
 
        // Free result
@@ -267,7 +267,7 @@ function GET_USER_REFS ($uid, $level) {
        $ADD = "";
        $refs = array();
 
-       // Do we have nickname installed?
+       // Do we have nickname extension installed?
        if (EXT_IS_ACTIVE("nickname")) {
                $ADD = ", d.nickname";
        } // END - if
@@ -334,7 +334,7 @@ function REFBACK_CHANGE_MEMBER_PERCENTS ($id, $percents) {
                // No member!
                $status['message'] = MEMBER_REFBACK_ERROR_NO_MEMBER;
                return $status;
-       } elseif ("".$id."" != "".bigintval($id)."") {
+       } elseif ("".$id."" != "".($id + 0)."") {
                // No number!
                $status['message'] = MEMBER_REFBACK_ERROR_INVALID_ID_NUMBER;
                return $status;