782a373125272c09c7d7658fceaf62d1c900ccc0
[mailer.git] / 0.2.1 / inc / modules / admin / what-config_bonus.php
1 <?php\r
2 /************************************************************************\r
3  * MXChange v0.2.1                                    Start: 08/31/2004 *\r
4  * ================                             Last change: 11/14/2004 *\r
5  *                                                                      *\r
6  * -------------------------------------------------------------------- *\r
7  * File              : what-config_bonus.php                            *\r
8  * -------------------------------------------------------------------- *\r
9  * Short description : Configure "turbo-click-bonus"                    *\r
10  * -------------------------------------------------------------------- *\r
11  * Kurzbeschreibung  : Einstellen der Turbo-Klick-Verguetungen          *\r
12  * -------------------------------------------------------------------- *\r
13  *                                                                      *\r
14  * -------------------------------------------------------------------- *\r
15  * Copyright (c) 2003 - 2008 by Roland Haeder                           *\r
16  * For more information visit: http://www.mxchange.org                  *\r
17  *                                                                      *\r
18  * This program is free software; you can redistribute it and/or modify *\r
19  * it under the terms of the GNU General Public License as published by *\r
20  * the Free Software Foundation; either version 2 of the License, or    *\r
21  * (at your option) any later version.                                  *\r
22  *                                                                      *\r
23  * This program is distributed in the hope that it will be useful,      *\r
24  * but WITHOUT ANY WARRANTY; without even the implied warranty of       *\r
25  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        *\r
26  * GNU General Public License for more details.                         *\r
27  *                                                                      *\r
28  * You should have received a copy of the GNU General Public License    *\r
29  * along with this program; if not, write to the Free Software          *\r
30  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,               *\r
31  * MA  02110-1301  USA                                                  *\r
32  ************************************************************************/\r
33 \r
34 // Some security stuff...\r
35 if ((ereg(basename(__FILE__), $_SERVER['PHP_SELF'])) || (!IS_ADMIN()))\r
36 {\r
37         $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4)."/security.php";\r
38         require($INC);\r
39 }\r
40 // Add description as navigation point\r
41 ADD_DESCR("admin", basename(__FILE__));\r
42 \r
43 if (isset($_POST['ok']))\r
44 {\r
45         // Replace german decimal commas to computer decimal dots\r
46         $_POST['login_bonus']         = str_replace(",", ".", $_POST['login_bonus']        );\r
47         $_POST['turbo_bonus']         = str_replace(",", ".", $_POST['turbo_bonus']        );\r
48         $_POST['bonus_ref']           = str_replace(",", ".", $_POST['bonus_ref']          );\r
49         $_POST['bonus_order']         = str_replace(",", ".", $_POST['bonus_order']        );\r
50         $_POST['bonus_notify_points'] = str_replace(",", ".", $_POST['bonus_notify_points']);\r
51 \r
52         // Generate string for saving ranks\r
53         $_POST['turbo_rates'] = ""; $RATES = array();\r
54         foreach ($_POST['rate'] as $rate)\r
55         {\r
56                 $rate = trim(str_replace(",", ".", $rate));\r
57                 if (isset($rate)) $RATES[] = $rate;\r
58         }\r
59         $_POST['turbo_rates'] = trim(implode(";", $RATES));\r
60         unset($_POST['rate']);\r
61 \r
62         // Automatically calculate bonus points for ranks 2 and 3 when not set\r
63         if (empty($_POST['turbo_rates'])) $_POST['turbo_rates'] = "".round($CONFIG['turbo_bonus'] / 2).";".round($CONFIG['turbo_bonus'] / 4)."";\r
64 \r
65         // Save data\r
66         ADMIN_SAVE_SETTINGS($_POST, "_config", "config='0'");\r
67 \r
68         // Remember new settings\r
69         $CONFIG['bonus_active']    = $_POST['bonus_active'];\r
70         $CONFIG['bonus_en_notify'] = $_POST['bonus_en_notify'];\r
71         $CONFIG['bonus_di_notify'] = $_POST['bonus_di_notify'];\r
72 \r
73         // Include sending out mails\r
74         if ((($CONFIG['bonus_active'] == "Y") && ($CONFIG['bonus_en_notify'] == "Y")) || (($CONFIG['bonus_active'] == "N") && ($CONFIG['bonus_di_notify'] == "Y")))\r
75         {\r
76                 include(PATH."inc/mails/bonus_mails.php");\r
77         }\r
78 }\r
79  else\r
80 {\r
81         // Prepare contants for the template\r
82         define('__LOGIN_VALUE' , TRANSLATE_COMMA($CONFIG['login_bonus']        , false));\r
83         define('__TURBO_VALUE' , TRANSLATE_COMMA($CONFIG['turbo_bonus']        , false));\r
84         define('__ORDER_VALUE' , TRANSLATE_COMMA($CONFIG['bonus_order']        , false));\r
85         define('__REF_VALUE'   , TRANSLATE_COMMA($CONFIG['bonus_ref']          , false));\r
86         define('__STATS_VALUE' , TRANSLATE_COMMA($CONFIG['bonus_stats']        , false));\r
87         define('__NOTIFY_VALUE', TRANSLATE_COMMA($CONFIG['bonus_notify_points'], false));\r
88         define('__TRANKS_VALUE', $CONFIG['bonus_ranks']);\r
89         define('__TLINES_VALUE', $CONFIG['bonus_lines']);\r
90 \r
91         // Transfer options to template __MEMBER_SELECTION\r
92         ADD_MEMBER_SELECTION_BOX(false, true, true, $CONFIG['bonus_uid']);\r
93 \r
94         // Initialize array for the points list\r
95         $RANKS = explode(";", $CONFIG['bonus_rates']);\r
96 \r
97         // Automatically calculate bonus points for ranks 2 and 3 when not set\r
98         if (empty($CONFIG['bonus_rates'])) $RANKS = array(round($CONFIG['turbo_bonus'] / 2), round($CONFIG['turbo_bonus'] / 4));\r
99 \r
100         // Generate list\r
101         $OUT = "<OL start=\"2\">\n";\r
102         foreach ($RANKS as $k=>$rate)\r
103         {\r
104                 if (!empty($rate))\r
105                 {\r
106                         // Print only when something is in\r
107                         $OUT .= "  <LI><INPUT type=\"text\" name=\"rate[".($k + 2)."]\" class=\"admin_normal\" size=\"4\" maxlength=\"7\" value=\"".$rate."\">&nbsp;<FONT class=\"admin_notes\">(".POINTS.")</FONT?</LI>\n";\r
108                 }\r
109         }\r
110         for ($i = 3; $i < 8; $i++)\r
111         {\r
112                 $OUT .= "  <LI><INPUT type=\"text\" name=\"rate[".($k + $i)."]\" class=\"admin_normal\" size=\"4\" maxlength=\"7\">&nbsp;<FONT class=\"admin_notes\">(".POINTS.")</FONT?</LI>\n";\r
113         }\r
114         $OUT .= "</OL>\n";\r
115         define('__TRATES_LIST', $OUT);\r
116 \r
117         define('__LOGIN_TIMEOUT_SELECTION', CREATE_TIME_SELECTIONS($CONFIG['login_timeout']    , "login_timeout"    , "WDh"));\r
118         define('__BONUS_TIMEOUT_SELECTION', CREATE_TIME_SELECTIONS($CONFIG['bonus_timeout']    , "bonus_timeout"    , "WDh"));\r
119         define('__WAIT_SELECTION'         , CREATE_TIME_SELECTIONS($CONFIG['bonus_notify_wait'], "bonus_notify_wait", "ms" ));\r
120 \r
121         // Activate / Deactivate bonus active rallye (Y/N)\r
122         switch ($CONFIG['bonus_active'])\r
123         {\r
124         case "Y":\r
125                 define('__BONUS_ACTIVE_Y', " checked");\r
126                 define('__BONUS_ACTIVE_N', "");\r
127                 break;\r
128 \r
129         case "N":\r
130                 define('__BONUS_ACTIVE_Y', "");\r
131                 define('__BONUS_ACTIVE_N', " checked");\r
132                 break;\r
133         }\r
134         // Other bonus to de-/activate\r
135         switch ($CONFIG['bonus_login_yn'])\r
136         {\r
137         case "Y":\r
138                 define('__BONUS_LOGIN_Y', " checked");\r
139                 define('__BONUS_LOGIN_N', "");\r
140                 break;\r
141 \r
142         case "N":\r
143                 define('__BONUS_LOGIN_Y', "");\r
144                 define('__BONUS_LOGIN_N', " checked");\r
145                 break;\r
146         }\r
147         switch ($CONFIG['bonus_stats_yn'])\r
148         {\r
149         case "Y":\r
150                 define('__BONUS_STATS_Y', " checked");\r
151                 define('__BONUS_STATS_N', "");\r
152                 break;\r
153 \r
154         case "N":\r
155                 define('__BONUS_STATS_Y', "");\r
156                 define('__BONUS_STATS_N', " checked");\r
157                 break;\r
158         }\r
159         switch ($CONFIG['bonus_order_yn'])\r
160         {\r
161         case "Y":\r
162                 define('__BONUS_ORDER_Y', " checked");\r
163                 define('__BONUS_ORDER_N', "");\r
164                 break;\r
165 \r
166         case "N":\r
167                 define('__BONUS_ORDER_Y', "");\r
168                 define('__BONUS_ORDER_N', " checked");\r
169                 break;\r
170         }\r
171         switch ($CONFIG['bonus_ref_yn'])\r
172         {\r
173         case "Y":\r
174                 define('__BONUS_REF_Y', " checked");\r
175                 define('__BONUS_REF_N', "");\r
176                 break;\r
177 \r
178         case "N":\r
179                 define('__BONUS_REF_Y', "");\r
180                 define('__BONUS_REF_N', " checked");\r
181                 break;\r
182         }\r
183         switch ($CONFIG['bonus_click_yn'])\r
184         {\r
185         case "Y":\r
186                 define('__BONUS_CLICK_Y', " checked");\r
187                 define('__BONUS_CLICK_N', "");\r
188                 break;\r
189 \r
190         case "N":\r
191                 define('__BONUS_CLICK_Y', "");\r
192                 define('__BONUS_CLICK_N', " checked");\r
193                 break;\r
194         }\r
195         switch ($CONFIG['bonus_en_notify'])\r
196         {\r
197         case "Y":\r
198                 define('__BONUS_EN_NOTIFY_Y', " checked");\r
199                 define('__BONUS_EN_NOTIFY_N', "");\r
200                 break;\r
201 \r
202         case "N":\r
203                 define('__BONUS_EN_NOTIFY_Y', "");\r
204                 define('__BONUS_EN_NOTIFY_N', " checked");\r
205                 break;\r
206         }\r
207         switch ($CONFIG['bonus_di_notify'])\r
208         {\r
209         case "Y":\r
210                 define('__BONUS_DI_NOTIFY_Y', " checked");\r
211                 define('__BONUS_DI_NOTIFY_N', "");\r
212                 break;\r
213 \r
214         case "N":\r
215                 define('__BONUS_DI_NOTIFY_Y', "");\r
216                 define('__BONUS_DI_NOTIFY_N', " checked");\r
217                 break;\r
218         }\r
219         switch ($CONFIG['bonus_new_mem_notify'])\r
220         {\r
221         case "Y":\r
222                 define('__BONUS_NEW_MEMBER_NOTIFY_Y', " checked");\r
223                 define('__BONUS_NEW_MEMBER_NOTIFY_N', "");\r
224                 break;\r
225 \r
226         case "N":\r
227                 define('__BONUS_NEW_MEMBER_NOTIFY_Y', "");\r
228                 define('__BONUS_NEW_MEMBER_NOTIFY_N', " checked");\r
229                 break;\r
230         }\r
231         switch ($CONFIG['bonus_include_own'])\r
232         {\r
233         case "Y":\r
234                 define('__BONUS_INCLUDE_OWN_Y', " checked");\r
235                 define('__BONUS_INCLUDE_OWN_N', "");\r
236                 break;\r
237 \r
238         case "N":\r
239                 define('__BONUS_INCLUDE_OWN_Y', "");\r
240                 define('__BONUS_INCLUDE_OWN_N', " checked");\r
241                 break;\r
242         }\r
243 \r
244         // Load final template\r
245         LOAD_TEMPLATE("admin_config_bonus", false);\r
246 }\r
247 //\r
248 ?>\r