Complete rewrite of and , wrapper functions added, see bug #101
[mailer.git] / inc / modules / admin / what-config_other.php
1 <?php
2 /************************************************************************
3  * MXChange v0.2.1                                    Start: 10/11/2003 *
4  * ===============                              Last change: 09/21/2004 *
5  *                                                                      *
6  * -------------------------------------------------------------------- *
7  * File              : what-config_other.php                            *
8  * -------------------------------------------------------------------- *
9  * Short description : basic settings                                   *
10  * -------------------------------------------------------------------- *
11  * Kurzbeschreibung  : Grund Einstellungen                              *
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 } elseif (!EXT_IS_ACTIVE("other")) {
39         // Missing extension!
40         addFatalMessage(getMessage('EXTENSION_PROBLEM_EXT_INACTIVE'), "other");
41         return;
42 }
43
44 // Add description as navigation point
45 ADD_DESCR("admin", __FILE__);
46
47 // Stop saving data if one input field is !isset
48 if (IS_FORM_SENT()) {
49         // Calculate stamps and set calculated stamps
50         REQUEST_POST('online_timeout')        = CREATE_TIMESTAMP_FROM_SELECTIONS("ip_timeout"           , REQUEST_POST_ARRAY());
51         REQUEST_POST('url_tlock')             = CREATE_TIMESTAMP_FROM_SELECTIONS("url_tlock"            , REQUEST_POST_ARRAY());
52         REQUEST_POST('profile_lock')          = CREATE_TIMESTAMP_FROM_SELECTIONS("profile_lock"         , REQUEST_POST_ARRAY());
53         REQUEST_POST('profile_update')        = CREATE_TIMESTAMP_FROM_SELECTIONS("profile_update"       , REQUEST_POST_ARRAY());
54         REQUEST_SET_POST('resend_profile_update', CREATE_TIMESTAMP_FROM_SELECTIONS("resend_profile_update", REQUEST_POST_ARRAY()));
55
56         // Online-Timeout shall be > 0 or your database will crow and crow and crow...
57         if (!REQUEST_ISSET_POST(('online_timeout')))        { REQUEST_UNSET_POST('ok'); }
58
59         // Chedck other timestamps (which can be zero!)
60         if (!REQUEST_ISSET_POST(('profile_lock')))          { REQUEST_UNSET_POST('ok'); }
61         if (!REQUEST_ISSET_POST(('url_tlock')))             { REQUEST_UNSET_POST('ok'); }
62         if (!REQUEST_ISSET_POST(('profile_update')))        { REQUEST_UNSET_POST('ok'); }
63         if (!REQUEST_ISSET_POST(('resend_profile_update'))) { REQUEST_UNSET_POST('ok'); }
64
65         // Check other settings
66         if (!REQUEST_ISSET_POST(('max_send')))              { REQUEST_UNSET_POST('ok'); }
67         if (!REQUEST_ISSET_POST(('code_length')))           { REQUEST_UNSET_POST('ok'); }
68         if (!REQUEST_ISSET_POST(('reject_url')))            { REQUEST_UNSET_POST('ok'); }
69 }
70
71 if (IS_FORM_SENT()) {
72         // Update stamps directly
73         ADMIN_SAVE_SETTINGS_POST();
74 } else {
75         // Transfer config data into constants for the template (DO NOT set $_CONFIG as global in LOAD_TEMPLATE!!!)
76         define('_CFG_CODE_LENGTH', getConfig('code_length'));
77         define('_CFG_ACT_SYSTEM' , getConfig('activate_xchange'));
78         define('_CFG_MAX_SEND'   , getConfig('max_send'));
79         define('_CFG_REJECT_URL' , getConfig('reject_url'));
80         define('_CFG_MIN_AGE'    , getConfig('min_age'));
81
82         // Time selection boxes
83         define('_CFG_ONLINE_TIMEOUT', CREATE_TIME_SELECTIONS(getConfig('online_timeout'), "ip_timeout"           , "ms"));
84         define('_CFG_URL_TLOCK'     , CREATE_TIME_SELECTIONS(getConfig('url_tlock')     , "url_tlock"            , "WDh"));
85         define('_CFG_PROFILE_LOCK'  , CREATE_TIME_SELECTIONS(getConfig('profile_lock')  , "profile_lock"         , "WDh"));
86         define('_CFG_PROFILE_UPDATE', CREATE_TIME_SELECTIONS(getConfig('profile_update'), "profile_update"       , "YM"));
87         define('_CFG_PROF_REUPDATE' , CREATE_TIME_SELECTIONS(getConfig('resend_profile_update') , "resend_profile_update", "MWD"));
88
89         if (getConfig('order_multi_page') != "Y") {
90                 define('_CFG_ORDER_MULTI_N', " checked=\"checked\"");
91                 define('_CFG_ORDER_MULTI_Y', "");
92         } else {
93                 define('_CFG_ORDER_MULTI_N', "");
94                 define('_CFG_ORDER_MULTI_Y', " checked=\"checked\"");
95         }
96
97         if (getConfig('autosend_active') != "Y") {
98                 define('_CFG_AUTOSEND_ACTIVE_N', " checked=\"checked\"");
99                 define('_CFG_AUTOSEND_ACTIVE_Y', "");
100         } else {
101                 define('_CFG_AUTOSEND_ACTIVE_N', "");
102                 define('_CFG_AUTOSEND_ACTIVE_Y', " checked=\"checked\"");
103         }
104
105         if (getConfig('send_prof_update') != "Y") {
106                 define('_CFG_SEND_UPDATE_N', " checked=\"checked\"");
107                 define('_CFG_SEND_UPDATE_Y', "");
108         } else {
109                 define('_CFG_SEND_UPDATE_N', "");
110                 define('_CFG_SEND_UPDATE_Y', " checked=\"checked\"");
111         }
112
113         if (getConfig('admin_notify') != "Y") {
114                 define('_CFG_ADMIN_NOTIFY_N', " checked=\"checked\"");
115                 define('_CFG_ADMIN_NOTIFY_Y', "");
116         } else {
117                 define('_CFG_ADMIN_NOTIFY_N', "");
118                 define('_CFG_ADMIN_NOTIFY_Y', " checked=\"checked\"");
119         }
120
121         if (getConfig('css_php') == "DIRECT") {
122                 define('_CFG_CSS_PHP_DIRECT', " checked=\"checked\"");
123                 define('_CFG_CSS_PHP_FILE', "");
124         } else {
125                 define('_CFG_CSS_PHP_DIRECT', "");
126                 define('_CFG_CSS_PHP_FILE', " checked=\"checked\"");
127         }
128
129         if (getConfig('guest_menu') == "Y") {
130                 define('_CFG_GUEST_MENU_ACTIVE', " checked=\"checked\"");
131                 define('_CFG_GUEST_MENU_INACTIVE', "");
132         } else {
133                 define('_CFG_GUEST_MENU_ACTIVE', "");
134                 define('_CFG_GUEST_MENU_INACTIVE', " checked=\"checked\"");
135         }
136
137         if (getConfig('member_menu') == "Y") {
138                 define('_CFG_MEMBER_MENU_ACTIVE', " checked=\"checked\"");
139                 define('_CFG_MEMBER_MENU_INACTIVE', "");
140         } else {
141                 define('_CFG_MEMBER_MENU_ACTIVE', "");
142                 define('_CFG_MEMBER_MENU_INACTIVE', " checked=\"checked\"");
143         }
144
145         if (getConfig('youre_here') == "Y") {
146                 define('_CFG_YOURE_HERE_ACTIVE', " checked=\"checked\"");
147                 define('_CFG_YOURE_HERE_INACTIVE', "");
148         } else {
149                 define('_CFG_YOURE_HERE_ACTIVE', "");
150                 define('_CFG_YOURE_HERE_INACTIVE', " checked=\"checked\"");
151         }
152
153         if (getConfig('show_timings') == "Y") {
154                 define('_CFG_SHOW_TIMINGS_Y', " checked=\"checked\"");
155                 define('_CFG_SHOW_TIMINGS_N', "");
156         } else {
157                 define('_CFG_SHOW_TIMINGS_Y', "");
158                 define('_CFG_SHOW_TIMINGS_N', " checked=\"checked\"");
159         }
160
161         if (getConfig('show_points_unconfirmed') == "Y") {
162                 define('_CFG_SHOW_POINTS_UNCONFIRMED_Y', " checked=\"checked\"");
163                 define('_CFG_SHOW_POINTS_UNCONFIRMED_N', "");
164         } else {
165                 define('_CFG_SHOW_POINTS_UNCONFIRMED_Y', "");
166                 define('_CFG_SHOW_POINTS_UNCONFIRMED_N', " checked=\"checked\"");
167         }
168
169         if (getConfig('mailid_error_redirect') == 'INDEX') {
170                 define('_CFG_MAILID_REDIRECT_INDEX', " checked=\"checked\"");
171                 define('_CFG_MAILID_REDIRECT_REJECT', "");
172         } else {
173                 define('_CFG_MAILID_REDIRECT_INDEX', "");
174                 define('_CFG_MAILID_REDIRECT_REJECT', " checked=\"checked\"");
175         }
176
177         for ($i = 0; $i <= 5; $i++) {
178                 $eval = "define('_COMMA_DEF_".$i."', \"\");";
179                 if (getConfig('max_comma') == $i) $eval = "define('_COMMA_DEF_".$i."', ' selected=\"selected\"');";
180                 eval($eval);
181         }
182
183         // Load template
184         LOAD_TEMPLATE("admin_config_other");
185 }
186
187 //
188 ?>