Mahor rewrite:
[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")) || (GET_EXT_VERSION("other") == "")) {
39         // Missing extension!
40         ADD_FATAL(sprintf(EXTENSION_PROBLEM_NOT_INSTALLED, "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 (isset($_POST['ok'])) {
49         if (function_exists('CREATE_TIME_SELECTIONS')) {
50                 // Calculate stamps and set calculated stamps
51                 $_POST['online_timeout']        = CREATE_TIMESTAMP_FROM_SELECTIONS("ip_timeout"           , $_POST);
52                 $_POST['url_tlock']             = CREATE_TIMESTAMP_FROM_SELECTIONS("url_tlock"            , $_POST);
53                 $_POST['profile_lock']          = CREATE_TIMESTAMP_FROM_SELECTIONS("profile_lock"         , $_POST);
54                 $_POST['profile_update']        = CREATE_TIMESTAMP_FROM_SELECTIONS("profile_update"       , $_POST);
55                 $_POST['resend_profile_update'] = CREATE_TIMESTAMP_FROM_SELECTIONS("resend_profile_update", $_POST);
56         }
57
58         // Online-Timeout shall be > 0 or your database will crow and crow and crow...
59         if (!isset($_POST['online_timeout']))        { unset($_POST['ok']); }
60
61         // Chedck other timestamps (which can be zero!)
62         if (!isset($_POST['profile_lock']))          { unset($_POST['ok']); }
63         if (!isset($_POST['url_tlock']))             { unset($_POST['ok']); }
64         if (!isset($_POST['profile_update']))        { unset($_POST['ok']); }
65         if (!isset($_POST['resend_profile_update'])) { unset($_POST['ok']); }
66
67         // Check other settings
68         if (!isset($_POST['max_send']))              { unset($_POST['ok']); }
69         if (!isset($_POST['code_length']))           { unset($_POST['ok']); }
70         if (!isset($_POST['reject_url']))            { unset($_POST['ok']); }
71 }
72
73 if (isset($_POST['ok'])) {
74         // Update stamps directly
75         ADMIN_SAVE_SETTINGS($_POST);
76 } else {
77         // Transfer config data into constants for the template (DO NOT set $_CONFIG as global in LOAD_TEMPLATE!!!)
78         define('_CFG_CODE_LENGTH', getConfig('code_length'));
79         define('_CFG_ACT_SYSTEM' , getConfig('activate_xchange'));
80         define('_CFG_MAX_SEND'   , getConfig('max_send'));
81         define('_CFG_REJECT_URL' , getConfig('reject_url'));
82         define('_CFG_MIN_AGE'    , getConfig('min_age'));
83
84         // Is there the pro-version function avaiable to create selection boxes instead of input boxes?
85         if (function_exists('CREATE_TIME_SELECTIONS')) {
86                 // Only pro versions: time selection boxes
87                 define('_CFG_ONLINE_TIMEOUT', CREATE_TIME_SELECTIONS(getConfig('online_timeout'), "ip_timeout"           , "ms"));
88                 define('_CFG_URL_TLOCK'     , CREATE_TIME_SELECTIONS(getConfig('url_tlock')     , "url_tlock"            , "WDh"));
89                 define('_CFG_PROFILE_LOCK'  , CREATE_TIME_SELECTIONS(getConfig('profile_lock')  , "profile_lock"         , "WDh"));
90                 define('_CFG_PROFILE_UPDATE', CREATE_TIME_SELECTIONS(getConfig('profile_update'), "profile_update"       , "YM"));
91                 define('_CFG_PROF_REUPDATE' , CREATE_TIME_SELECTIONS(getConfig('resend_profile_update') , "resend_profile_update", "MWD"));
92         } else {
93                 // Normal input boxes
94                 define('_CFG_ONLINE_TIMEOUT', "<INPUT type=\"text\" name=\"online_timeout\" class=\"admin_normal\" size=\"6\"  maxlength=\"255\" value=\"".getConfig('online_timeout')."\"> <FONT class=\"tiny\">("._SECONDS.")</FONT>");
95                 define('_CFG_URL_TLOCK'     , "<INPUT type=\"text\" name=\"url_tlock\" class=\"admin_normal\" size=\"6\"  maxlength=\"255\" value=\"".getConfig('url_tlock')     ."\"> <FONT class=\"tiny\">("._SECONDS.")</FONT>");
96                 define('_CFG_PROFILE_LOCK'  , "<INPUT type=\"text\" name=\"profile_lock\" class=\"admin_normal\" size=\"6\"  maxlength=\"255\" value=\"".getConfig('profile_lock')  ."\"> <FONT class=\"tiny\">("._SECONDS.")</FONT>");
97                 define('_CFG_PROFILE_UPDATE', "<INPUT type=\"text\" name=\"profile_update\" class=\"admin_normal\" size=\"10\" maxlength=\"255\" value=\"".getConfig('profile_update')."\"> <FONT class=\"tiny\">("._SECONDS.")</FONT>");
98                 define('_CFG_PROF_REUPDATE' , "<INPUT type=\"text\" name=\"resend_profile_update\" class=\"admin_normal\" size=\"6\"  maxlength=\"255\" value=\"".getConfig('resend_profile_update') ."\"> <FONT class=\"tiny\">("._SECONDS.")</FONT>");
99         }
100
101         if (getConfig('order_multi_page') == "N") {
102                 define('_CFG_ORDER_MULTI_N', " checked=\"checked\"");
103                 define('_CFG_ORDER_MULTI_Y', "");
104         } else {
105                 define('_CFG_ORDER_MULTI_N', "");
106                 define('_CFG_ORDER_MULTI_Y', " checked=\"checked\"");
107         }
108
109         if (getConfig('autosend_active') == "N") {
110                 define('_CFG_AUTOSEND_ACTIVE_N', " checked=\"checked\"");
111                 define('_CFG_AUTOSEND_ACTIVE_Y', "");
112         } else {
113                 define('_CFG_AUTOSEND_ACTIVE_N', "");
114                 define('_CFG_AUTOSEND_ACTIVE_Y', " checked=\"checked\"");
115         }
116
117         if (getConfig('send_prof_update') == "N") {
118                 define('_CFG_SEND_UPDATE_N', " checked=\"checked\"");
119                 define('_CFG_SEND_UPDATE_Y', "");
120         } else {
121                 define('_CFG_SEND_UPDATE_N', "");
122                 define('_CFG_SEND_UPDATE_Y', " checked=\"checked\"");
123         }
124
125         if (getConfig('admin_notify') == "N") {
126                 define('_CFG_ADMIN_NOTIFY_N', " checked=\"checked\"");
127                 define('_CFG_ADMIN_NOTIFY_Y', "");
128         } else {
129                 define('_CFG_ADMIN_NOTIFY_N', "");
130                 define('_CFG_ADMIN_NOTIFY_Y', " checked=\"checked\"");
131         }
132
133         if (getConfig('css_php') == "DIRECT") {
134                 define('_CFG_CSS_PHP_DIRECT', " checked=\"checked\"");
135                 define('_CFG_CSS_PHP_FILE', "");
136         } else {
137                 define('_CFG_CSS_PHP_DIRECT', "");
138                 define('_CFG_CSS_PHP_FILE', " checked=\"checked\"");
139         }
140
141         if (getConfig('guest_menu') == "Y") {
142                 define('_CFG_GUEST_MENU_ACTIVE', " checked=\"checked\"");
143                 define('_CFG_GUEST_MENU_INACTIVE', "");
144         } else {
145                 define('_CFG_GUEST_MENU_ACTIVE', "");
146                 define('_CFG_GUEST_MENU_INACTIVE', " checked=\"checked\"");
147         }
148
149         if (getConfig('member_menu') == "Y") {
150                 define('_CFG_MEMBER_MENU_ACTIVE', " checked=\"checked\"");
151                 define('_CFG_MEMBER_MENU_INACTIVE', "");
152         } else {
153                 define('_CFG_MEMBER_MENU_ACTIVE', "");
154                 define('_CFG_MEMBER_MENU_INACTIVE', " checked=\"checked\"");
155         }
156
157         if (getConfig('youre_here') == "Y") {
158                 define('_CFG_YOURE_HERE_ACTIVE', " checked=\"checked\"");
159                 define('_CFG_YOURE_HERE_INACTIVE', "");
160         } else {
161                 define('_CFG_YOURE_HERE_ACTIVE', "");
162                 define('_CFG_YOURE_HERE_INACTIVE', " checked=\"checked\"");
163         }
164
165         if (getConfig('show_timings') == "Y") {
166                 define('_CFG_SHOW_TIMINGS_Y', " checked=\"checked\"");
167                 define('_CFG_SHOW_TIMINGS_N', "");
168         } else {
169                 define('_CFG_SHOW_TIMINGS_Y', "");
170                 define('_CFG_SHOW_TIMINGS_N', " checked=\"checked\"");
171         }
172
173         if (getConfig('show_points_unconfirmed') == "Y") {
174                 define('_CFG_SHOW_POINTS_UNCONFIRMED_Y', " checked=\"checked\"");
175                 define('_CFG_SHOW_POINTS_UNCONFIRMED_N', "");
176         } else {
177                 define('_CFG_SHOW_POINTS_UNCONFIRMED_Y', "");
178                 define('_CFG_SHOW_POINTS_UNCONFIRMED_N', " checked=\"checked\"");
179         }
180
181         if (getConfig('mailid_error_redirect') == 'INDEX') {
182                 define('_CFG_MAILID_REDIRECT_INDEX', " checked=\"checked\"");
183                 define('_CFG_MAILID_REDIRECT_REJECT', "");
184         } else {
185                 define('_CFG_MAILID_REDIRECT_INDEX', "");
186                 define('_CFG_MAILID_REDIRECT_REJECT', " checked=\"checked\"");
187         }
188
189         for ($i = 0; $i <= 5; $i++) {
190                 $eval = "define('_COMMA_DEF_".$i."', \"\");";
191                 if (getConfig('max_comma') == $i) $eval = "define('_COMMA_DEF_".$i."', ' selected=\"selected\"');";
192                 eval($eval);
193         }
194
195         // Load template
196         LOAD_TEMPLATE("admin_config_other");
197 }
198
199 //
200 ?>