ad5dc9e0c32973fb7e90487406b2373d80b962b7
[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 ((ereg(basename(__FILE__), $_SERVER['PHP_SELF'])) || (!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", basename(__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['max_tlength']))           { unset($_POST['ok']); }
70         if (!isset($_POST['unconfirmed']))           { unset($_POST['ok']); }
71         if (!isset($_POST['code_length']))           { unset($_POST['ok']); }
72         if (!isset($_POST['reject_url']))            { unset($_POST['ok']); }
73 }
74
75 if (isset($_POST['ok'])) {
76         // Update stamps directly
77         ADMIN_SAVE_SETTINGS($_POST);
78 } else {
79         // Transfer config data into constants for the template (DO NOT set $_CONFIG as global in LOAD_TEMPLATE!!!)
80         define('_CFG_CODE_LENGTH'   , $_CONFIG['code_length']);
81         define('_CFG_ACT_SYSTEM'    , $_CONFIG['activate_xchange']);
82         define('_CFG_MAX_SEND'      , $_CONFIG['max_send']);
83         define('_CFG_REJECT_URL'    , $_CONFIG['reject_url']);
84
85         // Is there the pro-version function avaiable to create selection boxes instead of input boxes?
86         if (function_exists('CREATE_TIME_SELECTIONS')) {
87                 // Only pro versions: time selection boxes
88                 define('_CFG_ONLINE_TIMEOUT', CREATE_TIME_SELECTIONS($_CONFIG['online_timeout'], "ip_timeout"           , "ms"));
89                 define('_CFG_URL_TLOCK'     , CREATE_TIME_SELECTIONS($_CONFIG['url_tlock']     , "url_tlock"            , "WDh"));
90                 define('_CFG_PROFILE_LOCK'  , CREATE_TIME_SELECTIONS($_CONFIG['profile_lock']  , "profile_lock"         , "WDh"));
91                 define('_CFG_PROFILE_UPDATE', CREATE_TIME_SELECTIONS($_CONFIG['profile_update'], "profile_update"       , "YM"));
92                 define('_CFG_PROF_REUPDATE' , CREATE_TIME_SELECTIONS($_CONFIG['resend_profile_update'] , "resend_profile_update", "MWD"));
93         } else {
94                 // Normal input boxes
95                 define('_CFG_ONLINE_TIMEOUT', "<INPUT type=\"text\" name=\"online_timeout\" class=\"admin_normal\" size=\"6\"  maxlength=\"255\" value=\"".$_CONFIG['online_timeout']."\"> <FONT class=\"tiny\">(".SECS.")</FONT>");
96                 define('_CFG_URL_TLOCK'     , "<INPUT type=\"text\" name=\"url_tlock\" class=\"admin_normal\" size=\"6\"  maxlength=\"255\" value=\"".$_CONFIG['url_tlock']     ."\"> <FONT class=\"tiny\">(".SECS.")</FONT>");
97                 define('_CFG_PROFILE_LOCK'  , "<INPUT type=\"text\" name=\"profile_lock\" class=\"admin_normal\" size=\"6\"  maxlength=\"255\" value=\"".$_CONFIG['profile_lock']  ."\"> <FONT class=\"tiny\">(".SECS.")</FONT>");
98                 define('_CFG_PROFILE_UPDATE', "<INPUT type=\"text\" name=\"profile_update\" class=\"admin_normal\" size=\"10\" maxlength=\"255\" value=\"".$_CONFIG['profile_update']."\"> <FONT class=\"tiny\">(".SECS.")</FONT>");
99                 define('_CFG_PROF_REUPDATE' , "<INPUT type=\"text\" name=\"resend_profile_update\" class=\"admin_normal\" size=\"6\"  maxlength=\"255\" value=\"".$_CONFIG['resend_profile_update'] ."\"> <FONT class=\"tiny\">(".SECS.")</FONT>");
100         }
101
102         if ($_CONFIG['order_multi_page'] == 'N') {
103                 define('_CFG_ORDER_MULTI_N', ' checked');
104                 define('_CFG_ORDER_MULTI_Y', "");
105         } else {
106                 define('_CFG_ORDER_MULTI_N', "");
107                 define('_CFG_ORDER_MULTI_Y', ' checked');
108         }
109
110         if ($_CONFIG['autosend_active'] == 'N') {
111                 define('_CFG_AUTOSEND_ACTIVE_N', ' checked');
112                 define('_CFG_AUTOSEND_ACTIVE_Y', "");
113         } else {
114                 define('_CFG_AUTOSEND_ACTIVE_N', "");
115                 define('_CFG_AUTOSEND_ACTIVE_Y', ' checked');
116         }
117
118         if ($_CONFIG['send_prof_update'] == 'N') {
119                 define('_CFG_SEND_UPDATE_N', ' checked');
120                 define('_CFG_SEND_UPDATE_Y', "");
121         } else {
122                 define('_CFG_SEND_UPDATE_N', "");
123                 define('_CFG_SEND_UPDATE_Y', ' checked');
124         }
125
126         if ($_CONFIG['admin_notify'] == 'N') {
127                 define('_CFG_ADMIN_NOTIFY_N', ' checked');
128                 define('_CFG_ADMIN_NOTIFY_Y', "");
129         } else {
130                 define('_CFG_ADMIN_NOTIFY_N', "");
131                 define('_CFG_ADMIN_NOTIFY_Y', ' checked');
132         }
133
134         if ($_CONFIG['css_php'] == "DIRECT") {
135                 define('_CFG_CSS_PHP_DIRECT', ' checked');
136                 define('_CFG_CSS_PHP_FILE', "");
137         } else {
138                 define('_CFG_CSS_PHP_DIRECT', "");
139                 define('_CFG_CSS_PHP_FILE', ' checked');
140         }
141
142         if ($_CONFIG['guest_menu'] == 'Y') {
143                 define('_CFG_GUEST_MENU_ACTIVE', ' checked');
144                 define('_CFG_GUEST_MENU_INACTIVE', "");
145         } else {
146                 define('_CFG_GUEST_MENU_ACTIVE', "");
147                 define('_CFG_GUEST_MENU_INACTIVE', ' checked');
148         }
149
150         if ($_CONFIG['member_menu'] == 'Y') {
151                 define('_CFG_MEMBER_MENU_ACTIVE', ' checked');
152                 define('_CFG_MEMBER_MENU_INACTIVE', "");
153         } else {
154                 define('_CFG_MEMBER_MENU_ACTIVE', "");
155                 define('_CFG_MEMBER_MENU_INACTIVE', ' checked');
156         }
157
158         if ($_CONFIG['youre_here'] == 'Y') {
159                 define('_CFG_YOURE_HERE_ACTIVE', ' checked');
160                 define('_CFG_YOURE_HERE_INACTIVE', "");
161         } else {
162                 define('_CFG_YOURE_HERE_ACTIVE', "");
163                 define('_CFG_YOURE_HERE_INACTIVE', ' checked');
164         }
165
166         if ($_CONFIG['show_timings'] == 'Y') {
167                 define('_CFG_SHOW_TIMINGS_Y', ' checked');
168                 define('_CFG_SHOW_TIMINGS_N', "");
169         } else {
170                 define('_CFG_SHOW_TIMINGS_Y', "");
171                 define('_CFG_SHOW_TIMINGS_N', ' checked');
172         }
173
174         if ($_CONFIG['mailid_error_redirect'] == 'index') {
175                 define('_CFG_MAILID_REDIRECT_INDEX', ' checked');
176                 define('_CFG_MAILID_REDIRECT_REJECT', "");
177         } else {
178                 define('_CFG_MAILID_REDIRECT_INDEX', "");
179                 define('_CFG_MAILID_REDIRECT_REJECT', ' checked');
180         }
181
182         for ($i = 0; $i <= 5; $i++) {
183                 $eval = "define('_COMMA_DEF_".$i."', \"\");";
184                 if ($_CONFIG['max_comma'] == $i) $eval = "define('_COMMA_DEF_".$i."', \" selected\");";
185                 eval($eval);
186         }
187
188         // Load template
189         LOAD_TEMPLATE("admin_config_other");
190 }
191
192 //
193 ?>