]> git.mxchange.org Git - mailer.git/blobdiff - inc/modules/guest/what-top10.php
Filters for configurable userid exclusion added:
[mailer.git] / inc / modules / guest / what-top10.php
index db8fb817a31ae95e9667179898bd1ee2e9e56119..1c6231871ff7203ceffde1c723e044843ce77b7d 100644 (file)
@@ -81,9 +81,9 @@ while ($content = SQL_FETCHARRAY($result)) {
        $count++;
 } // END - while
 
-if ($count < getConfig('top10_max')) {
+if ($count < getTop10Max()) {
        // Add more "blank" rows
-       for ($i = $count; $i <= getConfig('top10_max'); $i++) {
+       for ($i = $count; $i <= getTop10Max(); $i++) {
                // Prepare data for template
                $content = array(
                        'index' => $i
@@ -102,24 +102,24 @@ SQL_FREERESULT($result);
 
 // TOP earners
 $result = SQL_QUERY("SELECT
-       d.userid,
-       (SUM(p.points) - d.used_points) AS `points`,
-       d.last_online
+       `d`.`userid`,
+       SUM(`p`.`points` + `p`.`locked_points`) AS `points`,
+       `d`.`last_online`
 FROM
-       `{?_MYSQL_PREFIX?}_user_data` AS d
+       `{?_MYSQL_PREFIX?}_user_data` AS `d`
 LEFT JOIN
-       {?_MYSQL_PREFIX?}_user_points AS p
+       {?_MYSQL_PREFIX?}_user_points AS `p`
 ON
-       p.userid=d.userid
+       `p`.`userid`=`d`.`userid`
 WHERE
-       p.points > 0 AND
-       d.`status`='CONFIRMED'
+       `p`.`points` > 0 AND
+       `d`.`status`='CONFIRMED'
        " . runFilterChain('user_exclusion_sql', ' ') . "
 GROUP BY
-       p.userid
+       `p`.`userid`
 ORDER BY
-       points DESC,
-       d.last_online DESC
+       `points` DESC,
+       `d`.`last_online` DESC
 LIMIT {?top10_max?}", __FILE__, __LINE__);
 
 $OUT = ''; $count = 1;
@@ -135,9 +135,9 @@ while ($content = SQL_FETCHARRAY($result)) {
        $count++;
 } // END - while
 
-if ($count < getConfig('top10_max')) {
+if ($count < getTop10Max()) {
        // Add more "blank" rows
-       for ($i = $count; $i <= getConfig('top10_max'); $i++) {
+       for ($i = $count; $i <= getTop10Max(); $i++) {
                // Prepare data for template
                $content = array(
                        'index' => $i
@@ -156,24 +156,24 @@ SQL_FREERESULT($result);
 
 // TOP referral "hunter"
 $result = SQL_QUERY("SELECT
-       d.userid,
-       SUM(r.counter) AS refs,
-       d.last_online
+       `d`.`userid`,
+       SUM(`r`.`counter`) AS `refs`,
+       `d`.`last_online`
 FROM
-       `{?_MYSQL_PREFIX?}_user_data` AS d
+       `{?_MYSQL_PREFIX?}_user_data` AS `d`
 LEFT JOIN
-       {?_MYSQL_PREFIX?}_refsystem AS r
+       {?_MYSQL_PREFIX?}_refsystem AS `r`
 ON
-       r.userid=d.userid
+       `r`.`userid`=`d`.`userid`
 WHERE
-       r.counter > 0 AND
-       d.`status`='CONFIRMED'
+       `r`.`counter` > 0 AND
+       `d`.`status`='CONFIRMED'
        " . runFilterChain('user_exclusion_sql', ' ') . "
 GROUP BY
-       r.userid
+       `r`.`userid`
 ORDER BY
-       refs DESC,
-       d.last_online DESC
+       `refs` DESC,
+       `d`.`last_online` DESC
 LIMIT {?top10_max?}", __FILE__, __LINE__);
 
 $OUT = ''; $count = 1;
@@ -193,9 +193,9 @@ while ($content = SQL_FETCHARRAY($result)) {
        $count++;
 } // END - while
 
-if ($count < getConfig('top10_max')) {
+if ($count < getTop10Max()) {
        // Add more "blank" rows
-       for ($i = $count; $i <= getConfig('top10_max'); $i++) {
+       for ($i = $count; $i <= getTop10Max(); $i++) {
                // Prepare data for template
                $content = array(
                        'index' => $i