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 * Needs to be in all Files and every File needs "svn propset *
18 * svn:keywords Date Revision" (autoprobset!) at least!!!!!! *
19 * -------------------------------------------------------------------- *
20 * Copyright (c) 2003 - 2009 by Roland Haeder *
21 * Copyright (c) 2009, 2010 by Mailer Developer Team *
22 * For more information visit: http://www.mxchange.org *
24 * This program is free software; you can redistribute it and/or modify *
25 * it under the terms of the GNU General Public License as published by *
26 * the Free Software Foundation; either version 2 of the License, or *
27 * (at your option) any later version. *
29 * This program is distributed in the hope that it will be useful, *
30 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
31 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
32 * GNU General Public License for more details. *
34 * You should have received a copy of the GNU General Public License *
35 * along with this program; if not, write to the Free Software *
36 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, *
38 ************************************************************************/
40 // Some security stuff...
41 if (!defined('__SECURITY')) {
45 // Add description as navigation point
46 addMenuDescription('guest', __FILE__);
48 if ((!isExtensionActive('top10')) && (!isAdmin())) {
49 loadTemplate('admin_settings_saved', false, generateExtensionInactiveNotInstalledMessage('top10'));
57 $result = SQL_QUERY("SELECT
58 `userid`, `total_logins`, `last_online`
60 `{?_MYSQL_PREFIX?}_user_data`
62 `total_logins` > 0 AND
66 LIMIT {?top10_max?}", __FILE__, __LINE__);
69 while ($content = SQL_FETCHARRAY($result)) {
71 $content['nickname'] = '';
74 if (isExtensionActive('nickname')) $content['nickname'] = getNickname($content['userid']);
76 // Prepare data for template
79 'userid' => $content['userid'],
80 'nickname' => $content['nickname'],
81 'total_logins' => $content['total_logins'],
82 'points' => (countSumTotalData($content['userid'], 'user_points', 'points')),
83 'last_online' => generateDateTime($content['last_online'], 3),
87 $OUT .= loadTemplate('guest_top10_row_login', true, $content);
93 if ($cnt < getConfig('top10_max')) {
94 // Add more "blank" rows
95 for ($i = $cnt; $i <= getConfig('top10_max'); $i++) {
96 // Prepare data for template
102 $OUT .= loadTemplate('guest_top10_empty5', true, $content);
106 // Remember the rows in array
107 $rows['logins_out'] = $OUT;
110 SQL_FREERESULT($result);
113 $result = SQL_QUERY("SELECT
115 (SUM(p.points) - d.used_points) AS points,
118 `{?_MYSQL_PREFIX?}_user_data` AS d
120 {?_MYSQL_PREFIX?}_user_points AS p
125 d.`status`='CONFIRMED'
131 LIMIT {?top10_max?}", __FILE__, __LINE__);
134 while ($content = SQL_FETCHARRAY($result)) {
136 $content['nickname'] = '';
139 if (isExtensionActive('nickname')) $content['nickname'] = getNickname($content['userid']);
141 // Prepare data for template
144 'userid' => $content['userid'],
145 'nickname' => $content['nickname'],
146 'points' => $content['points'],
147 'last_online' => generateDateTime($content['last_online'], 3)
151 $OUT .= loadTemplate('guest_top10_row_earner', true, $content);
157 if ($cnt < getConfig('top10_max')) {
158 // Add more "blank" rows
159 for ($i = $cnt; $i <= getConfig('top10_max'); $i++) {
160 // Prepare data for template
166 $OUT .= loadTemplate('guest_top10_empty4', true, $content);
170 // Remember the rows in array
171 $rows['points_out'] = $OUT;
174 SQL_FREERESULT($result);
176 //// TOP referal "hunter"
177 $result = SQL_QUERY("SELECT
179 SUM(r.counter) AS refs,
182 `{?_MYSQL_PREFIX?}_user_data` AS d
184 {?_MYSQL_PREFIX?}_refsystem AS r
189 d.`status`='CONFIRMED'
195 LIMIT {?top10_max?}", __FILE__, __LINE__);
198 while ($content = SQL_FETCHARRAY($result)) {
200 $content['nickname'] = '';
203 if (isExtensionActive('nickname')) $content['nickname'] = getNickname($content['userid']);
205 // Prepare data for template
208 'userid' => $content['userid'],
209 'refs' => $content['refs'],
210 'nickname' => $content['nickname'],
211 'points' => (countSumTotalData($content['userid'], 'user_points', 'points')),
212 'last_online' => generateDateTime($content['last_online'], 3)
216 $OUT .= loadTemplate('guest_top10_row_refs', true, $content);
222 if ($cnt < getConfig('top10_max')) {
223 // Add more "blank" rows
224 for ($i = $cnt; $i <= getConfig('top10_max'); $i++) {
225 // Prepare data for template
231 $OUT .= loadTemplate('guest_top10_empty5', true, $content);
235 // Remember the rows in array
236 $rows['referals_out'] = $OUT;
239 SQL_FREERESULT($result);
241 // Load final template
242 loadTemplate('guest_top10', false, $rows);