0aa9a139768d50ba6e71093b3d40dd3fb26e07d3
[mailer.git] / inc / modules / admin / what-config_doubler.php
1 <?php
2 /************************************************************************
3  * MXChange v0.2.1                                    Start: 02/12/2005 *
4  * ================                             Last change: 02/12/2005 *
5  *                                                                      *
6  * -------------------------------------------------------------------- *
7  * File              : what-config_doubler.php                          *
8  * -------------------------------------------------------------------- *
9  * Short description : Points doubler                                   *
10  * -------------------------------------------------------------------- *
11  * Kurzbeschreibung  : Punkte verdoppeln                                *
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 (isFormSent()) {
49         // Replace commata with decimal dot
50         REQUEST_SET_POST('doubler_charge', convertCommaToDot((REQUEST_POST('doubler_charge') / 100)));
51         REQUEST_SET_POST('doubler_ref'   , convertCommaToDot((REQUEST_POST('doubler_ref') / 100)));
52         REQUEST_SET_POST('doubler_min'   , convertCommaToDot(REQUEST_POST('doubler_min')));
53         REQUEST_SET_POST('doubler_max'   , convertCommaToDot(REQUEST_POST('doubler_max')));
54         REQUEST_SET_POST('doubler_left'  , convertCommaToDot(REQUEST_POST('doubler_left')));
55
56         // Save settings
57         ADMIN_SAVE_SETTINGS_POST();
58 } else {
59         // Prepare data for the template
60         // - Charge rate
61         define('__DOUBLER_CHARGE', translateComma((getConfig('doubler_charge') * 100), false));
62         // - Referal rate
63         define('__DOUBLER_REFERRAL', translateComma((getConfig('doubler_ref') * 100), false));
64         // - Minimum points to double
65         define('__DOUBLER_MINIMUM', translateComma(getConfig('doubler_min'), false));
66         // - Maximum points to double
67         define('__DOUBLER_MAXIMUM', translateComma(getConfig('doubler_max'), false));
68         // - Points left on users account after doubling
69         define('__DOUBLER_LEFT', translateComma(getConfig('doubler_left'), false));
70         // - Max payouts to check per click/reset
71         define('__DOUBLER_MAX_SENT', getConfig('doubler_max_sent'));
72         // - Group sending
73         define('__DOUBLER_GROUP_SENT', getConfig('doubler_group_sent'));
74
75         // Take points from jackpot (Y/N)
76         switch (getConfig('doubler_jackpot')) {
77                 case 'Y':
78                         define('__DOUBLER_JACKPOT_Y', ' checked="checked"');
79                         define('__DOUBLER_JACKPOT_N', '');
80                         break;
81
82                 case 'N':
83                         define('__DOUBLER_JACKPOT_Y', '');
84                         define('__DOUBLER_JACKPOT_N', ' checked="checked"');
85                         break;
86         }
87
88         // Take points from own account (Y/N)
89         switch (getConfig('doubler_own')) {
90                 case 'Y':
91                         define('__DOUBLER_OWN_Y', ' checked="checked"');
92                         define('__DOUBLER_OWN_N', '');
93                         break;
94
95                 case 'N':
96                         define('__DOUBLER_OWN_Y', '');
97                         define('__DOUBLER_OWN_N', ' checked="checked"');
98                         break;
99         }
100
101         // Mail send mode
102         switch (getConfig('doubler_send_mode')) {
103                 case 'DIRECT':
104                         define('__DOUBLER_SEND_DIRECT', ' checked="checked"');
105                         define('__DOUBLER_SEND_RESET' , '');
106                         break;
107
108                 case 'RESET':
109                         define('__DOUBLER_SEND_DIRECT', '');
110                         define('__DOUBLER_SEND_RESET' , ' checked="checked"');
111                         break;
112         }
113
114         // Take points from own account (Y/N)
115         switch (getConfig('doubler_sent_all')) {
116                 case 'Y':
117                         define('__DOUBLER_SENT_ALL_Y', ' checked="checked"');
118                         define('__DOUBLER_SENT_ALL_N', '');
119                         break;
120
121                 case 'N':
122                         define('__DOUBLER_SENT_ALL_Y', '');
123                         define('__DOUBLER_SENT_ALL_N', ' checked="checked"');
124                         break;
125         }
126
127         // Transfer options (!!!) to __MEMBER_SELECTION
128         define('__MEMBER_SELECTION', ADD_MEMBER_SELECTION_BOX(getConfig('doubler_uid'), false, true, true, 'doubler_uid'));
129
130         // Number of rows to display (option lines!!!)
131         define('__DOUBLER_DISPLAY_NEW', generateOptionList('/ARRAY/', array(5,10,20,30,40,50,100), array(5,10,20,30,40,50,100), getConfig('doubler_display_new')));
132         define('__DOUBLER_DISPLAY_PAY', generateOptionList('/ARRAY/', array(5,10,20,30,40,50,100), array(5,10,20,30,40,50,100), getConfig('doubler_display_pay')));
133         define('__DOUBLER_DISPLAY_OLD', generateOptionList('/ARRAY/', array(5,10,20,30,40,50,100), array(5,10,20,30,40,50,100), getConfig('doubler_display_old')));
134
135         // Timeout selection box or input box?
136         define('__DOUBLER_TIMEOUT', createTimeSelections(getConfig('doubler_timeout')  , 'doubler_timeout'  , 'WDh'));
137
138         // Load template
139         LOAD_TEMPLATE('admin_config_doubler');
140 }
141
142 //
143 ?>