2 /***************************************************************************
5 * begin : Thursday, Jul 12, 2001
6 * copyright : (C) 2001 The phpBB Group
7 * email : support@phpbb.com
9 * $Id: admin_board.php,v 1.51.2.9 2004/11/18 17:49:33 acydburn Exp $
12 ***************************************************************************/
14 define('IN_PHPBB', 1);
16 if( !empty($setmodules) )
18 $file = basename(__FILE__);
19 $module['General']['Configuration'] = "$file";
24 // Let's set the root dir for phpBB
26 $phpbb_root_path = "./../";
27 require($phpbb_root_path . 'extension.inc');
28 require('./pagestart.' . $phpEx);
29 include($phpbb_root_path . 'includes/functions_selects.'.$phpEx);
32 // Pull all config data
35 FROM " . CONFIG_TABLE;
36 if(!$result = $db->sql_query($sql))
38 message_die(CRITICAL_ERROR, "Could not query config information in admin_board", "", __LINE__, __FILE__, $sql);
42 while( $row = $db->sql_fetchrow($result) )
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;
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')
52 $cookie_name = str_replace('.', '_', $new['cookie_name']);
55 if( isset($HTTP_POST_VARS['submit']) )
57 $sql = "UPDATE " . CONFIG_TABLE . " SET
58 config_value = '" . str_replace("\'", "''", $new[$config_name]) . "'
59 WHERE config_name = '$config_name'";
60 if( !$db->sql_query($sql) )
62 message_die(GENERAL_ERROR, "Failed to update general configuration for $config_name", "", __LINE__, __FILE__, $sql);
67 if( isset($HTTP_POST_VARS['submit']) )
69 $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>");
71 message_die(GENERAL_MESSAGE, $message);
75 $style_select = style_select($new['default_style'], 'default_style', "../templates");
76 $lang_select = language_select($new['default_lang'], 'default_lang', "language");
77 $timezone_select = tz_select($new['board_timezone'], 'board_timezone');
79 $disable_board_yes = ( $new['board_disable'] ) ? "checked=\"checked\"" : "";
80 $disable_board_no = ( !$new['board_disable'] ) ? "checked=\"checked\"" : "";
82 $cookie_secure_yes = ( $new['cookie_secure'] ) ? "checked=\"checked\"" : "";
83 $cookie_secure_no = ( !$new['cookie_secure'] ) ? "checked=\"checked\"" : "";
85 $html_tags = $new['allow_html_tags'];
87 $override_user_style_yes = ( $new['override_user_style'] ) ? "checked=\"checked\"" : "";
88 $override_user_style_no = ( !$new['override_user_style'] ) ? "checked=\"checked\"" : "";
90 $html_yes = ( $new['allow_html'] ) ? "checked=\"checked\"" : "";
91 $html_no = ( !$new['allow_html'] ) ? "checked=\"checked\"" : "";
93 $bbcode_yes = ( $new['allow_bbcode'] ) ? "checked=\"checked\"" : "";
94 $bbcode_no = ( !$new['allow_bbcode'] ) ? "checked=\"checked\"" : "";
96 $activation_none = ( $new['require_activation'] == USER_ACTIVATION_NONE ) ? "checked=\"checked\"" : "";
97 $activation_user = ( $new['require_activation'] == USER_ACTIVATION_SELF ) ? "checked=\"checked\"" : "";
98 $activation_admin = ( $new['require_activation'] == USER_ACTIVATION_ADMIN ) ? "checked=\"checked\"" : "";
100 $confirm_yes = ($new['enable_confirm']) ? 'checked="checked"' : '';
101 $confirm_no = (!$new['enable_confirm']) ? 'checked="checked"' : '';
103 $board_email_form_yes = ( $new['board_email_form'] ) ? "checked=\"checked\"" : "";
104 $board_email_form_no = ( !$new['board_email_form'] ) ? "checked=\"checked\"" : "";
106 $gzip_yes = ( $new['gzip_compress'] ) ? "checked=\"checked\"" : "";
107 $gzip_no = ( !$new['gzip_compress'] ) ? "checked=\"checked\"" : "";
109 $privmsg_on = ( !$new['privmsg_disable'] ) ? "checked=\"checked\"" : "";
110 $privmsg_off = ( $new['privmsg_disable'] ) ? "checked=\"checked\"" : "";
112 $prune_yes = ( $new['prune_enable'] ) ? "checked=\"checked\"" : "";
113 $prune_no = ( !$new['prune_enable'] ) ? "checked=\"checked\"" : "";
115 $smile_yes = ( $new['allow_smilies'] ) ? "checked=\"checked\"" : "";
116 $smile_no = ( !$new['allow_smilies'] ) ? "checked=\"checked\"" : "";
118 $sig_yes = ( $new['allow_sig'] ) ? "checked=\"checked\"" : "";
119 $sig_no = ( !$new['allow_sig'] ) ? "checked=\"checked\"" : "";
121 $namechange_yes = ( $new['allow_namechange'] ) ? "checked=\"checked\"" : "";
122 $namechange_no = ( !$new['allow_namechange'] ) ? "checked=\"checked\"" : "";
124 $avatars_local_yes = ( $new['allow_avatar_local'] ) ? "checked=\"checked\"" : "";
125 $avatars_local_no = ( !$new['allow_avatar_local'] ) ? "checked=\"checked\"" : "";
126 $avatars_remote_yes = ( $new['allow_avatar_remote'] ) ? "checked=\"checked\"" : "";
127 $avatars_remote_no = ( !$new['allow_avatar_remote'] ) ? "checked=\"checked\"" : "";
128 $avatars_upload_yes = ( $new['allow_avatar_upload'] ) ? "checked=\"checked\"" : "";
129 $avatars_upload_no = ( !$new['allow_avatar_upload'] ) ? "checked=\"checked\"" : "";
131 $smtp_yes = ( $new['smtp_delivery'] ) ? "checked=\"checked\"" : "";
132 $smtp_no = ( !$new['smtp_delivery'] ) ? "checked=\"checked\"" : "";
134 $template->set_filenames(array(
135 "body" => "admin/board_config_body.tpl")
139 // Escape any quotes in the site description for proper display in the text
140 // box on the admin page
142 $new['site_desc'] = str_replace('"', '"', $new['site_desc']);
143 $new['sitename'] = str_replace('"', '"', strip_tags($new['sitename']));
144 $template->assign_vars(array(
145 "S_CONFIG_ACTION" => append_sid("admin_board.$phpEx"),
147 "L_YES" => $lang['Yes'],
148 "L_NO" => $lang['No'],
149 "L_CONFIGURATION_TITLE" => $lang['General_Config'],
150 "L_CONFIGURATION_EXPLAIN" => $lang['Config_explain'],
151 "L_GENERAL_SETTINGS" => $lang['General_settings'],
152 "L_SERVER_NAME" => $lang['Server_name'],
153 "L_SERVER_NAME_EXPLAIN" => $lang['Server_name_explain'],
154 "L_SERVER_PORT" => $lang['Server_port'],
155 "L_SERVER_PORT_EXPLAIN" => $lang['Server_port_explain'],
156 "L_SCRIPT_PATH" => $lang['Script_path'],
157 "L_SCRIPT_PATH_EXPLAIN" => $lang['Script_path_explain'],
158 "L_SITE_NAME" => $lang['Site_name'],
159 "L_SITE_DESCRIPTION" => $lang['Site_desc'],
160 "L_DISABLE_BOARD" => $lang['Board_disable'],
161 "L_DISABLE_BOARD_EXPLAIN" => $lang['Board_disable_explain'],
162 "L_ACCT_ACTIVATION" => $lang['Acct_activation'],
163 "L_NONE" => $lang['Acc_None'],
164 "L_USER" => $lang['Acc_User'],
165 "L_ADMIN" => $lang['Acc_Admin'],
166 "L_VISUAL_CONFIRM" => $lang['Visual_confirm'],
167 "L_VISUAL_CONFIRM_EXPLAIN" => $lang['Visual_confirm_explain'],
168 "L_COOKIE_SETTINGS" => $lang['Cookie_settings'],
169 "L_COOKIE_SETTINGS_EXPLAIN" => $lang['Cookie_settings_explain'],
170 "L_COOKIE_DOMAIN" => $lang['Cookie_domain'],
171 "L_COOKIE_NAME" => $lang['Cookie_name'],
172 "L_COOKIE_PATH" => $lang['Cookie_path'],
173 "L_COOKIE_SECURE" => $lang['Cookie_secure'],
174 "L_COOKIE_SECURE_EXPLAIN" => $lang['Cookie_secure_explain'],
175 "L_SESSION_LENGTH" => $lang['Session_length'],
176 "L_PRIVATE_MESSAGING" => $lang['Private_Messaging'],
177 "L_INBOX_LIMIT" => $lang['Inbox_limits'],
178 "L_SENTBOX_LIMIT" => $lang['Sentbox_limits'],
179 "L_SAVEBOX_LIMIT" => $lang['Savebox_limits'],
180 "L_DISABLE_PRIVATE_MESSAGING" => $lang['Disable_privmsg'],
181 "L_ENABLED" => $lang['Enabled'],
182 "L_DISABLED" => $lang['Disabled'],
183 "L_ABILITIES_SETTINGS" => $lang['Abilities_settings'],
184 "L_MAX_POLL_OPTIONS" => $lang['Max_poll_options'],
185 "L_FLOOD_INTERVAL" => $lang['Flood_Interval'],
186 "L_FLOOD_INTERVAL_EXPLAIN" => $lang['Flood_Interval_explain'],
187 "L_BOARD_EMAIL_FORM" => $lang['Board_email_form'],
188 "L_BOARD_EMAIL_FORM_EXPLAIN" => $lang['Board_email_form_explain'],
189 "L_TOPICS_PER_PAGE" => $lang['Topics_per_page'],
190 "L_POSTS_PER_PAGE" => $lang['Posts_per_page'],
191 "L_HOT_THRESHOLD" => $lang['Hot_threshold'],
192 "L_DEFAULT_STYLE" => $lang['Default_style'],
193 "L_OVERRIDE_STYLE" => $lang['Override_style'],
194 "L_OVERRIDE_STYLE_EXPLAIN" => $lang['Override_style_explain'],
195 "L_DEFAULT_LANGUAGE" => $lang['Default_language'],
196 "L_DATE_FORMAT" => $lang['Date_format'],
197 "L_SYSTEM_TIMEZONE" => $lang['System_timezone'],
198 "L_ENABLE_GZIP" => $lang['Enable_gzip'],
199 "L_ENABLE_PRUNE" => $lang['Enable_prune'],
200 "L_ALLOW_HTML" => $lang['Allow_HTML'],
201 "L_ALLOW_BBCODE" => $lang['Allow_BBCode'],
202 "L_ALLOWED_TAGS" => $lang['Allowed_tags'],
203 "L_ALLOWED_TAGS_EXPLAIN" => $lang['Allowed_tags_explain'],
204 "L_ALLOW_SMILIES" => $lang['Allow_smilies'],
205 "L_SMILIES_PATH" => $lang['Smilies_path'],
206 "L_SMILIES_PATH_EXPLAIN" => $lang['Smilies_path_explain'],
207 "L_ALLOW_SIG" => $lang['Allow_sig'],
208 "L_MAX_SIG_LENGTH" => $lang['Max_sig_length'],
209 "L_MAX_SIG_LENGTH_EXPLAIN" => $lang['Max_sig_length_explain'],
210 "L_ALLOW_NAME_CHANGE" => $lang['Allow_name_change'],
211 "L_AVATAR_SETTINGS" => $lang['Avatar_settings'],
212 "L_ALLOW_LOCAL" => $lang['Allow_local'],
213 "L_ALLOW_REMOTE" => $lang['Allow_remote'],
214 "L_ALLOW_REMOTE_EXPLAIN" => $lang['Allow_remote_explain'],
215 "L_ALLOW_UPLOAD" => $lang['Allow_upload'],
216 "L_MAX_FILESIZE" => $lang['Max_filesize'],
217 "L_MAX_FILESIZE_EXPLAIN" => $lang['Max_filesize_explain'],
218 "L_MAX_AVATAR_SIZE" => $lang['Max_avatar_size'],
219 "L_MAX_AVATAR_SIZE_EXPLAIN" => $lang['Max_avatar_size_explain'],
220 "L_AVATAR_STORAGE_PATH" => $lang['Avatar_storage_path'],
221 "L_AVATAR_STORAGE_PATH_EXPLAIN" => $lang['Avatar_storage_path_explain'],
222 "L_AVATAR_GALLERY_PATH" => $lang['Avatar_gallery_path'],
223 "L_AVATAR_GALLERY_PATH_EXPLAIN" => $lang['Avatar_gallery_path_explain'],
224 "L_COPPA_SETTINGS" => $lang['COPPA_settings'],
225 "L_COPPA_FAX" => $lang['COPPA_fax'],
226 "L_COPPA_MAIL" => $lang['COPPA_mail'],
227 "L_COPPA_MAIL_EXPLAIN" => $lang['COPPA_mail_explain'],
228 "L_EMAIL_SETTINGS" => $lang['Email_settings'],
229 "L_ADMIN_EMAIL" => $lang['Admin_email'],
230 "L_EMAIL_SIG" => $lang['Email_sig'],
231 "L_EMAIL_SIG_EXPLAIN" => $lang['Email_sig_explain'],
232 "L_USE_SMTP" => $lang['Use_SMTP'],
233 "L_USE_SMTP_EXPLAIN" => $lang['Use_SMTP_explain'],
234 "L_SMTP_SERVER" => $lang['SMTP_server'],
235 "L_SMTP_USERNAME" => $lang['SMTP_username'],
236 "L_SMTP_USERNAME_EXPLAIN" => $lang['SMTP_username_explain'],
237 "L_SMTP_PASSWORD" => $lang['SMTP_password'],
238 "L_SMTP_PASSWORD_EXPLAIN" => $lang['SMTP_password_explain'],
239 "L_SUBMIT" => $lang['Submit'],
240 "L_RESET" => $lang['Reset'],
242 "SERVER_NAME" => $new['server_name'],
243 "SCRIPT_PATH" => $new['script_path'],
244 "SERVER_PORT" => $new['server_port'],
245 "SITENAME" => $new['sitename'],
246 "SITE_DESCRIPTION" => $new['site_desc'],
247 "S_DISABLE_BOARD_YES" => $disable_board_yes,
248 "S_DISABLE_BOARD_NO" => $disable_board_no,
249 "ACTIVATION_NONE" => USER_ACTIVATION_NONE,
250 "ACTIVATION_NONE_CHECKED" => $activation_none,
251 "ACTIVATION_USER" => USER_ACTIVATION_SELF,
252 "ACTIVATION_USER_CHECKED" => $activation_user,
253 "ACTIVATION_ADMIN" => USER_ACTIVATION_ADMIN,
254 "ACTIVATION_ADMIN_CHECKED" => $activation_admin,
255 "CONFIRM_ENABLE" => $confirm_yes,
256 "CONFIRM_DISABLE" => $confirm_no,
257 "ACTIVATION_NONE_CHECKED" => $activation_none,
258 "BOARD_EMAIL_FORM_ENABLE" => $board_email_form_yes,
259 "BOARD_EMAIL_FORM_DISABLE" => $board_email_form_no,
260 "MAX_POLL_OPTIONS" => $new['max_poll_options'],
261 "FLOOD_INTERVAL" => $new['flood_interval'],
262 "TOPICS_PER_PAGE" => $new['topics_per_page'],
263 "POSTS_PER_PAGE" => $new['posts_per_page'],
264 "HOT_TOPIC" => $new['hot_threshold'],
265 "STYLE_SELECT" => $style_select,
266 "OVERRIDE_STYLE_YES" => $override_user_style_yes,
267 "OVERRIDE_STYLE_NO" => $override_user_style_no,
268 "LANG_SELECT" => $lang_select,
269 "L_DATE_FORMAT_EXPLAIN" => $lang['Date_format_explain'],
270 "DEFAULT_DATEFORMAT" => $new['default_dateformat'],
271 "TIMEZONE_SELECT" => $timezone_select,
272 "S_PRIVMSG_ENABLED" => $privmsg_on,
273 "S_PRIVMSG_DISABLED" => $privmsg_off,
274 "INBOX_LIMIT" => $new['max_inbox_privmsgs'],
275 "SENTBOX_LIMIT" => $new['max_sentbox_privmsgs'],
276 "SAVEBOX_LIMIT" => $new['max_savebox_privmsgs'],
277 "COOKIE_DOMAIN" => $new['cookie_domain'],
278 "COOKIE_NAME" => $new['cookie_name'],
279 "COOKIE_PATH" => $new['cookie_path'],
280 "SESSION_LENGTH" => $new['session_length'],
281 "S_COOKIE_SECURE_ENABLED" => $cookie_secure_yes,
282 "S_COOKIE_SECURE_DISABLED" => $cookie_secure_no,
283 "GZIP_YES" => $gzip_yes,
284 "GZIP_NO" => $gzip_no,
285 "PRUNE_YES" => $prune_yes,
286 "PRUNE_NO" => $prune_no,
287 "HTML_TAGS" => $html_tags,
288 "HTML_YES" => $html_yes,
289 "HTML_NO" => $html_no,
290 "BBCODE_YES" => $bbcode_yes,
291 "BBCODE_NO" => $bbcode_no,
292 "SMILE_YES" => $smile_yes,
293 "SMILE_NO" => $smile_no,
294 "SIG_YES" => $sig_yes,
296 "SIG_SIZE" => $new['max_sig_chars'],
297 "NAMECHANGE_YES" => $namechange_yes,
298 "NAMECHANGE_NO" => $namechange_no,
299 "AVATARS_LOCAL_YES" => $avatars_local_yes,
300 "AVATARS_LOCAL_NO" => $avatars_local_no,
301 "AVATARS_REMOTE_YES" => $avatars_remote_yes,
302 "AVATARS_REMOTE_NO" => $avatars_remote_no,
303 "AVATARS_UPLOAD_YES" => $avatars_upload_yes,
304 "AVATARS_UPLOAD_NO" => $avatars_upload_no,
305 "AVATAR_FILESIZE" => $new['avatar_filesize'],
306 "AVATAR_MAX_HEIGHT" => $new['avatar_max_height'],
307 "AVATAR_MAX_WIDTH" => $new['avatar_max_width'],
308 "AVATAR_PATH" => $new['avatar_path'],
309 "AVATAR_GALLERY_PATH" => $new['avatar_gallery_path'],
310 "SMILIES_PATH" => $new['smilies_path'],
311 "INBOX_PRIVMSGS" => $new['max_inbox_privmsgs'],
312 "SENTBOX_PRIVMSGS" => $new['max_sentbox_privmsgs'],
313 "SAVEBOX_PRIVMSGS" => $new['max_savebox_privmsgs'],
314 "EMAIL_FROM" => $new['board_email'],
315 "EMAIL_SIG" => $new['board_email_sig'],
316 "SMTP_YES" => $smtp_yes,
317 "SMTP_NO" => $smtp_no,
318 "SMTP_HOST" => $new['smtp_host'],
319 "SMTP_USERNAME" => $new['smtp_username'],
320 "SMTP_PASSWORD" => $new['smtp_password'],
321 "COPPA_MAIL" => $new['coppa_mail'],
322 "COPPA_FAX" => $new['coppa_fax'])
325 $template->pparse("body");
327 include('./page_footer_admin.'.$phpEx);