Several more constants rewritten to getConfig()
[mailer.git] / inc / modules / admin / what-list_doubler.php
1 <?php
2 /************************************************************************
3  * MXChange v0.2.1                                    Start: 02/12/2004 *
4  * ================                             Last change: 02/12/2004 *
5  *                                                                      *
6  * -------------------------------------------------------------------- *
7  * File              : what-list_doubler.php                            *
8  * -------------------------------------------------------------------- *
9  * Short description : List doubler entries                             *
10  * -------------------------------------------------------------------- *
11  * Kurzbeschreibung  : Verdoppler-Eintraege auflisten                   *
12  * -------------------------------------------------------------------- *
13  * $Revision::                                                        $ *
14  * $Date::                                                            $ *
15  * $Tag:: 0.2.1-FINAL                                                 $ *
16  * $Author::                                                          $ *
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                  *
22  *                                                                      *
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.                                  *
27  *                                                                      *
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.                         *
32  *                                                                      *
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,               *
36  * MA  02110-1301  USA                                                  *
37  ************************************************************************/
38
39 // Some security stuff...
40 if ((!defined('__SECURITY')) || (!IS_ADMIN())) {
41         $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), '/inc') + 4) . '/security.php';
42         require($INC);
43 }
44
45 // Add description as navigation point
46 ADD_DESCR('admin', __FILE__);
47
48 if (!REQUEST_ISSET_GET('mode')) {
49         // Chosse the overview page as default
50         REQUEST_GET('mode', 'overview');
51 } else {
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'))."'));";
55         eval($eval);
56 }
57
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
62                 break;
63
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);
70
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');
75                 } else {
76                         // Something was payed out
77                         $SUM_ALREADY += $cnt;
78                         define('__DOUBLER_ALREADY_DIRECT_LINK', "<a href=\"{?URL?}/modules.php?module=admin&amp;what=list_doubler&amp;mode=already&amp;select=direct\">".$cnt."</a>");
79                 }
80
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);
84
85         if ((empty($cnt)) || ($cnt == '0')) {
86                 // Nothing payed out so far
87                 define('__DOUBLER_ALREADY_REF_LINK', '0');
88         } else {
89                 // Something was payed out
90                 $SUM_ALREADY += $cnt;
91                 define('__DOUBLER_ALREADY_REF_LINK', "<a href=\"{?URL?}/modules.php?module=admin&amp;what=list_doubler&amp;mode=already&amp;select=ref\">".$cnt."</a>");
92         }
93         define('__DOUBLER_ALREADY_ALL_LINK', "<a href=\"{?URL?}/modules.php?module=admin&amp;what=list_doubler&amp;mode=already&amp;select=all\">".$SUM_ALREADY."</a>");
94
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);
99
100         if ((empty($cnt)) || ($cnt == '0')) {
101                 // Nothing payed out so far
102                 define('__DOUBLER_WAITING_DIRECT_LINK', '0');
103         } else {
104                 // Something was payed out
105                 $SUM_WAITING += $cnt;
106                 define('__DOUBLER_WAITING_DIRECT_LINK', "<a href=\"{?URL?}/modules.php?module=admin&amp;what=list_doubler&amp;mode=waiting&amp;select=direct\">".$cnt."</a>");
107         }
108
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);
112
113         if ((empty($cnt)) || ($cnt == '0')) {
114                 // Nothing payed out so far
115                 define('__DOUBLER_WAITING_REF_LINK', '0');
116         } else {
117                 // Something was payed out
118                 $SUM_WAITING += $cnt;
119                 define('__DOUBLER_WAITING_REF_LINK', "<a href=\"{?URL?}/modules.php?module=admin&amp;what=list_doubler&amp;mode=waiting&amp;select=ref\">".$cnt."</a>");
120         }
121         define('__DOUBLER_WAITING_ALL_LINK', "<a href=\"{?URL?}/modules.php?module=admin&amp;what=list_doubler&amp;mode=waiting&amp;select=all\">".$SUM_WAITING."</a>");
122
123         // All data is loaded here...
124         break;
125 }
126
127 // Load mode template
128 LOAD_TEMPLATE('admin_list_doubler_' . REQUEST_GET('mode'));
129
130 //
131 ?>