More use of REVERT_COMMA() fixes problems
[mailer.git] / inc / modules / admin / what-config_surfbar.php
1 <?php
2 /************************************************************************
3  * MXChange v0.2.1                                    Start: 08/31/2008 *
4  * ================                             Last change: 08/31/2008 *
5  *                                                                      *
6  * -------------------------------------------------------------------- *
7  * File              : what-config_surfbar.php                          *
8  * -------------------------------------------------------------------- *
9  * Short description : Configuration for surfbar                        *
10  * -------------------------------------------------------------------- *
11  * Kurzbeschreibung  : Konfiguration fuer Surfbar                       *
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", basename(__FILE__));
42
43 // Was the form submitted?
44 if (isset($_POST['ok'])) {
45         // Replace german decimal comma with computer decimal dot
46         if (isset($_POST['surfbar_static_reward']))   $_POST['surfbar_static_reward']   = REVERT_COMMA($_POST['surfbar_static_reward']);
47         if (isset($_POST['surfbar_static_costs']))    $_POST['surfbar_static_costs']    = REVERT_COMMA($_POST['surfbar_static_costs']);
48         if (isset($_POST['surfbar_dynamic_percent'])) $_POST['surfbar_dynamic_percent'] = REVERT_COMMA($_POST['surfbar_dynamic_percent']);
49
50         // Save settings
51         ADMIN_SAVE_SETTINGS($_POST);
52 } else {
53         // Prepare content
54         $content = array(
55                 'surfbar_static_reward'   => TRANSLATE_COMMA($_CONFIG['surfbar_static_reward']),
56                 'surfbar_static_costs'    => TRANSLATE_COMMA($_CONFIG['surfbar_static_costs']),
57                 // @TODO Rewrite this to tiny selection boxes
58                 'surfbar_static_time'     => $_CONFIG['surfbar_static_time'],
59                 // @TODO Rewrite this to tiny selection boxes
60                 'surfbar_restart_time'    => $_CONFIG['surfbar_restart_time'],
61                 'surfbar_static_lock'     => $_CONFIG['surfbar_static_lock'],
62                 'surfbar_dynamic_percent' => TRANSLATE_COMMA($_CONFIG['surfbar_dynamic_percent']),
63                 'surfbar_max_order'       => $_CONFIG['surfbar_max_order'],
64                 // @TODO Rewrite this to tiny selection boxes
65                 'surfbar_stats_reload'    => $_CONFIG['surfbar_stats_reload'],
66                 // @TODO Rewrite this to tiny selection boxes
67                 'surfbar_purge_deleted'   => $_CONFIG['surfbar_purge_deleted'],
68                 // @TODO Rewrite this to tiny selection boxes
69                 'surfbar_purge_migrated'  => $_CONFIG['surfbar_purge_migrated'],
70                 'surfbar_pause_url'       => $_CONFIG['surfbar_pause_url'],
71                 'surfbar_warn_low_points' => $_CONFIG['surfbar_warn_low_points'],
72                 // @TODO Rewrite this to tiny selection boxes
73                 'surfbar_low_interval'    => $_CONFIG['surfbar_low_interval'],
74         );
75
76         // Prepare payment model for template
77         if ($_CONFIG['surfbar_pay_model'] == "STATIC") {
78                 // Static model
79                 define('__CONFIG_SURFBAR_PAY_MODEL_STATIC' , " checked=\"checked\"");
80                 define('__CONFIG_SURFBAR_PAY_MODEL_DYNAMIC', "");
81         } else {
82                 // Dynamic model
83                 define('__CONFIG_SURFBAR_PAY_MODEL_STATIC' , "");
84                 define('__CONFIG_SURFBAR_PAY_MODEL_DYNAMIC', " checked=\"checked\"");
85         }
86
87         // Prepare auto-sart
88         if ($_CONFIG['surfbar_autostart'] == "Y") {
89                 // Yes selected
90                 define('__CONFIG_SURFBAR_AUTOSTART_Y', " checked=\"checked\"");
91                 define('__CONFIG_SURFBAR_AUTOSTART_N', "");
92         } else {
93                 // No selected
94                 define('__CONFIG_SURFBAR_AUTOSTART_Y', "");
95                 define('__CONFIG_SURFBAR_AUTOSTART_N', " checked=\"checked\"");
96         }
97
98         // Prepare notify limits
99         if ($_CONFIG['surfbar_notify_limits'] == "Y") {
100                 // Yes selected
101                 define('__CONFIG_SURFBAR_NOTIFY_LIMITS_Y', " checked=\"checked\"");
102                 define('__CONFIG_SURFBAR_NOTIFY_LIMITS_N', "");
103         } else {
104                 // No selected
105                 define('__CONFIG_SURFBAR_NOTIFY_LIMITS_Y', "");
106                 define('__CONFIG_SURFBAR_NOTIFY_LIMITS_N', " checked=\"checked\"");
107         }
108
109         // Prepare order migration
110         if ($_CONFIG['surfbar_migrate_order'] == "Y") {
111                 // Yes selected
112                 define('__CONFIG_SURFBAR_MIGRATE_ORDER_Y', " checked=\"checked\"");
113                 define('__CONFIG_SURFBAR_MIGRATE_ORDER_N', "");
114         } else {
115                 // No selected
116                 define('__CONFIG_SURFBAR_MIGRATE_ORDER_Y', "");
117                 define('__CONFIG_SURFBAR_MIGRATE_ORDER_N', " checked=\"checked\"");
118         }
119
120         // Pause URL mode
121         if ($_CONFIG['surfbar_pause_mode'] == "INTERNAL") {
122                 // Internal pause page
123                 define('__CONFIG_SURFBAR_PAUSE_MODE_INTERNAL', " checked=\"checked\"");
124                 define('__CONFIG_SURFBAR_PAUSE_MODE_EXTERNAL', "");
125         } else {
126                 // External pause page (if not empty)
127                 define('__CONFIG_SURFBAR_PAUSE_MODE_INTERNAL', "");
128                 define('__CONFIG_SURFBAR_PAUSE_MODE_EXTERNAL', " checked=\"checked\"");
129         }
130
131         // Notification mode
132         if ($_CONFIG['surfbar_notification_mode'] == "INSTANT") {
133                 // Instant notification
134                 define('__CONFIG_SURFBAR_NOTIFICATION_MODE_INSTANT', " selected=\"selected\"");
135                 define('__CONFIG_SURFBAR_NOTIFICATION_MODE_RESET'  , "");
136         } else {
137                 // Only daily reset
138                 define('__CONFIG_SURFBAR_NOTIFICATION_MODE_INSTANT', "");
139                 define('__CONFIG_SURFBAR_NOTIFICATION_MODE_RESET'  , " selected=\"selected\"");
140         }
141
142         // Load template
143         LOAD_TEMPLATE("admin_config_surfbar", false, $content);
144 }
145
146 //
147 ?>