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
56 `userid`,`last_online`
58 `{?_MYSQL_PREFIX?}_user_data`
60 `total_logins` > 0 AND
62 " . runFilterChain('user_exclusion_sql', ' ') . "
65 LIMIT {?top10_max?}", __FILE__, __LINE__);
67 $OUT = ''; $count = 1;
68 while ($content = SQL_FETCHARRAY($result)) {
69 // Prepare data for template
72 'userid' => $content['userid'],
73 'last_online' => generateDateTime($content['last_online'], '3'),
77 $OUT .= loadTemplate('guest_top10_row_login', true, $content);
83 if ($count < getConfig('top10_max')) {
84 // Add more "blank" rows
85 for ($i = $count; $i <= getConfig('top10_max'); $i++) {
86 // Prepare data for template
92 $OUT .= loadTemplate('guest_top10_empty5', true, $content);
96 // Remember the rows in array
97 $rows['logins_out'] = $OUT;
100 SQL_FREERESULT($result);
103 $result = SQL_QUERY("SELECT
105 (SUM(p.points) - d.used_points) AS `points`,
108 `{?_MYSQL_PREFIX?}_user_data` AS d
110 {?_MYSQL_PREFIX?}_user_points AS p
115 d.`status`='CONFIRMED'
116 " . runFilterChain('user_exclusion_sql', ' ') . "
122 LIMIT {?top10_max?}", __FILE__, __LINE__);
124 $OUT = ''; $count = 1;
125 while ($content = SQL_FETCHARRAY($result)) {
126 // Prepare data for template
127 $content['count'] = $count;
128 $content['last_online'] = generateDateTime($content['last_online'], '3');
131 $OUT .= loadTemplate('guest_top10_row_earner', true, $content);
137 if ($count < getConfig('top10_max')) {
138 // Add more "blank" rows
139 for ($i = $count; $i <= getConfig('top10_max'); $i++) {
140 // Prepare data for template
146 $OUT .= loadTemplate('guest_top10_empty4', true, $content);
150 // Remember the rows in array
151 $rows['points_out'] = $OUT;
154 SQL_FREERESULT($result);
156 // TOP referral "hunter"
157 $result = SQL_QUERY("SELECT
159 SUM(r.counter) AS refs,
162 `{?_MYSQL_PREFIX?}_user_data` AS d
164 {?_MYSQL_PREFIX?}_refsystem AS r
169 d.`status`='CONFIRMED'
170 " . runFilterChain('user_exclusion_sql', ' ') . "
176 LIMIT {?top10_max?}", __FILE__, __LINE__);
178 $OUT = ''; $count = 1;
179 while ($content = SQL_FETCHARRAY($result)) {
180 // Prepare data for template
183 'userid' => $content['userid'],
184 'refs' => $content['refs'],
185 'last_online' => generateDateTime($content['last_online'], '3')
189 $OUT .= loadTemplate('guest_top10_row_refs', true, $content);
195 if ($count < getConfig('top10_max')) {
196 // Add more "blank" rows
197 for ($i = $count; $i <= getConfig('top10_max'); $i++) {
198 // Prepare data for template
204 $OUT .= loadTemplate('guest_top10_empty5', true, $content);
208 // Remember the rows in array
209 $rows['referrals_out'] = $OUT;
212 SQL_FREERESULT($result);
214 // Load final template
215 loadTemplate('guest_top10', false, $rows);