2 /************************************************************************
3 * MXChange v0.2.1 Start: 02/12/2004 *
4 * ================ Last change: 02/12/2004 *
6 * -------------------------------------------------------------------- *
7 * File : what-list_doubler.php *
8 * -------------------------------------------------------------------- *
9 * Short description : List doubler entries *
10 * -------------------------------------------------------------------- *
11 * Kurzbeschreibung : Verdoppler-Eintraege 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 - 2008 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')) || (!IS_ADMIN())) {
41 $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), '/inc') + 4) . '/security.php';
45 // Add description as navigation point
46 ADD_DESCR('admin', __FILE__);
48 if (!REQUEST_ISSET_GET('mode')) {
49 // Chosse the overview page as default
50 REQUEST_GET('mode', 'overview');
52 // Set table title automatically
53 if (!REQUEST_ISSET_GET(('select'))) REQUEST_GET('select', "all");
54 $eval = "define('__ADMIN_DOUBLER_LIST_".strtoupper(REQUEST_GET('mode'))."', getMessage('ADMIN_DOUBLER_LIST_".strtoupper(REQUEST_GET('mode'))."_".strtoupper(REQUEST_GET('select'))."'));";
58 // Load data for the template
59 // @TODO Try to rewrite this into include files
60 switch (REQUEST_GET('mode')) {
61 case 'already': // Already payed out points
64 case 'overview': // General overview page
65 $SUM_ALREADY = 0; $SUM_WAITING = 0;
66 // Number of direct already payouts and referal
67 $result = SQL_QUERY("SELECT COUNT(id) FROM `{!_MYSQL_PREFIX!}_doubler` WHERE completed='Y' AND is_ref='N'", __FILE__, __LINE__);
68 list($cnt) = SQL_FETCHROW($result);
69 SQL_FREERESULT($result);
71 if ((empty($cnt)) || ($cnt == '0')) {
72 // Nothing payed out so far
73 // @TODO Rewrite all these constants
74 define('__DOUBLER_ALREADY_DIRECT_LINK', '0');
76 // Something was payed out
78 define('__DOUBLER_ALREADY_DIRECT_LINK', "<a href=\"{?URL?}/modules.php?module=admin&what=list_doubler&mode=already&select=direct\">".$cnt."</a>");
81 $result = SQL_QUERY("SELECT COUNT(id) FROM `{!_MYSQL_PREFIX!}_doubler` WHERE completed='Y' AND is_ref='Y'", __FILE__, __LINE__);
82 list($cnt) = SQL_FETCHROW($result);
83 SQL_FREERESULT($result);
85 if ((empty($cnt)) || ($cnt == '0')) {
86 // Nothing payed out so far
87 define('__DOUBLER_ALREADY_REF_LINK', '0');
89 // Something was payed out
91 define('__DOUBLER_ALREADY_REF_LINK', "<a href=\"{?URL?}/modules.php?module=admin&what=list_doubler&mode=already&select=ref\">".$cnt."</a>");
93 define('__DOUBLER_ALREADY_ALL_LINK', "<a href=\"{?URL?}/modules.php?module=admin&what=list_doubler&mode=already&select=all\">".$SUM_ALREADY."</a>");
95 // And the same for waiting pouts (direct and referal)
96 $result = SQL_QUERY("SELECT COUNT(id) FROM `{!_MYSQL_PREFIX!}_doubler` WHERE completed='N' AND is_ref='N'", __FILE__, __LINE__);
97 list($cnt) = SQL_FETCHROW($result);
98 SQL_FREERESULT($result);
100 if ((empty($cnt)) || ($cnt == '0')) {
101 // Nothing payed out so far
102 define('__DOUBLER_WAITING_DIRECT_LINK', '0');
104 // Something was payed out
105 $SUM_WAITING += $cnt;
106 define('__DOUBLER_WAITING_DIRECT_LINK', "<a href=\"{?URL?}/modules.php?module=admin&what=list_doubler&mode=waiting&select=direct\">".$cnt."</a>");
109 $result = SQL_QUERY("SELECT COUNT(id) FROM `{!_MYSQL_PREFIX!}_doubler` WHERE completed='N' AND is_ref='Y'", __FILE__, __LINE__);
110 list($cnt) = SQL_FETCHROW($result);
111 SQL_FREERESULT($result);
113 if ((empty($cnt)) || ($cnt == '0')) {
114 // Nothing payed out so far
115 define('__DOUBLER_WAITING_REF_LINK', '0');
117 // Something was payed out
118 $SUM_WAITING += $cnt;
119 define('__DOUBLER_WAITING_REF_LINK', "<a href=\"{?URL?}/modules.php?module=admin&what=list_doubler&mode=waiting&select=ref\">".$cnt."</a>");
121 define('__DOUBLER_WAITING_ALL_LINK', "<a href=\"{?URL?}/modules.php?module=admin&what=list_doubler&mode=waiting&select=all\">".$SUM_WAITING."</a>");
123 // All data is loaded here...
127 // Load mode template
128 LOAD_TEMPLATE('admin_list_doubler_' . REQUEST_GET('mode'));