Re-added, now the right ones
[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:: 856                                                    $ *
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 switch (REQUEST_GET('mode'))
60 {
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         {
73                 // Nothing payed out so far
74                 define('__DOUBLER_ALREADY_DIRECT_LINK', "0");
75         }
76          else
77         {
78                 // Something was payed out
79                 $SUM_ALREADY += $cnt;
80                 define('__DOUBLER_ALREADY_DIRECT_LINK', "<a href=\"{!URL!}/modules.php?module=admin&amp;what=list_doubler&amp;mode=already&amp;select=direct\">".$cnt."</a>");
81         }
82         $result = SQL_QUERY("SELECT COUNT(id) FROM `{!_MYSQL_PREFIX!}_doubler` WHERE completed='Y' AND is_ref='Y'", __FILE__, __LINE__);
83         list($cnt) = SQL_FETCHROW($result);
84         SQL_FREERESULT($result);
85
86         if ((empty($cnt)) || ($cnt == "0"))
87         {
88                 // Nothing payed out so far
89                 define('__DOUBLER_ALREADY_REF_LINK', "0");
90         }
91          else
92         {
93                 // Something was payed out
94                 $SUM_ALREADY += $cnt;
95                 define('__DOUBLER_ALREADY_REF_LINK', "<a href=\"{!URL!}/modules.php?module=admin&amp;what=list_doubler&amp;mode=already&amp;select=ref\">".$cnt."</a>");
96         }
97         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>");
98
99         // And the same for waiting pouts (direct and referal)
100         $result = SQL_QUERY("SELECT COUNT(id) FROM `{!_MYSQL_PREFIX!}_doubler` WHERE completed='N' AND is_ref='N'", __FILE__, __LINE__);
101         list($cnt) = SQL_FETCHROW($result);
102         SQL_FREERESULT($result);
103
104         if ((empty($cnt)) || ($cnt == "0"))
105         {
106                 // Nothing payed out so far
107                 define('__DOUBLER_WAITING_DIRECT_LINK', "0");
108         }
109          else
110         {
111                 // Something was payed out
112                 $SUM_WAITING += $cnt;
113                 define('__DOUBLER_WAITING_DIRECT_LINK', "<a href=\"{!URL!}/modules.php?module=admin&amp;what=list_doubler&amp;mode=waiting&amp;select=direct\">".$cnt."</a>");
114         }
115         $result = SQL_QUERY("SELECT COUNT(id) FROM `{!_MYSQL_PREFIX!}_doubler` WHERE completed='N' AND is_ref='Y'", __FILE__, __LINE__);
116         list($cnt) = SQL_FETCHROW($result);
117         SQL_FREERESULT($result);
118
119         if ((empty($cnt)) || ($cnt == "0"))
120         {
121                 // Nothing payed out so far
122                 define('__DOUBLER_WAITING_REF_LINK', "0");
123         }
124          else
125         {
126                 // Something was payed out
127                 $SUM_WAITING += $cnt;
128                 define('__DOUBLER_WAITING_REF_LINK', "<a href=\"{!URL!}/modules.php?module=admin&amp;what=list_doubler&amp;mode=waiting&amp;select=ref\">".$cnt."</a>");
129         }
130         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>");
131
132         // All data is loaded here...
133         break;
134 }
135
136 // Load mode template
137 LOAD_TEMPLATE("admin_list_doubler_".REQUEST_GET('mode'));
138
139 //
140 ?>