2 /************************************************************************
3 * Mailer v0.2.1-FINAL Start: 11/24/2004 *
4 * =================== Last change: 11/26/2004 *
6 * -------------------------------------------------------------------- *
7 * File : what-top10.php *
8 * -------------------------------------------------------------------- *
9 * Short description : TOP logins / best earner etc. *
10 * -------------------------------------------------------------------- *
11 * Kurzbeschreibung : TOP-Logins / Bestverdiener usw. *
12 * -------------------------------------------------------------------- *
13 * Copyright (c) 2003 - 2009 by Roland Haeder *
14 * Copyright (c) 2009 - 2013 by Mailer Developer Team *
15 * For more information visit: http://mxchange.org *
17 * This program is free software; you can redistribute it and/or modify *
18 * it under the terms of the GNU General Public License as published by *
19 * the Free Software Foundation; either version 2 of the License, or *
20 * (at your option) any later version. *
22 * This program is distributed in the hope that it will be useful, *
23 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
25 * GNU General Public License for more details. *
27 * You should have received a copy of the GNU General Public License *
28 * along with this program; if not, write to the Free Software *
29 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, *
31 ************************************************************************/
33 // Some security stuff...
34 if (!defined('__SECURITY')) {
38 // Add description as navigation point
39 addYouAreHereLink('guest', __FILE__);
41 if ((!isExtensionActive('top10')) && (!isAdmin())) {
42 displayMessage('{%pipe,generateExtensionInactiveNotInstalledMessage=top10%}');
50 $result = sqlQuery("SELECT
54 `{?_MYSQL_PREFIX?}_user_data`
56 `total_logins` > 0 AND
58 " . runFilterChain('user_exclusion_sql', ' ') . "
61 LIMIT {?top10_max?}", __FILE__, __LINE__);
63 $OUT = ''; $count = 1;
64 while ($content = sqlFetchArray($result)) {
65 // Prepare data for template
68 'userid' => $content['userid'],
69 'last_online' => generateDateTime($content['last_online'], '3'),
73 $OUT .= loadTemplate('guest_top10_row_login', TRUE, $content);
79 if ($count < getTop10Max()) {
80 // Add more "blank" rows
81 for ($i = $count; $i <= getTop10Max(); $i++) {
82 // Prepare data for template
88 $OUT .= loadTemplate('guest_top10_empty5', TRUE, $content);
92 // Remember the rows in array
93 $rows['logins_out'] = $OUT;
96 sqlFreeResult($result);
99 $result = sqlQuery("SELECT
101 SUM(`p`.`points` + `p`.`locked_points`) AS `points`,
104 `{?_MYSQL_PREFIX?}_user_data` AS `d`
106 {?_MYSQL_PREFIX?}_user_points AS `p`
108 `p`.`userid`=`d`.`userid`
111 `d`.`status`='CONFIRMED'
112 " . runFilterChain('user_exclusion_sql', ' ') . "
117 `d`.`last_online` DESC
118 LIMIT {?top10_max?}", __FILE__, __LINE__);
120 $OUT = ''; $count = 1;
121 while ($content = sqlFetchArray($result)) {
122 // Prepare data for template
123 $content['count'] = $count;
124 $content['last_online'] = generateDateTime($content['last_online'], '3');
127 $OUT .= loadTemplate('guest_top10_row_earner', TRUE, $content);
133 if ($count < getTop10Max()) {
134 // Add more "blank" rows
135 for ($i = $count; $i <= getTop10Max(); $i++) {
136 // Prepare data for template
142 $OUT .= loadTemplate('guest_top10_empty4', TRUE, $content);
146 // Remember the rows in array
147 $rows['points_out'] = $OUT;
150 sqlFreeResult($result);
152 // TOP referral "hunter"
153 $result = sqlQuery("SELECT
155 SUM(`r`.`counter`) AS `refs`,
158 `{?_MYSQL_PREFIX?}_user_data` AS `d`
160 {?_MYSQL_PREFIX?}_refsystem AS `r`
162 `r`.`userid`=`d`.`userid`
164 `r`.`counter` > 0 AND
165 `d`.`status`='CONFIRMED'
166 " . runFilterChain('user_exclusion_sql', ' ') . "
171 `d`.`last_online` DESC
172 LIMIT {?top10_max?}", __FILE__, __LINE__);
174 $OUT = ''; $count = 1;
175 while ($content = sqlFetchArray($result)) {
176 // Prepare data for template
179 'userid' => $content['userid'],
180 'refs' => $content['refs'],
181 'last_online' => generateDateTime($content['last_online'], '3')
185 $OUT .= loadTemplate('guest_top10_row_refs', TRUE, $content);
191 if ($count < getTop10Max()) {
192 // Add more "blank" rows
193 for ($i = $count; $i <= getTop10Max(); $i++) {
194 // Prepare data for template
200 $OUT .= loadTemplate('guest_top10_empty5', TRUE, $content);
204 // Remember the rows in array
205 $rows['referrals_out'] = $OUT;
208 sqlFreeResult($result);
210 // Load final template
211 loadTemplate('guest_top10', FALSE, $rows);