2 /************************************************************************
3 * Mailer v0.2.1-FINAL Start: 10/19/2003 *
4 * =================== Last change: 11/19/2005 *
6 * -------------------------------------------------------------------- *
7 * File : what-bonus.php *
8 * -------------------------------------------------------------------- *
9 * Short description : Bonus pages for some extra points *
10 * -------------------------------------------------------------------- *
11 * Kurzbeschreibung : Bonusseiten fuer ein paar Extrapunkte *
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')) {
42 } elseif (!isMember()) {
43 redirectToIndexMemberOnlyModule();
46 // Add description as navigation point
47 addMenuDescription('member', __FILE__);
49 if ((!isExtensionActive('bonus')) && (!isAdmin())) {
50 loadTemplate('admin_settings_saved', false, generateExtensionInactiveNotInstalledMessage('bonus'));
54 if (getExtensionVersion('bonus') >= '0.6.9') {
55 // Add more bonus points here
56 // @TODO Rewrite this to a filter
58 if (getConfig('bonus_click_yn') == 'Y') $USE .= ' + `turbo_bonus`';
59 if (getConfig('bonus_login_yn') == 'Y') $USE .= ' + `login_bonus`';
60 if (getConfig('bonus_order_yn') == 'Y') $USE .= ' + `bonus_order`';
61 if (getConfig('bonus_stats_yn') == 'Y') $USE .= ' + `bonus_stats`';
62 if (getConfig('bonus_ref_yn') == 'Y') $USE .= ' + `bonus_ref`';
66 $USE = '`turbo_bonus`';
69 // Autopurge installed?
70 $lastOnline = "%s"; $ONLINE = '';
71 if (isExtensionActive('autopurge')) {
72 // Use last online timestamp to keep inactive members away from here
73 $lastOnline = " AND `last_online` >= (UNIX_TIMESTAMP() - %s)";
74 $ONLINE = getConfig('ap_inactive_since');
77 // Let's check if there are some points left we can 'pay'...
78 $result = SQL_QUERY_ESC("SELECT
79 `userid`, ".$USE." AS points, `last_online`
81 `{?_MYSQL_PREFIX?}_user_data`
83 ".$USE." > 0 AND `status`='CONFIRMED'".$lastOnline."
91 getConfig('bonus_ranks')
92 ), __FILE__, __LINE__);
94 // Reset temporary variable and check for users
96 if (SQL_NUMROWS($result) > 0) {
97 // Load our winners...
99 while ($content = SQL_FETCHARRAY($result)) {
100 // Prepare data for the template
104 'userid' => bigintval($content['userid']),
105 'points' => translateComma($content['points']),
106 'last_online' => generateDateTime($content['last_online'], 2)
110 $OUT .= loadTemplate('member_bonus_row', true, $content);
112 // Count one up and switch colors
113 $cnt++; $SW = 3 - $SW;
116 // No one is interested in our "active rallye" ! :-(
117 $OUT = loadTemplate('member_bonus_404', true);
121 SQL_FREERESULT($result);
123 // Prepare content array
124 $content['rows'] = $OUT;
126 // Load final template
127 loadTemplate('member_bonus', false, $content);