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, 2010 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 addMenuDescription('admin', __FILE__);
47 // Replace german decimal commas to computer decimal dots
48 setPostRequestParameter('login_bonus', convertCommaToDot(postRequestParameter('login_bonus')));
49 setPostRequestParameter('turbo_bonus', convertCommaToDot(postRequestParameter('turbo_bonus')));
50 setPostRequestParameter('bonus_ref', convertCommaToDot(postRequestParameter('bonus_ref')));
51 setPostRequestParameter('bonus_order', convertCommaToDot(postRequestParameter('bonus_order')));
52 setPostRequestParameter('bonus_notify_points', convertCommaToDot(postRequestParameter('bonus_notify_points')));
54 // Generate string for saving ranks
55 setPostRequestParameter('turbo_rates', '');
57 foreach (postRequestParameter('rate') as $rate) {
58 $rate = trim(convertCommaToDot($rate));
59 if (!empty($rate)) $RATES[] = $rate;
61 setPostRequestParameter('turbo_rates', trim(implode(';', $RATES)));
62 unsetPostRequestParameter('rate');
64 // Automatically calculate bonus points for ranks 2 and 3 when not set
65 if (!isPostRequestParameterSet('turbo_rates')) setPostRequestParameter('turbo_rates', ''.round(getConfig('turbo_bonus') / 2).';'.round(getConfig('turbo_bonus') / 4).'');
68 adminSaveSettingsFromPostData();
70 // Remember new settings
71 setConfigEntry('bonus_active' , postRequestParameter('bonus_active'));
72 setConfigEntry('bonus_enable_notify' , postRequestParameter('bonus_enable_notify'));
73 setConfigEntry('bonus_disable_notify', postRequestParameter('bonus_disable_notify'));
75 // Transfer options to template
76 $content['form_selection'] = addMemberSelectionBox(getBonusUserId(), false, true, true, 'bonus_userid');
78 // Initialize array for the points list
79 $RANKS = explode(';', getConfig('turbo_rates'));
81 // Automatically calculate bonus points for ranks 2 and 3 when not set
82 if (getConfig('turbo_rates') == '') $RANKS = array(round(getConfig('turbo_bonus') / 2), round(getConfig('turbo_bonus') / 4));
85 $OUT = '<ol start="2">';
87 foreach ($RANKS as $k => $rate) {
89 // Print only when something is in
90 $OUT .= '<li><input type="text" name="rate[' . ($k + 2) . ']" class="form_field" size="4" maxlength="7" value="' . $rate . '" /> <div class="notice">({?POINTS?})</div></li>';
97 if ($cnt >= 8) $max = $cnt+3;
99 // Add more empty fields
100 for ($i = $cnt; $i < $max; $i++) {
101 $OUT .= ' <li><input type="text" name="rate[' . ($i+2) . ']" class="form_field" size="4" maxlength="7" /> <div class="notice">({?POINTS?})</div></li>';
104 $content['trates_list'] = $OUT;
107 $content['login_timeout_selection'] = createTimeSelections(getConfig('login_timeout') , 'login_timeout' , 'WDh');
108 $content['bonus_timeout_selection'] = createTimeSelections(getConfig('bonus_timeout') , 'bonus_timeout' , 'WDh');
109 $content['wait_selection'] = createTimeSelections(getConfig('bonus_notify_wait'), 'bonus_notify_wait', 'ms' );
111 // Init Y/N selections
112 foreach (array('active','login_yn','stats_yn','order_yn','ref_yn','click_yn','enable_notify','disable_notify','new_member_notify','include_own') as $entry) {
113 $content[$entry . '_y'] = '';
114 $content[$entry . '_n'] = '';
115 $content[$entry . '_' . strtolower(getConfig('bonus_' . $entry))] = ' checked="checked"';
118 // Load final template
119 loadTemplate('admin_config_bonus', false, $content);