05f92154a37e432e4215a9d4b16b76a2712398d6
[mailer.git] / inc / modules / admin / what-config_beg.php
1 <?php
2 /************************************************************************
3  * MXChange v0.2.1                                    Start: 01/09/2005 *
4  * ================                             Last change: 01/09/2005 *
5  *                                                                      *
6  * -------------------------------------------------------------------- *
7  * File              : what-config_beg.php                              *
8  * -------------------------------------------------------------------- *
9  * Short description : Setup beg link                                   *
10  * -------------------------------------------------------------------- *
11  * Kurzbeschreibung  : Bettel-Link einstellen                           *
12  * -------------------------------------------------------------------- *
13  *                                                                      *
14  * -------------------------------------------------------------------- *
15  * Copyright (c) 2003 - 2008 by Roland Haeder                           *
16  * For more information visit: http://www.mxchange.org                  *
17  *                                                                      *
18  * This program is free software; you can redistribute it and/or modify *
19  * it under the terms of the GNU General Public License as published by *
20  * the Free Software Foundation; either version 2 of the License, or    *
21  * (at your option) any later version.                                  *
22  *                                                                      *
23  * This program is distributed in the hope that it will be useful,      *
24  * but WITHOUT ANY WARRANTY; without even the implied warranty of       *
25  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        *
26  * GNU General Public License for more details.                         *
27  *                                                                      *
28  * You should have received a copy of the GNU General Public License    *
29  * along with this program; if not, write to the Free Software          *
30  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,               *
31  * MA  02110-1301  USA                                                  *
32  ************************************************************************/
33
34 // Some security stuff...
35 if ((!defined('__SECURITY')) || (!is_admin())) {
36         $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
37         require($INC);
38 }
39
40 // Add description as navigation point
41 ADD_DESCR("admin", basename(__FILE__));
42
43 if (isset($_POST['ok']))
44 {
45         // Translate german decimal commas to computer decimal dots
46         $_POST['beg_points']       = str_replace(",", ".", $_POST['beg_points']      );
47         $_POST['beg_points_max']   = str_replace(",", ".", $_POST['beg_points_max']  );
48         $_POST['beg_notify_bonus'] = str_replace(",", ".", $_POST['beg_notify_bonus']);
49
50         // Save settings
51         ADMIN_SAVE_SETTINGS($_POST);
52
53         // Remember new settings
54         $_CONFIG['beg_rallye']        = $_POST['beg_rallye'];
55         $_CONFIG['beg_ral_en_notify'] = $_POST['beg_ral_en_notify'];
56         $_CONFIG['beg_ral_di_notify'] = $_POST['beg_ral_di_notify'];
57
58         // Include sending out mails
59         if ((($_CONFIG['beg_rallye'] == "Y") && ($_CONFIG['beg_ral_en_notify'] == "Y")) || (($_CONFIG['beg_rallye'] == "N") && ($_CONFIG['beg_ral_di_notify'] == "Y")))
60         {
61                 include(PATH."inc/mails/beg_mails.php");
62         }
63 }
64  else
65 {
66         // Prepare constants for the template
67         define('__BEG_POINTS'           , TRANSLATE_COMMA($_CONFIG['beg_points']      , false));
68         define('__BEG_POINTS_MAX'       , TRANSLATE_COMMA($_CONFIG['beg_points_max']  , false));
69         define('__BEG_NOTIFY_BONUS'     , TRANSLATE_COMMA($_CONFIG['beg_notify_bonus'], false));
70         define('__BEG_TIMEOUT'          , CREATE_TIME_SELECTIONS($_CONFIG['beg_timeout']    , "beg_timeout"    , "Dhm"));
71         define('__BEG_UID_TIMEOUT'      , CREATE_TIME_SELECTIONS($_CONFIG['beg_uid_timeout'], "beg_uid_timeout", "Dhm"));
72         define('__BEG_REMOTE_IP_TIMEOUT', CREATE_TIME_SELECTIONS($_CONFIG['beg_ip_timeout'] , "beg_ip_timeout" , "Dhm"));
73         define('__WAIT_SELECTION'       , CREATE_TIME_SELECTIONS($_CONFIG['beg_notify_wait'], "beg_notify_wait", "ms" ));
74         define('__BEG_RANKS', $_CONFIG['beg_ranks']);
75
76         // Activate / Deactivate beg rallye (Y/N)
77         switch ($_CONFIG['beg_rallye'])
78         {
79         case 'Y':
80                 define('__BEG_RALLYE_Y', " checked");
81                 define('__BEG_RALLYE_N', "");
82                 break;
83
84         case 'N':
85                 define('__BEG_RALLYE_Y', "");
86                 define('__BEG_RALLYE_N', " checked");
87                 break;
88         }
89         switch ($_CONFIG['beg_active'])
90         {
91         case 'Y':
92                 define('__BEG_ACTIVE_Y', " checked");
93                 define('__BEG_ACTIVE_N', "");
94                 break;
95
96         case 'N':
97                 define('__BEG_ACTIVE_Y', "");
98                 define('__BEG_ACTIVE_N', " checked");
99                 break;
100         }
101         switch ($_CONFIG['beg_mode'])
102         {
103         case "DIRECT":
104                 define('__BEG_MODE_DIRECT', " checked");
105                 define('__BEG_MODE_REF'   , "");
106                 break;
107
108         case "REF":
109                 define('__BEG_MODE_DIRECT', "");
110                 define('__BEG_MODE_REF'   , " checked");
111                 break;
112         }
113         switch ($_CONFIG['beg_ral_en_notify'])
114         {
115         case 'Y':
116                 define('__BEG_RAL_EN_NOTIFY_Y', " checked");
117                 define('__BEG_RAL_EN_NOTIFY_N', "");
118                 break;
119
120         case 'N':
121                 define('__BEG_RAL_EN_NOTIFY_Y', "");
122                 define('__BEG_RAL_EN_NOTIFY_N', " checked");
123                 break;
124         }
125         switch ($_CONFIG['beg_ral_di_notify'])
126         {
127         case 'Y':
128                 define('__BEG_RAL_DI_NOTIFY_Y', " checked");
129                 define('__BEG_RAL_DI_NOTIFY_N', "");
130                 break;
131
132         case 'N':
133                 define('__BEG_RAL_DI_NOTIFY_Y', "");
134                 define('__BEG_RAL_DI_NOTIFY_N', " checked");
135                 break;
136         }
137         switch ($_CONFIG['beg_new_mem_notify'])
138         {
139         case 'Y':
140                 define('__BEG_NEW_MEMBER_NOTIFY_Y', " checked");
141                 define('__BEG_NEW_MEMBER_NOTIFY_N', "");
142                 break;
143
144         case 'N':
145                 define('__BEG_NEW_MEMBER_NOTIFY_Y', "");
146                 define('__BEG_NEW_MEMBER_NOTIFY_N', " checked");
147                 break;
148         }
149         switch ($_CONFIG['beg_include_own'])
150         {
151         case 'Y':
152                 define('__BEG_INCLUDE_OWN_Y', " checked");
153                 define('__BEG_INCLUDE_OWN_N', "");
154                 break;
155
156         case 'N':
157                 define('__BEG_INCLUDE_OWN_Y', "");
158                 define('__BEG_INCLUDE_OWN_N', " checked");
159                 break;
160         }
161
162         // Add data to constant __MEMBER_SELECTION
163         define('__MEMBER_SELECTION', ADD_MEMBER_SELECTION_BOX($_CONFIG['beg_uid'], false, true, true, "beg_uid"));
164
165         // Load form template
166         LOAD_TEMPLATE("admin_config_beg");
167 }
168 //
169 ?>