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 - 2011 by Mailer Developer Team *
20 * For more information visit: http://www.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__);
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 setPostRequestParameter('turbo_rates', '');
53 foreach (postRequestParameter('rate') as $rate) {
54 $rate = trim(convertCommaToDot($rate));
55 if (!empty($rate)) $RATES[] = $rate;
57 setPostRequestParameter('turbo_rates', trim(implode(';', $RATES)));
58 unsetPostRequestParameter('rate');
60 // Automatically calculate bonus points for ranks 2 and 3 when not set
61 if (!isPostRequestParameterSet('turbo_rates')) {
62 setPostRequestParameter('turbo_rates', ''.round(getConfig('turbo_bonus') / 2).';'.round(getConfig('turbo_bonus') / 4).'');
66 adminSaveSettingsFromPostData();
68 // Remember new settings
69 setConfigEntry('bonus_active' , postRequestParameter('bonus_active'));
70 setConfigEntry('bonus_enable_notify' , postRequestParameter('bonus_enable_notify'));
71 setConfigEntry('bonus_disable_notify', postRequestParameter('bonus_disable_notify'));
73 // Transfer options to template
74 $content['bonus_userid'] = addMemberSelectionBox(getBonusUserid(), false, true, true, 'bonus_userid');
76 // Initialize array for the points list
77 $RANKS = explode(';', getConfig('turbo_rates'));
79 // Automatically calculate bonus points for ranks 2 and 3 when not set
80 if (getConfig('turbo_rates') == '') $RANKS = array(round(getConfig('turbo_bonus') / 2), round(getConfig('turbo_bonus') / 4));
83 $OUT = '<ol start="2">';
85 foreach ($RANKS as $k => $rate) {
87 // Print only when something is in
88 $OUT .= '<li><input type="text" name="rate[' . ($k + 2) . ']" class="form_field" size="4" maxlength="7" value="' . $rate . '" /> <div class="notice">({?POINTS?})</div></li>';
95 if ($count >= 8) $max = $count+3;
97 // Add more empty fields
98 for ($i = $count; $i < $max; $i++) {
99 $OUT .= ' <li><input type="text" name="rate[' . ($i+2) . ']" class="form_field" size="4" maxlength="7" /> <div class="notice">({?POINTS?})</div></li>';
102 $content['trates_list'] = $OUT;
105 $content['login_timeout_selection'] = createConfigurationTimeSelections('login_timeout' , 'WDh');
106 $content['bonus_timeout_selection'] = createConfigurationTimeSelections('bonus_timeout' , 'WDh');
107 $content['wait_selection'] = createConfigurationTimeSelections('bonus_notify_wait', 'ms' );
109 // Init Y/N selections
110 foreach (array('active','login_yn','stats_yn','order_yn','ref_yn','click_yn','enable_notify','disable_notify','new_member_notify','include_own') as $entry) {
111 $content[$entry . '_y'] = '';
112 $content[$entry . '_n'] = '';
113 $content[$entry . '_' . strtolower(getConfig('bonus_' . $entry))] = ' checked="checked"';
116 // Load final template
117 loadTemplate('admin_config_bonus', false, $content);