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 ((ereg(basename(__FILE__), $_SERVER['PHP_SELF'])) || (!IS_ADMIN()))
37 $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
40 // Add description as navigation point
41 ADD_DESCR("admin", basename(__FILE__));
43 if (isset($_POST['ok']))
45 // Replace german decimal commas to computer decimal dots
46 $_POST['login_bonus'] = str_replace(",", ".", $_POST['login_bonus'] );
47 $_POST['turbo_bonus'] = str_replace(",", ".", $_POST['turbo_bonus'] );
48 $_POST['bonus_ref'] = str_replace(",", ".", $_POST['bonus_ref'] );
49 $_POST['bonus_order'] = str_replace(",", ".", $_POST['bonus_order'] );
50 $_POST['bonus_notify_points'] = str_replace(",", ".", $_POST['bonus_notify_points']);
52 // Generate string for saving ranks
53 $_POST['turbo_rates'] = ""; $RATES = array();
54 foreach ($_POST['rate'] as $rate)
56 $rate = trim(str_replace(",", ".", $rate));
57 if (isset($rate)) $RATES[] = $rate;
59 $_POST['turbo_rates'] = trim(implode(";", $RATES));
60 unset($_POST['rate']);
62 // Automatically calculate bonus points for ranks 2 and 3 when not set
63 if (empty($_POST['turbo_rates'])) $_POST['turbo_rates'] = "".round($_CONFIG['turbo_bonus'] / 2).";".round($_CONFIG['turbo_bonus'] / 4)."";
66 ADMIN_SAVE_SETTINGS($_POST);
68 // Remember new settings
69 $_CONFIG['bonus_active'] = $_POST['bonus_active'];
70 $_CONFIG['bonus_en_notify'] = $_POST['bonus_en_notify'];
71 $_CONFIG['bonus_di_notify'] = $_POST['bonus_di_notify'];
73 // Include sending out mails
74 if ((($_CONFIG['bonus_active'] == "Y") && ($_CONFIG['bonus_en_notify'] == "Y")) || (($_CONFIG['bonus_active'] == "N") && ($_CONFIG['bonus_di_notify'] == "Y")))
76 include(PATH."inc/mails/bonus_mails.php");
81 // Prepare contants for the template
82 define('__LOGIN_VALUE' , TRANSLATE_COMMA($_CONFIG['login_bonus'] , false));
83 define('__TURBO_VALUE' , TRANSLATE_COMMA($_CONFIG['turbo_bonus'] , false));
84 define('__ORDER_VALUE' , TRANSLATE_COMMA($_CONFIG['bonus_order'] , false));
85 define('__REF_VALUE' , TRANSLATE_COMMA($_CONFIG['bonus_ref'] , false));
86 define('__STATS_VALUE' , TRANSLATE_COMMA($_CONFIG['bonus_stats'] , false));
87 define('__NOTIFY_VALUE', TRANSLATE_COMMA($_CONFIG['bonus_notify_points'], false));
88 define('__TRANKS_VALUE', $_CONFIG['bonus_ranks']);
89 define('__TLINES_VALUE', $_CONFIG['bonus_lines']);
91 // Transfer options to template __MEMBER_SELECTION
92 ADD_MEMBER_SELECTION_BOX(false, true, true, $_CONFIG['bonus_uid']);
94 // Initialize array for the points list
95 $RANKS = explode(";", $_CONFIG['bonus_rates']);
97 // Automatically calculate bonus points for ranks 2 and 3 when not set
98 if (empty($_CONFIG['bonus_rates'])) $RANKS = array(round($_CONFIG['turbo_bonus'] / 2), round($_CONFIG['turbo_bonus'] / 4));
101 $OUT = "<OL start=\"2\">\n";
102 foreach ($RANKS as $k=>$rate)
106 // Print only when something is in
107 $OUT .= " <LI><INPUT type=\"text\" name=\"rate[".($k + 2)."]\" class=\"admin_normal\" size=\"4\" maxlength=\"7\" value=\"".$rate."\"> <FONT class=\"admin_notes\">(".POINTS.")</FONT?</LI>\n";
110 for ($i = 3; $i < 8; $i++)
112 $OUT .= " <LI><INPUT type=\"text\" name=\"rate[".($k + $i)."]\" class=\"admin_normal\" size=\"4\" maxlength=\"7\"> <FONT class=\"admin_notes\">(".POINTS.")</FONT?</LI>\n";
115 define('__TRATES_LIST', $OUT);
117 define('__LOGIN_TIMEOUT_SELECTION', CREATE_TIME_SELECTIONS($_CONFIG['login_timeout'] , "login_timeout" , "WDh"));
118 define('__BONUS_TIMEOUT_SELECTION', CREATE_TIME_SELECTIONS($_CONFIG['bonus_timeout'] , "bonus_timeout" , "WDh"));
119 define('__WAIT_SELECTION' , CREATE_TIME_SELECTIONS($_CONFIG['bonus_notify_wait'], "bonus_notify_wait", "ms" ));
121 // Activate / Deactivate bonus active rallye (Y/N)
122 switch ($_CONFIG['bonus_active'])
125 define('__BONUS_ACTIVE_Y', ' checked');
126 define('__BONUS_ACTIVE_N', "");
130 define('__BONUS_ACTIVE_Y', "");
131 define('__BONUS_ACTIVE_N', ' checked');
134 // Other bonus to de-/activate
135 switch ($_CONFIG['bonus_login_yn'])
138 define('__BONUS_LOGIN_Y', ' checked');
139 define('__BONUS_LOGIN_N', "");
143 define('__BONUS_LOGIN_Y', "");
144 define('__BONUS_LOGIN_N', ' checked');
147 switch ($_CONFIG['bonus_stats_yn'])
150 define('__BONUS_STATS_Y', ' checked');
151 define('__BONUS_STATS_N', "");
155 define('__BONUS_STATS_Y', "");
156 define('__BONUS_STATS_N', ' checked');
159 switch ($_CONFIG['bonus_order_yn'])
162 define('__BONUS_ORDER_Y', ' checked');
163 define('__BONUS_ORDER_N', "");
167 define('__BONUS_ORDER_Y', "");
168 define('__BONUS_ORDER_N', ' checked');
171 switch ($_CONFIG['bonus_ref_yn'])
174 define('__BONUS_REF_Y', ' checked');
175 define('__BONUS_REF_N', "");
179 define('__BONUS_REF_Y', "");
180 define('__BONUS_REF_N', ' checked');
183 switch ($_CONFIG['bonus_click_yn'])
186 define('__BONUS_CLICK_Y', ' checked');
187 define('__BONUS_CLICK_N', "");
191 define('__BONUS_CLICK_Y', "");
192 define('__BONUS_CLICK_N', ' checked');
195 switch ($_CONFIG['bonus_en_notify'])
198 define('__BONUS_EN_NOTIFY_Y', ' checked');
199 define('__BONUS_EN_NOTIFY_N', "");
203 define('__BONUS_EN_NOTIFY_Y', "");
204 define('__BONUS_EN_NOTIFY_N', ' checked');
207 switch ($_CONFIG['bonus_di_notify'])
210 define('__BONUS_DI_NOTIFY_Y', ' checked');
211 define('__BONUS_DI_NOTIFY_N', "");
215 define('__BONUS_DI_NOTIFY_Y', "");
216 define('__BONUS_DI_NOTIFY_N', ' checked');
219 switch ($_CONFIG['bonus_new_mem_notify'])
222 define('__BONUS_NEW_MEMBER_NOTIFY_Y', ' checked');
223 define('__BONUS_NEW_MEMBER_NOTIFY_N', "");
227 define('__BONUS_NEW_MEMBER_NOTIFY_Y', "");
228 define('__BONUS_NEW_MEMBER_NOTIFY_N', ' checked');
231 switch ($_CONFIG['bonus_include_own'])
234 define('__BONUS_INCLUDE_OWN_Y', ' checked');
235 define('__BONUS_INCLUDE_OWN_N', "");
239 define('__BONUS_INCLUDE_OWN_Y', "");
240 define('__BONUS_INCLUDE_OWN_N', ' checked');
244 // Load final template
245 LOAD_TEMPLATE("admin_config_bonus", false);