2 /************************************************************************
3 * MXChange v0.2.1 Start: 08/31/2004 *
4 * ================ Last change: 11/14/2004 *
6 * -------------------------------------------------------------------- *
7 * File : what-config_bonus.php *
8 * -------------------------------------------------------------------- *
9 * Short description : Configure "turbo-click-bonus" *
10 * -------------------------------------------------------------------- *
11 * Kurzbeschreibung : Einstellen der Turbo-Klick-Verguetungen *
12 * -------------------------------------------------------------------- *
14 * -------------------------------------------------------------------- *
15 * Copyright (c) 2003 - 2008 by Roland Haeder *
16 * For more information visit: http://www.mxchange.org *
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. *
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. *
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, *
32 ************************************************************************/
34 // Some security stuff...
35 if ((!defined('__SECURITY')) || (!IS_ADMIN())) {
36 $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
40 // Add description as navigation point
41 ADD_DESCR("admin", __FILE__);
44 // Replace german decimal commas to computer decimal dots
45 REQUEST_POST('login_bonus') = REVERT_COMMA(REQUEST_POST('login_bonus') );
46 REQUEST_POST('turbo_bonus') = REVERT_COMMA(REQUEST_POST('turbo_bonus') );
47 REQUEST_POST('bonus_ref') = REVERT_COMMA(REQUEST_POST('bonus_ref') );
48 REQUEST_POST('bonus_order') = REVERT_COMMA(REQUEST_POST('bonus_order') );
49 REQUEST_SET_POST('bonus_notify_points', REVERT_COMMA(REQUEST_POST('bonus_notify_points')));
51 // Generate string for saving ranks
52 REQUEST_SET_POST('turbo_rates', "");
54 foreach (REQUEST_POST('rate') as $rate) {
55 $rate = trim(REVERT_COMMA($rate));
56 if (!empty($rate)) $RATES[] = $rate;
58 REQUEST_SET_POST('turbo_rates', trim(implode(";", $RATES)));
59 REQUEST_UNSET_POST(('rate'));
61 // Automatically calculate bonus points for ranks 2 and 3 when not set
62 if (!REQUEST_ISSET_POST(('turbo_rates'))) REQUEST_SET_POST('turbo_rates', "".round(getConfig('turbo_bonus') / 2).";".round(getConfig('turbo_bonus') / 4)."");
65 ADMIN_SAVE_SETTINGS_POST();
67 // Remember new settings
68 setConfigEntry('bonus_active' , REQUEST_POST('bonus_active'));
69 setConfigEntry('bonus_en_notify', REQUEST_POST('bonus_en_notify'));
70 setConfigEntry('bonus_di_notify', REQUEST_POST('bonus_di_notify'));
72 // Prepare contants for the template
73 define('__LOGIN_VALUE' , TRANSLATE_COMMA(getConfig('login_bonus') , false));
74 define('__TURBO_VALUE' , TRANSLATE_COMMA(getConfig('turbo_bonus') , false));
75 define('__ORDER_VALUE' , TRANSLATE_COMMA(getConfig('bonus_order') , false));
76 define('__REF_VALUE' , TRANSLATE_COMMA(getConfig('bonus_ref') , false));
77 define('__STATS_VALUE' , TRANSLATE_COMMA(getConfig('bonus_stats') , false));
78 define('__NOTIFY_VALUE', TRANSLATE_COMMA(getConfig('bonus_notify_points'), false));
79 define('__TRANKS_VALUE', getConfig('bonus_ranks'));
80 define('__TLINES_VALUE', getConfig('bonus_lines'));
82 // Transfer options to template __MEMBER_SELECTION
83 define('__MEMBER_SELECTION', ADD_MEMBER_SELECTION_BOX(getConfig('bonus_uid'), false, true, true, "bonus_uid"));
85 // Initialize array for the points list
86 //die("*".getConfig('turbo_rates')."*");
87 $RANKS = explode(";", getConfig('turbo_rates'));
89 // Automatically calculate bonus points for ranks 2 and 3 when not set
90 if (getConfig('turbo_rates') == "") $RANKS = array(round(getConfig('turbo_bonus') / 2), round(getConfig('turbo_bonus') / 4));
93 $OUT = "<ol start=\"2\">\n";
95 foreach ($RANKS as $k => $rate) {
97 // Print only when something is in
98 $OUT .= " <li><input type=\"text\" name=\"rate[".($k + 2)."]\" class=\"admin_normal\" size=\"4\" maxlength=\"7\" value=\"".$rate."\"> <div class=\"admin_notes\">({!POINTS!})</div?</li>\n";
104 if ($cnt >= 8) $max = $cnt+3;
106 // Add more empty fields
107 for ($i = $cnt; $i < $max; $i++) {
108 $OUT .= " <li><input type=\"text\" name=\"rate[".($i+2)."]\" class=\"admin_normal\" size=\"4\" maxlength=\"7\"> <div class=\"admin_notes\">({!POINTS!})</div?</li>\n";
111 define('__TRATES_LIST', $OUT);
113 define('__LOGIN_TIMEOUT_SELECTION', CREATE_TIME_SELECTIONS(getConfig('login_timeout') , "login_timeout" , "WDh"));
114 define('__BONUS_TIMEOUT_SELECTION', CREATE_TIME_SELECTIONS(getConfig('bonus_timeout') , "bonus_timeout" , "WDh"));
115 define('__WAIT_SELECTION' , CREATE_TIME_SELECTIONS(getConfig('bonus_notify_wait'), "bonus_notify_wait", "ms" ));
117 // Activate / Deactivate bonus active rallye (Y/N)
118 switch (getConfig('bonus_active'))
121 define('__BONUS_ACTIVE_Y', " checked=\"checked\"");
122 define('__BONUS_ACTIVE_N', "");
126 define('__BONUS_ACTIVE_Y', "");
127 define('__BONUS_ACTIVE_N', " checked=\"checked\"");
130 // Other bonus to de-/activate
131 switch (getConfig('bonus_login_yn'))
134 define('__BONUS_LOGIN_Y', " checked=\"checked\"");
135 define('__BONUS_LOGIN_N', "");
139 define('__BONUS_LOGIN_Y', "");
140 define('__BONUS_LOGIN_N', " checked=\"checked\"");
143 switch (getConfig('bonus_stats_yn'))
146 define('__BONUS_STATS_Y', " checked=\"checked\"");
147 define('__BONUS_STATS_N', "");
151 define('__BONUS_STATS_Y', "");
152 define('__BONUS_STATS_N', " checked=\"checked\"");
155 switch (getConfig('bonus_order_yn'))
158 define('__BONUS_ORDER_Y', " checked=\"checked\"");
159 define('__BONUS_ORDER_N', "");
163 define('__BONUS_ORDER_Y', "");
164 define('__BONUS_ORDER_N', " checked=\"checked\"");
167 switch (getConfig('bonus_ref_yn'))
170 define('__BONUS_REF_Y', " checked=\"checked\"");
171 define('__BONUS_REF_N', "");
175 define('__BONUS_REF_Y', "");
176 define('__BONUS_REF_N', " checked=\"checked\"");
179 switch (getConfig('bonus_click_yn'))
182 define('__BONUS_CLICK_Y', " checked=\"checked\"");
183 define('__BONUS_CLICK_N', "");
187 define('__BONUS_CLICK_Y', "");
188 define('__BONUS_CLICK_N', " checked=\"checked\"");
191 switch (getConfig('bonus_en_notify'))
194 define('__BONUS_EN_NOTIFY_Y', " checked=\"checked\"");
195 define('__BONUS_EN_NOTIFY_N', "");
199 define('__BONUS_EN_NOTIFY_Y', "");
200 define('__BONUS_EN_NOTIFY_N', " checked=\"checked\"");
203 switch (getConfig('bonus_di_notify'))
206 define('__BONUS_DI_NOTIFY_Y', " checked=\"checked\"");
207 define('__BONUS_DI_NOTIFY_N', "");
211 define('__BONUS_DI_NOTIFY_Y', "");
212 define('__BONUS_DI_NOTIFY_N', " checked=\"checked\"");
215 switch (getConfig('bonus_new_mem_notify'))
218 define('__BONUS_NEW_MEMBER_NOTIFY_Y', " checked=\"checked\"");
219 define('__BONUS_NEW_MEMBER_NOTIFY_N', "");
223 define('__BONUS_NEW_MEMBER_NOTIFY_Y', "");
224 define('__BONUS_NEW_MEMBER_NOTIFY_N', " checked=\"checked\"");
227 switch (getConfig('bonus_include_own'))
230 define('__BONUS_INCLUDE_OWN_Y', " checked=\"checked\"");
231 define('__BONUS_INCLUDE_OWN_N', "");
235 define('__BONUS_INCLUDE_OWN_Y', "");
236 define('__BONUS_INCLUDE_OWN_N', " checked=\"checked\"");
240 // Load final template
241 LOAD_TEMPLATE("admin_config_bonus", false);