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 * Copyright (c) 2009, 2010 by Mailer Developer Team *
22 * For more information visit: http://www.mxchange.org *
24 * This program is free software; you can redistribute it and/or modify *
25 * it under the terms of the GNU General Public License as published by *
26 * the Free Software Foundation; either version 2 of the License, or *
27 * (at your option) any later version. *
29 * This program is distributed in the hope that it will be useful, *
30 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
31 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
32 * GNU General Public License for more details. *
34 * You should have received a copy of the GNU General Public License *
35 * along with this program; if not, write to the Free Software *
36 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, *
38 ************************************************************************/
40 // Some security stuff...
41 if ((!defined('__SECURITY')) || (!isAdmin())) {
45 // Add description as navigation point
46 addMenuDescription('admin', __FILE__);
49 // Replace german decimal commas to computer decimal dots
50 setPostRequestParameter('login_bonus', convertCommaToDot(postRequestParameter('login_bonus')));
51 setPostRequestParameter('turbo_bonus', convertCommaToDot(postRequestParameter('turbo_bonus')));
52 setPostRequestParameter('bonus_ref', convertCommaToDot(postRequestParameter('bonus_ref')));
53 setPostRequestParameter('bonus_order', convertCommaToDot(postRequestParameter('bonus_order')));
54 setPostRequestParameter('bonus_notify_points', convertCommaToDot(postRequestParameter('bonus_notify_points')));
56 // Generate string for saving ranks
57 setPostRequestParameter('turbo_rates', '');
59 foreach (postRequestParameter('rate') as $rate) {
60 $rate = trim(convertCommaToDot($rate));
61 if (!empty($rate)) $RATES[] = $rate;
63 setPostRequestParameter('turbo_rates', trim(implode(';', $RATES)));
64 unsetPostRequestParameter('rate');
66 // Automatically calculate bonus points for ranks 2 and 3 when not set
67 if (!isPostRequestParameterSet('turbo_rates')) setPostRequestParameter('turbo_rates', ''.round(getConfig('turbo_bonus') / 2).';'.round(getConfig('turbo_bonus') / 4).'');
70 adminSaveSettingsFromPostData();
72 // Remember new settings
73 setConfigEntry('bonus_active' , postRequestParameter('bonus_active'));
74 setConfigEntry('bonus_en_notify', postRequestParameter('bonus_en_notify'));
75 setConfigEntry('bonus_di_notify', postRequestParameter('bonus_di_notify'));
77 // Prepare contants for the template
78 $content['login'] = translateComma(getConfig('login_bonus') , false);
79 $content['turbo'] = translateComma(getConfig('turbo_bonus') , false);
80 $content['order'] = translateComma(getConfig('bonus_order') , false);
81 $content['ref'] = translateComma(getConfig('bonus_ref') , false);
82 $content['stats'] = translateComma(getConfig('bonus_stats') , false);
83 $content['notify'] = translateComma(getConfig('bonus_notify_points'), false);
85 // Transfer options to template
86 $content['member_selection'] = addMemberSelectionBox(getConfig('bonus_userid'), false, true, true, 'bonus_userid');
88 // Initialize array for the points list
89 //die("*".getConfig('turbo_rates')."*");
90 $RANKS = explode(';', getConfig('turbo_rates'));
92 // Automatically calculate bonus points for ranks 2 and 3 when not set
93 if (getConfig('turbo_rates') == '') $RANKS = array(round(getConfig('turbo_bonus') / 2), round(getConfig('turbo_bonus') / 4));
96 $OUT = "<ol start=\"2\">\n";
98 foreach ($RANKS as $k => $rate) {
100 // Print only when something is in
101 $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";
108 if ($cnt >= 8) $max = $cnt+3;
110 // Add more empty fields
111 for ($i = $cnt; $i < $max; $i++) {
112 $OUT .= " <li><input type=\"text\" name=\"rate[".($i+2)."]\" class=\"admin_normal\" size=\"4\" maxlength=\"7\" /> <div class=\"admin_notes\">({?POINTS?})</div></li>\n";
115 $content['trates_list'] = $OUT;
118 $content['login_timeout_selection'] = createTimeSelections(getConfig('login_timeout') , 'login_timeout' , 'WDh');
119 $content['bonus_timeout_selection'] = createTimeSelections(getConfig('bonus_timeout') , 'bonus_timeout' , 'WDh');
120 $content['wait_selection'] = createTimeSelections(getConfig('bonus_notify_wait'), 'bonus_notify_wait', 'ms' );
122 // Init Y/N selections
123 foreach (array('active','login_yn','stats_yn','order_yn','ref_yn','click_yn','en_notify','di_notify','new_mem_notify','include_own') as $entry) {
124 $content[$entry . '_y'] = '';
125 $content[$entry . '_n'] = '';
126 $content[$entry . '_' . strtolower(getConfig('bonus_' . $entry))] = ' checked="checked"';
129 // Load final template
130 loadTemplate('admin_config_bonus', false, $content);