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__);
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']);
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;
57 $_POST['turbo_rates'] = trim(implode(";", $RATES));
58 unset($_POST['rate']);
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)."";
64 ADMIN_SAVE_SETTINGS($_POST);
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'];
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'));
81 // Transfer options to template __MEMBER_SELECTION
82 define('__MEMBER_SELECTION', ADD_MEMBER_SELECTION_BOX(getConfig('bonus_uid'), false, true, true, "bonus_uid"));
84 // Initialize array for the points list
85 //die("*".getConfig('turbo_rates')."*");
86 $RANKS = explode(";", getConfig('turbo_rates'));
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));
92 $OUT = "<ol start=\"2\">\n";
94 foreach ($RANKS as $k => $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."\"> <div class=\"admin_notes\">(".POINTS.")</div?</li>\n";
103 if ($cnt >= 8) $max = $cnt+3;
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\"> <div class=\"admin_notes\">(".POINTS.")</div?</li>\n";
110 define('__TRATES_LIST', $OUT);
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" ));
116 // Activate / Deactivate bonus active rallye (Y/N)
117 switch (getConfig('bonus_active'))
120 define('__BONUS_ACTIVE_Y', " checked=\"checked\"");
121 define('__BONUS_ACTIVE_N', "");
125 define('__BONUS_ACTIVE_Y', "");
126 define('__BONUS_ACTIVE_N', " checked=\"checked\"");
129 // Other bonus to de-/activate
130 switch (getConfig('bonus_login_yn'))
133 define('__BONUS_LOGIN_Y', " checked=\"checked\"");
134 define('__BONUS_LOGIN_N', "");
138 define('__BONUS_LOGIN_Y', "");
139 define('__BONUS_LOGIN_N', " checked=\"checked\"");
142 switch (getConfig('bonus_stats_yn'))
145 define('__BONUS_STATS_Y', " checked=\"checked\"");
146 define('__BONUS_STATS_N', "");
150 define('__BONUS_STATS_Y', "");
151 define('__BONUS_STATS_N', " checked=\"checked\"");
154 switch (getConfig('bonus_order_yn'))
157 define('__BONUS_ORDER_Y', " checked=\"checked\"");
158 define('__BONUS_ORDER_N', "");
162 define('__BONUS_ORDER_Y', "");
163 define('__BONUS_ORDER_N', " checked=\"checked\"");
166 switch (getConfig('bonus_ref_yn'))
169 define('__BONUS_REF_Y', " checked=\"checked\"");
170 define('__BONUS_REF_N', "");
174 define('__BONUS_REF_Y', "");
175 define('__BONUS_REF_N', " checked=\"checked\"");
178 switch (getConfig('bonus_click_yn'))
181 define('__BONUS_CLICK_Y', " checked=\"checked\"");
182 define('__BONUS_CLICK_N', "");
186 define('__BONUS_CLICK_Y', "");
187 define('__BONUS_CLICK_N', " checked=\"checked\"");
190 switch (getConfig('bonus_en_notify'))
193 define('__BONUS_EN_NOTIFY_Y', " checked=\"checked\"");
194 define('__BONUS_EN_NOTIFY_N', "");
198 define('__BONUS_EN_NOTIFY_Y', "");
199 define('__BONUS_EN_NOTIFY_N', " checked=\"checked\"");
202 switch (getConfig('bonus_di_notify'))
205 define('__BONUS_DI_NOTIFY_Y', " checked=\"checked\"");
206 define('__BONUS_DI_NOTIFY_N', "");
210 define('__BONUS_DI_NOTIFY_Y', "");
211 define('__BONUS_DI_NOTIFY_N', " checked=\"checked\"");
214 switch (getConfig('bonus_new_mem_notify'))
217 define('__BONUS_NEW_MEMBER_NOTIFY_Y', " checked=\"checked\"");
218 define('__BONUS_NEW_MEMBER_NOTIFY_N', "");
222 define('__BONUS_NEW_MEMBER_NOTIFY_Y', "");
223 define('__BONUS_NEW_MEMBER_NOTIFY_N', " checked=\"checked\"");
226 switch (getConfig('bonus_include_own'))
229 define('__BONUS_INCLUDE_OWN_Y', " checked=\"checked\"");
230 define('__BONUS_INCLUDE_OWN_N', "");
234 define('__BONUS_INCLUDE_OWN_Y', "");
235 define('__BONUS_INCLUDE_OWN_N', " checked=\"checked\"");
239 // Load final template
240 LOAD_TEMPLATE("admin_config_bonus", false);