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 * -------------------------------------------------------------------- *
15 * $Tag:: 0.2.1-FINAL $ *
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 - 2008 by Roland Haeder *
21 * For more information visit: http://www.mxchange.org *
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. *
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. *
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, *
37 ************************************************************************/
39 // Some security stuff...
40 if ((!defined('__SECURITY')) || (!IS_ADMIN())) {
41 $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
45 // Add description as navigation point
46 ADD_DESCR("admin", __FILE__);
49 // Replace german decimal commas to computer decimal dots
50 REQUEST_POST('login_bonus') = REVERT_COMMA(REQUEST_POST('login_bonus') );
51 REQUEST_POST('turbo_bonus') = REVERT_COMMA(REQUEST_POST('turbo_bonus') );
52 REQUEST_POST('bonus_ref') = REVERT_COMMA(REQUEST_POST('bonus_ref') );
53 REQUEST_POST('bonus_order') = REVERT_COMMA(REQUEST_POST('bonus_order') );
54 REQUEST_SET_POST('bonus_notify_points', REVERT_COMMA(REQUEST_POST('bonus_notify_points')));
56 // Generate string for saving ranks
57 REQUEST_SET_POST('turbo_rates', "");
59 foreach (REQUEST_POST('rate') as $rate) {
60 $rate = trim(REVERT_COMMA($rate));
61 if (!empty($rate)) $RATES[] = $rate;
63 REQUEST_SET_POST('turbo_rates', trim(implode(";", $RATES)));
64 REQUEST_UNSET_POST(('rate'));
66 // Automatically calculate bonus points for ranks 2 and 3 when not set
67 if (!REQUEST_ISSET_POST(('turbo_rates'))) REQUEST_SET_POST('turbo_rates', "".round(getConfig('turbo_bonus') / 2).";".round(getConfig('turbo_bonus') / 4)."");
70 ADMIN_SAVE_SETTINGS_POST();
72 // Remember new settings
73 setConfigEntry('bonus_active' , REQUEST_POST('bonus_active'));
74 setConfigEntry('bonus_en_notify', REQUEST_POST('bonus_en_notify'));
75 setConfigEntry('bonus_di_notify', REQUEST_POST('bonus_di_notify'));
77 // Prepare contants for the template
78 define('__LOGIN_VALUE' , TRANSLATE_COMMA(getConfig('login_bonus') , false));
79 define('__TURBO_VALUE' , TRANSLATE_COMMA(getConfig('turbo_bonus') , false));
80 define('__ORDER_VALUE' , TRANSLATE_COMMA(getConfig('bonus_order') , false));
81 define('__REF_VALUE' , TRANSLATE_COMMA(getConfig('bonus_ref') , false));
82 define('__STATS_VALUE' , TRANSLATE_COMMA(getConfig('bonus_stats') , false));
83 define('__NOTIFY_VALUE', TRANSLATE_COMMA(getConfig('bonus_notify_points'), false));
84 define('__TRANKS_VALUE', getConfig('bonus_ranks'));
85 define('__TLINES_VALUE', getConfig('bonus_lines'));
87 // Transfer options to template __MEMBER_SELECTION
88 define('__MEMBER_SELECTION', ADD_MEMBER_SELECTION_BOX(getConfig('bonus_uid'), false, true, true, "bonus_uid"));
90 // Initialize array for the points list
91 //die("*".getConfig('turbo_rates')."*");
92 $RANKS = explode(";", getConfig('turbo_rates'));
94 // Automatically calculate bonus points for ranks 2 and 3 when not set
95 if (getConfig('turbo_rates') == "") $RANKS = array(round(getConfig('turbo_bonus') / 2), round(getConfig('turbo_bonus') / 4));
98 $OUT = "<ol start=\"2\">\n";
100 foreach ($RANKS as $k => $rate) {
102 // Print only when something is in
103 $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";
109 if ($cnt >= 8) $max = $cnt+3;
111 // Add more empty fields
112 for ($i = $cnt; $i < $max; $i++) {
113 $OUT .= " <li><input type=\"text\" name=\"rate[".($i+2)."]\" class=\"admin_normal\" size=\"4\" maxlength=\"7\"> <div class=\"admin_notes\">({!POINTS!})</div?</li>\n";
116 define('__TRATES_LIST', $OUT);
118 define('__LOGIN_TIMEOUT_SELECTION', CREATE_TIME_SELECTIONS(getConfig('login_timeout') , "login_timeout" , "WDh"));
119 define('__BONUS_TIMEOUT_SELECTION', CREATE_TIME_SELECTIONS(getConfig('bonus_timeout') , "bonus_timeout" , "WDh"));
120 define('__WAIT_SELECTION' , CREATE_TIME_SELECTIONS(getConfig('bonus_notify_wait'), "bonus_notify_wait", "ms" ));
122 // Activate / Deactivate bonus active rallye (Y/N)
123 switch (getConfig('bonus_active'))
126 define('__BONUS_ACTIVE_Y', " checked=\"checked\"");
127 define('__BONUS_ACTIVE_N', "");
131 define('__BONUS_ACTIVE_Y', "");
132 define('__BONUS_ACTIVE_N', " checked=\"checked\"");
135 // Other bonus to de-/activate
136 switch (getConfig('bonus_login_yn'))
139 define('__BONUS_LOGIN_Y', " checked=\"checked\"");
140 define('__BONUS_LOGIN_N', "");
144 define('__BONUS_LOGIN_Y', "");
145 define('__BONUS_LOGIN_N', " checked=\"checked\"");
148 switch (getConfig('bonus_stats_yn'))
151 define('__BONUS_STATS_Y', " checked=\"checked\"");
152 define('__BONUS_STATS_N', "");
156 define('__BONUS_STATS_Y', "");
157 define('__BONUS_STATS_N', " checked=\"checked\"");
160 switch (getConfig('bonus_order_yn'))
163 define('__BONUS_ORDER_Y', " checked=\"checked\"");
164 define('__BONUS_ORDER_N', "");
168 define('__BONUS_ORDER_Y', "");
169 define('__BONUS_ORDER_N', " checked=\"checked\"");
172 switch (getConfig('bonus_ref_yn'))
175 define('__BONUS_REF_Y', " checked=\"checked\"");
176 define('__BONUS_REF_N', "");
180 define('__BONUS_REF_Y', "");
181 define('__BONUS_REF_N', " checked=\"checked\"");
184 switch (getConfig('bonus_click_yn'))
187 define('__BONUS_CLICK_Y', " checked=\"checked\"");
188 define('__BONUS_CLICK_N', "");
192 define('__BONUS_CLICK_Y', "");
193 define('__BONUS_CLICK_N', " checked=\"checked\"");
196 switch (getConfig('bonus_en_notify'))
199 define('__BONUS_EN_NOTIFY_Y', " checked=\"checked\"");
200 define('__BONUS_EN_NOTIFY_N', "");
204 define('__BONUS_EN_NOTIFY_Y', "");
205 define('__BONUS_EN_NOTIFY_N', " checked=\"checked\"");
208 switch (getConfig('bonus_di_notify'))
211 define('__BONUS_DI_NOTIFY_Y', " checked=\"checked\"");
212 define('__BONUS_DI_NOTIFY_N', "");
216 define('__BONUS_DI_NOTIFY_Y', "");
217 define('__BONUS_DI_NOTIFY_N', " checked=\"checked\"");
220 switch (getConfig('bonus_new_mem_notify'))
223 define('__BONUS_NEW_MEMBER_NOTIFY_Y', " checked=\"checked\"");
224 define('__BONUS_NEW_MEMBER_NOTIFY_N', "");
228 define('__BONUS_NEW_MEMBER_NOTIFY_Y', "");
229 define('__BONUS_NEW_MEMBER_NOTIFY_N', " checked=\"checked\"");
232 switch (getConfig('bonus_include_own'))
235 define('__BONUS_INCLUDE_OWN_Y', " checked=\"checked\"");
236 define('__BONUS_INCLUDE_OWN_N', "");
240 define('__BONUS_INCLUDE_OWN_Y', "");
241 define('__BONUS_INCLUDE_OWN_N', " checked=\"checked\"");
245 // Load final template
246 LOAD_TEMPLATE("admin_config_bonus", false);