]> git.mxchange.org Git - mailer.git/blobdiff - inc/libs/rallye_functions.php
Extension 'yoomedia' now alpha status, some rewrites
[mailer.git] / inc / libs / rallye_functions.php
index 37c25d174f818987b3e1fd42f07e8142945fe27d..7335584f74508405d4306d263de3e3db7fb24a14 100644 (file)
@@ -388,9 +388,9 @@ LIMIT 1", array(bigintval($uid)), __FILE__, __LINE__);
                }
        }
 
-       if (($TOTAL < $min_prices) || ($TOTAL == 0))
-       {
+       if (($TOTAL < $min_prices) || ($TOTAL == 0)) {
                // Do not end this rallye!
+               unset($DATA);
                return;
        }
 
@@ -459,6 +459,7 @@ LIMIT 1", array(bigintval($uid)), __FILE__, __LINE__);
        }
 
        // Send mail to admin
+       die("OK!");
        SEND_ADMIN_NOTIFICATION(RALLYE_ADMIN_EXPIRED.": ".$title, $templ, $cnt, 0);
 
        // Add task
@@ -650,6 +651,7 @@ function RALLYE_LIST_WINNERS($rallye,$default=0)
 function RALLYE_DELETE_EXPIRED_RALLYES()
 {
        global $DATA, $_CONFIG;
+
        // Check for expired rallyes
        $EXPIRE = $_CONFIG['one_day'] * 3; // @TODO The hard-coded value...
        $result_rallye = SQL_QUERY_ESC("SELECT id, title, start_time, end_time
@@ -745,14 +747,24 @@ function RALLYE_GET_REFCOUNT($uid, $old=0) {
                foreach ($cacheArray['ref_system']['userid'] as $id => $u_id) {
                        // Do we have a ref for this user?
                        //* DEBUG: */ echo "id={$id},u_id={$u_id},uid={$uid},old={$old},level={$cacheArray['ref_system']['level'][$id]}<br />\n";
-                       if (($u_id == $uid) && (($cacheArray['ref_system']['level'][$id] == 1 && GET_EXT_VERSION("refback") != "") || ($cacheArray['ref_system']['level'][$id] == 0 && GET_EXT_VERSION("refback") == ""))) {
+                       if (($u_id == $uid) && ($cacheArray['ref_system']['level'][$id] == 1)) {
                                //* DEBUG: */ echo "uid matches!<br />\n";
-                               // Entry found!
-                               $cnt = $cacheArray['ref_system']['counter'][$id];
-                               break;
-                       } // END - if
-               } // END - foreach
+                               foreach ($cacheArray['ref_depths']['level'] as $level) {
+                                       if (($level == $cacheArray['ref_system']['level'][$id]) && ($level == 1)) {
+                                               // Level does exist so abort here
+                                               $cnt = $cacheArray['ref_system']['counter'][$id];
+                                               //* DEBUG: */ echo "*".$uid."/".$cnt."*<br />";
+                                               break;
+                                       } elseif ($level > 1) {
+                                               // Not interesting here...
+                                               break;
+                                       }
+                               }
 
+                               // Abort also here!
+                               if ($cnt > 0) break;
+                       }
+               }
                //* DEBUG: */ echo "<PRE>";
                //* DEBUG: */ print_r($cacheArray['ref_system']);
                //* DEBUG: */ echo "</PRE>";
@@ -760,12 +772,12 @@ function RALLYE_GET_REFCOUNT($uid, $old=0) {
 
                if ($cnt > 0) {
                        // Count cache hits
-                       $_CONFIG['cache_hits']++;
+                       if (isset($_CONFIG['cache_hits'])) { $_CONFIG['cache_hits']++; } else { $_CONFIG['cache_hits'] = 1; }
 
                        // Remove old refs
                        //* DEBUG: */ echo "+".$cnt."/".$old."+<br />";
                        $cnt -= $old;
-               } // END - if
+               }
        } else {
                // Load current refs from database
                $result_ref = SQL_QUERY_ESC("SELECT DISTINCT SUM(s.counter) AS cnt