]> git.vanrenterghem.biz Git - www.vanrenterghem.biz.git/blob - phpBB2/admin/admin_board.php
Baseline
[www.vanrenterghem.biz.git] / phpBB2 / admin / admin_board.php
1 <?php
2 /***************************************************************************
3  *                              admin_board.php
4  *                            -------------------
5  *   begin                : Thursday, Jul 12, 2001
6  *   copyright            : (C) 2001 The phpBB Group
7  *   email                : support@phpbb.com
8  *
9  *   $Id: admin_board.php,v 1.51.2.16 2006/12/16 13:11:24 acydburn Exp $
10  *
11  *
12  ***************************************************************************/
14 define('IN_PHPBB', 1);
16 if( !empty($setmodules) )
17 {
18         $file = basename(__FILE__);
19         $module['General']['Configuration'] = $file;
20         return;
21 }
23 //
24 // Let's set the root dir for phpBB
25 //
26 $phpbb_root_path = "./../";
27 require($phpbb_root_path . 'extension.inc');
28 require('./pagestart.' . $phpEx);
29 include($phpbb_root_path . 'includes/functions_selects.'.$phpEx);
31 //
32 // Pull all config data
33 //
34 $sql = "SELECT *
35         FROM " . CONFIG_TABLE;
36 if(!$result = $db->sql_query($sql))
37 {
38         message_die(CRITICAL_ERROR, "Could not query config information in admin_board", "", __LINE__, __FILE__, $sql);
39 }
40 else
41 {
42         while( $row = $db->sql_fetchrow($result) )
43         {
44                 $config_name = $row['config_name'];
45                 $config_value = $row['config_value'];
46                 $default_config[$config_name] = isset($HTTP_POST_VARS['submit']) ? str_replace("'", "\'", $config_value) : $config_value;
47                 
48                 $new[$config_name] = ( isset($HTTP_POST_VARS[$config_name]) ) ? $HTTP_POST_VARS[$config_name] : $default_config[$config_name];
50                 if ($config_name == 'cookie_name')
51                 {
52                         $new['cookie_name'] = str_replace('.', '_', $new['cookie_name']);
53                 }
55                 // Attempt to prevent a common mistake with this value,
56                 // http:// is the protocol and not part of the server name
57                 if ($config_name == 'server_name')
58                 {
59                         $new['server_name'] = str_replace('http://', '', $new['server_name']);
60                 }
62                 // Attempt to prevent a mistake with this value.
63                 if ($config_name == 'avatar_path')
64                 {
65                         $new['avatar_path'] = trim($new['avatar_path']);
66                         if (strstr($new['avatar_path'], "\0") || !is_dir($phpbb_root_path . $new['avatar_path']) || !is_writable($phpbb_root_path . $new['avatar_path']))
67                         {
68                                 $new['avatar_path'] = $default_config['avatar_path'];
69                         }
70                 }
72                 if( isset($HTTP_POST_VARS['submit']) )
73                 {
74                         $sql = "UPDATE " . CONFIG_TABLE . " SET
75                                 config_value = '" . str_replace("\'", "''", $new[$config_name]) . "'
76                                 WHERE config_name = '$config_name'";
77                         if( !$db->sql_query($sql) )
78                         {
79                                 message_die(GENERAL_ERROR, "Failed to update general configuration for $config_name", "", __LINE__, __FILE__, $sql);
80                         }
81                 }
82         }
84         if( isset($HTTP_POST_VARS['submit']) )
85         {
86                 $message = $lang['Config_updated'] . "<br /><br />" . sprintf($lang['Click_return_config'], "<a href=\"" . append_sid("admin_board.$phpEx") . "\">", "</a>") . "<br /><br />" . sprintf($lang['Click_return_admin_index'], "<a href=\"" . append_sid("index.$phpEx?pane=right") . "\">", "</a>");
88                 message_die(GENERAL_MESSAGE, $message);
89         }
90 }
92 $style_select = style_select($new['default_style'], 'default_style', "../templates");
93 $lang_select = language_select($new['default_lang'], 'default_lang', "language");
94 $timezone_select = tz_select($new['board_timezone'], 'board_timezone');
96 $disable_board_yes = ( $new['board_disable'] ) ? "checked=\"checked\"" : "";
97 $disable_board_no = ( !$new['board_disable'] ) ? "checked=\"checked\"" : "";
99 $cookie_secure_yes = ( $new['cookie_secure'] ) ? "checked=\"checked\"" : "";
100 $cookie_secure_no = ( !$new['cookie_secure'] ) ? "checked=\"checked\"" : "";
102 $html_tags = $new['allow_html_tags'];
104 $override_user_style_yes = ( $new['override_user_style'] ) ? "checked=\"checked\"" : "";
105 $override_user_style_no = ( !$new['override_user_style'] ) ? "checked=\"checked\"" : "";
107 $html_yes = ( $new['allow_html'] ) ? "checked=\"checked\"" : "";
108 $html_no = ( !$new['allow_html'] ) ? "checked=\"checked\"" : "";
110 $bbcode_yes = ( $new['allow_bbcode'] ) ? "checked=\"checked\"" : "";
111 $bbcode_no = ( !$new['allow_bbcode'] ) ? "checked=\"checked\"" : "";
113 $activation_none = ( $new['require_activation'] == USER_ACTIVATION_NONE ) ? "checked=\"checked\"" : "";
114 $activation_user = ( $new['require_activation'] == USER_ACTIVATION_SELF ) ? "checked=\"checked\"" : "";
115 $activation_admin = ( $new['require_activation'] == USER_ACTIVATION_ADMIN ) ? "checked=\"checked\"" : "";
117 $confirm_yes = ($new['enable_confirm']) ? 'checked="checked"' : '';
118 $confirm_no = (!$new['enable_confirm']) ? 'checked="checked"' : '';
120 $allow_autologin_yes = ($new['allow_autologin']) ? 'checked="checked"' : '';
121 $allow_autologin_no = (!$new['allow_autologin']) ? 'checked="checked"' : '';
123 $board_email_form_yes = ( $new['board_email_form'] ) ? "checked=\"checked\"" : "";
124 $board_email_form_no = ( !$new['board_email_form'] ) ? "checked=\"checked\"" : "";
126 $gzip_yes = ( $new['gzip_compress'] ) ? "checked=\"checked\"" : "";
127 $gzip_no = ( !$new['gzip_compress'] ) ? "checked=\"checked\"" : "";
129 $privmsg_on = ( !$new['privmsg_disable'] ) ? "checked=\"checked\"" : "";
130 $privmsg_off = ( $new['privmsg_disable'] ) ? "checked=\"checked\"" : "";
132 $prune_yes = ( $new['prune_enable'] ) ? "checked=\"checked\"" : "";
133 $prune_no = ( !$new['prune_enable'] ) ? "checked=\"checked\"" : "";
135 $smile_yes = ( $new['allow_smilies'] ) ? "checked=\"checked\"" : "";
136 $smile_no = ( !$new['allow_smilies'] ) ? "checked=\"checked\"" : "";
138 $sig_yes = ( $new['allow_sig'] ) ? "checked=\"checked\"" : "";
139 $sig_no = ( !$new['allow_sig'] ) ? "checked=\"checked\"" : "";
141 $namechange_yes = ( $new['allow_namechange'] ) ? "checked=\"checked\"" : "";
142 $namechange_no = ( !$new['allow_namechange'] ) ? "checked=\"checked\"" : "";
144 $avatars_local_yes = ( $new['allow_avatar_local'] ) ? "checked=\"checked\"" : "";
145 $avatars_local_no = ( !$new['allow_avatar_local'] ) ? "checked=\"checked\"" : "";
146 $avatars_remote_yes = ( $new['allow_avatar_remote'] ) ? "checked=\"checked\"" : "";
147 $avatars_remote_no = ( !$new['allow_avatar_remote'] ) ? "checked=\"checked\"" : "";
148 $avatars_upload_yes = ( $new['allow_avatar_upload'] ) ? "checked=\"checked\"" : "";
149 $avatars_upload_no = ( !$new['allow_avatar_upload'] ) ? "checked=\"checked\"" : "";
151 $smtp_yes = ( $new['smtp_delivery'] ) ? "checked=\"checked\"" : "";
152 $smtp_no = ( !$new['smtp_delivery'] ) ? "checked=\"checked\"" : "";
154 $template->set_filenames(array(
155         "body" => "admin/board_config_body.tpl")
156 );
158 //
159 // Escape any quotes in the site description for proper display in the text
160 // box on the admin page 
161 //
162 $new['site_desc'] = str_replace('"', '&quot;', $new['site_desc']);
163 $new['sitename'] = str_replace('"', '&quot;', strip_tags($new['sitename']));
164 $template->assign_vars(array(
165         "S_CONFIG_ACTION" => append_sid("admin_board.$phpEx"),
167         "L_YES" => $lang['Yes'],
168         "L_NO" => $lang['No'],
169         "L_CONFIGURATION_TITLE" => $lang['General_Config'],
170         "L_CONFIGURATION_EXPLAIN" => $lang['Config_explain'],
171         "L_GENERAL_SETTINGS" => $lang['General_settings'],
172         "L_SERVER_NAME" => $lang['Server_name'], 
173         "L_SERVER_NAME_EXPLAIN" => $lang['Server_name_explain'], 
174         "L_SERVER_PORT" => $lang['Server_port'], 
175         "L_SERVER_PORT_EXPLAIN" => $lang['Server_port_explain'], 
176         "L_SCRIPT_PATH" => $lang['Script_path'], 
177         "L_SCRIPT_PATH_EXPLAIN" => $lang['Script_path_explain'], 
178         "L_SITE_NAME" => $lang['Site_name'],
179         "L_SITE_DESCRIPTION" => $lang['Site_desc'],
180         "L_DISABLE_BOARD" => $lang['Board_disable'], 
181         "L_DISABLE_BOARD_EXPLAIN" => $lang['Board_disable_explain'], 
182         "L_ACCT_ACTIVATION" => $lang['Acct_activation'], 
183         "L_NONE" => $lang['Acc_None'], 
184         "L_USER" => $lang['Acc_User'], 
185         "L_ADMIN" => $lang['Acc_Admin'], 
186         "L_VISUAL_CONFIRM" => $lang['Visual_confirm'], 
187         "L_VISUAL_CONFIRM_EXPLAIN" => $lang['Visual_confirm_explain'], 
188         "L_ALLOW_AUTOLOGIN" => $lang['Allow_autologin'],
189         "L_ALLOW_AUTOLOGIN_EXPLAIN" => $lang['Allow_autologin_explain'],
190         "L_AUTOLOGIN_TIME" => $lang['Autologin_time'],
191         "L_AUTOLOGIN_TIME_EXPLAIN" => $lang['Autologin_time_explain'],
192         "L_COOKIE_SETTINGS" => $lang['Cookie_settings'], 
193         "L_COOKIE_SETTINGS_EXPLAIN" => $lang['Cookie_settings_explain'], 
194         "L_COOKIE_DOMAIN" => $lang['Cookie_domain'],
195         "L_COOKIE_NAME" => $lang['Cookie_name'], 
196         "L_COOKIE_PATH" => $lang['Cookie_path'], 
197         "L_COOKIE_SECURE" => $lang['Cookie_secure'], 
198         "L_COOKIE_SECURE_EXPLAIN" => $lang['Cookie_secure_explain'], 
199         "L_SESSION_LENGTH" => $lang['Session_length'], 
200         "L_PRIVATE_MESSAGING" => $lang['Private_Messaging'], 
201         "L_INBOX_LIMIT" => $lang['Inbox_limits'], 
202         "L_SENTBOX_LIMIT" => $lang['Sentbox_limits'], 
203         "L_SAVEBOX_LIMIT" => $lang['Savebox_limits'], 
204         "L_DISABLE_PRIVATE_MESSAGING" => $lang['Disable_privmsg'], 
205         "L_ENABLED" => $lang['Enabled'], 
206         "L_DISABLED" => $lang['Disabled'], 
207         "L_ABILITIES_SETTINGS" => $lang['Abilities_settings'],
208         "L_MAX_POLL_OPTIONS" => $lang['Max_poll_options'],
209         "L_FLOOD_INTERVAL" => $lang['Flood_Interval'],
210         "L_FLOOD_INTERVAL_EXPLAIN" => $lang['Flood_Interval_explain'], 
211         "L_SEARCH_FLOOD_INTERVAL" => $lang['Search_Flood_Interval'],
212         "L_SEARCH_FLOOD_INTERVAL_EXPLAIN" => $lang['Search_Flood_Interval_explain'], 
214         'L_MAX_LOGIN_ATTEMPTS'                  => $lang['Max_login_attempts'],
215         'L_MAX_LOGIN_ATTEMPTS_EXPLAIN'  => $lang['Max_login_attempts_explain'],
216         'L_LOGIN_RESET_TIME'                    => $lang['Login_reset_time'],
217         'L_LOGIN_RESET_TIME_EXPLAIN'    => $lang['Login_reset_time_explain'],
218         'MAX_LOGIN_ATTEMPTS'                    => $new['max_login_attempts'],
219         'LOGIN_RESET_TIME'                              => $new['login_reset_time'],
221         "L_BOARD_EMAIL_FORM" => $lang['Board_email_form'], 
222         "L_BOARD_EMAIL_FORM_EXPLAIN" => $lang['Board_email_form_explain'], 
223         "L_TOPICS_PER_PAGE" => $lang['Topics_per_page'],
224         "L_POSTS_PER_PAGE" => $lang['Posts_per_page'],
225         "L_HOT_THRESHOLD" => $lang['Hot_threshold'],
226         "L_DEFAULT_STYLE" => $lang['Default_style'],
227         "L_OVERRIDE_STYLE" => $lang['Override_style'],
228         "L_OVERRIDE_STYLE_EXPLAIN" => $lang['Override_style_explain'],
229         "L_DEFAULT_LANGUAGE" => $lang['Default_language'],
230         "L_DATE_FORMAT" => $lang['Date_format'],
231         "L_SYSTEM_TIMEZONE" => $lang['System_timezone'],
232         "L_ENABLE_GZIP" => $lang['Enable_gzip'],
233         "L_ENABLE_PRUNE" => $lang['Enable_prune'],
234         "L_ALLOW_HTML" => $lang['Allow_HTML'],
235         "L_ALLOW_BBCODE" => $lang['Allow_BBCode'],
236         "L_ALLOWED_TAGS" => $lang['Allowed_tags'],
237         "L_ALLOWED_TAGS_EXPLAIN" => $lang['Allowed_tags_explain'],
238         "L_ALLOW_SMILIES" => $lang['Allow_smilies'],
239         "L_SMILIES_PATH" => $lang['Smilies_path'],
240         "L_SMILIES_PATH_EXPLAIN" => $lang['Smilies_path_explain'],
241         "L_ALLOW_SIG" => $lang['Allow_sig'],
242         "L_MAX_SIG_LENGTH" => $lang['Max_sig_length'],
243         "L_MAX_SIG_LENGTH_EXPLAIN" => $lang['Max_sig_length_explain'],
244         "L_ALLOW_NAME_CHANGE" => $lang['Allow_name_change'],
245         "L_AVATAR_SETTINGS" => $lang['Avatar_settings'],
246         "L_ALLOW_LOCAL" => $lang['Allow_local'],
247         "L_ALLOW_REMOTE" => $lang['Allow_remote'],
248         "L_ALLOW_REMOTE_EXPLAIN" => $lang['Allow_remote_explain'],
249         "L_ALLOW_UPLOAD" => $lang['Allow_upload'],
250         "L_MAX_FILESIZE" => $lang['Max_filesize'],
251         "L_MAX_FILESIZE_EXPLAIN" => $lang['Max_filesize_explain'],
252         "L_MAX_AVATAR_SIZE" => $lang['Max_avatar_size'],
253         "L_MAX_AVATAR_SIZE_EXPLAIN" => $lang['Max_avatar_size_explain'],
254         "L_AVATAR_STORAGE_PATH" => $lang['Avatar_storage_path'],
255         "L_AVATAR_STORAGE_PATH_EXPLAIN" => $lang['Avatar_storage_path_explain'],
256         "L_AVATAR_GALLERY_PATH" => $lang['Avatar_gallery_path'],
257         "L_AVATAR_GALLERY_PATH_EXPLAIN" => $lang['Avatar_gallery_path_explain'],
258         "L_COPPA_SETTINGS" => $lang['COPPA_settings'],
259         "L_COPPA_FAX" => $lang['COPPA_fax'],
260         "L_COPPA_MAIL" => $lang['COPPA_mail'],
261         "L_COPPA_MAIL_EXPLAIN" => $lang['COPPA_mail_explain'],
262         "L_EMAIL_SETTINGS" => $lang['Email_settings'],
263         "L_ADMIN_EMAIL" => $lang['Admin_email'],
264         "L_EMAIL_SIG" => $lang['Email_sig'],
265         "L_EMAIL_SIG_EXPLAIN" => $lang['Email_sig_explain'],
266         "L_USE_SMTP" => $lang['Use_SMTP'],
267         "L_USE_SMTP_EXPLAIN" => $lang['Use_SMTP_explain'],
268         "L_SMTP_SERVER" => $lang['SMTP_server'], 
269         "L_SMTP_USERNAME" => $lang['SMTP_username'], 
270         "L_SMTP_USERNAME_EXPLAIN" => $lang['SMTP_username_explain'], 
271         "L_SMTP_PASSWORD" => $lang['SMTP_password'], 
272         "L_SMTP_PASSWORD_EXPLAIN" => $lang['SMTP_password_explain'], 
273         "L_SUBMIT" => $lang['Submit'], 
274         "L_RESET" => $lang['Reset'], 
275         
276         "SERVER_NAME" => $new['server_name'], 
277         "SCRIPT_PATH" => $new['script_path'], 
278         "SERVER_PORT" => $new['server_port'], 
279         "SITENAME" => $new['sitename'],
280         "SITE_DESCRIPTION" => $new['site_desc'], 
281         "S_DISABLE_BOARD_YES" => $disable_board_yes,
282         "S_DISABLE_BOARD_NO" => $disable_board_no,
283         "ACTIVATION_NONE" => USER_ACTIVATION_NONE, 
284         "ACTIVATION_NONE_CHECKED" => $activation_none,
285         "ACTIVATION_USER" => USER_ACTIVATION_SELF, 
286         "ACTIVATION_USER_CHECKED" => $activation_user,
287         "ACTIVATION_ADMIN" => USER_ACTIVATION_ADMIN, 
288         "ACTIVATION_ADMIN_CHECKED" => $activation_admin, 
289         "CONFIRM_ENABLE" => $confirm_yes,
290         "CONFIRM_DISABLE" => $confirm_no,
291         'ALLOW_AUTOLOGIN_YES' => $allow_autologin_yes,
292         'ALLOW_AUTOLOGIN_NO' => $allow_autologin_no,
293         'AUTOLOGIN_TIME' => (int) $new['max_autologin_time'],
294         "BOARD_EMAIL_FORM_ENABLE" => $board_email_form_yes, 
295         "BOARD_EMAIL_FORM_DISABLE" => $board_email_form_no, 
296         "MAX_POLL_OPTIONS" => $new['max_poll_options'], 
297         "FLOOD_INTERVAL" => $new['flood_interval'],
298         "SEARCH_FLOOD_INTERVAL" => $new['search_flood_interval'],
299         "TOPICS_PER_PAGE" => $new['topics_per_page'],
300         "POSTS_PER_PAGE" => $new['posts_per_page'],
301         "HOT_TOPIC" => $new['hot_threshold'],
302         "STYLE_SELECT" => $style_select,
303         "OVERRIDE_STYLE_YES" => $override_user_style_yes,
304         "OVERRIDE_STYLE_NO" => $override_user_style_no,
305         "LANG_SELECT" => $lang_select,
306         "L_DATE_FORMAT_EXPLAIN" => $lang['Date_format_explain'],
307         "DEFAULT_DATEFORMAT" => $new['default_dateformat'],
308         "TIMEZONE_SELECT" => $timezone_select,
309         "S_PRIVMSG_ENABLED" => $privmsg_on, 
310         "S_PRIVMSG_DISABLED" => $privmsg_off, 
311         "INBOX_LIMIT" => $new['max_inbox_privmsgs'], 
312         "SENTBOX_LIMIT" => $new['max_sentbox_privmsgs'],
313         "SAVEBOX_LIMIT" => $new['max_savebox_privmsgs'],
314         "COOKIE_DOMAIN" => $new['cookie_domain'], 
315         "COOKIE_NAME" => $new['cookie_name'], 
316         "COOKIE_PATH" => $new['cookie_path'], 
317         "SESSION_LENGTH" => $new['session_length'], 
318         "S_COOKIE_SECURE_ENABLED" => $cookie_secure_yes, 
319         "S_COOKIE_SECURE_DISABLED" => $cookie_secure_no, 
320         "GZIP_YES" => $gzip_yes,
321         "GZIP_NO" => $gzip_no,
322         "PRUNE_YES" => $prune_yes,
323         "PRUNE_NO" => $prune_no, 
324         "HTML_TAGS" => $html_tags, 
325         "HTML_YES" => $html_yes,
326         "HTML_NO" => $html_no,
327         "BBCODE_YES" => $bbcode_yes,
328         "BBCODE_NO" => $bbcode_no,
329         "SMILE_YES" => $smile_yes,
330         "SMILE_NO" => $smile_no,
331         "SIG_YES" => $sig_yes,
332         "SIG_NO" => $sig_no,
333         "SIG_SIZE" => $new['max_sig_chars'], 
334         "NAMECHANGE_YES" => $namechange_yes,
335         "NAMECHANGE_NO" => $namechange_no,
336         "AVATARS_LOCAL_YES" => $avatars_local_yes,
337         "AVATARS_LOCAL_NO" => $avatars_local_no,
338         "AVATARS_REMOTE_YES" => $avatars_remote_yes,
339         "AVATARS_REMOTE_NO" => $avatars_remote_no,
340         "AVATARS_UPLOAD_YES" => $avatars_upload_yes,
341         "AVATARS_UPLOAD_NO" => $avatars_upload_no,
342         "AVATAR_FILESIZE" => $new['avatar_filesize'],
343         "AVATAR_MAX_HEIGHT" => $new['avatar_max_height'],
344         "AVATAR_MAX_WIDTH" => $new['avatar_max_width'],
345         "AVATAR_PATH" => $new['avatar_path'], 
346         "AVATAR_GALLERY_PATH" => $new['avatar_gallery_path'], 
347         "SMILIES_PATH" => $new['smilies_path'], 
348         "INBOX_PRIVMSGS" => $new['max_inbox_privmsgs'], 
349         "SENTBOX_PRIVMSGS" => $new['max_sentbox_privmsgs'], 
350         "SAVEBOX_PRIVMSGS" => $new['max_savebox_privmsgs'], 
351         "EMAIL_FROM" => $new['board_email'],
352         "EMAIL_SIG" => $new['board_email_sig'],
353         "SMTP_YES" => $smtp_yes,
354         "SMTP_NO" => $smtp_no,
355         "SMTP_HOST" => $new['smtp_host'],
356         "SMTP_USERNAME" => $new['smtp_username'],
357         "SMTP_PASSWORD" => $new['smtp_password'],
358         "COPPA_MAIL" => $new['coppa_mail'],
359         "COPPA_FAX" => $new['coppa_fax'])
360 );
362 $template->pparse("body");
364 include('./page_footer_admin.'.$phpEx);
366 ?>