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