2 /************************************************************************
\r
3 * MXChange v0.2.1 Start: 08/31/2004 *
\r
4 * ================ Last change: 11/14/2004 *
\r
6 * -------------------------------------------------------------------- *
\r
7 * File : what-config_bonus.php *
\r
8 * -------------------------------------------------------------------- *
\r
9 * Short description : Configure "turbo-click-bonus" *
\r
10 * -------------------------------------------------------------------- *
\r
11 * Kurzbeschreibung : Einstellen der Turbo-Klick-Verguetungen *
\r
12 * -------------------------------------------------------------------- *
\r
14 * -------------------------------------------------------------------- *
\r
15 * Copyright (c) 2003 - 2008 by Roland Haeder *
\r
16 * For more information visit: http://www.mxchange.org *
\r
18 * This program is free software; you can redistribute it and/or modify *
\r
19 * it under the terms of the GNU General Public License as published by *
\r
20 * the Free Software Foundation; either version 2 of the License, or *
\r
21 * (at your option) any later version. *
\r
23 * This program is distributed in the hope that it will be useful, *
\r
24 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
\r
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
\r
26 * GNU General Public License for more details. *
\r
28 * You should have received a copy of the GNU General Public License *
\r
29 * along with this program; if not, write to the Free Software *
\r
30 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, *
\r
31 * MA 02110-1301 USA *
\r
32 ************************************************************************/
\r
34 // Some security stuff...
\r
35 if ((ereg(basename(__FILE__), $_SERVER['PHP_SELF'])) || (!IS_ADMIN()))
\r
37 $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4)."/security.php";
\r
40 // Add description as navigation point
\r
41 ADD_DESCR("admin", basename(__FILE__));
\r
43 if (isset($_POST['ok']))
\r
45 // Replace german decimal commas to computer decimal dots
\r
46 $_POST['login_bonus'] = str_replace(",", ".", $_POST['login_bonus'] );
\r
47 $_POST['turbo_bonus'] = str_replace(",", ".", $_POST['turbo_bonus'] );
\r
48 $_POST['bonus_ref'] = str_replace(",", ".", $_POST['bonus_ref'] );
\r
49 $_POST['bonus_order'] = str_replace(",", ".", $_POST['bonus_order'] );
\r
50 $_POST['bonus_notify_points'] = str_replace(",", ".", $_POST['bonus_notify_points']);
\r
52 // Generate string for saving ranks
\r
53 $_POST['turbo_rates'] = ""; $RATES = array();
\r
54 foreach ($_POST['rate'] as $rate)
\r
56 $rate = trim(str_replace(",", ".", $rate));
\r
57 if (isset($rate)) $RATES[] = $rate;
\r
59 $_POST['turbo_rates'] = trim(implode(";", $RATES));
\r
60 unset($_POST['rate']);
\r
62 // Automatically calculate bonus points for ranks 2 and 3 when not set
\r
63 if (empty($_POST['turbo_rates'])) $_POST['turbo_rates'] = "".round($CONFIG['turbo_bonus'] / 2).";".round($CONFIG['turbo_bonus'] / 4)."";
\r
66 ADMIN_SAVE_SETTINGS($_POST, "_config", "config='0'");
\r
68 // Remember new settings
\r
69 $CONFIG['bonus_active'] = $_POST['bonus_active'];
\r
70 $CONFIG['bonus_en_notify'] = $_POST['bonus_en_notify'];
\r
71 $CONFIG['bonus_di_notify'] = $_POST['bonus_di_notify'];
\r
73 // Include sending out mails
\r
74 if ((($CONFIG['bonus_active'] == "Y") && ($CONFIG['bonus_en_notify'] == "Y")) || (($CONFIG['bonus_active'] == "N") && ($CONFIG['bonus_di_notify'] == "Y")))
\r
76 include(PATH."inc/mails/bonus_mails.php");
\r
81 // Prepare contants for the template
\r
82 define('__LOGIN_VALUE' , TRANSLATE_COMMA($CONFIG['login_bonus'] , false));
\r
83 define('__TURBO_VALUE' , TRANSLATE_COMMA($CONFIG['turbo_bonus'] , false));
\r
84 define('__ORDER_VALUE' , TRANSLATE_COMMA($CONFIG['bonus_order'] , false));
\r
85 define('__REF_VALUE' , TRANSLATE_COMMA($CONFIG['bonus_ref'] , false));
\r
86 define('__STATS_VALUE' , TRANSLATE_COMMA($CONFIG['bonus_stats'] , false));
\r
87 define('__NOTIFY_VALUE', TRANSLATE_COMMA($CONFIG['bonus_notify_points'], false));
\r
88 define('__TRANKS_VALUE', $CONFIG['bonus_ranks']);
\r
89 define('__TLINES_VALUE', $CONFIG['bonus_lines']);
\r
91 // Transfer options to template __MEMBER_SELECTION
\r
92 ADD_MEMBER_SELECTION_BOX(false, true, true, $CONFIG['bonus_uid']);
\r
94 // Initialize array for the points list
\r
95 $RANKS = explode(";", $CONFIG['bonus_rates']);
\r
97 // Automatically calculate bonus points for ranks 2 and 3 when not set
\r
98 if (empty($CONFIG['bonus_rates'])) $RANKS = array(round($CONFIG['turbo_bonus'] / 2), round($CONFIG['turbo_bonus'] / 4));
\r
101 $OUT = "<OL start=\"2\">\n";
\r
102 foreach ($RANKS as $k=>$rate)
\r
106 // Print only when something is in
\r
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";
\r
110 for ($i = 3; $i < 8; $i++)
\r
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";
\r
115 define('__TRATES_LIST', $OUT);
\r
117 define('__LOGIN_TIMEOUT_SELECTION', CREATE_TIME_SELECTIONS($CONFIG['login_timeout'] , "login_timeout" , "WDh"));
\r
118 define('__BONUS_TIMEOUT_SELECTION', CREATE_TIME_SELECTIONS($CONFIG['bonus_timeout'] , "bonus_timeout" , "WDh"));
\r
119 define('__WAIT_SELECTION' , CREATE_TIME_SELECTIONS($CONFIG['bonus_notify_wait'], "bonus_notify_wait", "ms" ));
\r
121 // Activate / Deactivate bonus active rallye (Y/N)
\r
122 switch ($CONFIG['bonus_active'])
\r
125 define('__BONUS_ACTIVE_Y', " checked");
\r
126 define('__BONUS_ACTIVE_N', "");
\r
130 define('__BONUS_ACTIVE_Y', "");
\r
131 define('__BONUS_ACTIVE_N', " checked");
\r
134 // Other bonus to de-/activate
\r
135 switch ($CONFIG['bonus_login_yn'])
\r
138 define('__BONUS_LOGIN_Y', " checked");
\r
139 define('__BONUS_LOGIN_N', "");
\r
143 define('__BONUS_LOGIN_Y', "");
\r
144 define('__BONUS_LOGIN_N', " checked");
\r
147 switch ($CONFIG['bonus_stats_yn'])
\r
150 define('__BONUS_STATS_Y', " checked");
\r
151 define('__BONUS_STATS_N', "");
\r
155 define('__BONUS_STATS_Y', "");
\r
156 define('__BONUS_STATS_N', " checked");
\r
159 switch ($CONFIG['bonus_order_yn'])
\r
162 define('__BONUS_ORDER_Y', " checked");
\r
163 define('__BONUS_ORDER_N', "");
\r
167 define('__BONUS_ORDER_Y', "");
\r
168 define('__BONUS_ORDER_N', " checked");
\r
171 switch ($CONFIG['bonus_ref_yn'])
\r
174 define('__BONUS_REF_Y', " checked");
\r
175 define('__BONUS_REF_N', "");
\r
179 define('__BONUS_REF_Y', "");
\r
180 define('__BONUS_REF_N', " checked");
\r
183 switch ($CONFIG['bonus_click_yn'])
\r
186 define('__BONUS_CLICK_Y', " checked");
\r
187 define('__BONUS_CLICK_N', "");
\r
191 define('__BONUS_CLICK_Y', "");
\r
192 define('__BONUS_CLICK_N', " checked");
\r
195 switch ($CONFIG['bonus_en_notify'])
\r
198 define('__BONUS_EN_NOTIFY_Y', " checked");
\r
199 define('__BONUS_EN_NOTIFY_N', "");
\r
203 define('__BONUS_EN_NOTIFY_Y', "");
\r
204 define('__BONUS_EN_NOTIFY_N', " checked");
\r
207 switch ($CONFIG['bonus_di_notify'])
\r
210 define('__BONUS_DI_NOTIFY_Y', " checked");
\r
211 define('__BONUS_DI_NOTIFY_N', "");
\r
215 define('__BONUS_DI_NOTIFY_Y', "");
\r
216 define('__BONUS_DI_NOTIFY_N', " checked");
\r
219 switch ($CONFIG['bonus_new_mem_notify'])
\r
222 define('__BONUS_NEW_MEMBER_NOTIFY_Y', " checked");
\r
223 define('__BONUS_NEW_MEMBER_NOTIFY_N', "");
\r
227 define('__BONUS_NEW_MEMBER_NOTIFY_Y', "");
\r
228 define('__BONUS_NEW_MEMBER_NOTIFY_N', " checked");
\r
231 switch ($CONFIG['bonus_include_own'])
\r
234 define('__BONUS_INCLUDE_OWN_Y', " checked");
\r
235 define('__BONUS_INCLUDE_OWN_N', "");
\r
239 define('__BONUS_INCLUDE_OWN_Y', "");
\r
240 define('__BONUS_INCLUDE_OWN_N', " checked");
\r
244 // Load final template
\r
245 LOAD_TEMPLATE("admin_config_bonus", false);
\r