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 * Needs to be in all Files and every File needs "svn propset *
18 * svn:keywords Date Revision" (autoprobset!) at least!!!!!! *
19 * -------------------------------------------------------------------- *
20 * Copyright (c) 2003 - 2009 by Roland Haeder *
21 * For more information visit: http://www.mxchange.org *
23 * This program is free software; you can redistribute it and/or modify *
24 * it under the terms of the GNU General Public License as published by *
25 * the Free Software Foundation; either version 2 of the License, or *
26 * (at your option) any later version. *
28 * This program is distributed in the hope that it will be useful, *
29 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
30 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
31 * GNU General Public License for more details. *
33 * You should have received a copy of the GNU General Public License *
34 * along with this program; if not, write to the Free Software *
35 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, *
37 ************************************************************************/
39 // Some security stuff...
40 if ((!defined('__SECURITY')) || (!isAdmin())) {
44 // Add description as navigation point
45 addMenuDescription('admin', __FILE__);
48 // Replace german decimal commas to computer decimal dots
49 setPostRequestElement('login_bonus', convertCommaToDot(postRequestElement('login_bonus')));
50 setPostRequestElement('turbo_bonus', convertCommaToDot(postRequestElement('turbo_bonus')));
51 setPostRequestElement('bonus_ref', convertCommaToDot(postRequestElement('bonus_ref')));
52 setPostRequestElement('bonus_order', convertCommaToDot(postRequestElement('bonus_order')));
53 setPostRequestElement('bonus_notify_points', convertCommaToDot(postRequestElement('bonus_notify_points')));
55 // Generate string for saving ranks
56 setPostRequestElement('turbo_rates', '');
58 foreach (postRequestElement('rate') as $rate) {
59 $rate = trim(convertCommaToDot($rate));
60 if (!empty($rate)) $RATES[] = $rate;
62 setPostRequestElement('turbo_rates', trim(implode(';', $RATES)));
63 unsetPostRequestElement('rate');
65 // Automatically calculate bonus points for ranks 2 and 3 when not set
66 if (!isPostRequestElementSet('turbo_rates')) setPostRequestElement('turbo_rates', ''.round(getConfig('turbo_bonus') / 2).';'.round(getConfig('turbo_bonus') / 4).'');
69 adminSaveSettingsFromPostData();
71 // Remember new settings
72 setConfigEntry('bonus_active' , postRequestElement('bonus_active'));
73 setConfigEntry('bonus_en_notify', postRequestElement('bonus_en_notify'));
74 setConfigEntry('bonus_di_notify', postRequestElement('bonus_di_notify'));
76 // Prepare contants for the template
77 $content['login'] = translateComma(getConfig('login_bonus') , false);
78 $content['turbo'] = translateComma(getConfig('turbo_bonus') , false);
79 $content['order'] = translateComma(getConfig('bonus_order') , false);
80 $content['ref'] = translateComma(getConfig('bonus_ref') , false);
81 $content['stats'] = translateComma(getConfig('bonus_stats') , false);
82 $content['notify'] = translateComma(getConfig('bonus_notify_points'), false);
84 // Transfer options to template
85 $content['member_selection'] = addMemberSelectionBox(getConfig('bonus_userid'), false, true, true, 'bonus_userid');
87 // Initialize array for the points list
88 //die("*".getConfig('turbo_rates')."*");
89 $RANKS = explode(';', getConfig('turbo_rates'));
91 // Automatically calculate bonus points for ranks 2 and 3 when not set
92 if (getConfig('turbo_rates') == '') $RANKS = array(round(getConfig('turbo_bonus') / 2), round(getConfig('turbo_bonus') / 4));
95 $OUT = "<ol start=\"2\">\n";
97 foreach ($RANKS as $k => $rate) {
99 // Print only when something is in
100 $OUT .= " <li><input type=\"text\" name=\"rate[".($k + 2)."]\" class=\"admin_normal\" size=\"4\" maxlength=\"7\" value=\"".$rate."\"> <div class=\"admin_notes\">({?POINTS?})</div?</li>\n";
107 if ($cnt >= 8) $max = $cnt+3;
109 // Add more empty fields
110 for ($i = $cnt; $i < $max; $i++) {
111 $OUT .= " <li><input type=\"text\" name=\"rate[".($i+2)."]\" class=\"admin_normal\" size=\"4\" maxlength=\"7\" /> <div class=\"admin_notes\">({?POINTS?})</div></li>\n";
114 $content['trates_list'] = $OUT;
117 $content['login_timeout_selection'] = createTimeSelections(getConfig('login_timeout') , 'login_timeout' , 'WDh');
118 $content['bonus_timeout_selection'] = createTimeSelections(getConfig('bonus_timeout') , 'bonus_timeout' , 'WDh');
119 $content['wait_selection'] = createTimeSelections(getConfig('bonus_notify_wait'), 'bonus_notify_wait', 'ms' );
121 // Init Y/N selections
122 foreach (array('active','login_yn','stats_yn','order_yn','ref_yn','click_yn','en_notify','di_notify','new_mem_notify','include_own') as $entry) {
123 $content[$entry . '_y'] = '';
124 $content[$entry . '_n'] = '';
125 $content[$entry . '_' . strtolower(getConfig('bonus_' . $entry))] = ' checked="checked"';
128 // Load final template
129 loadTemplate('admin_config_bonus', false, $content);