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, 2010 by Mailer Developer Team *
20 * For more information visit: http://www.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 addMenuDescription('guest', __FILE__);
46 if ((!isExtensionActive('top10')) && (!isAdmin())) {
47 loadTemplate('admin_settings_saved', false, generateExtensionInactiveNotInstalledMessage('top10'));
55 $result = SQL_QUERY("SELECT
56 `userid`, `total_logins`, `last_online`
58 `{?_MYSQL_PREFIX?}_user_data`
60 `total_logins` > 0 AND
64 LIMIT {?top10_max?}", __FILE__, __LINE__);
66 $OUT = ''; $count = 1;
67 while ($content = SQL_FETCHARRAY($result)) {
69 $content['nickname'] = '';
72 if (isExtensionActive('nickname')) $content['nickname'] = getNickname($content['userid']);
74 // Prepare data for template
77 'userid' => $content['userid'],
78 'nickname' => $content['nickname'],
79 'total_logins' => $content['total_logins'],
80 'points' => getTotalPoints($content['userid']),
81 'last_online' => generateDateTime($content['last_online'], 3),
85 $OUT .= loadTemplate('guest_top10_row_login', true, $content);
91 if ($count < getConfig('top10_max')) {
92 // Add more "blank" rows
93 for ($i = $count; $i <= getConfig('top10_max'); $i++) {
94 // Prepare data for template
100 $OUT .= loadTemplate('guest_top10_empty5', true, $content);
104 // Remember the rows in array
105 $rows['logins_out'] = $OUT;
108 SQL_FREERESULT($result);
111 $result = SQL_QUERY("SELECT
113 (SUM(p.points) - d.used_points) AS points,
116 `{?_MYSQL_PREFIX?}_user_data` AS d
118 {?_MYSQL_PREFIX?}_user_points AS p
123 d.`status`='CONFIRMED'
129 LIMIT {?top10_max?}", __FILE__, __LINE__);
131 $OUT = ''; $count = 1;
132 while ($content = SQL_FETCHARRAY($result)) {
134 $content['nickname'] = '';
137 if (isExtensionActive('nickname')) $content['nickname'] = getNickname($content['userid']);
139 // Prepare data for template
142 'userid' => $content['userid'],
143 'nickname' => $content['nickname'],
144 'points' => $content['points'],
145 'last_online' => generateDateTime($content['last_online'], 3)
149 $OUT .= loadTemplate('guest_top10_row_earner', true, $content);
155 if ($count < getConfig('top10_max')) {
156 // Add more "blank" rows
157 for ($i = $count; $i <= getConfig('top10_max'); $i++) {
158 // Prepare data for template
164 $OUT .= loadTemplate('guest_top10_empty4', true, $content);
168 // Remember the rows in array
169 $rows['points_out'] = $OUT;
172 SQL_FREERESULT($result);
174 //// TOP referal "hunter"
175 $result = SQL_QUERY("SELECT
177 SUM(r.counter) AS refs,
180 `{?_MYSQL_PREFIX?}_user_data` AS d
182 {?_MYSQL_PREFIX?}_refsystem AS r
187 d.`status`='CONFIRMED'
193 LIMIT {?top10_max?}", __FILE__, __LINE__);
195 $OUT = ''; $count = 1;
196 while ($content = SQL_FETCHARRAY($result)) {
198 $content['nickname'] = '';
201 if (isExtensionActive('nickname')) $content['nickname'] = getNickname($content['userid']);
203 // Prepare data for template
206 'userid' => $content['userid'],
207 'refs' => $content['refs'],
208 'nickname' => $content['nickname'],
209 'points' => getTotalPoints($content['userid']),
210 'last_online' => generateDateTime($content['last_online'], 3)
214 $OUT .= loadTemplate('guest_top10_row_refs', true, $content);
220 if ($count < getConfig('top10_max')) {
221 // Add more "blank" rows
222 for ($i = $count; $i <= getConfig('top10_max'); $i++) {
223 // Prepare data for template
229 $OUT .= loadTemplate('guest_top10_empty5', true, $content);
233 // Remember the rows in array
234 $rows['referals_out'] = $OUT;
237 SQL_FREERESULT($result);
239 // Load final template
240 loadTemplate('guest_top10', false, $rows);