SQL_ESCAPE() rewritten for better caching of float numbers
[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 - 2009 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')) || (!isAdmin())) {
41         die();
42 } // END - if
43
44 // Add description as navigation point
45 addMenuDescription('admin', __FILE__);
46
47 if (isFormSent()) {
48         // Replace commata with decimal dot
49         setRequestPostElement('doubler_charge', (convertCommaToDot(postRequestElement('doubler_charge')) / 100));
50         setRequestPostElement('doubler_ref'   , (convertCommaToDot(postRequestElement('doubler_ref')) / 100));
51         setRequestPostElement('doubler_min'   , convertCommaToDot(postRequestElement('doubler_min')));
52         setRequestPostElement('doubler_max'   , convertCommaToDot(postRequestElement('doubler_max')));
53         setRequestPostElement('doubler_left'  , convertCommaToDot(postRequestElement('doubler_left')));
54
55         // Save settings
56         adminSaveSettingsFromPostData();
57 } else {
58         // Prepare data for the template
59         // - Charge rate
60         $content['charge']  = translateComma((getConfig('doubler_charge') * 100), false);
61         // - Referal rate
62         $content['referal'] = translateComma((getConfig('doubler_ref') * 100), false);
63         // - Minimum points to double
64         $content['minimum'] = translateComma(getConfig('doubler_min'), false);
65         // - Maximum points to double
66         $content['maximum'] = translateComma(getConfig('doubler_max'), false);
67         // - Points left on users account after doubling
68         $content['left']    = translateComma(getConfig('doubler_left'), false);
69
70         // Init all Y/N selections
71         foreach (array('jackpot','own','sent_all') as $entry) {
72                 $content[$entry . '_y'] = '';
73                 $content[$entry . '_n'] = '';
74                 $content[$entry . '_' . strtolower(getConfig('doubler_' . $entry))] = ' checked="checked"';
75         } // END - foreach
76
77         // Init other selections
78         foreach (array('send_mode_direct','send_mode_reset') as $entry) {
79                 $content[$entry] = '';
80         } // END - foreach
81
82         // Set current selections
83         foreach (array('send_mode') as $entry) {
84                 $content[$entry . '_' . strtolower(getConfig('doubler_' . $entry))] = ' checked="checked"';
85         } // END - foreach
86
87         // Transfer options
88         $content['member_selection'] = addMemberSelectionBox(getConfig('doubler_userid'), false, true, true, 'doubler_userid');
89
90         // Number of rows to display (option lines!!!)
91         foreach (array('new','pay','old') as $entry) {
92                 $content['display_' . $entry] = generateOptionList('/ARRAY/', array(5,10,20,30,40,50,100), array(5,10,20,30,40,50,100), getConfig('doubler_display_' . $entry));
93         } // END - foreach
94
95         // Timeout selection box or input box?
96         $content['timeout_selection'] = createTimeSelections(getConfig('doubler_timeout')  , 'doubler_timeout'  , 'WDh');
97
98         // Load template
99         loadTemplate('admin_config_doubler', false, $content);
100 }
101
102 // [EOF]
103 ?>