]> git.mxchange.org Git - mailer.git/blobdiff - inc/libs/refback_functions.php
Fixes for extension removal, now directly sent to [UN]REGISTER_FILTER()
[mailer.git] / inc / libs / refback_functions.php
index c93d950d660d7d16f2cec57a1356bb4aca39bdcd..85722cdad7cc8fbc1946ce543e46154ea480a357 100644 (file)
@@ -54,7 +54,7 @@ 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
                //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):uid={$uid},ref={$ref},level={$level},points={$points}<br />\n";
@@ -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) {
@@ -179,7 +179,7 @@ function UPDATE_REFBACK_TABLE($uid) {
        $old = 0; $minus = 0;
 
        // Check for his referal
-       $result_refid = SQL_QUERY_ESC("SELECT userid FROM "._MYSQL_PREFIX."_user_data WHERE refid=%s ORDER BY userid ASC",
+       $result_refid = SQL_QUERY_ESC("SELECT userid FROM `"._MYSQL_PREFIX."_user_data` WHERE refid=%s ORDER BY userid ASC",
                array(bigintval($uid)), __FILE__, __LINE__);
 
        // When no entry was updated then we have to create it here
@@ -192,7 +192,7 @@ function UPDATE_REFBACK_TABLE($uid) {
 
                        //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):uid={$uid},ref={$cacheArray['up_refid'][$cacheArray['back_level']]}<br />\n";
                        // Refid set?
-                       if (($cacheArray['up_refid'][$cacheArray['back_level']] > 0) && ($cacheArray['up_refid'][$cacheArray['back_level']] != $uid) && (!empty($cacheArray['up_refid'][$cacheArray['back_level']]))) {
+                       if (($cacheArray['up_refid'][$cacheArray['back_level']] > 0) && ($cacheArray['up_refid'][$cacheArray['back_level']] != $uid) && (isset($cacheArray['up_refid'][$cacheArray['back_level']]))) {
                                // New userid?
                                if ((isset($cacheArray['up_refid'][$cacheArray['back_level']-1])) && (isset($cacheArray['up_userid'][$cacheArray['up_refid'][$cacheArray['back_level']-1]]))) {
                                        // New userid!
@@ -247,7 +247,7 @@ function UPDATE_REFBACK_TABLE($uid) {
        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
 
@@ -275,7 +275,7 @@ function GET_USER_REFS ($uid, $level) {
        // Get refs from database
        $result = SQL_QUERY_ESC("SELECT r.id, r.refid, r.refback, r.points, d.status".$ADD."
 FROM "._MYSQL_PREFIX."_user_refs AS r
-LEFT JOIN "._MYSQL_PREFIX."_user_data AS d
+LEFT JOIN `"._MYSQL_PREFIX."_user_data` AS d
 ON r.refid=d.userid
 WHERE r.userid=%s AND r.level=%s
 ORDER BY r.refid ASC",