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 * For more information visit: http://www.mxchange.org *
23 * This program is free software; you can redistribute it and/or modify *
24 * it under the terms of the GNU General Public License as published by *
25 * the Free Software Foundation; either version 2 of the License, or *
26 * (at your option) any later version. *
28 * This program is distributed in the hope that it will be useful, *
29 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
30 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
31 * GNU General Public License for more details. *
33 * You should have received a copy of the GNU General Public License *
34 * along with this program; if not, write to the Free Software *
35 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, *
37 ************************************************************************/
39 // Some security stuff...
40 if (!defined('__SECURITY')) {
44 // Add description as navigation point
45 addMenuDescription('guest', __FILE__);
47 if ((!isExtensionActive('top10')) && (!isAdmin())) {
48 loadTemplate('admin_settings_saved', false, generateExtensionInactiveNotInstalledMessage('top10'));
56 $result = SQL_QUERY("SELECT
57 `userid`, `total_logins`, `last_online`
59 `{?_MYSQL_PREFIX?}_user_data`
61 `total_logins` > 0 AND
65 LIMIT {?top10_max?}", __FILE__, __LINE__);
67 $OUT = ''; $SW = 2; $cnt = 1;
68 while ($content = SQL_FETCHARRAY($result)) {
70 $content['nickname'] = '---';
73 if (isExtensionActive('nickname')) $content['nickname'] = getNickname($content['userid']);
75 // Prepare data for template
79 'userid' => $content['userid'],
80 'nickname' => $content['nickname'],
81 'total_logins' => $content['total_logins'],
82 'points' => translateComma(countSumTotalData($content['userid'], 'user_points', 'points')),
83 'last_online' => generateDateTime($content['last_online'], 3),
87 $OUT .= loadTemplate('guest_top10_row_login', true, $content);
89 // Switch colors and count one up
90 $SW = 3 - $SW; $cnt++;
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
103 $OUT .= loadTemplate('guest_top10_empty5', true, $content);
108 // Remember the rows in array
109 $rows['logins_out'] = $OUT;
112 SQL_FREERESULT($result);
115 $result = SQL_QUERY("SELECT
117 (SUM(p.points) - d.used_points) AS points,
120 `{?_MYSQL_PREFIX?}_user_data` AS d
122 {?_MYSQL_PREFIX?}_user_points AS p
127 d.`status`='CONFIRMED'
133 LIMIT {?top10_max?}", __FILE__, __LINE__);
135 $OUT = ''; $SW = 2; $cnt = 1;
136 while ($content = SQL_FETCHARRAY($result)) {
138 $content['nickname'] = '---';
141 if (isExtensionActive('nickname')) $content['nickname'] = getNickname($content['userid']);
143 // Prepare data for template
147 'userid' => $content['userid'],
148 'nickname' => $content['nickname'],
149 'points' => translateComma($content['points']),
150 'last_online' => generateDateTime($content['last_online'], 3)
154 $OUT .= loadTemplate('guest_top10_row_earner', true, $content);
156 // Switch colors and count one up
157 $SW = 3 - $SW; $cnt++;
160 if ($cnt < getConfig('top10_max')) {
161 // Add more "blank" rows
162 for ($i = $cnt; $i <= getConfig('top10_max'); $i++) {
163 // Prepare data for template
170 $OUT .= loadTemplate('guest_top10_empty4', true, $content);
175 // Remember the rows in array
176 $rows['points_out'] = $OUT;
179 SQL_FREERESULT($result);
181 //// TOP referal "hunter"
182 $result = SQL_QUERY("SELECT
184 SUM(r.counter) AS refs,
187 `{?_MYSQL_PREFIX?}_user_data` AS d
189 {?_MYSQL_PREFIX?}_refsystem AS r
194 d.`status`='CONFIRMED'
200 LIMIT {?top10_max?}", __FILE__, __LINE__);
202 $OUT = ''; $SW = 2; $cnt = 1;
203 while ($content = SQL_FETCHARRAY($result)) {
205 $content['nickname'] = '---';
208 if (isExtensionActive('nickname')) $content['nickname'] = getNickname($content['userid']);
210 // Prepare data for template
214 'userid' => $content['userid'],
215 'refs' => $content['refs'],
216 'nickname' => $content['nickname'],
217 'points' => translateComma(countSumTotalData($content['userid'], 'user_points', 'points')),
218 'last_online' => generateDateTime($content['last_online'], 3)
222 $OUT .= loadTemplate('guest_top10_row_refs', true, $content);
224 // Switch colors and count one up
225 $SW = 3 - $SW; $cnt++;
228 if ($cnt < getConfig('top10_max')) {
229 // Add more "blank" rows
230 for ($i = $cnt; $i <= getConfig('top10_max'); $i++) {
231 // Prepare data for template
238 $OUT .= loadTemplate('guest_top10_empty5', true, $content);
243 // Remember the rows in array
244 $rows['referals_out'] = $OUT;
247 SQL_FREERESULT($result);
249 // Load final template
250 loadTemplate('guest_top10', false, $rows);