+// "Getter" for total rallye winners
+function getTotalRallyeWinners ($rallyeId) {
+ // Is cache set?
+ if (!isset($GLOBALS[__FUNCTION__][$rallyeId])) {
+ // Default total is zero
+ $GLOBALS[__FUNCTION__][$rallyeId] = '0';
+
+ // Get prices
+ $prices = getArrayFromReferralRallyeUsers($rallyeId);
+
+ // "Walk" through all entries
+ foreach ($prices['userid'] as $key => $userid) {
+ // Check for userid
+ $active = countSumTotalData($userid, 'user_data', 'userid', 'userid', TRUE, runFilterChain('user_exclusion_sql', " AND `status`='CONFIRMED'"));
+
+ // Allow valid and active users with at least one ref
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'rallyeId=' . $rallyeId . ',userid=' . $userid . ',ref=' . $prices['ref'][$key] . ',cpoints=' . $prices['cpoints'][$key]);
+ if ((isValidUserId($userid)) && ($prices['ref'][$key] > 0) && ($active == 1) && ($prices['cpoints'][$key] > 0)) {
+ $GLOBALS[__FUNCTION__][$rallyeId]++;
+ } // END - if
+ } // END - foreach
+ } // END - if