Functions imported, some dev-scripts added
[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 ((!defined('__SECURITY')) || (!IS_ADMIN())) {
36         $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
37         require($INC);
38 }
39
40 // Add description as navigation point
41 ADD_DESCR("admin", __FILE__);
42
43 if (isset($_POST['ok'])) {
44         // Replace commata with decimal dot
45         $_POST['doubler_charge'] = REVERT_COMMA(($_POST['doubler_charge'] / 100));
46         $_POST['doubler_ref']    = REVERT_COMMA(($_POST['doubler_ref'] / 100));
47         $_POST['doubler_min']    = REVERT_COMMA($_POST['doubler_min']);
48         $_POST['doubler_max']    = REVERT_COMMA($_POST['doubler_max']);
49         $_POST['doubler_left']   = REVERT_COMMA($_POST['doubler_left']);
50
51         // Save settings
52         ADMIN_SAVE_SETTINGS($_POST);
53 } else {
54         // Prepare data for the template
55         // - Charge rate
56         define('__DOUBLER_CHARGE', TRANSLATE_COMMA((getConfig('doubler_charge') * 100), false));
57         // - Referal rate
58         define('__DOUBLER_REFERRAL', TRANSLATE_COMMA((getConfig('doubler_ref') * 100), false));
59         // - Minimum points to double
60         define('__DOUBLER_MINIMUM', TRANSLATE_COMMA(getConfig('doubler_min'), false));
61         // - Maximum points to double
62         define('__DOUBLER_MAXIMUM', TRANSLATE_COMMA(getConfig('doubler_max'), false));
63         // - Points left on users account after doubling
64         define('__DOUBLER_LEFT', TRANSLATE_COMMA(getConfig('doubler_left'), false));
65         // - Max payouts to check per click/reset
66         define('__DOUBLER_MAX_SENT', getConfig('doubler_max_sent'));
67         // - Group sending
68         define('__DOUBLER_GROUP_SENT', getConfig('doubler_group_sent'));
69
70         // Take points from jackpot (Y/N)
71         switch (getConfig('doubler_jackpot'))
72         {
73         case "Y":
74                 define('__DOUBLER_JACKPOT_Y', " checked=\"checked\"");
75                 define('__DOUBLER_JACKPOT_N', "");
76                 break;
77
78         case "N":
79                 define('__DOUBLER_JACKPOT_Y', "");
80                 define('__DOUBLER_JACKPOT_N', " checked=\"checked\"");
81                 break;
82         }
83
84         // Take points from own account (Y/N)
85         switch (getConfig('doubler_own'))
86         {
87         case "Y":
88                 define('__DOUBLER_OWN_Y', " checked=\"checked\"");
89                 define('__DOUBLER_OWN_N', "");
90                 break;
91
92         case "N":
93                 define('__DOUBLER_OWN_Y', "");
94                 define('__DOUBLER_OWN_N', " checked=\"checked\"");
95                 break;
96         }
97
98         // Mail send mode
99         switch (getConfig('doubler_send_mode'))
100         {
101         case "DIRECT":
102                 define('__DOUBLER_SEND_DIRECT', " checked=\"checked\"");
103                 define('__DOUBLER_SEND_RESET' , "");
104                 break;
105
106         case "RESET":
107                 define('__DOUBLER_SEND_DIRECT', "");
108                 define('__DOUBLER_SEND_RESET' , " checked=\"checked\"");
109                 break;
110         }
111
112         // Take points from own account (Y/N)
113         switch (getConfig('doubler_sent_all'))
114         {
115         case "Y":
116                 define('__DOUBLER_SENT_ALL_Y', " checked=\"checked\"");
117                 define('__DOUBLER_SENT_ALL_N', "");
118                 break;
119
120         case "N":
121                 define('__DOUBLER_SENT_ALL_Y', "");
122                 define('__DOUBLER_SENT_ALL_N', " checked=\"checked\"");
123                 break;
124         }
125
126         // Transfer options (!!!) to __MEMBER_SELECTION
127         define('__MEMBER_SELECTION', ADD_MEMBER_SELECTION_BOX(getConfig('doubler_uid'), false, true, true, "doubler_uid"));
128
129         // Number of rows to display (option lines!!!)
130         define('__DOUBLER_DISPLAY_NEW', ADD_OPTION_LINES("/ARRAY/", array(5,10,20,30,40,50,100), array(5,10,20,30,40,50,100), getConfig('doubler_display_new')));
131         define('__DOUBLER_DISPLAY_PAY', ADD_OPTION_LINES("/ARRAY/", array(5,10,20,30,40,50,100), array(5,10,20,30,40,50,100), getConfig('doubler_display_pay')));
132         define('__DOUBLER_DISPLAY_OLD', ADD_OPTION_LINES("/ARRAY/", array(5,10,20,30,40,50,100), array(5,10,20,30,40,50,100), getConfig('doubler_display_old')));
133
134         // Timeout selection box or input box?
135         define('__DOUBLER_TIMEOUT', CREATE_TIME_SELECTIONS(getConfig('doubler_timeout')  , "doubler_timeout"  , "WDh"));
136
137         // Load template
138         LOAD_TEMPLATE("admin_config_doubler");
139 }
140 //
141 ?>