2 /************************************************************************
3 * Mailer v0.2.1-FINAL 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 * -------------------------------------------------------------------- *
18 * Copyright (c) 2003 - 2009 by Roland Haeder *
19 * Copyright (c) 2009 - 2013 by Mailer Developer Team *
20 * For more information visit: http://mxchange.org *
22 * This program is free software; you can redistribute it and/or modify *
23 * it under the terms of the GNU General Public License as published by *
24 * the Free Software Foundation; either version 2 of the License, or *
25 * (at your option) any later version. *
27 * This program is distributed in the hope that it will be useful, *
28 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
29 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
30 * GNU General Public License for more details. *
32 * You should have received a copy of the GNU General Public License *
33 * along with this program; if not, write to the Free Software *
34 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, *
36 ************************************************************************/
38 // Some security stuff...
39 if ((!defined('__SECURITY')) || (!isAdmin())) {
43 // Add description as navigation point
44 addYouAreHereLink('admin', __FILE__);
46 if (isFormSent('save_config')) {
47 // Replace german decimal comma with computer decimal dot
48 convertCommaToDotInPostDataArray(array('login_bonus', 'turbo_bonus', 'bonus_ref', 'bonus_order', 'bonus_notify_points'));
50 // Generate string for saving ranks
51 setPostRequestElement('turbo_rates', '');
53 foreach (postRequestElement('rate') as $rate) {
54 // Convert German comma to dot
55 $rate = trim(convertCommaToDot($rate));
58 array_push($RATES, $rate);
61 setPostRequestElement('turbo_rates', trim(implode(';', $RATES)));
62 unsetPostRequestElement('rate');
64 // Automatically calculate bonus points for ranks 2 and 3 when not set
65 if (!isPostRequestElementSet('turbo_rates')) {
66 setPostRequestElement('turbo_rates', ''.round(getTurboBonus() / 2).';'.round(getTurboBonus() / 4).'');
70 adminSaveSettingsFromPostData();
72 // Remember new settings
73 setConfigEntry('bonus_active' , postRequestElement('bonus_active'));
74 setConfigEntry('bonus_enable_notify' , postRequestElement('bonus_enable_notify'));
75 setConfigEntry('bonus_disable_notify', postRequestElement('bonus_disable_notify'));
77 // Transfer options to template
78 $content['bonus_userid'] = addMemberSelectionBox(getBonusUserid(), FALSE, TRUE, TRUE, 'bonus_userid');
80 // Initialize array for the points list
81 $RANKS = explode(';', getTurboRates());
83 // Automatically calculate bonus points for ranks 2 and 3 when not set
84 if (getTurboRates() == '') $RANKS = array(round(getTurboBonus() / 2), round(getTurboBonus() / 4));
87 $OUT = '<ol start="2">';
89 foreach ($RANKS as $k => $rate) {
91 // Print only when something is in
92 $OUT .= '<li><input type="text" name="rate[' . ($k + 2) . ']" class="form_field" size="4" maxlength="7" value="' . $rate . '" /> <div class="notice">({?POINTS?})</div></li>';
99 if ($count >= 8) $max = $count+3;
101 // Add more empty fields
102 for ($i = $count; $i < $max; $i++) {
103 $OUT .= ' <li><input type="text" name="rate[' . ($i+2) . ']" class="form_field" size="4" maxlength="7" /> <div class="notice">({?POINTS?})</div></li>';
106 $content['trates_list'] = $OUT;
109 $content['login_timeout_selection'] = createConfigurationTimeSelections('login_timeout' , 'WDh');
110 $content['bonus_timeout_selection'] = createConfigurationTimeSelections('bonus_timeout' , 'WDh');
111 $content['wait_selection'] = createConfigurationTimeSelections('bonus_notify_wait', 'ms' );
113 // Load final template
114 loadTemplate('admin_config_bonus', FALSE, $content);