2b80c4c436bb47113a235fd7b38e236312ff5b09
[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  *                                                                      *
14  * -------------------------------------------------------------------- *
15  * Copyright (c) 2003 - 2008 by Roland Haeder                           *
16  * For more information visit: http://www.mxchange.org                  *
17  *                                                                      *
18  * This program is free software; you can redistribute it and/or modify *
19  * it under the terms of the GNU General Public License as published by *
20  * the Free Software Foundation; either version 2 of the License, or    *
21  * (at your option) any later version.                                  *
22  *                                                                      *
23  * This program is distributed in the hope that it will be useful,      *
24  * but WITHOUT ANY WARRANTY; without even the implied warranty of       *
25  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        *
26  * GNU General Public License for more details.                         *
27  *                                                                      *
28  * You should have received a copy of the GNU General Public License    *
29  * along with this program; if not, write to the Free Software          *
30  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,               *
31  * MA  02110-1301  USA                                                  *
32  ************************************************************************/
33
34 // Some security stuff...
35 if ((ereg(basename(__FILE__), $_SERVER['PHP_SELF'])) || (!is_admin()))
36 {
37         $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
38         require($INC);
39 }
40 // Add description as navigation point
41 ADD_DESCR("admin", basename(__FILE__));
42
43 if (isset($_POST['ok']))
44 {
45         // Replace commata with decimal dot
46         $_POST['doubler_charge'] = str_replace(",", ".", ($_POST['doubler_charge'] / 100));
47         $_POST['doubler_ref']    = str_replace(",", ".", ($_POST['doubler_ref'] / 100));
48         $_POST['doubler_min']    = str_replace(",", ".", $_POST['doubler_min']);
49         $_POST['doubler_max']    = str_replace(",", ".", $_POST['doubler_max']);
50         $_POST['doubler_left']   = str_replace(",", ".", $_POST['doubler_left']);
51
52         // Save settings
53         ADMIN_SAVE_SETTINGS($_POST);
54 }
55  else
56 {
57         // Prepare data for the template
58         // - Charge rate
59         define('__DOUBLER_CHARGE', TRANSLATE_COMMA(($_CONFIG['doubler_charge'] * 100), false));
60         // - Referral rate
61         define('__DOUBLER_REFERRAL', TRANSLATE_COMMA(($_CONFIG['doubler_ref'] * 100), false));
62         // - Minimum points to double
63         define('__DOUBLER_MINIMUM', TRANSLATE_COMMA($_CONFIG['doubler_min'], false));
64         // - Maximum points to double
65         define('__DOUBLER_MAXIMUM', TRANSLATE_COMMA($_CONFIG['doubler_max'], false));
66         // - Points left on users account after doubling
67         define('__DOUBLER_LEFT', TRANSLATE_COMMA($_CONFIG['doubler_left'], false));
68         // - Max payouts to check per click/reset
69         define('__DOUBLER_MAX_SENT', $_CONFIG['doubler_max_sent']);
70         // - Group sending
71         define('__DOUBLER_GROUP_SENT', $_CONFIG['doubler_group_sent']);
72
73         // Take points from jackpot (Y/N)
74         switch ($_CONFIG['doubler_jackpot'])
75         {
76         case 'Y':
77                 define('__DOUBLER_JACKPOT_Y', ' checked');
78                 define('__DOUBLER_JACKPOT_N', "");
79                 break;
80
81         case 'N':
82                 define('__DOUBLER_JACKPOT_Y', "");
83                 define('__DOUBLER_JACKPOT_N', ' checked');
84                 break;
85         }
86
87         // Take points from own account (Y/N)
88         switch ($_CONFIG['doubler_own'])
89         {
90         case 'Y':
91                 define('__DOUBLER_OWN_Y', ' checked');
92                 define('__DOUBLER_OWN_N', "");
93                 break;
94
95         case 'N':
96                 define('__DOUBLER_OWN_Y', "");
97                 define('__DOUBLER_OWN_N', ' checked');
98                 break;
99         }
100
101         // Mail send mode
102         switch ($_CONFIG['doubler_send_mode'])
103         {
104         case "DIRECT":
105                 define('__DOUBLER_SEND_DIRECT', ' checked');
106                 define('__DOUBLER_SEND_RESET' , "");
107                 break;
108
109         case "RESET":
110                 define('__DOUBLER_SEND_DIRECT', "");
111                 define('__DOUBLER_SEND_RESET' , ' checked');
112                 break;
113         }
114
115         // Take points from own account (Y/N)
116         switch ($_CONFIG['doubler_sent_all'])
117         {
118         case 'Y':
119                 define('__DOUBLER_SENT_ALL_Y', ' checked');
120                 define('__DOUBLER_SENT_ALL_N', "");
121                 break;
122
123         case 'N':
124                 define('__DOUBLER_SENT_ALL_Y', "");
125                 define('__DOUBLER_SENT_ALL_N', ' checked');
126                 break;
127         }
128
129         // Transfer options (!!!) to __MEMBER_SELECTION
130         ADD_MEMBER_SELECTION_BOX($_CONFIG['doubler_uid'], false, true, true);
131
132         // Number of rows to display (option lines!!!)
133         define('__DOUBLER_DISPLAY_NEW', ADD_OPTION_LINES("/ARRAY/", array(5,10,20,30,40,50,100), array(5,10,20,30,40,50,100), $_CONFIG['doubler_display_new']));
134         define('__DOUBLER_DISPLAY_PAY', ADD_OPTION_LINES("/ARRAY/", array(5,10,20,30,40,50,100), array(5,10,20,30,40,50,100), $_CONFIG['doubler_display_pay']));
135         define('__DOUBLER_DISPLAY_OLD', ADD_OPTION_LINES("/ARRAY/", array(5,10,20,30,40,50,100), array(5,10,20,30,40,50,100), $_CONFIG['doubler_display_old']));
136
137         // Timeout selection box or input box?
138         define('__DOUBLER_TIMEOUT', CREATE_TIME_SELECTIONS($_CONFIG['doubler_timeout']  , "doubler_timeout"  , "WDh"));
139
140         // Load template
141         LOAD_TEMPLATE("admin_config_doubler");
142 }
143 //
144 ?>