2 /************************************************************************
3 * Mailer v0.2.1-FINAL Start: 10/22/2005 *
4 * =================== Last change: 10/22/2005 *
6 * -------------------------------------------------------------------- *
7 * File : what-list_beg.php *
8 * -------------------------------------------------------------------- *
9 * Short description : List members in begging-rallye *
10 * -------------------------------------------------------------------- *
11 * Kurzbeschreibung : Mitglieder in Bettel-Rallye auflisten *
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')) || (!isAdmin())) {
45 // Add description as navigation point
46 addMenuDescription('admin', __FILE__);
48 if (isBegRallyeEnabled()) {
49 // Shall I withdraw now?
50 if (isPostRequestParameterSet('withdraw')) {
51 // Okay, let's prepare...
52 $curr = getMonth() - 1;
53 if (strlen($curr) == 1) $curr = '0' . $curr;
54 updateConfiguration('last_month', $curr);
55 loadTemplate('admin_settings_saved', false, '{--ADMIN_BEG_WITHDRAW_PREPARED--}');
58 // Autopurge installed?
60 if (isExtensionActive('autopurge')) {
61 // Use last online timestamp to keep inactive members away from here
62 $lastOnline = " AND `last_online` >= (UNIX_TIMESTAMP() - {?ap_inactive_since?})";
65 // Check if at least one is in the active rallye
66 $result = SQL_QUERY("SELECT `userid`, `gender`, `surname`, `family`, `email`, `beg_points`, `last_online`
68 `{?_MYSQL_PREFIX?}_user_data`
70 `status`='CONFIRMED' AND
76 `userid` ASC", __FILE__, __LINE__);
78 if (!SQL_HASZERONUMS($result)) {
80 $OUT = ''; $cnt = 1; $total = '0';
81 while ($content = SQL_FETCHARRAY($result)) {
83 $WIN1 = ''; $WIN2 = '';
85 // Maybe he can win his active beg?
86 if ($cnt <= getConfig('beg_ranks')) {
94 'userid' => $content['userid'],
95 'email' => generateEmailLink($content['email'], 'user_data'),
96 'gender' => $content['gender'],
97 'turbo' => $content['beg_points'],
98 'last_online' => generateDateTime($content['last_online'], 2),
104 // Load template and add it
105 $OUT .= loadTemplate('admin_list_beg_rows', true, $content);
106 $cnt++; $total += $content['beg_points'];
109 $content['rows'] = $OUT;
110 $content['total'] = translateComma($total);
112 // Check if we need to display form or not with manuel withdraw
113 if (getConfig('last_month') == getMonth()) {
115 $content['withdraw_form'] = loadTemplate('admin_list_beg_form', true);
117 // Display message "no manual withdraw possible"
118 $content['withdraw_form'] = loadTemplate('admin_settings_saved', true, '{--ADMIN_BEG_ALREADY_WITHDRAW--}');
121 // Prepare constant for timemark
122 if (isExtensionActive('autopurge')) {
123 $content['autopurge_timeout'] = generateDateTime(time() - getApInactiveSince(), 2);
125 $content['autopurge_timeout'] = loadTemplate('admin_settings_saved', true, generateExtensionInactiveNotInstalledMessage('autopurge'));
128 // Load final template
129 loadTemplate('admin_list_beg', false, $content);
131 // No one has joined the begging rallye...
132 loadTemplate('admin_settings_saved', false, '{--ADMIN_BEG_NO_RALLYE--}');
135 // Rallye deactivated
136 loadTemplate('admin_settings_saved', false, '{--ADMIN_BEG_RALLYE_DEACTIVATED--}');