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 * -------------------------------------------------------------------- *
15 * $Tag:: 0.2.1-FINAL $ *
17 * -------------------------------------------------------------------- *
18 * Copyright (c) 2003 - 2009 by Roland Haeder *
19 * Copyright (c) 2009 - 2012 by Mailer Developer Team *
20 * For more information visit: http://mxchange.org *
22 * This program is free software; you can redistribute it and/or modify *
23 * it under the terms of the GNU General Public License as published by *
24 * the Free Software Foundation; either version 2 of the License, or *
25 * (at your option) any later version. *
27 * This program is distributed in the hope that it will be useful, *
28 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
29 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
30 * GNU General Public License for more details. *
32 * You should have received a copy of the GNU General Public License *
33 * along with this program; if not, write to the Free Software *
34 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, *
36 ************************************************************************/
38 // Some security stuff...
39 if (!defined('__SECURITY')) {
43 // Add description as navigation point
44 addYouAreHereLink('guest', __FILE__);
46 if ((!isExtensionActive('top10')) && (!isAdmin())) {
47 displayMessage('{%pipe,generateExtensionInactiveNotInstalledMessage=top10%}');
55 $result = SQL_QUERY("SELECT
59 `{?_MYSQL_PREFIX?}_user_data`
61 `total_logins` > 0 AND
63 " . runFilterChain('user_exclusion_sql', ' ') . "
66 LIMIT {?top10_max?}", __FILE__, __LINE__);
68 $OUT = ''; $count = 1;
69 while ($content = SQL_FETCHARRAY($result)) {
70 // Prepare data for template
73 'userid' => $content['userid'],
74 'last_online' => generateDateTime($content['last_online'], '3'),
78 $OUT .= loadTemplate('guest_top10_row_login', TRUE, $content);
84 if ($count < getConfig('top10_max')) {
85 // Add more "blank" rows
86 for ($i = $count; $i <= getConfig('top10_max'); $i++) {
87 // Prepare data for template
93 $OUT .= loadTemplate('guest_top10_empty5', TRUE, $content);
97 // Remember the rows in array
98 $rows['logins_out'] = $OUT;
101 SQL_FREERESULT($result);
104 $result = SQL_QUERY("SELECT
106 (SUM(p.points) - d.used_points) AS `points`,
109 `{?_MYSQL_PREFIX?}_user_data` AS d
111 {?_MYSQL_PREFIX?}_user_points AS p
116 d.`status`='CONFIRMED'
117 " . runFilterChain('user_exclusion_sql', ' ') . "
123 LIMIT {?top10_max?}", __FILE__, __LINE__);
125 $OUT = ''; $count = 1;
126 while ($content = SQL_FETCHARRAY($result)) {
127 // Prepare data for template
128 $content['count'] = $count;
129 $content['last_online'] = generateDateTime($content['last_online'], '3');
132 $OUT .= loadTemplate('guest_top10_row_earner', TRUE, $content);
138 if ($count < getConfig('top10_max')) {
139 // Add more "blank" rows
140 for ($i = $count; $i <= getConfig('top10_max'); $i++) {
141 // Prepare data for template
147 $OUT .= loadTemplate('guest_top10_empty4', TRUE, $content);
151 // Remember the rows in array
152 $rows['points_out'] = $OUT;
155 SQL_FREERESULT($result);
157 // TOP referral "hunter"
158 $result = SQL_QUERY("SELECT
160 SUM(r.counter) AS refs,
163 `{?_MYSQL_PREFIX?}_user_data` AS d
165 {?_MYSQL_PREFIX?}_refsystem AS r
170 d.`status`='CONFIRMED'
171 " . runFilterChain('user_exclusion_sql', ' ') . "
177 LIMIT {?top10_max?}", __FILE__, __LINE__);
179 $OUT = ''; $count = 1;
180 while ($content = SQL_FETCHARRAY($result)) {
181 // Prepare data for template
184 'userid' => $content['userid'],
185 'refs' => $content['refs'],
186 'last_online' => generateDateTime($content['last_online'], '3')
190 $OUT .= loadTemplate('guest_top10_row_refs', TRUE, $content);
196 if ($count < getConfig('top10_max')) {
197 // Add more "blank" rows
198 for ($i = $count; $i <= getConfig('top10_max'); $i++) {
199 // Prepare data for template
205 $OUT .= loadTemplate('guest_top10_empty5', TRUE, $content);
209 // Remember the rows in array
210 $rows['referrals_out'] = $OUT;
213 SQL_FREERESULT($result);
215 // Load final template
216 loadTemplate('guest_top10', FALSE, $rows);