Fixes for 'Can't use function return value in write context in /foo/bar.php'
[mailer.git] / inc / modules / admin / what-config_bonus.php
1 <?php
2 /************************************************************************
3  * MXChange v0.2.1                                    Start: 08/31/2004 *
4  * ================                             Last change: 11/14/2004 *
5  *                                                                      *
6  * -------------------------------------------------------------------- *
7  * File              : what-config_bonus.php                            *
8  * -------------------------------------------------------------------- *
9  * Short description : Configure "turbo-click-bonus"                    *
10  * -------------------------------------------------------------------- *
11  * Kurzbeschreibung  : Einstellen der Turbo-Klick-Verguetungen          *
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 german decimal commas to computer decimal dots
45         $_POST['login_bonus']         = REVERT_COMMA($_POST['login_bonus']        );
46         $_POST['turbo_bonus']         = REVERT_COMMA($_POST['turbo_bonus']        );
47         $_POST['bonus_ref']           = REVERT_COMMA($_POST['bonus_ref']          );
48         $_POST['bonus_order']         = REVERT_COMMA($_POST['bonus_order']        );
49         $_POST['bonus_notify_points'] = REVERT_COMMA($_POST['bonus_notify_points']);
50
51         // Generate string for saving ranks
52         $_POST['turbo_rates'] = ""; $RATES = array();
53         foreach ($_POST['rate'] as $rate) {
54                 $rate = trim(REVERT_COMMA($rate));
55                 if (isset($rate)) $RATES[] = $rate;
56         }
57         $_POST['turbo_rates'] = trim(implode(";", $RATES));
58         unset($_POST['rate']);
59
60         // Automatically calculate bonus points for ranks 2 and 3 when not set
61         if (empty($_POST['turbo_rates'])) $_POST['turbo_rates'] = "".round(getConfig('turbo_bonus') / 2).";".round(getConfig('turbo_bonus') / 4)."";
62
63         // Save data
64         ADMIN_SAVE_SETTINGS($_POST);
65
66         // Remember new settings
67         $_CONFIG['bonus_active']    = $_POST['bonus_active'];
68         $_CONFIG['bonus_en_notify'] = $_POST['bonus_en_notify'];
69         $_CONFIG['bonus_di_notify'] = $_POST['bonus_di_notify'];
70 } else {
71         // Prepare contants for the template
72         define('__LOGIN_VALUE' , TRANSLATE_COMMA(getConfig('login_bonus')        , false));
73         define('__TURBO_VALUE' , TRANSLATE_COMMA(getConfig('turbo_bonus')        , false));
74         define('__ORDER_VALUE' , TRANSLATE_COMMA(getConfig('bonus_order')        , false));
75         define('__REF_VALUE'   , TRANSLATE_COMMA(getConfig('bonus_ref')          , false));
76         define('__STATS_VALUE' , TRANSLATE_COMMA(getConfig('bonus_stats')        , false));
77         define('__NOTIFY_VALUE', TRANSLATE_COMMA(getConfig('bonus_notify_points'), false));
78         define('__TRANKS_VALUE', getConfig('bonus_ranks'));
79         define('__TLINES_VALUE', getConfig('bonus_lines'));
80
81         // Transfer options to template __MEMBER_SELECTION
82         define('__MEMBER_SELECTION', ADD_MEMBER_SELECTION_BOX(getConfig('bonus_uid'), false, true, true, "bonus_uid"));
83
84         // Initialize array for the points list
85         //die("*".getConfig('turbo_rates')."*");
86         $RANKS = explode(";", getConfig('turbo_rates'));
87
88         // Automatically calculate bonus points for ranks 2 and 3 when not set
89         if (getConfig('turbo_rates') == "") $RANKS = array(round(getConfig('turbo_bonus') / 2), round(getConfig('turbo_bonus') / 4));
90
91         // Generate list
92         $OUT = "<OL start=\"2\">\n";
93         $cnt = 0;
94         foreach ($RANKS as $k => $rate) {
95                 if (!empty($rate))      {
96                         // Print only when something is in
97                         $OUT .= "  <LI><INPUT type=\"text\" name=\"rate[".($k + 2)."]\" class=\"admin_normal\" size=\"4\" maxlength=\"7\" value=\"".$rate."\">&nbsp;<FONT class=\"admin_notes\">(".POINTS.")</FONT?</LI>\n";
98                 }
99                 $cnt++;
100         }
101         // Maxmium entries
102         $max = 10;
103         if ($cnt >= 8) $max = $cnt+3;
104
105         // Add more empty fields
106         for ($i = $cnt; $i < $max; $i++) {
107                 $OUT .= "  <LI><INPUT type=\"text\" name=\"rate[".($i+2)."]\" class=\"admin_normal\" size=\"4\" maxlength=\"7\">&nbsp;<FONT class=\"admin_notes\">(".POINTS.")</FONT?</LI>\n";
108         }
109         $OUT .= "</OL>\n";
110         define('__TRATES_LIST', $OUT);
111
112         define('__LOGIN_TIMEOUT_SELECTION', CREATE_TIME_SELECTIONS(getConfig('login_timeout')    , "login_timeout"    , "WDh"));
113         define('__BONUS_TIMEOUT_SELECTION', CREATE_TIME_SELECTIONS(getConfig('bonus_timeout')    , "bonus_timeout"    , "WDh"));
114         define('__WAIT_SELECTION'         , CREATE_TIME_SELECTIONS(getConfig('bonus_notify_wait'), "bonus_notify_wait", "ms" ));
115
116         // Activate / Deactivate bonus active rallye (Y/N)
117         switch (getConfig('bonus_active'))
118         {
119         case "Y":
120                 define('__BONUS_ACTIVE_Y', " checked=\"checked\"");
121                 define('__BONUS_ACTIVE_N', "");
122                 break;
123
124         case "N":
125                 define('__BONUS_ACTIVE_Y', "");
126                 define('__BONUS_ACTIVE_N', " checked=\"checked\"");
127                 break;
128         }
129         // Other bonus to de-/activate
130         switch (getConfig('bonus_login_yn'))
131         {
132         case "Y":
133                 define('__BONUS_LOGIN_Y', " checked=\"checked\"");
134                 define('__BONUS_LOGIN_N', "");
135                 break;
136
137         case "N":
138                 define('__BONUS_LOGIN_Y', "");
139                 define('__BONUS_LOGIN_N', " checked=\"checked\"");
140                 break;
141         }
142         switch (getConfig('bonus_stats_yn'))
143         {
144         case "Y":
145                 define('__BONUS_STATS_Y', " checked=\"checked\"");
146                 define('__BONUS_STATS_N', "");
147                 break;
148
149         case "N":
150                 define('__BONUS_STATS_Y', "");
151                 define('__BONUS_STATS_N', " checked=\"checked\"");
152                 break;
153         }
154         switch (getConfig('bonus_order_yn'))
155         {
156         case "Y":
157                 define('__BONUS_ORDER_Y', " checked=\"checked\"");
158                 define('__BONUS_ORDER_N', "");
159                 break;
160
161         case "N":
162                 define('__BONUS_ORDER_Y', "");
163                 define('__BONUS_ORDER_N', " checked=\"checked\"");
164                 break;
165         }
166         switch (getConfig('bonus_ref_yn'))
167         {
168         case "Y":
169                 define('__BONUS_REF_Y', " checked=\"checked\"");
170                 define('__BONUS_REF_N', "");
171                 break;
172
173         case "N":
174                 define('__BONUS_REF_Y', "");
175                 define('__BONUS_REF_N', " checked=\"checked\"");
176                 break;
177         }
178         switch (getConfig('bonus_click_yn'))
179         {
180         case "Y":
181                 define('__BONUS_CLICK_Y', " checked=\"checked\"");
182                 define('__BONUS_CLICK_N', "");
183                 break;
184
185         case "N":
186                 define('__BONUS_CLICK_Y', "");
187                 define('__BONUS_CLICK_N', " checked=\"checked\"");
188                 break;
189         }
190         switch (getConfig('bonus_en_notify'))
191         {
192         case "Y":
193                 define('__BONUS_EN_NOTIFY_Y', " checked=\"checked\"");
194                 define('__BONUS_EN_NOTIFY_N', "");
195                 break;
196
197         case "N":
198                 define('__BONUS_EN_NOTIFY_Y', "");
199                 define('__BONUS_EN_NOTIFY_N', " checked=\"checked\"");
200                 break;
201         }
202         switch (getConfig('bonus_di_notify'))
203         {
204         case "Y":
205                 define('__BONUS_DI_NOTIFY_Y', " checked=\"checked\"");
206                 define('__BONUS_DI_NOTIFY_N', "");
207                 break;
208
209         case "N":
210                 define('__BONUS_DI_NOTIFY_Y', "");
211                 define('__BONUS_DI_NOTIFY_N', " checked=\"checked\"");
212                 break;
213         }
214         switch (getConfig('bonus_new_mem_notify'))
215         {
216         case "Y":
217                 define('__BONUS_NEW_MEMBER_NOTIFY_Y', " checked=\"checked\"");
218                 define('__BONUS_NEW_MEMBER_NOTIFY_N', "");
219                 break;
220
221         case "N":
222                 define('__BONUS_NEW_MEMBER_NOTIFY_Y', "");
223                 define('__BONUS_NEW_MEMBER_NOTIFY_N', " checked=\"checked\"");
224                 break;
225         }
226         switch (getConfig('bonus_include_own'))
227         {
228         case "Y":
229                 define('__BONUS_INCLUDE_OWN_Y', " checked=\"checked\"");
230                 define('__BONUS_INCLUDE_OWN_N', "");
231                 break;
232
233         case "N":
234                 define('__BONUS_INCLUDE_OWN_Y', "");
235                 define('__BONUS_INCLUDE_OWN_N', " checked=\"checked\"");
236                 break;
237         }
238
239         // Load final template
240         LOAD_TEMPLATE("admin_config_bonus", false);
241 }
242 //
243 ?>