]> git.mxchange.org Git - mailer.git/blobdiff - inc/referral-functions.php
getArrayFromDirectory() does now exclude files with size below 50 Bytes which always...
[mailer.git] / inc / referral-functions.php
index 9d5146c85c5b032bac989559c42f535237a26f70..39302c95b4a3b9cf72a4f23edd5103267a18f894 100644 (file)
@@ -576,18 +576,21 @@ function addMissingReferralLevels ($userid) {
        } // END - if
        //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'userid=' . $userid . ',count()=' . count($GLOBALS['referral_refid'][$userid]));
 
+       // Sort the array reversed
+       krsort($GLOBALS['referral_refid']);
+
        // Now walk through the array, first levels
        foreach ($GLOBALS['referral_refid'][$userid] as $level => $levelArray) {
                //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'userid=' . $userid . ',level=' . $level . ',count()=' . count($levelArray));
                // Next are the users
                foreach ($levelArray as $refid) {
                        //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'userid=' . $userid . ',level=' . $level . ',refid=' . $refid);
-                       // Add also this user's (maybe) missing levels
-                       addMissingReferralLevels($refid);
-
                        // Does the refid have an array?
                        if (isset($GLOBALS['referral_refid'][$refid])) {
                                //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'userid=' . $userid . ',level=' . $level . ',refid=' . convertNullToZero($refid) . ',count()=' . count($GLOBALS['referral_refid'][$refid]));
+                               // Add also this user's (maybe) missing levels
+                               addMissingReferralLevels($refid);
+
                                // Okay, then walk through here, too
                                foreach ($GLOBALS['referral_refid'][$refid] as $refLevel => $refArray) {
                                        //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'userid=' . $userid . ',level=' . $level . ',refid=' . convertNullToZero($refid) . ',refLevel=' . $refLevel . ',count()=' . count($refArray));