2 /************************************************************************
\r
3 * MXChange v0.2.1 Start: 10/22/2005 *
\r
4 * ================ Last change: 10/22/2005 *
\r
6 * -------------------------------------------------------------------- *
\r
7 * File : what-list_beg.php *
\r
8 * -------------------------------------------------------------------- *
\r
9 * Short description : List members in begging-rallye *
\r
10 * -------------------------------------------------------------------- *
\r
11 * Kurzbeschreibung : Mitglieder in Bettel-Rallye auflisten *
\r
12 * -------------------------------------------------------------------- *
\r
14 * -------------------------------------------------------------------- *
\r
15 * Copyright (c) 2003 - 2008 by Roland Haeder *
\r
16 * For more information visit: http://www.mxchange.org *
\r
18 * This program is free software; you can redistribute it and/or modify *
\r
19 * it under the terms of the GNU General Public License as published by *
\r
20 * the Free Software Foundation; either version 2 of the License, or *
\r
21 * (at your option) any later version. *
\r
23 * This program is distributed in the hope that it will be useful, *
\r
24 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
\r
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
\r
26 * GNU General Public License for more details. *
\r
28 * You should have received a copy of the GNU General Public License *
\r
29 * along with this program; if not, write to the Free Software *
\r
30 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, *
\r
31 * MA 02110-1301 USA *
\r
32 ************************************************************************/
\r
34 // Some security stuff...
\r
35 if ((ereg(basename(__FILE__), $_SERVER['PHP_SELF'])) || (!is_admin()))
\r
37 $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
\r
40 // Add description as navigation point
\r
41 ADD_DESCR("admin", basename(__FILE__));
\r
43 if ($CONFIG['beg_rallye'] == "Y")
\r
45 // Shall I withdraw now?
\r
46 if (isset($_POST['withdraw']))
\r
48 // Okay, let's prepare...
\r
49 $curr = date("m", time()) - 1;
\r
50 if (strlen($curr) == 1) $curr = "0".$curr;
\r
51 $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_config SET beg_month='%s' WHERE config='0' LIMIT 1",
\r
52 array($curr), __FILE__, __LINE__);
\r
53 LOAD_TEMPLATE("admin_settings_saved", false, ADMIN_BEG_WITHDRAW_PREPARED);
\r
54 OUTPUT_HTML("<BR>");
\r
57 // Autopurge installed?
\r
58 $LAST = "%s"; $ONLINE = "";
\r
59 if (EXT_IS_ACTIVE("autopurge"))
\r
61 // Use last online timestamp to keep inactive members away from here
\r
62 $LAST = " AND last_online >= %s";
\r
63 $ONLINE = bigintval(time() - $CONFIG['ap_in_since']);
\r
66 // Check if at least one is in the active rallye
\r
67 $result = SQL_QUERY_ESC("SELECT userid, email, sex, surname, family, beg_points, last_online
\r
68 FROM "._MYSQL_PREFIX."_user_data
\r
69 WHERE status='CONFIRMED' AND beg_points > 0".$LAST."
\r
70 ORDER BY beg_points DESC, last_online DESC, userid",
\r
71 array($ONLINE), __FILE__, __LINE__);
\r
73 if (SQL_NUMROWS($result) > 0)
\r
76 $OUT = "";$SW = 2; $cnt = 1; $total = 0;
\r
77 while(list($uid, $email, $sex, $sname, $fname, $turbo, $last) = SQL_FETCHROW($result))
\r
79 // Generate array fore the dynamic template
\r
80 $WIN1 = ""; $WIN2 = "";
\r
81 if ($cnt <= $CONFIG['beg_ranks'])
\r
83 // Maybe he can win his active beg?
\r
85 $WIN2 = "</STRONG>";
\r
89 'email' => CREATE_EMAIL_LINK($email, "user_data"),
\r
90 'salut' => TRANSLATE_SEX($sex),
\r
93 'turbo' => TRANSLATE_COMMA($turbo),
\r
94 'last' => MAKE_DATETIME($last, "2"),
\r
101 // Load template and add it
\r
102 $OUT .= LOAD_TEMPLATE("admin_list_beg_rows", true, $content);
\r
103 $SW = 3 - $SW; $cnt++; $total += $turbo;
\r
105 define('__BEG_ROWS', $OUT);
\r
106 define('__TOTAL', TRANSLATE_COMMA($total));
\r
108 // Check if we need to display form or not with manuel withdraw
\r
109 if ($CONFIG['beg_month'] == date("m", time()))
\r
112 define('__BEG_WITHDRAW_FORM', LOAD_TEMPLATE("admin_list_beg_form", true));
\r
116 // Display message "no manual withdraw possible"
\r
117 define('__BEG_WITHDRAW_FORM', "<FONT class=\"admin_failed\">".ADMIN_BEG_ALREADY_WITHDRAW."</FONT>");
\r
120 // Prepare constant for timemark
\r
121 define('__AUTOPURGE_TIMEOUT', MAKE_DATETIME(time() - $CONFIG['ap_in_since'], "2"));
\r
123 // Load final template
\r
124 LOAD_TEMPLATE("admin_list_beg");
\r
128 // No one has joined the begging rallye...
\r
129 LOAD_TEMPLATE("admin_settings_saved", false, ADMIN_BEG_NO_RALLYE);
\r
134 // Rallye deactivated
\r
135 LOAD_TEMPLATE("admin_settings_saved", false, ADMIN_BEG_RALLYE_DEACTIVATED);
\r