diff options
27 files changed, 775 insertions, 834 deletions
diff --git a/phpBB/adm/admin_attachments.php b/phpBB/adm/admin_attachments.php index 05587a897e..61581f27ae 100644 --- a/phpBB/adm/admin_attachments.php +++ b/phpBB/adm/admin_attachments.php @@ -904,27 +904,27 @@ if ($mode == 'ext_groups') <th colspan="2"><?php echo $user->lang[strtoupper($action) . '_EXTENSION_GROUP']; ?></th> </tr> <tr> - <td class="row1" width="35%"><b><?php echo $user->lang['GROUP_NAME']; ?></b>:</td> + <td class="row1" width="35%"><b><?php echo $user->lang['GROUP_NAME']; ?>: </b></td> <td class="row2"><input type="text" size="20" maxlength="100" name="group_name" class="post" value="<?php echo $group_name; ?>" /></td> </tr> <tr> - <td class="row1" width="35%"><b><?php echo $user->lang['SPECIAL_CATEGORY']; ?></b>:</td> + <td class="row1" width="35%"><b><?php echo $user->lang['SPECIAL_CATEGORY']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['SPECIAL_CATEGORY_EXPLAIN']; ?></span></td> <td class="row2"><?php echo category_select('special_category', $group_id); ?></td> </tr> <tr> - <td class="row1" width="35%"><b><?php echo $user->lang['ALLOWED']; ?></b>:</td> + <td class="row1" width="35%"><b><?php echo $user->lang['ALLOWED']; ?>: </b></td> <td class="row2"><input type="checkbox" name="allow_group" value="<?php echo $group_id; ?>"<?php echo $s_allowed; ?> /></td> </tr> <tr> - <td class="row1" width="35%"><b><?php echo $user->lang['ALLOW_IN_PM']; ?></b>:</td> + <td class="row1" width="35%"><b><?php echo $user->lang['ALLOW_IN_PM']; ?>: </b></td> <td class="row2"><input type="checkbox" name="allow_in_pm" value="1"<?php echo $s_in_pm_allowed; ?> /></td> </tr> <tr> - <td class="row1" width="35%"><b><?php echo $user->lang['DOWNLOAD_MODE']; ?></b>:</td> + <td class="row1" width="35%"><b><?php echo $user->lang['DOWNLOAD_MODE']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['DOWNLOAD_MODE_EXPLAIN']; ?></span></td> <td class="row2"><?php echo download_select('download_mode', $group_id); ?></td> </tr> <tr> - <td class="row1" width="35%"><b><?php echo $user->lang['UPLOAD_ICON']; ?></b>:</td> + <td class="row1" width="35%"><b><?php echo $user->lang['UPLOAD_ICON']; ?>: </b></td> <td class="row2" align="left"> <table border="0" cellpadding="0" cellspacing="0"> <tr> @@ -935,11 +935,11 @@ if ($mode == 'ext_groups') </td> </tr> <tr> - <td class="row1" width="35%"><b><?php echo $user->lang['MAX_EXTGROUP_FILESIZE']; ?></b>:</td> + <td class="row1" width="35%"><b><?php echo $user->lang['MAX_EXTGROUP_FILESIZE']; ?>: </b></td> <td class="row2"><input type="text" size="3" maxlength="15" name="max_filesize" class="post" value="<?php echo $max_filesize; ?>" /> <?php echo size_select('size_select', $size_format); ?></td> </tr> <tr> - <td class="row1" width="35%" valign="top"><table border="0" cellspacing="0" cellpadding="0" width="100%"><tr><td colspan="2"><b><?php echo $user->lang['ASSIGNED_EXTENSIONS']; ?></b>:</td></tr> + <td class="row1" width="35%" valign="top"><table border="0" cellspacing="0" cellpadding="0" width="100%"><tr><td colspan="2"><b><?php echo $user->lang['ASSIGNED_EXTENSIONS']; ?>: </b></td></tr> <tr><td class="row1" width="20"> » </td> <td class="row1"><div id="ext" style="margin:0px; width:200px"> <?php $i = 0; @@ -951,7 +951,8 @@ if ($mode == 'ext_groups') $i++; } } - ?></div></td></tr></table> + ?></div></td></tr> + <tr><td class="row1"> </td><td class="row1"><br />[ <a href="admin_attachments.<?php echo $phpEx.$SID . '&mode=extensions'; ?>"><?php echo $user->lang['GO_TO_EXTENSIONS']; ?></a> ]</td></tr></table> </td> <td class="row2"><select name="extensions[]" onChange="show_extensions(this);" multiple="true" size="8" style="width:100px"> <?php @@ -963,7 +964,7 @@ if ($mode == 'ext_groups') </select></td> </tr> <tr> - <td class="row1" valign="top"><b><?php echo $user->lang['ALLOWED_FORUMS']; ?></b>:<br /><span class="gensmall"><?php echo $user->lang['ALLOWED_FORUMS_EXPLAIN']; ?></span></td> + <td class="row1" valign="top"><b><?php echo $user->lang['ALLOWED_FORUMS']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['ALLOWED_FORUMS_EXPLAIN']; ?></span></td> <td class="row2"><input type="radio" name="forum_select" value="0"<?php echo (!sizeof($forum_ids)) ? ' checked="checked"' : ''; ?> /> <?php echo $user->lang['ALLOW_ALL_FORUMS']; ?> <input type="radio" name="forum_select" value="1"<?php echo (sizeof($forum_ids)) ? ' checked="checked"' : ''; ?> /> <?php echo $user->lang['ALLOW_SELECTED_FORUMS']; ?><br /><br /> <select name="allowed_forums[]" multiple="true" size="8"> <?php diff --git a/phpBB/adm/admin_board.php b/phpBB/adm/admin_board.php index fff08ad48e..bf6884d3a7 100644 --- a/phpBB/adm/admin_board.php +++ b/phpBB/adm/admin_board.php @@ -37,59 +37,196 @@ $mode = request_var('mode', ''); $action = request_var('action', ''); $submit = (isset($_POST['submit'])) ? true : false; -// Check permissions/set title -switch ($mode) +// Set config vars +$display_vars = array( + 'cookie' => array( + 'auth' => 'a_cookies', + 'title' => 'COOKIE_SETTINGS', + 'vars' => array( + 'cookie_domain' => array('lang' => 'COOKIE_DOMAIN', 'type' => 'text::255', 'explain' => false), + 'cookie_name' => array('lang' => 'COOKIE_NAME', 'type' => 'text::16', 'explain' => false), + 'cookie_path' => array('lang' => 'COOKIE_PATH', 'type' => 'text::255', 'explain' => false), + 'cookie_secure' => array('lang' => 'COOKIE_SECURE', 'type' => 'radio:disabled_enabled', 'explain' => true) + ) + ), + 'avatar' => array( + 'auth' => 'a_board', + 'title' => 'AVATAR_SETTINGS', + 'vars' => array( + 'avatar_min_height' => false, 'avatar_min_width' => false, 'avatar_max_height' => false, 'avatar_max_width' => false, + + 'allow_avatar_local' => array('lang' => 'ALLOW_LOCAL', 'type' => 'radio:yes_no', 'explain' => false), + 'allow_avatar_remote' => array('lang' => 'ALLOW_REMOTE', 'type' => 'radio:yes_no', 'explain' => true), + 'allow_avatar_upload' => array('lang' => 'ALLOW_UPLOAD', 'type' => 'radio:yes_no', 'explain' => false), + 'avatar_filesize' => array('lang' => 'MAX_FILESIZE', 'type' => 'text:4:10', 'explain' => true, 'append' => ' ' . $user->lang['BYTES']), + 'avatar_min' => array('lang' => 'MIN_AVATAR_SIZE', 'type' => 'dimension:3:4', 'explain' => true), + 'avatar_max' => array('lang' => 'MAX_AVATAR_SIZE', 'type' => 'dimension:3:4', 'explain' => true), + 'avatar_path' => array('lang' => 'AVATAR_STORAGE_PATH', 'type' => 'text:20:255', 'explain' => true), + 'avatar_gallery_path' => array('lang' => 'AVATAR_GALLERY_PATH', 'type' => 'text:20:255', 'explain' => true) + ) + ), + 'email' => array( + 'auth' => 'a_server', + 'title' => 'EMAIL_SETTINGS', + 'vars' => array( + 'email_enable' => array('lang' => 'ENABLE_EMAIL', 'type' => 'radio:enabled_disabled', 'explain' => true), + 'board_email_form' => array('lang' => 'BOARD_EMAIL_FORM', 'type' => 'radio:enabled_disabled', 'explain' => true), + 'email_function_name' => array('lang' => 'EMAIL_FUNCTION_NAME', 'type' => 'text:20:50', 'explain' => true), + 'email_package_size' => array('lang' => 'EMAIL_PACKAGE_SIZE', 'type' => 'text:5:5', 'explain' => true), + 'board_contact' => array('lang' => 'CONTACT_EMAIL', 'type' => 'text:25:100', 'explain' => true), + 'board_email' => array('lang' => 'ADMIN_EMAIL', 'type' => 'text:25:100', 'explain' => true), + 'board_email_sig' => array('lang' => 'EMAIL_SIG', 'type' => 'textarea:5:30', 'explain' => true), + 'smtp_delivery' => array('lang' => 'USE_SMTP', 'type' => 'radio:yes_no', 'explain' => true), + 'smtp_host' => array('lang' => 'SMTP_SERVER', 'type' => 'text:25:50', 'explain' => false), + 'smtp_port' => array('lang' => 'SMTP_PORT', 'type' => 'text:4:5', 'explain' => true), + 'smtp_auth_method' => array('lang' => 'SMTP_AUTH_METHOD', 'type' => 'select', 'options' => 'mail_auth_select(\'{VALUE}\')', 'explain' => true), + 'smtp_username' => array('lang' => 'SMTP_USERNAME', 'type' => 'text:25:255', 'explain' => true), + 'smtp_password' => array('lang' => 'SMTP_PASSWORD', 'type' => 'password:25:255', 'explain' => true) + ) + ), + 'load' => array( + 'auth' => 'a_server', + 'title' => 'SERVER_SETTINGS', + 'vars' => array( + 'limit_load' => array('lang' => 'LIMIT_LOAD', 'type' => 'text:4:4', 'explain' => true), + 'session_length' => array('lang' => 'SESSION_LENGTH', 'type' => 'text:5:5', 'explain' => true), + 'active_sessions' => array('lang' => 'LIMIT_SESSIONS', 'type' => 'text:4:4', 'explain' => true), + 'load_db_track' => array('lang' => 'YES_POST_MARKING', 'type' => 'radio:yes_no', 'explain' => true), + 'load_db_lastread' => array('lang' => 'YES_READ_MARKING', 'type' => 'radio:yes_no', 'explain' => true), + 'load_online' => array('lang' => 'YES_ONLINE', 'type' => 'radio:yes_no', 'explain' => true), + 'load_onlinetrack' => array('lang' => 'YES_ONLINE_TRACK', 'type' => 'radio:yes_no', 'explain' => true), + 'load_online_time' => array('lang' => 'ONLINE_LENGTH', 'type' => 'text:4:3', 'explain' => true), + 'load_birthdays' => array('lang' => 'YES_BIRTHDAYS', 'type' => 'radio:yes_no', 'explain' => false), + 'load_moderators' => array('lang' => 'YES_MODERATORS', 'type' => 'radio:yes_no', 'explain' => false), + 'load_jumpbox' => array('lang' => 'YES_JUMPBOX', 'type' => 'radio:yes_no', 'explain' => false), + 'load_search' => array('lang' => 'YES_SEARCH', 'type' => 'radio:yes_no', 'explain' => true), + 'search_interval' => array('lang' => 'SEARCH_INTERVAL', 'type' => 'text:3:4', 'explain' => true), + 'min_search_chars' => array('lang' => 'MIN_SEARCH_CHARS', 'type' => 'text:3:3', 'explain' => true), + 'max_search_chars' => array('lang' => 'MAX_SEARCH_CHARS', 'type' => 'text:3:3', 'explain' => true), + 'load_search_upd' => array('lang' => 'YES_SEARCH_UPDATE', 'type' => 'radio:yes_no', 'explain' => true), +// 'load_search_phr' => array('lang' => 'YES_SEARCH_PHRASE', 'type' => 'radio:yes_no', 'explain' => true), + 'load_tplcompile' => array('lang' => 'RECOMPILE_TEMPLATES', 'type' => 'radio:yes_no', 'explain' => true) + ) + ), + 'default' => array( + 'auth' => 'a_defaults', + 'title' => 'BOARD_DEFAULTS', + 'vars' => array( + 'default_style' => array('lang' => 'DEFAULT_STYLE', 'type' => 'select', 'options' => 'style_select(\'{VALUE}\', true)', 'explain' => false), + 'override_user_style' => array('lang' => 'OVERRIDE_STYLE', 'type' => 'radio:yes_no', 'explain' => true), + 'default_lang' => array('lang' => 'DEFAULT_LANGUAGE', 'type' => 'select', 'options' => 'language_select(\'{VALUE}\')', 'explain' => false), + 'default_dateformat' => array('lang' => 'DEFAULT_DATE_FORMAT', 'type' => 'text::255', 'explain' => true), + 'board_timezone' => array('lang' => 'SYSTEM_TIMEZONE', 'type' => 'select', 'options' => 'tz_select(\'{VALUE}\')', 'explain' => false), + 'board_dst' => array('lang' => 'SYSTEM_DST', 'type' => 'radio:yes_no', 'explain' => false), + 'allow_privmsg' => array('lang' => 'BOARD_PM', 'type' => 'radio:yes_no', 'explain' => true), + 'allow_topic_notify' => array('lang' => 'ALLOW_TOPIC_NOTIFY', 'type' => 'radio:yes_no', 'explain' => false), + 'allow_forum_notify' => array('lang' => 'ALLOW_FORUM_NOTIFY', 'type' => 'radio:yes_no', 'explain' => false), + 'allow_namechange' => array('lang' => 'ALLOW_NAME_CHANGE', 'type' => 'radio:yes_no', 'explain' => false), + 'allow_attachments' => array('lang' => 'ALLOW_ATTACHMENTS', 'type' => 'radio:yes_no', 'explain' => false), + 'allow_pm_attach' => array('lang' => 'ALLOW_PM_ATTACHMENTS', 'type' => 'radio:yes_no', 'explain' => false), + 'allow_html' => array('lang' => 'ALLOW_HTML', 'type' => 'radio:yes_no', 'explain' => false), + 'allow_html_tags' => array('lang' => 'ALLOWED_TAGS', 'type' => 'text:30:255', 'explain' => true), + 'allow_bbcode' => array('lang' => 'ALLOW_BBCODE', 'type' => 'radio:yes_no', 'explain' => false), + 'allow_smilies' => array('lang' => 'ALLOW_SMILIES', 'type' => 'radio:yes_no', 'explain' => false), + 'allow_sig' => array('lang' => 'ALLOW_SIG', 'type' => 'radio:yes_no', 'explain' => false), + 'max_sig_chars' => array('lang' => 'MAX_SIG_LENGTH', 'type' => 'text:5:4', 'explain' => true), + 'allow_nocensors' => array('lang' => 'ALLOW_NO_CENSORS', 'type' => 'radio:yes_no', 'explain' => true) + ) + ), + 'message' => array( + 'auth' => 'a_defaults', + 'title' => 'MESSAGE_SETTINGS', + 'vars' => array( + 'pm_max_boxes' => array('lang' => 'BOXES_MAX', 'type' => 'text:4:4', 'explain' => true), + 'pm_max_msgs' => array('lang' => 'BOXES_LIMIT', 'type' => 'text:4:4', 'explain' => true), + 'full_folder_action' => array('lang' => 'FULL_FOLDER_ACTION', 'type' => 'select', 'options' => 'full_folder_select(\'{VALUE}\')', 'explain' => true), + 'pm_edit_time' => array('lang' => 'PM_EDIT_TIME', 'type' => 'text:3:3', 'explain' => true), + 'allow_mass_pm' => array('lang' => 'ALLOW_MASS_PM', 'type' => 'radio:yes_no', 'explain' => false), + 'allow_html_pm' => array('lang' => 'ALLOW_HTML_PM', 'type' => 'radio:yes_no', 'explain' => false), + 'allow_bbcode_pm' => array('lang' => 'ALLOW_BBCODE_PM', 'type' => 'radio:yes_no', 'explain' => false), + 'allow_smilies_pm' => array('lang' => 'ALLOW_SMILIES_PM', 'type' => 'radio:yes_no', 'explain' => false), + 'auth_download_pm' => array('lang' => 'AUTH_DOWNLOAD_PM', 'type' => 'radio:yes_no', 'explain' => false), + 'allow_sig_pm' => array('lang' => 'ALLOW_SIG_PM', 'type' => 'radio:yes_no', 'explain' => false), +// 'enable_karma_pm' => array('lang' => 'ENABLE_KARMA_PM', 'type' => 'radio:yes_no', 'explain' => false), + 'auth_report_pm' => array('lang' => 'AUTH_REPORT_PM', 'type' => 'radio:yes_no', 'explain' => false), + 'auth_quote_pm' => array('lang' => 'AUTH_QUOTE_PM', 'type' => 'radio:yes_no', 'explain' => false), + 'print_pm' => array('lang' => 'PRINT_PM', 'type' => 'radio:yes_no', 'explain' => false), + 'email_pm' => array('lang' => 'EMAIL_PM', 'type' => 'radio:yes_no', 'explain' => false), + 'forward_pm' => array('lang' => 'FORWARD_PM', 'type' => 'radio:yes_no', 'explain' => false), + 'auth_img_pm' => array('lang' => 'AUTH_IMG_PM', 'type' => 'radio:yes_no', 'explain' => false), + 'auth_flash_pm' => array('lang' => 'AUTH_FLASH_PM', 'type' => 'radio:yes_no', 'explain' => false), + 'enable_pm_icons' => array('lang' => 'ENABLE_PM_ICONS', 'type' => 'radio:yes_no', 'explain' => false) + ) + ), + 'server' => array( + 'auth' => 'a_server', + 'title' => 'SERVER_SETTINGS', + 'vars' => array( + 'server_name' => array('lang' => 'SERVER_NAME', 'type' => 'text:40:255', 'explain' => true), + 'server_port' => array('lang' => 'SERVER_PORT', 'type' => 'text:5:5', 'explain' => true), + 'script_path' => array('lang' => 'SCRIPT_PATH', 'type' => 'text::255', 'explain' => true), + 'ip_check' => array('lang' => 'IP_VALID', 'type' => 'custom', 'options' => 'select_ip_check(\'{VALUE}\')', 'explain' => true), + 'browser_check' => array('lang' => 'BROWSER_VALID', 'type' => 'radio:yes_no', 'explain' => true), + 'gzip_compress' => array('lang' => 'ENABLE_GZIP', 'type' => 'radio:yes_no', 'explain' => false), + 'smilies_path' => array('lang' => 'SMILIES_PATH', 'type' => 'text:20:255', 'explain' => true), + 'icons_path' => array('lang' => 'ICONS_PATH', 'type' => 'text:20:255', 'explain' => true), + 'upload_icons_path' => array('lang' => 'UPLOAD_ICONS_PATH', 'type' => 'text:20:255', 'explain' => true), + 'ranks_path' => array('lang' => 'RANKS_PATH', 'type' => 'text:20:255', 'explain' => true) + ) + ), + 'setting' => array( + 'auth' => 'a_board', + 'title' => 'BOARD_SETTINGS', + 'vars' => array( + 'board_disable_msg' => false, 'max_name_chars' => false, 'max_pass_chars' => false, 'bump_type' => false, + + 'sitename' => array('lang' => 'SITE_NAME', 'type' => 'text:40:255', 'explain' => false), + 'site_desc' => array('lang' => 'SITE_DESC', 'type' => 'text:40:255', 'explain' => false), + 'board_disable' => array('lang' => 'DISABLE_BOARD', 'type' => 'custom', 'options' => 'board_disable(\'{VALUE}\')', 'explain' => true), + 'require_activation'=> array('lang' => 'ACC_ACTIVATION', 'type' => 'custom', 'options' => 'select_acc_activation(\'{VALUE}\')', 'explain' => true), + 'coppa_enable' => array('lang' => 'ENABLE_COPPA', 'type' => 'radio:yes_no', 'explain' => true), + 'coppa_fax' => array('lang' => 'COPPA_FAX', 'type' => 'text:25:100', 'explain' => false), + 'coppa_mail' => array('lang' => 'COPPA_MAIL', 'type' => 'textarea:5:40', 'explain' => true), + 'enable_confirm' => array('lang' => 'VISUAL_CONFIRM', 'type' => 'radio:yes_no', 'explain' => true), + 'max_reg_attempts' => array('lang' => 'REG_LIMIT', 'type' => 'text:4:4', 'explain' => true), + 'min_name_chars' => array('lang' => 'USERNAME_LENGTH', 'type' => 'custom', 'options' => 'username_length(\'{VALUE}\')', 'explain' => true), + 'allow_name_chars' => array('lang' => 'USERNAME_CHARS', 'type' => 'select', 'options' => 'select_username_chars(\'{VALUE}\')', 'explain' => true), + 'min_pass_chars' => array('lang' => 'PASSWORD_LENGTH', 'type' => 'custom', 'options' => 'password_length(\'{VALUE}\')', 'explain' => true), + 'pass_complex' => array('lang' => 'PASSWORD_TYPE', 'type' => 'select', 'options' => 'select_password_chars(\'{VALUE}\')', 'explain' => true), + 'chg_passforce' => array('lang' => 'FORCE_PASS_CHANGE', 'type' => 'text:3:3', 'explain' => true), + 'allow_emailreuse' => array('lang' => 'ALLOW_EMAIL_REUSE', 'type' => 'radio:yes_no', 'explain' => true), + 'edit_time' => array('lang' => 'EDIT_TIME', 'type' => 'text:3:3', 'explain' => true), + 'display_last_edited' => array('lang' => 'DISPLAY_LAST_EDITED', 'type' => 'radio:yes_no', 'explain' => true), + 'flood_interval' => array('lang' => 'FLOOD_INTERVAL', 'type' => 'text:3:4', 'explain' => true), + 'bump_interval' => array('lang' => 'BUMP_INTERVAL', 'type' => 'custom', 'options' => 'bump_interval(\'{VALUE}\')', 'explain' => true), + 'topics_per_page' => array('lang' => 'TOPICS_PER_PAGE', 'type' => 'text:3:4', 'explain' => false), + 'posts_per_page' => array('lang' => 'POSTS_PER_PAGE', 'type' => 'text:3:4', 'explain' => false), + 'hot_threshold' => array('lang' => 'HOT_THRESHOLD', 'type' => 'text:3:4', 'explain' => false), + 'max_poll_options' => array('lang' => 'MAX_POLL_OPTIONS', 'type' => 'text:4:4', 'explain' => false), + 'max_post_chars' => array('lang' => 'CHAR_LIMIT', 'type' => 'text:4:6', 'explain' => true), + 'max_post_smilies' => array('lang' => 'SMILIES_LIMIT', 'type' => 'text:4:4', 'explain' => true), + 'max_quote_depth' => array('lang' => 'QUOTE_DEPTH_LIMIT', 'type' => 'text:4:4', 'explain' => true) + ) + ), + 'auth' => array( + 'auth' => 'a_server', + 'title' => 'AUTH_SETTINGS', + 'vars' => array( + 'auth_method' => array('lang' => 'AUTH_METHOD', 'type' => 'select', 'options' => 'select_auth_method(\'{VALUE}\')', 'explain' => false) + ) + ) +); + +if (!in_array($mode, array_keys($display_vars))) { - case 'cookie': - $l_title = 'COOKIE_SETTINGS'; - $which_auth = 'a_cookies'; - break; - case 'default': - $l_title = 'BOARD_DEFAULTS'; - $which_auth = 'a_defaults'; - break; - case 'avatar': - $l_title = 'AVATAR_SETTINGS'; - $which_auth = 'a_board'; - break; - case 'setting': - $l_title = 'BOARD_SETTINGS'; - $which_auth = 'a_board'; - break; - case 'email': - $l_title = 'EMAIL_SETTINGS'; - $which_auth = 'a_server'; - break; - case 'server': - $l_title = 'SERVER_SETTINGS'; - $which_auth = 'a_server'; - break; - case 'load': - $l_title = 'LOAD_SETTINGS'; - $which_auth = 'a_server'; - break; - case 'auth': - $l_title = 'AUTH_SETTINGS'; - $which_auth = 'a_server'; - break; -// case 'karma': -// $l_title = 'KARMA_SETTINGS'; -// $which_auth = 'a_user'; -// break; - case 'message': - $l_title = 'MESSAGE_SETTINGS'; - $which_auth = 'a_defaults'; - break; - case 'message': - $l_title = 'MESSAGE_SETTINGS'; - $which_auth = 'a_defaults'; - break; - default: - return; + return; } +// Perform the current mode +$display_vars = $display_vars[$mode]; + // Check permissions -if (!$auth->acl_get($which_auth)) +if (!$auth->acl_get($display_vars['auth'])) { trigger_error($user->lang['NO_ADMIN']); } @@ -97,8 +234,15 @@ if (!$auth->acl_get($which_auth)) $new = $config; $cfg_array = (isset($_REQUEST['config'])) ? request_var('config', '') : $new; -foreach ($cfg_array as $config_name => $config_value) +// We go through the display_vars to make sure no one is trying to set variables he/she is not allowed to... +foreach ($display_vars['vars'] as $config_name => $null) { + if (!isset($cfg_array[$config_name])) + { + continue; + } + + $config_value = $cfg_array[$config_name]; $new[$config_name] = $config_value; if ($config_name == 'email_function_name') @@ -119,771 +263,306 @@ if ($submit) trigger_error($user->lang['CONFIG_UPDATED']); } -adm_page_header($user->lang[$l_title]); +adm_page_header($user->lang[$display_vars['title']]); ?> -<h1><?php echo $user->lang[$l_title]; ?></h1> +<h1><?php echo $user->lang[$display_vars['title']]; ?></h1> -<p><?php echo $user->lang[$l_title . '_EXPLAIN']; ?></p> +<p><?php echo $user->lang[$display_vars['title'] . '_EXPLAIN']; ?></p> <form action="<?php echo "admin_board.$phpEx$SID&mode=$mode"; ?>" method="post"><table class="bg" width="95%" cellspacing="1" cellpadding="4" border="0" align="center"> <tr> - <th colspan="2"><?php echo $user->lang[$l_title]; ?></th> + <th colspan="2"><?php echo $user->lang[$display_vars['title']]; ?></th> </tr> <?php // Output relevant page -switch ($mode) +foreach ($display_vars['vars'] as $config_key => $vars) { - case 'cookie': + if (!is_array($vars)) + { + continue; + } - $cookie_secure_yes = ($new['cookie_secure']) ? 'checked="checked"' : ''; - $cookie_secure_no = (!$new['cookie_secure']) ? 'checked="checked"' : ''; + $type = explode(':', $vars['type']); ?> + <tr> - <td class="row1" width="50%"><b><?php echo $user->lang['COOKIE_DOMAIN']; ?>: </b></td> - <td class="row2"><input class="post" type="text" maxlength="255" name="config[cookie_domain]" value="<?php echo $new['cookie_domain']; ?>" /></td> - </tr> - <tr> - <td class="row1"><b><?php echo $user->lang['COOKIE_NAME']; ?>: </b></td> - <td class="row2"><input class="post" type="text" maxlength="16" name="config[cookie_name]" value="<?php echo $new['cookie_name']; ?>" /></td> - </tr> - <tr> - <td class="row1"><b><?php echo $user->lang['COOKIE_PATH']; ?>: </b></td> - <td class="row2"><input class="post" type="text" maxlength="255" name="config[cookie_p]" value="<?php echo $new['cookie_path']; ?>" /></td> - </tr> - <tr> - <td class="row1"><b><?php echo $user->lang['COOKIE_SECURE']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['COOKIE_SECURE_EXPLAIN']; ?></span></td> - <td class="row2"><input type="radio" name="config[cookie_secure]" value="0"<?php echo $cookie_secure_no; ?> /><?php echo $user->lang['DISABLED']; ?> <input type="radio" name="config[cookie_secure]" value="1"<?php echo $cookie_secure_yes; ?> /><?php echo $user->lang['ENABLED']; ?></td> + <td class="row1" width="50%"><b><?php echo $user->lang[$vars['lang']]; ?>: </b><?php echo ($vars['explain']) ? '<br /><span class="gensmall">' . $user->lang[$vars['lang'] . '_EXPLAIN'] . '</span>' : ''; ?></td> + <td class="row2"><?php echo build_cfg_template($type, $config_key, ((isset($vars['options'])) ? $vars['options'] : '')) . ((isset($vars['append'])) ? str_replace('{VALUE}', $new[$config_key], $vars['append']) : ''); ?></td> </tr> + <?php + + unset($display_vars['vars'][$config_key]); +} - break; +if ($mode == 'auth') +{ + $auth_plugins = array(); - case 'avatar': + $dp = opendir($phpbb_root_path . 'includes/auth'); + while ($file = readdir($dp)) + { + if (preg_match('#^auth_(.*?)\.' . $phpEx . '$#', $file)) + { + $auth_plugins[] = preg_replace('#^auth_(.*?)\.' . $phpEx . '$#', '\1', $file); + } + } - $avatars_local_yes = ($new['allow_avatar_local']) ? 'checked="checked"' : ''; - $avatars_local_no = (!$new['allow_avatar_local']) ? 'checked="checked"' : ''; - $avatars_remote_yes = ($new['allow_avatar_remote']) ? 'checked="checked"' : ''; - $avatars_remote_no = (!$new['allow_avatar_remote']) ? 'checked="checked"' : ''; - $avatars_upload_yes = ($new['allow_avatar_upload']) ? 'checked="checked"' : ''; - $avatars_upload_no = (!$new['allow_avatar_upload']) ? 'checked="checked"' : ''; + sort($auth_plugins); + + foreach ($auth_plugins as $method) + { + if ($method && file_exists($phpbb_root_path . 'includes/auth/auth_' . $method . '.' . $phpEx)) + { + include_once($phpbb_root_path . 'includes/auth/auth_' . $method . '.' . $phpEx); + + $method = 'admin_' . $method; + if (function_exists($method)) + { + if ($config_fields = $method($new)) + { + // Check if we need to create config fields for this plugin + foreach($config_fields as $field) + { + if (!isset($config[$field])) + { + set_config($field, ''); + } + } + } + unset($config_fields); + } + } + } +} ?> <tr> - <td class="row1" width="50%"><b><?php echo $user->lang['ALLOW_LOCAL']; ?>: </b></td> - <td class="row2"><input type="radio" name="config[allow_avatar_local]" value="1"<?php echo $avatars_local_yes; ?> /> <?php echo $user->lang['YES']; ?> <input type="radio" name="config[allow_avatar_local]" value="0"<?php echo $avatars_local_no; ?> /> <?php echo $user->lang['NO']; ?></td> - </tr> - <tr> - <td class="row1"><b><?php echo $user->lang['ALLOW_REMOTE']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['ALLOW_REMOTE_EXPLAIN']; ?></span></td> - <td class="row2"><input type="radio" name="config[allow_avatar_remote]" value="1"<?php echo $avatars_remote_yes; ?> /> <?php echo $user->lang['YES']; ?> <input type="radio" name="config[allow_avatar_remote]" value="0"<?php echo $avatars_remote_no; ?> /> <?php echo $user->lang['NO']; ?></td> - </tr> - <tr> - <td class="row1"><b><?php echo $user->lang['ALLOW_UPLOAD']; ?>: </b></td> - <td class="row2"><input type="radio" name="config[allow_avatar_upload]" value="1"<?php echo $avatars_upload_yes; ?> /> <?php echo $user->lang['YES']; ?> <input type="radio" name="config[allow_avatar_upload]" value="0"<?php echo $avatars_upload_no; ?> /> <?php echo $user->lang['NO']; ?></td> - </tr> - <tr> - <td class="row1"><b><?php echo $user->lang['MAX_FILESIZE']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['MAX_FILESIZE_EXPLAIN']; ?></span></td> - <td class="row2"><input class="post" type="text" size="4" maxlength="10" name="config[avatar_filesize]" value="<?php echo $new['avatar_filesize']; ?>" /> Bytes</td> - </tr> - <tr> - <td class="row1"><b><?php echo $user->lang['MIN_AVATAR_SIZE']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['MIN_AVATAR_SIZE_EXPLAIN']; ?></span></td> - <td class="row2"><input class="post" type="text" size="3" maxlength="4" name="config[avatar_min_height]" value="<?php echo $new['avatar_min_height']; ?>" /> x <input class="post" type="text" size="3" maxlength="4" name="config[avatar_min_width]" value="<?php echo $new['avatar_min_width']; ?>"></td> - </tr> - <tr> - <td class="row1"><b><?php echo $user->lang['MAX_AVATAR_SIZE']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['MAX_AVATAR_SIZE_EXPLAIN']; ?></span></td> - <td class="row2"><input class="post" type="text" size="3" maxlength="4" name="config[avatar_max_height]" value="<?php echo $new['avatar_max_height']; ?>" /> x <input class="post" type="text" size="3" maxlength="4" name="config[avatar_max_width]" value="<?php echo $new['avatar_max_width']; ?>"></td> - </tr> - <tr> - <td class="row1"><b><?php echo $user->lang['AVATAR_STORAGE_PATH']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['AVATAR_STORAGE_PATH_EXPLAIN']; ?></span></td> - <td class="row2"><input class="post" type="text" size="20" maxlength="255" name="config[avatar_path]" value="<?php echo $new['avatar_path']; ?>" /></td> - </tr> - <tr> - <td class="row1"><b><?php echo $user->lang['AVATAR_GALLERY_PATH']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['AVATAR_GALLERY_PATH_EXPLAIN']; ?></span></td> - <td class="row2"><input class="post" type="text" size="20" maxlength="255" name="config[avatar_gallery_path]" value="<?php echo $new['avatar_gallery_path']; ?>" /></td> + <td class="cat" colspan="2" align="center"><input type="submit" name="submit" value="<?php echo $user->lang['SUBMIT']; ?>" class="btnmain" /> <input type="reset" value="<?php echo $user->lang['RESET']; ?>" class="btnlite" /></td> </tr> -<?php - - break; +</table></form> - case 'default': +<?php - $style_select = style_select($new['default_style'], true); - $lang_select = language_select($new['default_lang']); - $timezone_select = tz_select($new['board_timezone']); +adm_page_footer(); - $dst_yes = ($new['board_dst']) ? 'checked="checked"' : ''; - $dst_no = (!$new['board_dst']) ? 'checked="checked"' : ''; +function select_auth_method($selected_method) +{ + global $new, $phpbb_root_path, $phpEx; - $yes_no_switches = array('override_user_style', 'allow_privmsg', 'allow_topic_notify', 'allow_forum_notify', 'allow_html', 'allow_bbcode', 'allow_smilies', 'allow_sig', 'allow_nocensors', 'allow_namechange', 'allow_attachments', 'allow_pm_attach', 'board_dst'); + $auth_plugins = array(); - foreach ($yes_no_switches as $switch) + $dp = opendir($phpbb_root_path . 'includes/auth'); + while ($file = readdir($dp)) + { + if (preg_match('#^auth_(.*?)\.' . $phpEx . '$#', $file)) { - $switch_var = str_replace('allow_', '', $switch); - ${$switch_var . '_yes'} = ($new[$switch]) ? ' checked="checked"' : ''; - ${$switch_var . '_no'} = (!$new[$switch]) ? ' checked="checked"' : ''; + $auth_plugins[] = preg_replace('#^auth_(.*?)\.' . $phpEx . '$#', '\1', $file); } + } -?> - <tr> - <td class="row1" width="50%"><b><?php echo $user->lang['DEFAULT_STYLE']; ?></td> - <td class="row2"><select name="config[default_style]"><?php echo $style_select; ?></select></td> - </tr> - <tr> - <td class="row1"><b><?php echo $user->lang['OVERRIDE_STYLE']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['OVERRIDE_STYLE_EXPLAIN']; ?></span></td> - <td class="row2"><input type="radio" name="config[override_user_style]" value="1" <?php echo $override_user_style_yes; ?> /> <?php echo $user->lang['YES']; ?> <input type="radio" name="config[override_user_style]" value="0" <?php echo $override_user_style_no; ?> /> <?php echo $user->lang['NO']; ?></td> - </tr> - <tr> - <td class="row1"><b><?php echo $user->lang['DEFAULT_LANGUAGE']; ?>: </b></td> - <td class="row2"><select name="config[default_lang]"><?php echo $lang_select; ?></select></td> - </tr> - <tr> - <td class="row1"><b><?php echo $user->lang['DEFAULT_DATE_FORMAT']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['DEFAULT_DATE_FORMAT_EXPLAIN']; ?></span></td> - <td class="row2"><input class="post" type="text" name="config[default_dateformat]" value="<?php echo $new['default_dateformat']; ?>" /></td> - </tr> - <tr> - <td class="row1"><b><?php echo $user->lang['SYSTEM_TIMEZONE']; ?>: </b></td> - <td class="row2"><select name="config[board_timezone]"><?php echo $timezone_select; ?></select></td> - </tr> - <tr> - <td class="row1"><b><?php echo $user->lang['SYSTEM_DST']; ?>: </b></td> - <td class="row2"><input type="radio" name="config[board_dst]" value="1" <?php echo $board_dst_yes; ?> /> <?php echo $user->lang['YES']; ?> <input type="radio" name="config[board_dst]" value="0" <?php echo $board_dst_no; ?> /> <?php echo $user->lang['NO']; ?></td> - </tr> - <tr> - <td class="row1"><b><?php echo $user->lang['BOARD_PM']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['BOARD_PM_EXPLAIN']; ?></span></td> - <td class="row2"><input type="radio" name="config[allow_privmsg]" value="1" <?php echo $privmsg_yes; ?> /><?php echo $user->lang['ENABLED']; ?> <input type="radio" name="config[allow_privmsg]" value="0" <?php echo $privmsg_no; ?> /><?php echo $user->lang['DISABLED']; ?></td> - </tr> - <tr> - <td class="row1"><b><?php echo $user->lang['ALLOW_TOPIC_NOTIFY']; ?>: </b></td> - <td class="row2"><input type="radio" name="config[allow_topic_notify]" value="1" <?php echo $topic_notify_yes; ?> /> <?php echo $user->lang['YES']; ?> <input type="radio" name="config[allow_topic_notify]" value="0" <?php echo $topic_notify_no; ?> /> <?php echo $user->lang['NO']; ?></td> - </tr> - <tr> - <td class="row1"><b><?php echo $user->lang['ALLOW_FORUM_NOTIFY']; ?>: </b></td> - <td class="row2"><input type="radio" name="config[allow_forum_notify]" value="1" <?php echo $forum_notify_yes; ?> /> <?php echo $user->lang['YES']; ?> <input type="radio" name="config[allow_forum_notify]" value="0" <?php echo $forum_notify_no; ?> /> <?php echo $user->lang['NO']; ?></td> - </tr> - <tr> - <td class="row1"><b><?php echo $user->lang['ALLOW_NAME_CHANGE']; ?>: </b></td> - <td class="row2"><input type="radio" name="config[allow_namechange]" value="1" <?php echo $namechange_yes; ?> /> <?php echo $user->lang['YES']; ?> <input type="radio" name="config[allow_namechange]" value="0" <?php echo $namechange_no; ?> /> <?php echo $user->lang['NO']; ?></td> - </tr> - <tr> - <td class="row1"><b><?php echo $user->lang['ALLOW_ATTACHMENTS']; ?>: </b></td> - <td class="row2"><input type="radio" name="config[allow_attachments]" value="1" <?php echo $attachments_yes; ?> /> <?php echo $user->lang['YES']; ?> <input type="radio" name="config[allow_attachments]" value="0" <?php echo $attachments_no; ?> /> <?php echo $user->lang['NO']; ?></td> - </tr> - <tr> - <td class="row1"><b><?php echo $user->lang['ALLOW_PM_ATTACHMENTS']; ?>: </b></td> - <td class="row2"><input type="radio" name="config[allow_pm_attach]" value="1" <?php echo $pm_attach_yes; ?> /> <?php echo $user->lang['YES']; ?> <input type="radio" name="config[allow_pm_attach]" value="0" <?php echo $pm_attach_no; ?> /> <?php echo $user->lang['NO']; ?></td> - </tr> - <tr> - <td class="row1"><b><?php echo $user->lang['ALLOW_HTML']; ?>: </b></td> - <td class="row2"><input type="radio" name="config[allow_html]" value="1" <?php echo $html_yes; ?> /> <?php echo $user->lang['YES']; ?> <input type="radio" name="config[allow_html]" value="0" <?php echo $html_no; ?> /> <?php echo $user->lang['NO']; ?></td> - </tr> - <tr> - <td class="row1"><b><?php echo $user->lang['ALLOWED_TAGS']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['ALLOWED_TAGS_EXPLAIN']; ?></span></td> - <td class="row2"><input class="post" type="text" size="30" maxlength="255" name="config[allow_html_tags]" value="<?php echo $new['allow_html_tags']; ?>" /></td> - </tr> - <tr> - <td class="row1"><b><?php echo $user->lang['ALLOW_BBCODE']; ?>: </b></td> - <td class="row2"><input type="radio" name="config[allow_bbcode]" value="1" <?php echo $bbcode_yes; ?> /> <?php echo $user->lang['YES']; ?> <input type="radio" name="config[allow_bbcode]" value="0" <?php echo $bbcode_no; ?> /> <?php echo $user->lang['NO']; ?></td> - </tr> - <tr> - <td class="row1"><b><?php echo $user->lang['ALLOW_SMILIES']; ?>: </b></td> - <td class="row2"><input type="radio" name="config[allow_smilies]" value="1" <?php echo $smilies_yes; ?> /> <?php echo $user->lang['YES']; ?> <input type="radio" name="config[allow_smilies]" value="0" <?php echo $smilies_no; ?> /> <?php echo $user->lang['NO']; ?></td> - </tr> - <tr> - <td class="row1"><b><?php echo $user->lang['ALLOW_SIG']; ?>: </b></td> - <td class="row2"><input type="radio" name="config[allow_sig]" value="1" <?php echo $sig_yes; ?> /> <?php echo $user->lang['YES']; ?> <input type="radio" name="config[allow_sig]" value="0" <?php echo $sig_no; ?> /> <?php echo $user->lang['NO']; ?></td> - </tr> - <tr> - <td class="row1"><b><?php echo $user->lang['MAX_SIG_LENGTH']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['MAX_SIG_LENGTH_EXPLAIN']; ?></span></td> - <td class="row2"><input class="post" type="text" size="5" maxlength="4" name="config[max_sig_chars]" value="<?php echo $new['max_sig_chars']; ?>" /></td> - </tr> - <tr> - <td class="row1"><b><?php echo $user->lang['ALLOW_NO_CENSORS']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['ALLOW_NO_CENSORS_EXPLAIN']; ?></span></td> - <td class="row2"><input type="radio" name="config[allow_nocensors]" value="1" <?php echo $nocensors_yes; ?> /> <?php echo $user->lang['YES']; ?> <input type="radio" name="config[allow_nocensors]" value="0" <?php echo $nocensors_no; ?> /> <?php echo $user->lang['NO']; ?></td> - </tr> -<?php + sort($auth_plugins); - break; + $auth_select = ''; + foreach ($auth_plugins as $method) + { + $selected = ($selected_method == $method) ? ' selected="selected"' : ''; + $auth_select .= '<option value="' . $method . '"' . $selected . '>' . ucfirst($method) . '</option>'; + } - case 'setting': + return $auth_select; +} - $yes_no_switches = array('board_disable', 'enable_confirm', 'coppa_enable', 'display_last_edited', 'allow_emailreuse'); +function mail_auth_select($selected_method) +{ + global $user; - foreach ($yes_no_switches as $switch) - { - $switch_var = str_replace('allow_', '', $switch); - ${$switch_var . '_yes'} = ($new[$switch]) ? ' checked="checked"' : ''; - ${$switch_var . '_no'} = (!$new[$switch]) ? ' checked="checked"' : ''; - } + $auth_methods = array('PLAIN', 'LOGIN', 'CRAM-MD5', 'DIGEST-MD5', 'POP-BEFORE-SMTP'); + $s_smtp_auth_options = ''; - $activation_none = ($new['require_activation'] == USER_ACTIVATION_NONE) ? 'checked="checked"' : ''; - $activation_user = ($new['require_activation'] == USER_ACTIVATION_SELF) ? 'checked="checked"' : ''; - $activation_admin = ($new['require_activation'] == USER_ACTIVATION_ADMIN) ? 'checked="checked"' : ''; - $activation_disable = ($new['require_activation'] == USER_ACTIVATION_DISABLE) ? 'checked="checked"' : ''; + foreach ($auth_methods as $method) + { + $s_smtp_auth_options .= '<option value="' . $method . '"' . (($selected_method == $method) ? ' selected="selected"' : '') . '>' . $user->lang['SMTP_' . str_replace('-', '_', $method)] . '</option>'; + } - $s_bump_type = ''; - $types = array('m' => 'MINUTES', 'h' => 'HOURS', 'd' => 'DAYS'); - foreach ($types as $type => $lang) - { - $selected = ($new['bump_type'] == $type) ? 'selected="selected" ' : ''; - $s_bump_type .= '<option value="' . $type . '" ' . $selected . '>' . $user->lang[$lang] . '</option>'; - } + return $s_smtp_auth_options; +} - $user_char_ary = array('USERNAME_CHARS_ANY' => '.*', 'USERNAME_ALPHA_ONLY' => '[\w]+', 'USERNAME_ALPHA_SPACERS' => '[\w_\+\. \-\[\]]+'); - $user_char_options = ''; - foreach ($user_char_ary as $lang => $value) - { - $selected = ($new['allow_name_chars'] == $value) ? ' selected="selected"' : ''; - $user_char_options .= '<option value="' . $value . '"' . $selected . '>' . $user->lang[$lang] . '</option>'; - } +function full_folder_select($value) +{ + global $user; - $pass_type_ary = array('PASS_TYPE_ANY' => '.*', 'PASS_TYPE_CASE' => '[a-zA-Z]', 'PASS_TYPE_ALPHA' => '[a-zA-Z0-9]', 'PASS_TYPE_SYMBOL' => '[a-zA-Z\W]'); - $pass_char_options = ''; - foreach ($pass_type_ary as $lang => $value) - { - $selected = ($new['pass_complex'] == $value) ? ' selected="selected"' : ''; - $pass_char_options .= '<option value="' . $value . '"' . $selected . '>' . $user->lang[$lang] . '</option>'; - } + return '<option value="1"' . (($value == 1) ? ' selected="selected"' : '') . '>' . $user->lang['DELETE_OLD_MESSAGES'] . '</option><option value="2"' . (($value == 2) ? ' selected="selected"' : '') . '>' . $user->lang['HOLD_NEW_MESSAGES'] . '</option>'; +} -?> - <tr> - <td class="row1" width="50%"><b><?php echo $user->lang['SITE_NAME']; ?>: </b></td> - <td class="row2"><input class="post" type="text" size="40" maxlength="255" name="config[sitename]" value="<?php echo $new['sitename']; ?>" /></td> - </tr> - <tr> - <td class="row1"><b><?php echo $user->lang['SITE_DESC']; ?>: </b></td> - <td class="row2"><input class="post" type="text" size="40" maxlength="255" name="config[site_desc]" value="<?php echo $new['site_desc']; ?>" /></td> - </tr> - <tr> - <td class="row1"><b><?php echo $user->lang['DISABLE_BOARD']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['DISABLE_BOARD_EXPLAIN']; ?></span></td> - <td class="row2"><input type="radio" name="config[board_disable]" value="1" <?php echo $board_disable_yes; ?> /> <?php echo $user->lang['YES']; ?> <input type="radio" name="config[board_disable]" value="0" <?php echo $board_disable_no; ?> /> <?php echo $user->lang['NO']; ?><br /><input class="post" type="text" name="config[board_disable_msg]" maxlength="255" size="40" value="<?php echo $new['board_disable_msg']; ?>" /></td> - </tr> - <tr> - <td class="row1"><b><?php echo $user->lang['ACC_ACTIVATION']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['ACC_ACTIVATION_EXPLAIN']; ?></span></td> - <td class="row2"><input type="radio" name="config[require_activation]" value="<?php echo USER_ACTIVATION_NONE; ?>" <?php echo $activation_none; ?> /> <?php echo $user->lang['ACC_NONE']; ?><?php if ($config['email_enable']) { ?> <input type="radio" name="config[require_activation]" value="<?php echo USER_ACTIVATION_SELF; ?>" <?php echo $activation_user; ?> /> <?php echo $user->lang['ACC_USER']; ?> <input type="radio" name="config[require_activation]" value="<?php echo USER_ACTIVATION_ADMIN; ?>" <?php echo $activation_admin; ?> /> <?php echo $user->lang['ACC_ADMIN']; ?><?php } ?> <input type="radio" name="config[require_activation]" value="<?php echo USER_ACTIVATION_DISABLE; ?>" <?php echo $activation_disable; ?> /> <?php echo $user->lang['ACC_DISABLE']; ?></td> - </tr> - <tr> - <td class="row1"><b><?php echo $user->lang['ENABLE_COPPA']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['ENABLE_COPPA_EXPLAIN']; ?></span></td> - <td class="row2"><input type="radio" name="config[coppa_enable]" value="1" <?php echo $enable_confirm_yes; ?> /> <?php echo $user->lang['YES']; ?> <input type="radio" name="config[coppa_enable]" value="0" <?php echo $enable_confirm_no; ?> /> <?php echo $user->lang['NO']; ?></td> - </tr> - <tr> - <td class="row1"><b><?php echo $user->lang['COPPA_FAX']; ?>: </b></td> - <td class="row2"><input class="post" type="text" size="25" maxlength="100" name="config[coppa_fax]" value="<?php echo $new['coppa_fax']; ?>" /></td> - </tr> - <tr> - <td class="row1"><b><?php echo $user->lang['COPPA_MAIL']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['COPPA_MAIL_EXPLAIN']; ?></span></td> - <td class="row2"><textarea name="config[coppa_mail]" rows="5" cols="40"><?php echo $new['coppa_mail']; ?></textarea></td> - </tr> - <tr> - <td class="row1"><b><?php echo $user->lang['VISUAL_CONFIRM']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['VISUAL_CONFIRM_EXPLAIN']; ?></span></td> - <td class="row2"><input type="radio" name="config[enable_confirm]" value="1"<?php echo $enable_confirm_yes ?> /> <?php echo $user->lang['YES'] ?> <input type="radio" name="config[enable_confirm]" value="0" <?php echo $enable_confirm_no ?> /> <?php echo $user->lang['NO']; ?></td> - </tr> - <tr> - <td class="row1"><b><?php echo $user->lang['REG_LIMIT']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['REG_LIMIT_EXPLAIN']; ?></span></td> - <td class="row2"><input class="post" type="text" maxlength="4" size="4" name="config[max_reg_attempts]" value="<?php echo $new['max_reg_attempts']; ?>" /></td> - </tr> - <tr> - <td class="row1"><b><?php echo $user->lang['USERNAME_LENGTH']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['USERNAME_LENGTH_EXPLAIN']; ?></span></td> - <td class="row2"><input class="post" type="text" size="3" maxlength="3" name="config[min_name_chars]" value="<?php echo $new['min_name_chars']; ?>" /> <?php echo $user->lang['MIN_CHARS']; ?> <input class="post" type="text" size="3" maxlength="3" name="config[max_name_chars]" value="<?php echo $new['max_name_chars']; ?>" /> <?php echo $user->lang['MAX_CHARS']; ?></td> - </tr> - <tr> - <td class="row1"><b><?php echo $user->lang['USERNAME_CHARS']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['USERNAME_CHARS_EXPLAIN']; ?></span></td> - <td class="row2"><select name="config[allow_name_chars]"><?php echo $user_char_options; ?></select></td> - </tr> - <tr> - <td class="row1"><b><?php echo $user->lang['PASSWORD_LENGTH']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['PASSWORD_LENGTH_EXPLAIN']; ?></span></td> - <td class="row2"><input class="post" type="text" size="3" maxlength="3" name="config[min_pass_chars]" value="<?php echo $new['min_pass_chars']; ?>" /> <?php echo $user->lang['MIN_CHARS']; ?> <input class="post" type="text" size="3" maxlength="3" name="config[max_pass_chars]" value="<?php echo $new['max_pass_chars']; ?>" /> <?php echo $user->lang['MAX_CHARS']; ?></td> - </tr> - <tr> - <td class="row1"><b><?php echo $user->lang['PASSWORD_TYPE']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['PASSWORD_TYPE_EXPLAIN']; ?></span></td> - <td class="row2"><select name="config[pass_complex]"><?php echo $pass_char_options; ?></select></td> - </tr> - <tr> - <td class="row1"><b><?php echo $user->lang['FORCE_PASS_CHANGE']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['FORCE_PASS_CHANGE_EXPLAIN']; ?></span></td> - <td class="row2"><input class="post" type="text" size="3" maxlength="3" name="config[chg_passforce]" value="<?php echo $new['chg_passforce']; ?>" /> <?php echo $user->lang['DAYS']; ?></td> - </tr> - <tr> - <td class="row1"><b><?php echo $user->lang['ALLOW_EMAIL_REUSE']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['ALLOW_EMAIL_REUSE_EXPLAIN']; ?></span></td> - <td class="row2"><input type="radio" name="config[allow_emailreuse]" value="1" <?php echo $emailreuse_yes; ?> /> <?php echo $user->lang['YES']; ?> <input type="radio" name="config[allow_emailreuse]" value="0" <?php echo $emailreuse_no; ?> /> <?php echo $user->lang['NO']; ?></td> - </tr> - <tr> - <td class="row1"><b><?php echo $user->lang['EDIT_TIME']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['EDIT_TIME_EXPLAIN']; ?></span></td> - <td class="row2"><input class="post" type="text" maxlength="3" size="3" name="config[edit_time]" value="<?php echo $new['edit_time']; ?>" /></td> - </tr> - <tr> - <td class="row1"><b><?php echo $user->lang['DISPLAY_LAST_EDITED']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['DISPLAY_LAST_EDITED_EXPLAIN']; ?></span></td> - <td class="row2"><input type="radio" name="config[display_last_edited]" value="1" <?php echo $display_last_edited_yes; ?> /><?php echo $user->lang['YES']; ?> <input type="radio" name="config[display_last_edited]" value="0" <?php echo $display_last_edited_no; ?> /><?php echo $user->lang['NO']; ?></td> - </tr> - <tr> - <td class="row1"><b><?php echo $user->lang['FLOOD_INTERVAL']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['FLOOD_INTERVAL_EXPLAIN']; ?></span></td> - <td class="row2"><input class="post" type="text" size="3" maxlength="4" name="config[flood_interval]" value="<?php echo $new['flood_interval']; ?>" /></td> - </tr> - <tr> - <td class="row1"><b><?php echo $user->lang['BUMP_INTERVAL']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['BUMP_INTERVAL_EXPLAIN']; ?></span></td> - <td class="row2"><input class="post" type="text" size="3" maxlength="4" name="config[bump_interval]" value="<?php echo $new['bump_interval'] ?>" /> <select name="config[bump_type]"><?php echo $s_bump_type; ?></select></td> - </tr> - <tr> - <td class="row1"><b><?php echo $user->lang['TOPICS_PER_PAGE']; ?>: </b></td> - <td class="row2"><input class="post" type="text" name="config[topics_per_page]" size="3" maxlength="4" value="<?php echo $new['topics_per_page']; ?>" /></td> - </tr> - <tr> - <td class="row1"><b><?php echo $user->lang['POSTS_PER_PAGE']; ?>: </b></td> - <td class="row2"><input class="post" type="text" name="config[posts_per_page]" size="3" maxlength="4" value="<?php echo $new['posts_per_page']; ?>" /></td> - </tr> - <tr> - <td class="row1"><b><?php echo $user->lang['HOT_THRESHOLD']; ?>: </b></td> - <td class="row2"><input class="post" type="text" name="config[hot_threshold]" size="3" maxlength="4" value="<?php echo $new['hot_threshold']; ?>" /></td> - </tr> - <tr> - <td class="row1"><b><?php echo $user->lang['MAX_POLL_OPTIONS']; ?>: </b></td> - <td class="row2"><input class="post" type="text" name="config[max_poll_options]" size="4" maxlength="4" value="<?php echo $new['max_poll_options']; ?>" /></td> - </tr> - <tr> - <td class="row1"><b><?php echo $user->lang['CHAR_LIMIT']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['CHAR_LIMIT_EXPLAIN']; ?></span</td> - <td class="row2"><input class="post" type="text" size="4" maxlength="6" name="config[max_post_chars]" value="<?php echo $new['max_post_chars']; ?>" /></td> - </tr> - <tr> - <td class="row1"><b><?php echo $user->lang['SMILIES_LIMIT']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['SMILIES_LIMIT_EXPLAIN']; ?></span</td> - <td class="row2"><input class="post" type="text" size="4" maxlength="4" name="config[max_post_smilies]" value="<?php echo $new['max_post_smilies']; ?>" /></td> - </tr> - <tr> - <td class="row1"><b><?php echo $user->lang['QUOTE_DEPTH_LIMIT']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['QUOTE_DEPTH_LIMIT_EXPLAIN']; ?></span</td> - <td class="row2"><input class="post" type="text" size="4" maxlength="4" name="config[max_quote_depth]" value="<?php echo $new['max_quote_depth']; ?>" /></td> - </tr> -<?php +function select_ip_check($value) +{ + global $user; - break; + $ip_all = ($value == 4) ? ' checked="checked"' : ''; + $ip_classc = ($value == 3) ? ' checked="checked"' : ''; + $ip_classb = ($value == 2) ? ' checked="checked"' : ''; + $ip_none = ($value == 0) ? ' checked="checked"' : ''; - case 'email': + $options = <<<EOT + <input type="radio" name="config[ip_check]" value="4"$ip_all /> {$user->lang['ALL']} <input type="radio" name="config[ip_check]" value="3"$ip_classc /> {$user->lang['CLASS_C']} <input type="radio" name="config[ip_check]" value="2"$ip_classb /> {$user->lang['CLASS_B']} <input type="radio" name="config[ip_check]" value="0"$ip_none /> {$user->lang['NONE']} +EOT; + + return $options; +} - $email_yes = ($new['email_enable']) ? 'checked="checked"' : ''; - $email_no = (!$new['email_enable']) ? 'checked="checked"' : ''; +function select_acc_activation($value) +{ + global $user, $config; - $board_email_form_yes = ($new['board_email_form']) ? 'checked="checked"' : ''; - $board_email_form_no = (!$new['board_email_form']) ? 'checked="checked"' : ''; + $activation_none = ($value == USER_ACTIVATION_NONE) ? ' checked="checked"' : ''; + $activation_user = ($value == USER_ACTIVATION_SELF) ? ' checked="checked"' : ''; + $activation_admin = ($value == USER_ACTIVATION_ADMIN) ? ' checked="checked"' : ''; + $activation_disable = ($value == USER_ACTIVATION_DISABLE) ? ' checked="checked"' : ''; - $smtp_yes = ($new['smtp_delivery']) ? 'checked="checked"' : ''; - $smtp_no = (!$new['smtp_delivery']) ? 'checked="checked"' : ''; + $options = '<input type="radio" name="config[require_activation]" value="' . USER_ACTIVATION_NONE . '"' . $activation_none . ' /> ' . $user->lang['ACC_NONE']; - $auth_methods = array('PLAIN', 'LOGIN', 'CRAM-MD5', 'DIGEST-MD5', 'POP-BEFORE-SMTP'); - $s_smtp_auth_options = ''; + if ($config['email_enable']) + { + $options .= ' <input type="radio" name="config[require_activation]" value="' . USER_ACTIVATION_SELF . '"' . $activation_user . ' /> ' . $user->lang['ACC_USER']; + $options .= ' <input type="radio" name="config[require_activation]" value="' . USER_ACTIVATION_ADMIN . '"' . $activation_admin . ' /> ' . $user->lang['ACC_ADMIN']; + } + $options .= ' <input type="radio" name="config[require_activation]" value="' . USER_ACTIVATION_DISABLE . '"' . $activation_disable . ' /> ' . $user->lang['ACC_DISABLE']; - foreach ($auth_methods as $method) - { - $s_smtp_auth_options .= '<option value="' . $method . '"' . (($new['smtp_auth_method'] == $method) ? ' selected="selected"' : '') . '>' . $user->lang['SMTP_' . str_replace('-', '_', $method)] . '</option>'; - } -?> - <tr> - <td class="row1" width="50%"><b><?php echo $user->lang['ENABLE_EMAIL']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['ENABLE_EMAIL_EXPLAIN']; ?></span></td> - <td class="row2"><input type="radio" name="config[email_enable]" value="1" <?php echo $email_yes; ?> /> <?php echo $user->lang['ENABLED']; ?> <input type="radio" name="config[email_enable]" value="0" <?php echo $email_no; ?> /> <?php echo $user->lang['DISABLED']; ?></td> - </tr> - <tr> - <td class="row1"><b><?php echo $user->lang['BOARD_EMAIL_FORM']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['BOARD_EMAIL_FORM_EXPLAIN']; ?></span></td> - <td class="row2"><input type="radio" name="config[board_email_form]" value="1" <?php echo $board_email_form_yes; ?> /> <?php echo $user->lang['ENABLED']; ?> <input type="radio" name="config[board_email_form]" value="0" <?php echo $board_email_form_no; ?> /> <?php echo $user->lang['DISABLED']; ?></td> - </tr> - <tr> - <td class="row1"><b><?php echo $user->lang['EMAIL_FUNCTION_NAME']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['EMAIL_FUNCTION_NAME_EXPLAIN']; ?></span></td> - <td class="row2"><input class="post" type="text" size="20" maxlength="50" name="config[email_function_name]" value="<?php echo $new['email_function_name']; ?>" /></td> - </tr> - <tr> - <td class="row1"><b><?php echo $user->lang['EMAIL_PACKAGE_SIZE']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['EMAIL_PACKAGE_SIZE_EXPLAIN']; ?></span></td> - <td class="row2"><input class="post" type="text" size="5" maxlength="5" name="config[email_package_size]" value="<?php echo $new['email_package_size']; ?>" /></td> - </tr> - <tr> - <td class="row1"><b><?php echo $user->lang['CONTACT_EMAIL']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['CONTACT_EMAIL_EXPLAIN']; ?></span></td> - <td class="row2"><input class="post" type="text" size="25" maxlength="100" name="config[board_contact]" value="<?php echo $new['board_contact']; ?>" /></td> - </tr> - <tr> - <td class="row1"><b><?php echo $user->lang['ADMIN_EMAIL']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['ADMIN_EMAIL_EXPLAIN']; ?></span></td> - <td class="row2"><input class="post" type="text" size="25" maxlength="100" name="config[board_email]" value="<?php echo $new['board_email']; ?>" /></td> - </tr> - <tr> - <td class="row1"><b><?php echo $user->lang['EMAIL_SIG']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['EMAIL_SIG_EXPLAIN']; ?></span></td> - <td class="row2"><textarea name="config[board_email_sig]" rows="5" cols="30"><?php echo $new['board_email_sig']; ?></textarea></td> - </tr> - <tr> - <td class="row1"><b><?php echo $user->lang['USE_SMTP']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['USE_SMTP_EXPLAIN']; ?></span></td> - <td class="row2"><input type="radio" name="config[smtp_delivery]" value="1" <?php echo $smtp_yes; ?> /> <?php echo $user->lang['YES']; ?> <input type="radio" name="config[smtp_delivery]" value="0" <?php echo $smtp_no; ?> /> <?php echo $user->lang['NO']; ?></td> - </tr> - <tr> - <td class="row1"><b><?php echo $user->lang['SMTP_SERVER']; ?>: </b></td> - <td class="row2"><input class="post" type="text" name="config[smtp_host]" value="<?php echo $new['smtp_host']; ?>" size="25" maxlength="50" /></td> - </tr> - <tr> - <td class="row1"><b><?php echo $user->lang['SMTP_PORT']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['SMTP_PORT_EXPLAIN']; ?></span></td> - <td class="row2"><input class="post" type="text" name="config[smtp_port]" value="<?php echo $new['smtp_port']; ?>" size="4" maxlength="5" /></td> - </tr> - <tr> - <td class="row1"><b><?php echo $user->lang['SMTP_AUTH_METHOD']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['SMTP_AUTH_METHOD_EXPLAIN']; ?></span></td> - <td class="row2"><select name="config[smtp_auth_method]"><?php echo $s_smtp_auth_options; ?></select></td> - </tr> - <tr> - <td class="row1"><b><?php echo $user->lang['SMTP_USERNAME']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['SMTP_USERNAME_EXPLAIN']; ?></span></td> - <td class="row2"><input class="post" type="text" name="config[smtp_username]" value="<?php echo $new['smtp_username']; ?>" size="25" maxlength="255" /></td> - </tr> - <tr> - <td class="row1"><b><?php echo $user->lang['SMTP_PASSWORD']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['SMTP_PASSWORD_EXPLAIN']; ?></span></td> - <td class="row2"><input class="post" type="password" name="config[smtp_password]" value="<?php echo $new['smtp_password']; ?>" size="25" maxlength="255" /></td> - </tr> -<?php + return $options; +} - break; +function username_length($value) +{ + global $new, $user; - case 'server': + return '<input class="post" type="text" size="3" maxlength="3" name="config[min_name_chars]" value="' . $value . '" /> ' . $user->lang['MIN_CHARS'] . ' <input class="post" type="text" size="3" maxlength="3" name="config[max_name_chars]" value="' . $new['max_name_chars'] . '" /> ' . $user->lang['MAX_CHARS']; +} - $ip_all = ($new['ip_check'] == 4) ? 'checked="checked"' : ''; - $ip_classc = ($new['ip_check'] == 3) ? 'checked="checked"' : ''; - $ip_classb = ($new['ip_check'] == 2) ? 'checked="checked"' : ''; - $ip_none = ($new['ip_check'] == 0) ? 'checked="checked"' : ''; +function select_username_chars($selected_value) +{ + global $user; - $browser_yes = ($new['browser_check']) ? 'checked="checked"' : ''; - $browser_no = (!$new['browser_check']) ? 'checked="checked"' : ''; + $user_char_ary = array('USERNAME_CHARS_ANY' => '.*', 'USERNAME_ALPHA_ONLY' => '[\w]+', 'USERNAME_ALPHA_SPACERS' => '[\w_\+\. \-\[\]]+'); + $user_char_options = ''; + foreach ($user_char_ary as $lang => $value) + { + $selected = ($selected_value == $value) ? ' selected="selected"' : ''; + $user_char_options .= '<option value="' . $value . '"' . $selected . '>' . $user->lang[$lang] . '</option>'; + } - $gzip_yes = ($new['gzip_compress']) ? 'checked="checked"' : ''; - $gzip_no = (!$new['gzip_compress']) ? 'checked="checked"' : ''; -?> - <tr> - <td class="row1" width="50%"><b><?php echo $user->lang['SERVER_NAME']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['SERVER_NAME_EXPLAIN']; ?></span></td> - <td class="row2"><input class="post" type="text" maxlength="255" size="40" name="config[server_name]" value="<?php echo $new['server_name']; ?>" /></td> - </tr> - <tr> - <td class="row1"><b><?php echo $user->lang['SERVER_PORT']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['SERVER_PORT_EXPLAIN']; ?></span></td> - <td class="row2"><input class="post" type="text" maxlength="5" size="5" name="config[server_port]" value="<?php echo $new['server_port']; ?>" /></td> - </tr> - <tr> - <td class="row1"><b><?php echo $user->lang['SCRIPT_PATH']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['SCRIPT_PATH_EXPLAIN']; ?></span></td> - <td class="row2"><input class="post" type="text" maxlength="255" name="config[script_path]" value="<?php echo $new['script_path']; ?>" /></td> - </tr> - <tr> - <td class="row1"><b><?php echo $user->lang['IP_VALID']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['IP_VALID_EXPLAIN']; ?></span></td> - <td class="row2"><input type="radio" name="config[ip_check]" value="4" <?php echo $ip_all; ?> /> <?php echo $user->lang['ALL']; ?> <input type="radio" name="config[ip_check]" value="3" <?php echo $ip_classc; ?> /> <?php echo $user->lang['CLASS_C']; ?> <input type="radio" name="config[ip_check]" value="2" <?php echo $ip_classb; ?> /> <?php echo $user->lang['CLASS_B']; ?> <input type="radio" name="config[ip_check]" value="0" <?php echo $ip_none; ?> /> <?php echo $user->lang['NONE']; ?> </td> - </tr> - <tr> - <td class="row1"><b><?php echo $user->lang['BROWSER_VALID']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['BROWSER_VALID_EXPLAIN']; ?></span></td> - <td class="row2"><input type="radio" name="config[browser_check]" value="1" <?php echo $browser_yes; ?> /> <?php echo $user->lang['YES']; ?> <input type="radio" name="config[browser_check]" value="0" <?php echo $browser_no; ?> /> <?php echo $user->lang['NO']; ?></td> - </tr> - <tr> - <td class="row1"><b><?php echo $user->lang['ENABLE_GZIP']; ?>: </b></td> - <td class="row2"><input type="radio" name="config[gzip_compress]" value="1" <?php echo $gzip_yes; ?> /> <?php echo $user->lang['YES']; ?> <input type="radio" name="config[gzip_compress]" value="0" <?php echo $gzip_no; ?> /> <?php echo $user->lang['NO']; ?></td> - </tr> - <tr> - <td class="row1"><b><?php echo $user->lang['SMILIES_PATH']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['SMILIES_PATH_EXPLAIN']; ?></span></td> - <td class="row2"><input class="post" type="text" size="20" maxlength="255" name="config[smilies_path]" value="<?php echo $new['smilies_path']; ?>" /></td> - </tr> - <tr> - <td class="row1"><b><?php echo $user->lang['ICONS_PATH']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['ICONS_PATH_EXPLAIN']; ?></span></td> - <td class="row2"><input class="post" type="text" size="20" maxlength="255" name="config[icons_path]" value="<?php echo $new['icons_path']; ?>" /></td> - </tr> - <tr> - <td class="row1"><b><?php echo $user->lang['UPLOAD_ICONS_PATH']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['UPLOAD_ICONS_PATH_EXPLAIN']; ?></span></td> - <td class="row2"><input class="post" type="text" size="20" maxlength="255" name="config[upload_icons_path]" value="<?php echo $new['upload_icons_path']; ?>" /></td> - </tr> - <tr> - <td class="row1"><b><?php echo $user->lang['RANKS_PATH']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['RANKS_PATH_EXPLAIN']; ?></span></td> - <td class="row2"><input class="post" type="text" size="20" maxlength="255" name="config[ranks_path]" value="<?php echo $new['ranks_path']; ?>" /></td> - </tr> -<?php + return $user_char_options; +} - break; - - case 'load': - - $tplcompile_yes = ($new['load_tplcompile']) ? 'checked="checked"' : ''; - $tplcompile_no = (!$new['load_tplcompile']) ? 'checked="checked"' : ''; - $load_db_track_yes = ($new['load_db_track']) ? 'checked="checked"' : ''; - $load_db_track_no = (!$new['load_db_track']) ? 'checked="checked"' : ''; - $load_db_lastread_yes = ($new['load_db_lastread']) ? 'checked="checked"' : ''; - $load_db_lastread_no = (!$new['load_db_lastread']) ? 'checked="checked"' : ''; - $load_online_yes = ($new['load_online']) ? 'checked="checked"' : ''; - $load_online_no = (!$new['load_online']) ? 'checked="checked"' : ''; - $load_onlinetrack_yes = ($new['load_onlinetrack']) ? 'checked="checked"' : ''; - $load_onlinetrack_no = (!$new['load_onlinetrack']) ? 'checked="checked"' : ''; - $load_birthdays_yes = ($new['load_birthdays']) ? 'checked="checked"' : ''; - $load_birthdays_no = (!$new['load_birthdays']) ? 'checked="checked"' : ''; - $moderators_yes = ($new['load_moderators']) ? 'checked="checked"' : ''; - $moderators_no = (!$new['load_moderators']) ? 'checked="checked"' : ''; - $jumpbox_yes = ($new['load_jumpbox']) ? 'checked="checked"' : ''; - $jumpbox_no = (!$new['load_jumpbox']) ? 'checked="checked"' : ''; - $search_yes = ($new['load_search']) ? 'checked="checked"' : ''; - $search_no = (!$new['load_search']) ? 'checked="checked"' : ''; - $search_update_yes = ($new['load_search_upd']) ? 'checked="checked"' : ''; - $search_update_no = (!$new['load_search_upd']) ? 'checked="checked"' : ''; - $search_phrase_yes = ($new['load_search_phr']) ? 'checked="checked"' : ''; - $search_phrase_no = (!$new['load_search_phr']) ? 'checked="checked"' : ''; +function password_length($value) +{ + global $new, $user; -?> - <tr> - <td class="row1" width="50%"><b><?php echo $user->lang['LIMIT_LOAD']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['LIMIT_LOAD_EXPLAIN']; ?></span></td> - <td class="row2"><input class="post" type="text" size="4" maxlength="4" name="config[limit_load]" value="<?php echo $new['limit_load']; ?>" /></td> - </tr> - <tr> - <td class="row1"><b><?php echo $user->lang['SESSION_LENGTH']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['SESSION_LENGTH_EXPLAIN']; ?></span></td> - <td class="row2"><input class="post" type="text" maxlength="5" size="5" name="config[session_length]" value="<?php echo $new['session_length']; ?>" /></td> - </tr> - <tr> - <td class="row1"><b><?php echo $user->lang['LIMIT_SESSIONS']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['LIMIT_SESSIONS_EXPLAIN']; ?></span></td> - <td class="row2"><input class="post" type="text" size="4" maxlength="4" name="config[active_sessions]" value="<?php echo $new['active_sessions']; ?>" /></td> - </tr> - <tr> - <td class="row1"><b><?php echo $user->lang['YES_POST_MARKING']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['YES_POST_MARKING_EXPLAIN']; ?></span></td> - <td class="row2"><input type="radio" name="config[load_db_track]" value="1"<?php echo $load_db_track_yes ?> /><?php echo $user->lang['YES'] ?> <input type="radio" name="config[load_db_track]" value="0" <?php echo $load_db_track_no ?> /> <?php echo $user->lang['NO']; ?></td> - </tr> - <tr> - <td class="row1"><b><?php echo $user->lang['YES_READ_MARKING']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['YES_READ_MARKING_EXPLAIN']; ?></span></td> - <td class="row2"><input type="radio" name="config[load_db_lastread]" value="1"<?php echo $load_db_lastread_yes ?> /><?php echo $user->lang['YES'] ?> <input type="radio" name="config[load_db_lastread]" value="0" <?php echo $load_db_lastread_no ?> /> <?php echo $user->lang['NO']; ?></td> - </tr> - <tr> - <td class="row1"><b><?php echo $user->lang['YES_ONLINE']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['YES_ONLINE_EXPLAIN']; ?></span></td> - <td class="row2"><input type="radio" name="config[load_online]" value="1"<?php echo $load_online_yes ?> /><?php echo $user->lang['YES'] ?> <input type="radio" name="config[load_online]" value="0" <?php echo $load_online_no ?> /> <?php echo $user->lang['NO']; ?></td> - </tr> - <tr> - <td class="row1"><b><?php echo $user->lang['YES_ONLINE_TRACK']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['YES_ONLINE_TRACK_EXPLAIN']; ?></span></td> - <td class="row2"><input type="radio" name="config[load_onlinetrack]" value="1"<?php echo $load_onlinetrack_yes ?> /><?php echo $user->lang['YES'] ?> <input type="radio" name="config[load_onlinetrack]" value="0" <?php echo $load_onlinetrack_no ?> /> <?php echo $user->lang['NO']; ?></td> - </tr> - <tr> - <td class="row1"><b><?php echo $user->lang['ONLINE_LENGTH']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['ONLINE_LENGTH_EXPLAIN']; ?></span></td> - <td class="row2"><input class="post" type="text" size="4" maxlength="3" name="config[load_online_time]" value="<?php echo $new['load_online_time']; ?>" /></td> - </tr> - <tr> - <td class="row1"><b><?php echo $user->lang['YES_BIRTHDAYS']; ?>: </b></td> - <td class="row2"><input type="radio" name="config[load_birthdays]" value="1"<?php echo $load_birthdays_yes ?> /><?php echo $user->lang['YES'] ?> <input type="radio" name="config[load_birthdays]" value="0" <?php echo $load_birthdays_no ?> /> <?php echo $user->lang['NO']; ?></td> - </tr> - <tr> - <td class="row1"><b><?php echo $user->lang['YES_MODERATORS']; ?>: </b></td> - <td class="row2"><input type="radio" name="config[load_moderators]" value="1"<?php echo $moderators_yes ?> /><?php echo $user->lang['YES'] ?> <input type="radio" name="config[load_moderators]" value="0" <?php echo $moderators_no ?> /> <?php echo $user->lang['NO']; ?></td> - </tr> - <tr> - <td class="row1"><b><?php echo $user->lang['YES_JUMPBOX']; ?>: </b></td> - <td class="row2"><input type="radio" name="config[load_jumpbox]" value="1"<?php echo $jumpbox_yes ?> /><?php echo $user->lang['YES'] ?> <input type="radio" name="config[load_jumpbox]" value="0" <?php echo $jumpbox_no ?> /> <?php echo $user->lang['NO']; ?></td> - </tr> - <tr> - <td class="row1"><b><?php echo $user->lang['YES_SEARCH']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['YES_SEARCH_EXPLAIN']; ?></span></td> - <td class="row2"><input type="radio" name="config[load_search]" value="1"<?php echo $search_yes ?> /><?php echo $user->lang['YES'] ?> <input type="radio" name="config[load_search]" value="0" <?php echo $search_no ?> /> <?php echo $user->lang['NO']; ?></td> - </tr> - <tr> - <td class="row1"><b><?php echo $user->lang['SEARCH_INTERVAL']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['SEARCH_INTERVAL_EXPLAIN']; ?></span></td> - <td class="row2"><input class="post" type="text" size="3" maxlength="4" name="config[search_interval]" value="<?php echo $new['search_interval']; ?>" /></td> - </tr> - <tr> - <td class="row1"><b><?php echo $user->lang['MIN_SEARCH_CHARS']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['MIN_SEARCH_CHARS_EXPLAIN']; ?></span</td> - <td class="row2"><input class="post" type="text" size="3" maxlength="3" name="config[min_search_chars]" value="<?php echo $new['min_search_chars']; ?>" /></td> - </tr> - <tr> - <td class="row1"><b><?php echo $user->lang['MAX_SEARCH_CHARS']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['MAX_SEARCH_CHARS_EXPLAIN']; ?></span</td> - <td class="row2"><input class="post" type="text" size="3" maxlength="3" name="config[max_search_chars]" value="<?php echo $new['max_search_chars']; ?>" /></td> - </tr> - <tr> - <td class="row1"><b><?php echo $user->lang['YES_SEARCH_UPDATE']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['YES_SEARCH_UPDATE_EXPLAIN']; ?></span></td> - <td class="row2"><input type="radio" name="config[load_search_upd]" value="1"<?php echo $search_update_yes ?> /><?php echo $user->lang['YES'] ?> <input type="radio" name="config[load_search_upd]" value="0" <?php echo $search_update_no ?> /> <?php echo $user->lang['NO']; ?></td> - </tr> - <!--tr> - <td class="row1"><b><?php echo $user->lang['YES_SEARCH_PHRASE']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['YES_SEARCH_PHRASE_EXPLAIN']; ?></span></td> - <td class="row2"><input type="radio" name="config[load_search_phr]" value="1"<?php echo $search_phrase_yes ?> /><?php echo $user->lang['YES'] ?> <input type="radio" name="config[load_search_phr]" value="0" <?php echo $search_phrase_no ?> /> <?php echo $user->lang['NO']; ?></td> - </tr--> - <tr> - <td class="row1"><b><?php echo $user->lang['RECOMPILE_TEMPLATES']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['RECOMPILE_TEMPLATES_EXPLAIN']; ?></span></td> - <td class="row2"><input type="radio" name="config[load_tplcompile]" value="1"<?php echo $tplcompile_yes ?> /><?php echo $user->lang['YES'] ?> <input type="radio" name="config[load_tplcompile]" value="0" <?php echo $tplcompile_no ?> /> <?php echo $user->lang['NO']; ?></td> - </tr> -<?php + return '<input class="post" type="text" size="3" maxlength="3" name="config[min_pass_chars]" value="' . $value . '" /> ' . $user->lang['MIN_CHARS'] . ' <input class="post" type="text" size="3" maxlength="3" name="config[max_pass_chars]" value="' . $new['max_pass_chars'] . '" /> ' . $user->lang['MAX_CHARS']; +} - break; +function select_password_chars($selected_value) +{ + global $user; - case 'message': + $pass_type_ary = array('PASS_TYPE_ANY' => '.*', 'PASS_TYPE_CASE' => '[a-zA-Z]', 'PASS_TYPE_ALPHA' => '[a-zA-Z0-9]', 'PASS_TYPE_SYMBOL' => '[a-zA-Z\W]'); + $pass_char_options = ''; + foreach ($pass_type_ary as $lang => $value) + { + $selected = ($selected_value == $value) ? ' selected="selected"' : ''; + $pass_char_options .= '<option value="' . $value . '"' . $selected . '>' . $user->lang[$lang] . '</option>'; + } - $yes_no_switches = array('auth_html_pm', 'auth_bbcode_pm', 'auth_smilies_pm', 'auth_download_pm', 'allow_sig_pm', 'enable_karma_pm', 'auth_report_pm', 'auth_quote_pm', 'print_pm', 'email_pm', 'forward_pm', 'auth_img_pm', 'auth_flash_pm', 'enable_pm_icons', 'allow_mass_pm'); + return $pass_char_options; +} - foreach ($yes_no_switches as $switch) - { - $switch_var = str_replace(array('allow_', 'auth_'), array('', ''), $switch); - ${$switch_var . '_yes'} = ($new[$switch]) ? ' checked="checked"' : ''; - ${$switch_var . '_no'} = (!$new[$switch]) ? ' checked="checked"' : ''; - } - -?> +function bump_interval($value) +{ + global $new, $user; - <tr> - <td class="row1"><b><?php echo $user->lang['BOXES_MAX']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['BOXES_MAX_EXPLAIN']; ?></span></td> - <td class="row2"><input class="post" type="text" maxlength="4" size="4" name="config[pm_max_boxes]" value="<?php echo $new['pm_max_boxes']; ?>" /></td> - </tr> - <tr> - <td class="row1"><b><?php echo $user->lang['BOXES_LIMIT']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['BOXES_LIMIT_EXPLAIN']; ?></span></td> - <td class="row2"><input class="post" type="text" maxlength="4" size="4" name="config[pm_max_msgs]" value="<?php echo $new['pm_max_msgs']; ?>" /></td> - </tr> - <tr> - <td class="row1"><b><?php echo $user->lang['FULL_FOLDER_ACTION']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['FULL_FOLDER_ACTION_EXPLAIN']; ?></span></td> - <td class="row2"><select name="config[full_folder_action]"><option value="1"><?php echo $user->lang['DELETE_OLD_MESSAGES']; ?></option><option value="2"><?php echo $user->lang['HOLD_NEW_MESSAGES']; ?></option></select></td> - </tr> - <tr> - <td class="row1"><b><?php echo $user->lang['PM_EDIT_TIME']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['PM_EDIT_TIME_EXPLAIN']; ?></span></td> - <td class="row2"><input class="post" type="text" maxlength="3" size="3" name="config[pm_edit_time]" value="<?php echo $new['pm_edit_time']; ?>" /></td> - </tr> - <tr> - <td class="row1"><b><?php echo $user->lang['ALLOW_MASS_PM']; ?>: </b></td> - <td class="row2"><input type="radio" name="config[allow_mass_pm]" value="1" <?php echo $mass_pm_yes; ?> /> <?php echo $user->lang['YES']; ?> <input type="radio" name="config[allow_mass_pm]" value="0" <?php echo $mass_pm_no; ?> /> <?php echo $user->lang['NO']; ?></td> - </tr> - <tr> - <td class="row1"><b><?php echo $user->lang['ALLOW_HTML_PM']; ?>: </b></td> - <td class="row2"><input type="radio" name="config[auth_html_pm]" value="1" <?php echo $html_pm_yes; ?> /> <?php echo $user->lang['YES']; ?> <input type="radio" name="config[auth_html_pm]" value="0" <?php echo $html_pm_no; ?> /> <?php echo $user->lang['NO']; ?></td> - </tr> - <tr> - <td class="row1"><b><?php echo $user->lang['ALLOW_BBCODE_PM']; ?>: </b></td> - <td class="row2"><input type="radio" name="config[auth_bbcode_pm]" value="1" <?php echo $bbcode_pm_yes; ?> /> <?php echo $user->lang['YES']; ?> <input type="radio" name="config[auth_bbcode_pm]" value="0" <?php echo $bbcode_pm_no; ?> /> <?php echo $user->lang['NO']; ?></td> - </tr> - <tr> - <td class="row1"><b><?php echo $user->lang['ALLOW_SMILIES_PM']; ?>: </b></td> - <td class="row2"><input type="radio" name="config[auth_smilies_pm]" value="1" <?php echo $smilies_pm_yes; ?> /> <?php echo $user->lang['YES']; ?> <input type="radio" name="config[auth_smilies_pm]" value="0" <?php echo $smilies_pm_no; ?> /> <?php echo $user->lang['NO']; ?></td> - </tr> - <tr> - <td class="row1"><b><?php echo $user->lang['AUTH_DOWNLOAD_PM']; ?>: </b></td> - <td class="row2"><input type="radio" name="config[auth_download_pm]" value="1" <?php echo $download_pm_yes; ?> /> <?php echo $user->lang['YES']; ?> <input type="radio" name="config[auth_download_pm]" value="0" <?php echo $download_pm_no; ?> /> <?php echo $user->lang['NO']; ?></td> - </tr> - <tr> - <td class="row1"><b><?php echo $user->lang['ALLOW_SIG_PM']; ?>: </b></td> - <td class="row2"><input type="radio" name="config[allow_sig_pm]" value="1" <?php echo $sig_pm_yes; ?> /> <?php echo $user->lang['YES']; ?> <input type="radio" name="config[allow_sig_pm]" value="0" <?php echo $sig_pm_no; ?> /> <?php echo $user->lang['NO']; ?></td> - </tr> -<!-- <tr> - <td class="row1" width="50%"><?php echo $user->lang['ENABLE_KARMA_PM']; ?>: </td> - <td class="row2"><input type="radio" name="config[enable_karma_pm]" value="1"<?php echo $enable_karma_pm_yes ?> /> <?php echo $user->lang['YES'] ?> <input type="radio" name="config[enable_karma_pm]" value="0" <?php echo $enable_karma_pm_no ?> /> <?php echo $user->lang['NO']; ?></td> - </tr>//--> - <tr> - <td class="row1"><b><?php echo $user->lang['AUTH_REPORT_PM']; ?>: </b></td> - <td class="row2"><input type="radio" name="config[auth_report_pm]" value="1" <?php echo $report_pm_yes; ?> /> <?php echo $user->lang['YES']; ?> <input type="radio" name="config[auth_report_pm]" value="0" <?php echo $report_pm_no; ?> /> <?php echo $user->lang['NO']; ?></td> - </tr> - <tr> - <td class="row1"><b><?php echo $user->lang['AUTH_QUOTE_PM']; ?>: </b></td> - <td class="row2"><input type="radio" name="config[auth_quote_pm]" value="1" <?php echo $quote_pm_yes; ?> /> <?php echo $user->lang['YES']; ?> <input type="radio" name="config[auth_quote_pm]" value="0" <?php echo $quote_pm_no; ?> /> <?php echo $user->lang['NO']; ?></td> - </tr> - <tr> - <td class="row1"><b><?php echo $user->lang['PRINT_PM']; ?>: </b></td> - <td class="row2"><input type="radio" name="config[print_pm]" value="1" <?php echo $print_pm_yes; ?> /> <?php echo $user->lang['YES']; ?> <input type="radio" name="config[print_pm]" value="0" <?php echo $print_pm_no; ?> /> <?php echo $user->lang['NO']; ?></td> - </tr> - <tr> - <td class="row1"><b><?php echo $user->lang['EMAIL_PM']; ?>: </b></td> - <td class="row2"><input type="radio" name="config[email_pm]" value="1" <?php echo $email_pm_yes; ?> /> <?php echo $user->lang['YES']; ?> <input type="radio" name="config[email_pm]" value="0" <?php echo $email_pm_no; ?> /> <?php echo $user->lang['NO']; ?></td> - </tr> - <tr> - <td class="row1"><b><?php echo $user->lang['FORWARD_PM']; ?>: </b></td> - <td class="row2"><input type="radio" name="config[forward_pm]" value="1" <?php echo $forward_pm_yes; ?> /> <?php echo $user->lang['YES']; ?> <input type="radio" name="config[forward_pm]" value="0" <?php echo $forward_pm_no; ?> /> <?php echo $user->lang['NO']; ?></td> - </tr> - <tr> - <td class="row1"><b><?php echo $user->lang['AUTH_IMG_PM']; ?>: </b></td> - <td class="row2"><input type="radio" name="config[auth_img_pm]" value="1" <?php echo $img_pm_yes; ?> /> <?php echo $user->lang['YES']; ?> <input type="radio" name="config[auth_img_pm]" value="0" <?php echo $img_pm_no; ?> /> <?php echo $user->lang['NO']; ?></td> - </tr> - <tr> - <td class="row1"><b><?php echo $user->lang['AUTH_FLASH_PM']; ?>: </b></td> - <td class="row2"><input type="radio" name="config[auth_flash_pm]" value="1" <?php echo $flash_pm_yes; ?> /> <?php echo $user->lang['YES']; ?> <input type="radio" name="config[auth_flash_pm]" value="0" <?php echo $flash_pm_no; ?> /> <?php echo $user->lang['NO']; ?></td> - </tr> - <tr> - <td class="row1"><b><?php echo $user->lang['ENABLE_PM_ICONS']; ?>: </b></td> - <td class="row2"><input type="radio" name="config[enable_pm_icons]" value="1" <?php echo $enable_pm_icons_yes; ?> /> <?php echo $user->lang['YES']; ?> <input type="radio" name="config[enable_pm_icons]" value="0" <?php echo $enable_pm_icons_no; ?> /> <?php echo $user->lang['NO']; ?></td> - </tr> -<?php + $s_bump_type = ''; + $types = array('m' => 'MINUTES', 'h' => 'HOURS', 'd' => 'DAYS'); + foreach ($types as $type => $lang) + { + $selected = ($new['bump_type'] == $type) ? 'selected="selected" ' : ''; + $s_bump_type .= '<option value="' . $type . '" ' . $selected . '>' . $user->lang[$lang] . '</option>'; + } - break; + return '<input class="post" type="text" size="3" maxlength="4" name="config[bump_interval]" value="' . $value . '" /> <select name="config[bump_type]">' . $s_bump_type . '</select>'; +} - case 'auth': +function board_disable($value) +{ + global $new, $user; - $auth_plugins = array(); + $board_disable_yes = ($value) ? ' checked="checked"' : ''; + $board_disable_no = (!$value) ? ' checked="checked"' : ''; - $dp = opendir($phpbb_root_path . 'includes/auth'); - while ($file = readdir($dp)) - { - if (preg_match('#^auth_(.*?)\.' . $phpEx . '$#', $file)) - { - $auth_plugins[] = preg_replace('#^auth_(.*?)\.' . $phpEx . '$#', '\1', $file); - } - } + return '<input type="radio" name="config[board_disable]" value="1"' . $board_disable_yes . ' /> ' . $user->lang['YES'] . ' <input type="radio" name="config[board_disable]" value="0"' . $board_disable_no . ' /> ' . $user->lang['NO'] . '<br /><input class="post" type="text" name="config[board_disable_msg]" maxlength="255" size="40" value="' . $new['board_disable_msg'] . '" />'; +} - sort($auth_plugins); +function build_cfg_template($tpl_type, $config_key, $options = '') +{ + global $new, $user; + + $tpl = ''; + $name = 'config[' . $config_key . ']'; - $auth_select = ''; - foreach ($auth_plugins as $method) - { - $selected = ($config['auth_method'] == $method) ? ' selected="selected"' : ''; - $auth_select .= '<option value="' . $method . '"' . $selected . '>' . ucfirst($method) . '</option>'; - } + switch ($tpl_type[0]) + { + case 'text': + case 'password': + $size = (int) $tpl_type[1]; + $maxlength = (int) $tpl_type[2]; -?> - <tr> - <td class="row1" width="50%"><b><?php echo $user->lang['AUTH_METHOD']; ?>: </b></td> - <td class="row2"><select name="config[auth_method]"><?php echo $auth_select; ?></select></td> - </tr> -<?php + $tpl = '<input class="post" type="' . $tpl_type[0] . '"' . (($size) ? ' size="' . $size . '"' : '') . ' maxlength="' . (($maxlength) ? $maxlength : 255) . '" name="' . $name . '" value="' . $new[$config_key] . '" />'; + break; - foreach ($auth_plugins as $method) - { - if ($method && file_exists($phpbb_root_path . 'includes/auth/auth_' . $method . '.' . $phpEx)) - { - include_once($phpbb_root_path . 'includes/auth/auth_' . $method . '.' . $phpEx); + case 'dimension': + $size = (int) $tpl_type[1]; + $maxlength = (int) $tpl_type[2]; - $method = 'admin_' . $method; - if (function_exists($method)) - { - if ($config_fields = $method($new)) - { - // Check if we need to create config fields for this plugin - foreach($config_fields as $field) - { - if (!isset($config[$field])) - { - set_config($field, ''); - } - } - } + $tpl = '<input class="post" type="text"' . (($size) ? ' size="' . $size . '"' : '') . ' maxlength="' . (($maxlength) ? $maxlength : 255) . '" name="config[' . $config_key . '_height]" value="' . $new[$config_key . '_height'] . '" /> x <input class="post" type="text"' . (($size) ? ' size="' . $size . '"' : '') . ' maxlength="' . (($maxlength) ? $maxlength : 255) . '" name="config[' . $config_key . '_width]" value="' . $new[$config_key . '_width'] . '" />'; + break; - unset($config_fields); - } - } - } + case 'textarea': + $rows = (int) $tpl_type[1]; + $cols = (int) $tpl_type[2]; - break; -/* - case 'karma': + $tpl = '<textarea name="' . $name . '" rows="' . $rows . '" cols="' . $cols . '">' . $new[$config_key] . '</textarea>'; + break; - $enable_karma_yes = ($new['enable_karma']) ? 'checked="checked"' : ''; - $enable_karma_no = (!$new['enable_karma']) ? 'checked="checked"' : ''; + case 'radio': + $key_yes = ($new[$config_key]) ? 'checked="checked"' : ''; + $key_no = (!$new[$config_key]) ? 'checked="checked"' : ''; -?> - <tr> - <td class="row1" width="50%"><?php echo $user->lang['ENABLE_KARMA']; ?>: </td> - <td class="row2"><input type="radio" name="config[enable_karma]" value="1"<?php echo $enable_karma_yes ?> /><?php echo $user->lang['YES'] ?> <input type="radio" name="config[enable_karma]" value="0" <?php echo $enable_karma_no ?> /> <?php echo $user->lang['NO']; ?></td> - </tr> - <tr> - <td class="row1"><b><?php echo $user->lang['MIN_RATINGS']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['MIN_RATINGS_EXPLAIN']; ?></span</td> - <td class="row2"><input class="post" type="text" size="3" maxlength="5" name="config[min_ratings]" value="<?php echo $new['min_ratings']; ?>" /></td> - </tr> - <tr> - <td class="row1"><b><?php echo $user->lang['KARMA_HIST_WEIGHT']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['KARMA_HIST_WEIGHT_EXPLAIN']; ?></span</td> - <td class="row2"><input class="post" type="text" size="3" maxlength="5" name="config[karma_hist_weight]" value="<?php echo $new['karma_hist_weight']; ?>" /></td> - </tr> - <tr> - <td class="row1"><b><?php echo $user->lang['KARMA_DAY_WEIGHT']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['KARMA_DAY_WEIGHT_EXPLAIN']; ?></span</td> - <td class="row2"><input class="post" type="text" size="3" maxlength="5" name="config[karma_day_weight]" value="<?php echo $new['karma_30_weight']; ?>" /></td> - </tr> - <tr> - <td class="row1"><b><?php echo $user->lang['KARMA_REG_WEIGHT']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['KARMA_REG_WEIGHT_EXPLAIN']; ?></span</td> - <td class="row2"><input class="post" type="text" size="3" maxlength="5" name="config[karma_reg_weight]" value="<?php echo $new['karma_reg_weight']; ?>" /></td> - </tr> - <tr> - <td class="row1"><b><?php echo $user->lang['KARMA_POST_WEIGHT']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['KARMA_POST_WEIGHT_EXPLAIN']; ?></span</td> - <td class="row2"><input class="post" type="text" size="3" maxlength="5" name="config[karma_post_weight]" value="<?php echo $new['karma_post_weight']; ?>" /></td> - </tr> -<?php + $tpl_type_cond = explode('_', $tpl_type[1]); + $type_no = ($tpl_type_cond[0] == 'disabled' || $tpl_type_cond[0] == 'enabled') ? false : true; - break; -*/ -} + $tpl_no = '<input type="radio" name="' . $name . '" value="0"' . $key_no . ' />' . (($type_no) ? $user->lang['NO'] : $user->lang['DISABLED']); + $tpl_yes = '<input type="radio" name="' . $name . '" value="1"' . $key_yes . ' />' . (($type_no) ? $user->lang['YES'] : $user->lang['ENABLED']); -?> - <tr> - <td class="cat" colspan="2" align="center"><input type="submit" name="submit" value="<?php echo $user->lang['SUBMIT']; ?>" class="btnmain" /> <input type="reset" value="<?php echo $user->lang['RESET']; ?>" class="btnlite" /></td> - </tr> -</table></form> + $tpl = ($tpl_type_cond[0] == 'yes' || $tpl_type_cond[0] == 'enabled') ? $tpl_yes . ' ' . $tpl_no : $tpl_no . ' ' . $tpl_yes; + break; + + case 'select': + eval('$s_options = ' . str_replace('{VALUE}', $new[$config_key], $options) . ';'); + $tpl = '<select name="' . $name . '">' . $s_options . '</select>'; + break; -<?php + case 'custom': + eval('$tpl = ' . str_replace('{VALUE}', $new[$config_key], $options) . ';'); + break; -adm_page_footer(); + default: + break; + } + + return $tpl; +} ?>
\ No newline at end of file diff --git a/phpBB/adm/admin_forums.php b/phpBB/adm/admin_forums.php index 4da3de90f4..712c87ca45 100644 --- a/phpBB/adm/admin_forums.php +++ b/phpBB/adm/admin_forums.php @@ -78,6 +78,7 @@ if ($update) // $auth->acl_clear_prefetch(); + $show_prev_info = false; trigger_error($user->lang['FORUM_DELETED']); break; @@ -97,6 +98,11 @@ if ($update) 'forum_link' => request_var('forum_link', ''), 'forum_link_track' => request_var('forum_link_track', FALSE), 'forum_desc' => str_replace("\n", '<br />', request_var('forum_desc', '')), + 'forum_rules' => request_var('forum_rules', ''), + 'forum_rules_link' => request_var('forum_rules_link', ''), + 'rules_allow_bbcode' => request_var('parse_bbcode', false), + 'rules_allow_smilies' => request_var('parse_smilies', false), + 'rules_allow_urls' => request_var('parse_urls', false), 'forum_image' => request_var('forum_image', ''), 'forum_style' => request_var('forum_style', 0), 'display_on_index' => request_var('display_on_index', FALSE), @@ -127,6 +133,7 @@ if ($update) // Redirect to permissions $message = ($mode == 'add') ? $user->lang['FORUM_CREATED'] : $user->lang['FORUM_UPDATED']; $message .= '<br /><br />' . sprintf($user->lang['REDIRECT_ACL'], "<a href=\"admin_permissions.$phpEx$SID&mode=forum&submit_usergroups=true&ug_type=forum&action=usergroups&f[forum][]=" . $forum_data['forum_id'] . '">', '</a>'); + $show_prev_info = ($mode == 'edit') ? true : false; trigger_error($message); break; @@ -150,10 +157,17 @@ switch ($mode) $forum_status = request_var('forum_status', ITEM_UNLOCKED); $forum_desc = request_var('forum_desc', ''); $forum_name = request_var('forum_name', ''); + $forum_rules_link = request_var('forum_rules_link', ''); + $forum_rules = request_var('forum_rules', ''); $forum_password = request_var('forum_password', ''); $forum_password_confirm = request_var('forum_password_confirm', ''); - } + $forum_rules_flags = 0; + $forum_rules_flags += (request_var('parse_bbcode', false)) ? 1 : 0; + $forum_rules_flags += (request_var('parse_smilies', false)) ? 2 : 0; + $forum_rules_flags += (request_var('parse_urls', false)) ? 4 : 0; + } + // Show form to create/modify a forum if ($mode == 'edit') { @@ -174,6 +188,13 @@ switch ($mode) $forums_list = make_forum_select($parent_id, $forum_id, false, true, false); $forum_password_confirm = $forum_password; + + $flags = explode(':', $forum_rules_flags); + + $bbcode_checked = ((int) $flags[0] & 1) ? ' checked="checked"' : ''; + $smilies_checked = ((int) $flags[0] & 2) ? ' checked="checked"' : ''; + $urls_checked = ((int) $flags[0] & 4) ? ' checked="checked"' : ''; + unset($flags); } else { @@ -186,16 +207,36 @@ switch ($mode) { $temp_forum_desc = $forum_desc; $temp_forum_name = $forum_name; + $temp_forum_rules = $forum_rules; + $temp_forum_rules_link = $forum_rules_link; $temp_forum_type = $forum_type; extract(get_forum_info($parent_id)); $forum_type = $temp_forum_type; $forum_name = $temp_forum_name; $forum_desc = $temp_forum_desc; + $forum_rules = $temp_forum_rules; + $forum_rules_link = $temp_forum_rules_link; $forum_password_confirm = $forum_password; } } + // Forum Rules + if ($forum_rules) + { + include_once($phpbb_root_path . 'includes/functions_posting.' . $phpEx); + + // Split text rules (we saved the status and bbcode codes here) + if (!strstr($forum_rules_flags, ':') && is_numeric($forum_rules_flags)) + { + // text not parsed yet... a hard time for us... + $forum_rules_flags = 0; + $forum_rules = parse_text_insert($forum_rules, request_var('parse_bbcode', false), request_var('parse_smilies', false), request_var('parse_urls', false), $forum_rules_flags); + } + + $forum_rules_preview = parse_text_display($forum_rules, $forum_rules_flags); + } + $forum_type_options = ''; $forum_type_ary = array(FORUM_CAT => 'CAT', FORUM_POST => 'FORUM', FORUM_LINK => 'LINK'); foreach ($forum_type_ary as $value => $lang) @@ -231,7 +272,7 @@ switch ($mode) $forums_nav = get_forum_branch($forum_id, 'parents', 'descending'); foreach ($forums_nav as $row) { - $navigation .= ($row['forum_id'] == $forum_id) ? ' -> ' . $row['forum_name'] : ' -> <a href="admin_forums.' . $phpEx . $SID . '&f=' . $row['forum_id'] . '">' . $row['forum_name'] . '</a>'; + $navigation .= ($row['forum_id'] == $forum_id) ? ' -> ' . $row['forum_name'] : ' -> <a href="admin_forums.' . $phpEx . $SID . '&parent_id=' . $row['forum_id'] . '">' . $row['forum_name'] . '</a>'; } adm_page_header($l_title); @@ -269,7 +310,7 @@ switch ($mode) ?> <tr> - <td class="row1" width="33%"><?php echo $user->lang['FORUM_TYPE'] ?>: </td> + <td class="row1" width="33%"><b><?php echo $user->lang['FORUM_TYPE'] ?>: </b></td> <td class="row2"><select name="forum_type" onchange="this.form.submit();"><?php echo $forum_type_options; ?></select><?php if ($old_forum_type == FORUM_POST && $forum_type != FORUM_POST) @@ -321,7 +362,7 @@ switch ($mode) ?> <tr> <td class="row1"><b><?php echo $user->lang['FORUM_LINK'] ?>: </b><br /><span class="gensmall"><?php echo $user->lang['FORUM_LINK_EXPLAIN']; ?></span></td> - <td class="row2"><input class="post" type="text" size="25" name="forum_link" value="<?php echo $forum_link; ?>" /></td> + <td class="row2"><input class="post" type="text" size="40" name="forum_link" value="<?php echo $forum_link; ?>" /></td> </tr> <tr> <td class="row1"><b><?php echo $user->lang['FORUM_LINK_TRACK'] ?>: </b><br /><span class="gensmall"><?php echo $user->lang['FORUM_LINK_TRACK_EXPLAIN']; ?></span></td> @@ -334,19 +375,47 @@ switch ($mode) ?> <tr> <td class="row1"><b><?php echo $user->lang['FORUM_NAME']; ?>: </b></td> - <td class="row2"><input class="post" type="text" size="25" name="forum_name" value="<?php echo $forum_name ?>" /></td> + <td class="row2"><input class="post" type="text" size="40" name="forum_name" value="<?php echo $forum_name ?>" /></td> </tr> <tr> <td class="row1"><b><?php echo $user->lang['FORUM_DESC'] ?>: </b><br /><span class="gensmall"><?php echo $user->lang['FORUM_DESC_EXPLAIN']; ?></span> </td> <td class="row2"><textarea class="post" rows="5" cols="45" wrap="virtual" name="forum_desc"><?php echo htmlspecialchars(str_replace('<br />', "\n", $forum_desc)); ?></textarea></td> </tr> +<?php + if ($forum_type != FORUM_LINK) + { +?> + <tr> + <td class="row1"><b><?php echo $user->lang['FORUM_RULES_LINK']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['FORUM_RULES_LINK_EXPLAIN']; ?></span></td> + <td class="row2"><input class="post" type="text" size="40" name="forum_rules_link" value="<?php echo $forum_rules_link ?>" /></td> + </tr> +<?php + if ($forum_rules_preview) + { +?> + <tr> + <td class="row1"><b><?php echo $user->lang['FORUM_RULES_PREVIEW'] ?>: </b></td> + <td class="row2"><?php echo $forum_rules_preview; ?></td> + </tr> +<?php + } +?> + <tr> + <td class="row1"><b><?php echo $user->lang['FORUM_RULES'] ?>: </b><br /><span class="gensmall"><?php echo $user->lang['FORUM_RULES_EXPLAIN']; ?></span></td> + <td class="row2"><table cellspacing="2" cellpadding="0" border="0"><tr><td colspan="6"><textarea class="post" rows="4" cols="70" name="forum_rules"><?php echo ($forum_rules) ? parse_text_form_display($forum_rules, $forum_rules_flags) : ''; ?></textarea></td></tr><tr> + <td width="10"><input type="checkbox" name="parse_bbcode"<?php echo $bbcode_checked; ?> /></td><td><?php echo $user->lang['PARSE_BBCODE']; ?></td><td width="10"><input type="checkbox" name="parse_smilies"<?php echo $smilies_checked; ?> /></td><td><?php echo $user->lang['PARSE_SMILIES']; ?></td><td width="10"><input type="checkbox" name="parse_urls"<?php echo $urls_checked; ?> /></td><td><?php echo $user->lang['PARSE_URLS']; ?></td></tr></table> + </td> + </tr> +<?php + } +?> <tr> <td class="row1"><b><?php echo $user->lang['FORUM_IMAGE']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['FORUM_IMAGE_EXPLAIN']; ?></span></td> - <td class="row2"><input class="post" type="text" size="25" name="forum_image" value="<?php echo $forum_image ?>" /><br /><?php + <td class="row2"><input class="post" type="text" size="40" name="forum_image" value="<?php echo $forum_image ?>" /><br /><?php if ($forum_image != '') { - echo '<img src="../' . $forum_image . '" alt="" />'; + echo '<img src="' . $phpbb_root_path . $forum_image . '" alt="" />'; } ?></td> @@ -740,18 +809,18 @@ while ($row = $db->sql_fetchrow($result)) if ($row['forum_status'] == ITEM_LOCKED) { - $folder_image = '<img src="images/icon_folder_lock.gif" width="46" height="25" alt="' . $user->lang['LOCKED'] . '" alt="' . $user->lang['LOCKED'] . '" />'; + $folder_image = '<img src="images/icon_folder_lock.gif" width="46" height="25" alt="' . $user->lang['LOCKED'] . '" />'; } else { switch ($forum_type) { case FORUM_LINK: - $folder_image = '<img src="images/icon_folder_link.gif" width="46" height="25" alt="' . $user->lang['LINK'] . '" alt="' . $user->lang['LINK'] . '" />'; + $folder_image = '<img src="images/icon_folder_link.gif" width="46" height="25" alt="' . $user->lang['LINK'] . '" />'; break; default: - $folder_image = ($row['left_id'] + 1 != $row['right_id']) ? '<img src="images/icon_subfolder.gif" width="46" height="25" alt="' . $user->lang['SUBFORUM'] . '" alt="' . $user->lang['SUBFORUM'] . '" />' : '<img src="images/icon_folder.gif" width="46" height="25" alt="' . $user->lang['FOLDER'] . '" alt="' . $user->lang['FOLDER'] . '" />'; + $folder_image = ($row['left_id'] + 1 != $row['right_id']) ? '<img src="images/icon_subfolder.gif" width="46" height="25" alt="' . $user->lang['SUBFORUM'] . '" />' : '<img src="images/icon_folder.gif" width="46" height="25" alt="' . $user->lang['FOLDER'] . '" />'; } } @@ -812,9 +881,9 @@ while ($row = $db->sql_fetchrow($result)) </tr> </table></form> -<form method="get" action="admin_forums.<?php echo $phpEx,$SID ?>"><table width="100%" cellpadding="1" cellspacing="1" border="0"> +<form method="get" action="admin_forums.<?php echo $phpEx.$SID ?>"><table width="100%" cellpadding="1" cellspacing="1" border="0"> <tr> - <td align="right"><?php echo $user->lang['SELECT_FORUM']; ?>: <select name="f" onchange="if(this.options[this.selectedIndex].value != -1){ this.form.submit(); }"><?php echo $forum_box; ?></select> <input class="btnlite" type="submit" value="<?php echo $user->lang['GO']; ?>" /><input type="hidden" name="sid" value="<?php echo $user->session_id; ?>" /></td> + <td align="right"><?php echo $user->lang['SELECT_FORUM']; ?>: <select name="parent_id" onchange="if(this.options[this.selectedIndex].value != -1){ this.form.submit(); }"><?php echo $forum_box; ?></select> <input class="btnlite" type="submit" value="<?php echo $user->lang['GO']; ?>" /><input type="hidden" name="sid" value="<?php echo $user->session_id; ?>" /></td> </tr> </table></form> <?php @@ -901,6 +970,21 @@ function update_forum_data(&$forum_data) unset($forum_data['prune_sticky']); unset($forum_data['forum_password_confirm']); + // Parse Forum Rules + $forum_data['forum_rules_flags'] = 0; + + if ($forum_data['forum_rules']) + { + global $phpbb_root_path, $phpEx; + include_once($phpbb_root_path . 'includes/functions_posting.' . $phpEx); + + $forum_data['forum_rules'] = parse_text_insert($forum_data['forum_rules'], $forum_data['rules_allow_bbcode'], $forum_data['rules_allow_smilies'], $forum_data['rules_allow_urls'], $forum_data['forum_rules_flags']); + } + + unset($forum_data['rules_allow_smilies']); + unset($forum_data['rules_allow_urls']); + unset($forum_data['rules_allow_bbcode']); + // What are we going to do tonight Brain? The same thing we do everynight, // try to take over the world ... or decide whether to continue update // and if so, whether it's a new forum/cat/link or an existing one @@ -1108,7 +1192,7 @@ function move_forum_content($from_id, $to_id, $sync = TRUE) global $db; $table_ary = array(LOG_TABLE, POSTS_TABLE, TOPICS_TABLE); - foreach ($sql_ary as $table) + foreach ($table_ary as $table) { $sql = "UPDATE $table SET forum_id = $to_id @@ -1129,7 +1213,7 @@ function move_forum_content($from_id, $to_id, $sync = TRUE) function delete_forum($forum_id, $action_posts = 'delete', $action_subforums = 'delete', $posts_to_id = 0, $subforums_to_id = 0) { - global $db, $user; + global $db, $user, $cache; $row = get_forum_info($forum_id); extract($row); @@ -1291,6 +1375,7 @@ function delete_forum($forum_id, $action_posts = 'delete', $action_subforums = ' WHERE group_id = {$row['group_id']}"; $db->sql_query($sql); } + $cache->destroy('extensions'); $log_action = implode('_', array($log_action_posts, $log_action_forums)); @@ -1335,8 +1420,6 @@ function delete_forum_content($forum_id) switch (SQL_LAYER) { case 'mysql4': - // Use delete_attachments('topic', $ids, false) here... - // Select then delete all attachments $sql = 'SELECT a.topic_id FROM ' . POSTS_TABLE . ' p, ' . ATTACHMENTS_TABLE . " a diff --git a/phpBB/adm/admin_viewlogs.php b/phpBB/adm/admin_viewlogs.php index ece903bb5b..f4a8bba844 100644 --- a/phpBB/adm/admin_viewlogs.php +++ b/phpBB/adm/admin_viewlogs.php @@ -54,6 +54,11 @@ $sort_dir = request_var('sd', 'd'); // Define some vars depending on which logs we're looking at $log_type = ($mode == 'admin') ? LOG_ADMIN : (($mode == 'mod') ? LOG_MOD : LOG_CRITICAL); +if ($log_type == LOG_MOD) +{ + $user->add_lang('mcp'); +} + // Delete entries if requested and able if (($deletemark || $deleteall) && $auth->acl_get('a_clearlogs')) { @@ -74,7 +79,7 @@ if (($deletemark || $deleteall) && $auth->acl_get('a_clearlogs')) $where_sql"; $db->sql_query($sql); - add_log('admin', 'log_' . $mode . '_clear'); + add_log('admin', 'LOG_' . strtoupper($mode) . '_CLEAR'); } // Sorting diff --git a/phpBB/adm/admin_words.php b/phpBB/adm/admin_words.php index c53acc58dd..a13b92e1f6 100644 --- a/phpBB/adm/admin_words.php +++ b/phpBB/adm/admin_words.php @@ -74,11 +74,11 @@ switch ($mode) <th colspan="2"><?php echo $user->lang['EDIT_WORD']; ?></th> </tr> <tr> - <td class="row1"><b><?php echo $user->lang['WORD']; ?></b>:</td> + <td class="row1"><b><?php echo $user->lang['WORD']; ?>: </b></td> <td class="row2"><input class="post" type="text" name="word" value="<?php echo $word_info['word']; ?>" /></td> </tr> <tr> - <td class="row1"><b><?php echo $user->lang['REPLACEMENT']; ?></b>:</td> + <td class="row1"><b><?php echo $user->lang['REPLACEMENT']; ?>: </b></td> <td class="row2"><input class="post" type="text" name="replacement" value="<?php echo $word_info['replacement']; ?>" /></td> </tr> <tr> @@ -106,8 +106,8 @@ switch ($mode) $cache->destroy('word_censors'); - $log_action = ($word_id) ? 'log_edit_word' : 'log_add_word'; - add_log('admin', $log_action, stripslashes($word)); + $log_action = ($word_id) ? 'LOG_EDIT_WORD' : 'LOG_ADD_WORD'; + add_log('admin', $log_action, $word); $message = ($word_id) ? $user->lang['WORD_UPDATED'] : $user->lang['WORD_ADDED']; trigger_error($message); @@ -122,13 +122,20 @@ switch ($mode) trigger_error($user->lang['NO_WORD']); } + $sql = 'SELECT word + FROM ' . WORDS_TABLE . " + WHERE word_id = $word_id"; + $result = $db->sql_query($sql); + $deleted_word = $db->sql_fetchfield('word', 0, $result); + $db->sql_freeresult($result); + $sql = 'DELETE FROM ' . WORDS_TABLE . " WHERE word_id = $word_id"; $db->sql_query($sql); $cache->destroy('word_censors'); - add_log('admin', 'log_delete_word'); + add_log('admin', 'LOG_DELETE_WORD', $deleted_word); $message = $user->lang['WORD_REMOVE']; trigger_error($message); @@ -158,6 +165,7 @@ switch ($mode) ORDER BY word'; $result = $db->sql_query($sql); + $row_class = ''; if ($row = $db->sql_fetchrow($result)) { do diff --git a/phpBB/adm/pagestart.php b/phpBB/adm/pagestart.php index 4621fa67a2..d69f5c9b86 100644 --- a/phpBB/adm/pagestart.php +++ b/phpBB/adm/pagestart.php @@ -19,7 +19,7 @@ * ***************************************************************************/ -if (!defined('IN_PHPBB')) +if (!defined('IN_PHPBB') || !isset($phpbb_root_path)) { die('Hacking attempt'); } @@ -36,7 +36,7 @@ $user->setup('admin'); // Did user forget to login? Give 'em a chance to here ... if ($user->data['user_id'] == ANONYMOUS) { - login_box("adm/index.$phpEx$SID", '', $user->lang['LOGIN_ADMIN']); + login_box("{$phpbb_root_path}adm/index.$phpEx$SID", '', $user->lang['LOGIN_ADMIN']); } $auth->acl($user->data); diff --git a/phpBB/includes/bbcode.php b/phpBB/includes/bbcode.php index 537199fb57..144dafbb30 100644 --- a/phpBB/includes/bbcode.php +++ b/phpBB/includes/bbcode.php @@ -40,15 +40,15 @@ class bbcode if ($bbcode_bitfield !== FALSE) { $this->bbcode_bitfield = $bbcode_bitfield; + // Init those added with a new bbcode_bitfield (already stored codes will not get parsed again) + $this->bbcode_cache_init(); } + if (!$this->bbcode_bitfield) { return $message; } - // Init those added with a new bbcode_bitfield (already stored codes will not get parsed again) - $this->bbcode_cache_init(); - $str = array('search' => array(), 'replace' => array()); $preg = array('search' => array(), 'replace' => array()); diff --git a/phpBB/includes/db/mysql.php b/phpBB/includes/db/mysql.php index ccaca5e884..8b08b33458 100644 --- a/phpBB/includes/db/mysql.php +++ b/phpBB/includes/db/mysql.php @@ -131,7 +131,7 @@ class sql_db if ($cache_ttl && method_exists($cache, 'sql_save')) { $cache->sql_save($query, $this->query_result, $cache_ttl); - @mysql_free_result($this->query_result); + // mysql_free_result happened within sql_save() } elseif (preg_match('/^SELECT/', $query)) { diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 29b627bccc..9b399312c7 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -117,6 +117,29 @@ function get_userdata($user) return ($row = $db->sql_fetchrow($result)) ? $row : false; } +// Create forum rules for given forum +function generate_forum_rules($forum_data) +{ + if (!$forum_data['forum_rules'] && !$forum_data['forum_rules_link']) + { + return; + } + + global $template, $phpbb_root_path, $phpEx; + + if ($forum_data['forum_rules']) + { + include_once($phpbb_root_path . 'includes/functions_posting.' . $phpEx); + $text_flags = explode(':', $forum_data['forum_rules_flags']); + } + + $template->assign_vars(array( + 'S_FORUM_RULES' => true, + 'U_FORUM_RULES' => $forum_data['forum_rules_link'], + 'FORUM_RULES' => (!$forum_data['forum_rules_link']) ? parse_text_display($forum_data['forum_rules'], $forum_data['forum_rules_flags']) : '') + ); +} + // Create forum navigation links for given forum, create parent // list if currently null, assign basic forum info to template function generate_forum_nav(&$forum_data) @@ -235,7 +258,7 @@ function get_moderators(&$forum_moderators, $forum_id = false) } // User authorisation levels output -function gen_forum_rules($mode, &$forum_id) +function gen_forum_auth_level($mode, &$forum_id) { global $SID, $template, $auth, $user; @@ -1098,6 +1121,7 @@ function login_box($s_action, $s_hidden_fields = '', $login_explain = '', $ucp_l } $s_hidden_fields .= ($ucp_login && !empty($_SERVER['HTTP_REFERER'])) ? '<input type="hidden" name="redirect" value="' . htmlspecialchars($_SERVER['HTTP_REFERER']) . '" />' : '<input type="hidden" name="redirect" value="' . $s_action . '" />'; + $s_hidden_fields .= '<input type="hidden" name="sid" value="' . $SID . '" />'; $template->assign_vars(array( 'LOGIN_ERROR' => $err, @@ -1285,7 +1309,7 @@ function extension_allowed($forum_id, $extension) function msg_handler($errno, $msg_text, $errfile, $errline) { global $cache, $db, $auth, $template, $config, $user; - global $phpEx, $phpbb_root_path, $starttime, $display_header; + global $phpEx, $phpbb_root_path, $starttime, $display_header, $show_prev_info; switch ($errno) { @@ -1349,10 +1373,11 @@ function msg_handler($errno, $msg_text, $errfile, $errline) $msg_text = (!empty($user->lang[$msg_text])) ? $user->lang[$msg_text] : $msg_text; $msg_title = (!isset($msg_title)) ? $user->lang['INFORMATION'] : ((!empty($user->lang[$msg_title])) ? $user->lang[$msg_title] : $msg_title); $display_header = (!isset($display_header)) ? false : (bool) $display_header; + $show_prev_info = (!isset($show_prev_info)) ? true : (bool) $show_prev_info; if (defined('IN_ADMIN')) { - adm_page_message($msg_title, $msg_text, $display_header); + adm_page_message($msg_title, $msg_text, $display_header, $show_prev_info); adm_page_footer(); } else diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php index 35f1dc2cc0..913962f566 100644 --- a/phpBB/includes/functions_admin.php +++ b/phpBB/includes/functions_admin.php @@ -779,12 +779,20 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = FALSE, } else { + if (!sizeof($where_ids)) + { + return; + } $where_sql = 'WHERE ' . $mode{0} . ".$where_type IN (" . implode(', ', $where_ids) . ')'; $where_sql_and = $where_sql . "\n\tAND"; } } else { + if (!sizeof($where_ids)) + { + return; + } $where_sql = 'WHERE ' . $mode{0} . ".$where_type IN (" . implode(', ', $where_ids) . ')'; $where_sql_and = $where_sql . "\n\tAND"; } @@ -807,7 +815,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = FALSE, FROM ' .TOPICS_TABLE . ' t1, ' . TOPICS_TABLE . " t2 WHERE t1.topic_moved_id = t2.topic_id AND t1.forum_id = t2.forum_id"; - $result = $db->sql_query($result); + $result = $db->sql_query($sql); if ($row = $db->sql_fetchrow($result)) { diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index 3bd9aba370..1932e2d2df 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -13,7 +13,7 @@ function display_forums($root_data = '', $display_moderators = TRUE) { - global $config, $db, $template, $auth, $user, $phpEx, $SID, $forum_moderators; + global $config, $db, $template, $auth, $user, $phpEx, $SID, $forum_moderators, $phpbb_root_path; // Get posted/get info $mark_read = request_var('mark', ''); @@ -300,11 +300,10 @@ function display_forums($root_data = '', $display_moderators = TRUE) 'S_IS_CAT' => false, 'S_IS_LINK' => ($row['forum_type'] != FORUM_LINK) ? false : true, - 'FORUM_IMG' => $row['forum_image'], 'LAST_POST_IMG' => $user->img('icon_post_latest', 'VIEW_LATEST_POST'), 'FORUM_ID' => $row['forum_id'], - 'FORUM_FOLDER_IMG' => $user->img($folder_image, $folder_alt), + 'FORUM_FOLDER_IMG' => ($row['forum_image']) ? '<img src="' . $phpbb_root_path . $row['forum_image'] . '" alt="' . $folder_alt . '" border="0" />' : $user->img($folder_image, $folder_alt), 'FORUM_NAME' => $row['forum_name'], 'FORUM_DESC' => $row['forum_desc'], $l_post_click_count => $post_click_count, diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php index 4b2f2f2c71..00d521d412 100644 --- a/phpBB/includes/functions_posting.php +++ b/phpBB/includes/functions_posting.php @@ -101,7 +101,10 @@ function format_display(&$message, &$signature, $uid, $siguid, $enable_html, $en } // Second parse bbcode here - $bbcode->bbcode_second_pass($message, $uid); + if ($enable_bbcode) + { + $bbcode->bbcode_second_pass($message, $uid); + } // If we allow users to disable display of emoticons we'll need an appropriate // check and preg_replace here @@ -128,6 +131,101 @@ function format_display(&$message, &$signature, $uid, $siguid, $enable_html, $en return $message; } +// Three simple functions we use for bbcode/smilie/url capable text + +// prepare text to be inserted into db... +function parse_text_insert($text, $allow_bbcode, $allow_smilies, $allow_magic_url, &$text_flags) +{ + global $message_parser; + + $text_flags += ($allow_bbcode) ? 1 : 0; + $text_flags += ($allow_smilies) ? 2 : 0; + $text_flags += ($allow_magic_url) ? 4 : 0; + + $match = array('#\r\n?#', '#sid=[a-z0-9]*?&?#', "#([\n][\s]+){3,}#", '#&(\#[0-9]+;)#'); + $replace = array("\n", '', "\n\n", '&\1'); + $text = preg_replace($match, $replace, $text); + + // Parse BBCode + if (!method_exists('parse_message', 'parse_message') || !isset($message_parser)) + { + global $phpbb_root_path, $phpEx; + include_once($phpbb_root_path . 'includes/message_parser.' . $phpEx); + $message_parser = new parse_message(); + } + + $message_parser->message = $text; + + if ($allow_bbcode && strpos($text, '[') !== false) + { + $message_parser->bbcode_init(); + $message_parser->bbcode(); + } + + // Parse Emoticons + $message_parser->emoticons($allow_smilies); + + // Parse URL's + $message_parser->magic_url($allow_magic_url); + + $text_flags = $text_flags . ':' . $message_parser->bbcode_uid . ':' . $message_parser->bbcode_bitfield; + + return $message_parser->message; +} + +// prepare text to be displayed/previewed... +function parse_text_display($text, $text_rules) +{ + global $bbcode, $user; + + $text_flags = explode(':', $text_rules); + + $allow_bbcode = (int) $text_flags[0] & 1; + $allow_smilies = (int) $text_flags[0] & 2; + $allow_magic_url = (int) $text_flags[0] & 4; + + $bbcode_uid = trim($text_flags[1]); + $bbcode_bitfield = (int) $text_flags[2]; + + if (!$bbcode && $allow_bbcode) + { + global $phpbb_root_path, $phpEx; + + include_once($phpbb_root_path . 'includes/bbcode.' . $phpEx); + $bbcode = new bbcode(); + } + + // Second parse bbcode here + if ($allow_bbcode) + { + $bbcode->bbcode_second_pass($text, $bbcode_uid, $bbcode_bitfield); + } + + // If we allow users to disable display of emoticons we'll need an appropriate + // check and preg_replace here + if ($allow_smilies) + { + $text = smilie_text($text, !$allow_smilies); + } + + // Replace naughty words such as farty pants + $text = str_replace("\n", '<br />', censor_text($text)); + + return $text; +} + +// prepare text to be displayed within a form (fetched from db) +function parse_text_form_display($text, $text_rules) +{ + // We use decode_text here... + $text_rules = explode(':', $text_rules); + $bbcode_uid = trim($text_rules[1]); + + decode_text($text, $bbcode_uid); + + return $text; +} + // Update Last Post Informations function update_last_post_information($type, $id) { diff --git a/phpBB/install/schemas/mysql_schema.sql b/phpBB/install/schemas/mysql_schema.sql index fc4d88149c..65006eb46f 100644 --- a/phpBB/install/schemas/mysql_schema.sql +++ b/phpBB/install/schemas/mysql_schema.sql @@ -190,6 +190,9 @@ CREATE TABLE phpbb_forums ( forum_password varchar(32) DEFAULT '' NOT NULL, forum_style tinyint(4) UNSIGNED, forum_image varchar(50) DEFAULT '' NOT NULL, + forum_rules text DEFAULT '' NOT NULL, + forum_rules_link varchar(200) DEFAULT '' NOT NULL, + forum_rules_flags varchar(50) DEFAULT '' NOT NULL, forum_topics_per_page tinyint(4) UNSIGNED DEFAULT '0' NOT NULL, forum_type tinyint(4) DEFAULT '0' NOT NULL, forum_status tinyint(4) DEFAULT '0' NOT NULL, diff --git a/phpBB/install/schemas/schema_data.sql b/phpBB/install/schemas/schema_data.sql index 9a951e061f..4032fcec73 100644 --- a/phpBB/install/schemas/schema_data.sql +++ b/phpBB/install/schemas/schema_data.sql @@ -150,7 +150,6 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('auth_bbcode_pm', ' INSERT INTO phpbb_config (config_name, config_value) VALUES ('auth_smilies_pm', '1'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('auth_download_pm', '1'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_sig_pm', '1'); -INSERT INTO phpbb_config (config_name, config_value) VALUES ('enable_karma_pm', '0'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('auth_report_pm', '1'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('auth_quote_pm', '1'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('print_pm', '1'); diff --git a/phpBB/language/en/admin.php b/phpBB/language/en/admin.php index 93f2c3c2fa..2cde583ae4 100644 --- a/phpBB/language/en/admin.php +++ b/phpBB/language/en/admin.php @@ -123,11 +123,10 @@ $lang += array( 'LOG_USER_ACTIVE' => '<b>User activated</b><br />» %s', 'LOG_MASS_EMAIL' => '<b>Sent mass email</b><br />» %s', - 'LOG_MAIL_SESSION' => '<b>Logged Mail Session</b><br />» %s', - 'log_delete_word' => '<b>Deleted word censor</b>', - 'log_edit_word' => '<b>Edited word censor</b><br />» %s', - 'log_add_word' => '<b>Added word censor</b><br />» %s', + 'LOG_DELETE_WORD' => '<b>Deleted word censor</b><br />» %s', + 'LOG_EDIT_WORD' => '<b>Edited word censor</b><br />» %s', + 'LOG_ADD_WORD' => '<b>Added word censor</b><br />» %s', 'log_db_backup' => '<b>Database backup</b>', 'log_db_restore' => '<b>Database restore</b>', @@ -136,7 +135,9 @@ $lang += array( 'log_disallow_add' => '<b>Added disallowed username</b><br />» %s', 'log_disallow_delete' => '<b>Deleted disallowed username</b>', - 'log_admin_clear' => '<b>Cleared admin log</b>', + 'LOG_ADMIN_CLEAR' => '<b>Cleared admin log</b>', + 'LOG_MOD_CLEAR' => '<b>Cleared moderator log</b>', + 'LOG_CRITICAL_CLEAR' => '<b>Cleared error log</b>', 'LOG_PRUNE' => '<b>Pruned forums</b><br />» %s', 'LOG_AUTO_PRUNE' => '<b>Auto-pruned forums</b><br />» %s', @@ -163,6 +164,7 @@ $lang += array( 'LOG_AVATAR_CONFIG' => '<b>Altered avatar settings</b>', 'LOG_AUTH_CONFIG' => '<b>Altered authentication settings</b>', 'LOG_LOAD_CONFIG' => '<b>Altered load settings</b>', + 'LOG_MESSAGE_CONFIG' => '<b>Altered private message settings</b>', 'LOG_ATTACH_CONFIG' => '<b>Altered attachment settings</b>', 'LOG_ATTACH_EXT_ADD' => '<b>Added or edited attachment extension</b><br />» %s', @@ -880,7 +882,7 @@ $lang += array( 'FORUM_ADMIN_EXPLAIN' => 'In phpBB 2.2 there are no categories, everything is forum based. Each forum can have an unlimited number of sub-forums and you can determine whether each may be posted to or not (i.e. whether it acts like an old category). Here you can add, edit, delete, lock, unlock individual forums as well as set certain additional controls. If your posts and topics have got out of sync you can also resynchronise a forum.', 'FORUM_EDIT_EXPLAIN' => 'The form below will allow you to customise this forum. Please note that moderation and post count controls are set via forum permissions for each user or usergroup.', 'FORUM_DELETE' => 'Delete Forum', - 'FORUM_DELETE_EXPLAIN' => 'The form below will allow you to delete a forum and decide where you want to put all topics (or forums) it contained.', + 'FORUM_DELETE_EXPLAIN' => 'The form below will allow you to delete a forum and decide where you want to put all topics (or forums) it contained.', 'EDIT_FORUM' => 'Edit forum', 'CREATE_FORUM' => 'Create new forum', @@ -909,7 +911,18 @@ $lang += array( 'FORUM_IMAGE' => 'Forum Image', 'FORUM_IMAGE_EXPLAIN'=> 'Location, relative to the phpBB root directory, of an image to associate with this forum.', 'FORUM_PARENT' => 'Parent Forum', + + 'FORUM_RULES' => 'Forum Rules', + 'FORUM_RULES_EXPLAIN' => 'Forum Rules are displayed at any page within the given forum.', + 'FORUM_RULES_LINK' => 'Link to Forum Rules', + 'FORUM_RULES_LINK_EXPLAIN'=> 'You are able to enter the URL of the page/post containing your forum rules here. This setting will override the Forum Rules text you specified.', + 'FORUM_RULES_PREVIEW' => 'Forum Rules preview', + 'PARSE_BBCODE' => 'Parse BBCode', + 'PARSE_SMILIES' => 'Parse Smilies', + 'PARSE_URLS' => 'Parse Links', + 'NO_PARENT' => 'No Parent', + 'LINK' => 'Link', 'LOCKED' => 'Locked', 'UNLOCKED' => 'Unlocked', 'ENABLE_NEWS' => 'Set as news forum', @@ -951,13 +964,15 @@ $lang += array( 'DELETE_ALL_POSTS' => 'Delete posts', 'DELETE_SUBFORUMS' => 'Delete subforums and posts', - 'NO_DESTINATION_FORUM' => 'You have not specified a forum to move content to', + 'NO_DESTINATION_FORUM' => 'You have not specified a forum to move content to', 'FORUM_PASSWORD_MISMATCH' => 'The passwords you entered did not match.', 'FORUM_NAME_EMPTY' => 'You must enter a name for this forum.', 'FORUM_DATA_NEGATIVE' => 'Pruning parameters cannot be negative.', + 'FORUM_CREATED' => 'Forum created successfully.', 'FORUM_UPDATED' => 'Forum informations updated successfully.', 'REDIRECT_ACL' => 'To set permissions for this forum click %sHERE%s.', 'FORUM_DELETED' => 'Forum successfully deleted', + 'FORUM_RESYNCED' => 'Forum successfully resynced', ); // Smiley and topic icons @@ -1768,7 +1783,9 @@ $lang += array( 'EXTENSION_GROUPS' => 'Extension Groups', 'EXTENSION_GROUP' => 'Extension Group', 'SPECIAL_CATEGORY' => 'Special Category', + 'SPECIAL_CATEGORY_EXPLAIN' => 'Special Categories differ between the way presented within posts.', 'DOWNLOAD_MODE' => 'Download Mode', + 'DOWNLOAD_MODE_EXPLAIN' => 'If you experience problems downloading files, set this to "physical", the user will be directed to the file directly. Do not set it to physical if not really needed, it discloses the filename.', 'UPLOAD_ICON' => 'Upload Icon', 'MAX_EXTGROUP_FILESIZE' => 'Maximum Filesize', 'ASSIGNED_EXTENSIONS' => 'Assigned Extensions', @@ -1781,10 +1798,11 @@ $lang += array( 'EXTENSION_GROUP_EXIST' => 'The Extension Group %s already exist', 'EXTENSION_GROUP_DELETED' => 'Extension Group successfully deleted', 'ALLOWED_FORUMS' => 'Allowed Forums', - 'ALLOWED_FORUMS_EXPLAIN' => 'Able to post the assigned extensions at the following forums', + 'ALLOWED_FORUMS_EXPLAIN' => 'Able to post the assigned extensions at the selected (or all if selected) forums', 'ALLOW_IN_PM' => 'Allowed in private messaging', 'ALLOW_ALL_FORUMS' => 'Allow All Forums', 'ALLOW_SELECTED_FORUMS' => 'Only Forums selected below', + 'GO_TO_EXTENSIONS' => 'Go to Extension Management Screen', 'CAT_IMAGES' => 'Images', 'CAT_WM_FILES' => 'Win Media Streams', diff --git a/phpBB/language/en/common.php b/phpBB/language/en/common.php index 3c6d26ff75..d325db31ed 100644 --- a/phpBB/language/en/common.php +++ b/phpBB/language/en/common.php @@ -46,6 +46,7 @@ $lang += array( 'ACP' => 'Administration Control Panel', 'ACTIVE_ERROR' => 'You have specified an inactive username. Please activate your account and try again. If you continue to have problems please contact a board administrator.', 'ALLOWED' => 'Allowed', + 'ALL_FORUMS' => 'All Forums', 'ALL_MESSAGES' => 'All Messages', 'ALL_POSTS' => 'All Posts', 'ALL_TIMES' => 'All times are %s %s', @@ -82,6 +83,7 @@ $lang += array( 'DAY' => 'Day', 'DAYS' => 'Days', 'DELETE' => 'Delete', + 'DELETE_MARKED' => 'Delete Marked', 'DESCENDING' => 'Descending', 'DISABLED' => 'Disabled', 'DISPLAY_MESSAGES' => 'Display messages from previous', @@ -111,6 +113,7 @@ $lang += array( 'FORUM_INDEX' => 'Board Index', 'FORUM_LOCATION' => 'Forum Location', 'FORUM_LOCKED' => 'Forum Locked', + 'FORUM_RULES' => 'Forum Rules', 'FROM' => 'from', 'GO' => 'Go', diff --git a/phpBB/language/en/ucp.php b/phpBB/language/en/ucp.php index b305876e34..56a76a64a9 100644 --- a/phpBB/language/en/ucp.php +++ b/phpBB/language/en/ucp.php @@ -85,6 +85,7 @@ $lang += array( 'CURRENT_PASSWORD_EXPLAIN' => 'You must confirm your current password if you wish to change it, alter your email address or username.', 'CUR_PASSWORD_ERROR' => 'The current password you entered is incorrect.', + 'DEFAULT_ACTION' => 'Default Action', 'DEFAULT_ADD_SIG' => 'Attach my signature by default', 'DEFAULT_BBCODE' => 'Enable BBCode by default', 'DEFAULT_HTML' => 'Enable HTML by default', @@ -97,7 +98,6 @@ $lang += array( 'DELETE_ATTACHMENT_CONFIRM' => 'Are you sure you want to delete this attachment?', 'DELETE_ATTACHMENTS_CONFIRM'=> 'Are you sure you want to delete these attachments?', 'DELETE_AVATAR' => 'Delete Image', - 'DELETE_MARKED' => 'Delete Marked', 'DELETE_MARKED_PM' => 'Delete Marked Messages', 'DELETE_MARKED_PM_CONFIRM' => 'Are you sure you want to delete all marked messages?', 'DELETE_PM' => 'Delete PM', @@ -137,6 +137,7 @@ $lang += array( 'HIDE_ONLINE' => 'Hide my online status', + 'IF_FOLDER_FULL' => 'If Folder Full', 'IMPORTANT_NEWS' => 'Important announcements', 'LANGUAGE' => 'Language', @@ -144,6 +145,7 @@ $lang += array( 'LINK_REMOTE_AVATAR_EXPLAIN'=> 'Enter the URL of the location containing the Avatar image you wish to link to.', 'LINK_REMOTE_SIZE' => 'Avatar dimensions', 'LINK_REMOTE_SIZE_EXPLAIN' => 'Specify the width and height of the avatar, leave blank to attempt automatic verification.', + 'LOGIN_EXPLAIN_UCP' => 'Please Login in order to access the User Control Panel', 'LOGIN_REDIRECT' => 'You have been successfully logged in.', 'LOGOUT_REDIRECT' => 'You have been successfully logged out.', diff --git a/phpBB/memberlist.php b/phpBB/memberlist.php index 25840654c1..0cf6d7a867 100644 --- a/phpBB/memberlist.php +++ b/phpBB/memberlist.php @@ -46,7 +46,7 @@ switch ($mode) trigger_error($user->lang['NO_VIEW_USERS']); } - login_box(preg_replace('#.*?([a-z]+?\.' . $phpEx . '.*?)$#i', '\1', htmlspecialchars($_SERVER['REQUEST_URI']))); + login_box($user->cur_page, '', $user->lang['LOGIN_EXPLAIN_' . strtoupper($mode)]); } break; } diff --git a/phpBB/posting.php b/phpBB/posting.php index 68d80d2b35..725295f5bf 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -266,7 +266,7 @@ if (!$auth->acl_get('f_' . $mode, $forum_id) && $forum_type == FORUM_POST) trigger_error('USER_CANNOT_' . strtoupper($mode)); } - login_box(preg_replace('#.*?([a-z]+?\.' . $phpEx . '.*?)$#i', '\1', htmlspecialchars($_SERVER['REQUEST_URI'])), '', $user->lang['USER_CANNOT_' . strtoupper($mode)]); + login_box($user->cur_page, '', $user->lang['LOGIN_EXPLAIN_' . strtoupper($mode)]); } @@ -917,10 +917,18 @@ $forum_data = array( 'forum_name' => $forum_name, 'forum_id' => $forum_id, 'forum_type' => $forum_type, - 'forum_desc' => $forum_desc + 'forum_desc' => $forum_desc, + 'forum_rules' => $forum_rules, + 'forum_rules_flags' => $forum_rules_flags, + 'forum_rules_link' => $forum_rules_link ); + +// Generate Navigation Links generate_forum_nav($forum_data); +// Generate Forum Rules +generate_forum_rules($forum_data); + $s_hidden_fields = ($mode == 'reply' || $mode == 'quote') ? '<input type="hidden" name="topic_cur_post_id" value="' . $topic_last_post_id . '" />' : ''; $s_hidden_fields .= '<input type="hidden" name="lastclick" value="' . $current_time . '" />'; $s_hidden_fields .= (isset($check_value)) ? '<input type="hidden" name="status_switch" value="' . $check_value . '" />' : ''; diff --git a/phpBB/styles/subSilver/template/posting_body.html b/phpBB/styles/subSilver/template/posting_body.html index 05d6898e75..fccc9922b0 100644 --- a/phpBB/styles/subSilver/template/posting_body.html +++ b/phpBB/styles/subSilver/template/posting_body.html @@ -48,15 +48,16 @@ function checkForm() <script language="javascript" type="text/javascript" src="styles/subSilver/template/editor.js"></script> <!-- IF S_FORUM_RULES --> - <p class="forumrules"> +<div class="forumrules"> <!-- IF U_FORUM_RULES --> <a href="{U_FORUM_RULES}">{L_FORUM_RULES}</a> <!-- ELSE --> - {L_FORUM_RULES} + <span style="color:red">{L_FORUM_RULES}</span><br /> + {FORUM_RULES} <!-- ENDIF --> - </p> +</div> - <br clear="all" /> +<br clear="all" /> <!-- ENDIF --> <!-- IF not S_PRIVMSGS --> diff --git a/phpBB/styles/subSilver/template/posting_review.html b/phpBB/styles/subSilver/template/posting_review.html index ba2bd64922..d4296ecdeb 100644 --- a/phpBB/styles/subSilver/template/posting_review.html +++ b/phpBB/styles/subSilver/template/posting_review.html @@ -29,9 +29,6 @@ <tr> <td align="center"><b class="postauthor">{post_review_row.POSTER_NAME}</b></td> </tr> - <tr> - <td align="center">{post_review_row.KARMA_IMG}</td> - </tr> </table> </td> <td width="100%"> diff --git a/phpBB/styles/subSilver/template/posting_topic_review.html b/phpBB/styles/subSilver/template/posting_topic_review.html index 0a29a3758e..19bdf0023f 100644 --- a/phpBB/styles/subSilver/template/posting_topic_review.html +++ b/phpBB/styles/subSilver/template/posting_topic_review.html @@ -24,9 +24,6 @@ <tr> <td align="center"><b class="postauthor">{topic_review_row.POSTER_NAME}</b></td> </tr> - <tr> - <td align="center">{topic_review_row.KARMA_IMG}</td> - </tr> </table></td> <td width="100%"><table width="100%" cellspacing="0"> <tr> diff --git a/phpBB/styles/subSilver/template/viewforum_body.html b/phpBB/styles/subSilver/template/viewforum_body.html index 2916165c4e..17d6b49f7a 100644 --- a/phpBB/styles/subSilver/template/viewforum_body.html +++ b/phpBB/styles/subSilver/template/viewforum_body.html @@ -3,13 +3,14 @@ <!-- $Id$ --> <!-- IF S_FORUM_RULES --> - <p class="forumrules"> + <div class="forumrules"> <!-- IF U_FORUM_RULES --> - <a href="{U_FORUM_RULES}">{L_FORUM_RULES}</a> + <a href="{U_FORUM_RULES}">{L_FORUM_RULES}</a> <!-- ELSE --> - {L_FORUM_RULES} + <span style="color:red">{L_FORUM_RULES}</span><br /> + {FORUM_RULES} <!-- ENDIF --> - </p> + </div> <br clear="all" /> <!-- ENDIF --> diff --git a/phpBB/styles/subSilver/template/viewtopic_body.html b/phpBB/styles/subSilver/template/viewtopic_body.html index cea26f5a47..c0dea66295 100644 --- a/phpBB/styles/subSilver/template/viewtopic_body.html +++ b/phpBB/styles/subSilver/template/viewtopic_body.html @@ -3,13 +3,14 @@ <!-- $Id$ --> <!-- IF S_FORUM_RULES --> - <p class="forumrules"> + <div class="forumrules"> <!-- IF U_FORUM_RULES --> - <a href="{U_FORUM_RULES}">{L_FORUM_RULES}</a> + <a href="{U_FORUM_RULES}">{L_FORUM_RULES}</a> <!-- ELSE --> - {L_FORUM_RULES} + <span style="color:red">{L_FORUM_RULES}</span><br /> + {FORUM_RULES} <!-- ENDIF --> - </p> + </div> <br clear="all" /> <!-- ENDIF --> @@ -134,9 +135,6 @@ <div align="center"> <table cellspacing="4" align="center"> - <tr> - <td>{postrow.KARMA_IMG}</td> - </tr> <!-- IF postrow.ONLINE_IMG --> <tr> <td>{postrow.ONLINE_IMG}</td> diff --git a/phpBB/ucp.php b/phpBB/ucp.php index 80d383e837..2b1e6e0a51 100755 --- a/phpBB/ucp.php +++ b/phpBB/ucp.php @@ -301,7 +301,12 @@ switch ($mode) // Only registered users can go beyond this point if ($user->data['user_id'] == ANONYMOUS || $user->data['user_type'] == USER_INACTIVE || $user->data['user_type'] == USER_IGNORE) { - redirect("index.$phpEx"); + if ($user->data['user_id'] != ANONYMOUS) + { + redirect("index.$phpEx"); + } + + login_box($user->cur_page, '', $user->lang['LOGIN_EXPLAIN_UCP']); } diff --git a/phpBB/viewforum.php b/phpBB/viewforum.php index 0cfcedc882..24a9829920 100644 --- a/phpBB/viewforum.php +++ b/phpBB/viewforum.php @@ -119,7 +119,7 @@ if ($forum_data['forum_password']) // Redirect to login upon emailed notification links if (isset($_GET['e']) && $user->data['user_id'] == ANONYMOUS) { - login_box(preg_replace('#.*?([a-z]+?\.' . $phpEx . '.*?)$#i', '\1', htmlspecialchars($_SERVER['REQUEST_URI'])), '', $user->lang['LOGIN_NOTIFY_FORUM']); + login_box($user->cur_page, '', $user->lang['LOGIN_NOTIFY_FORUM']); } // Permissions check @@ -130,12 +130,15 @@ if (!$auth->acl_get('f_read', $forum_id)) trigger_error($user->lang['SORRY_AUTH_READ']); } - login_box(preg_replace('#.*?([a-z]+?\.' . $phpEx . '.*?)$#i', '\1', htmlspecialchars($_SERVER['REQUEST_URI'])), '', $user->lang['LOGIN_VIEWFORUM']); + login_box($user->cur_page, '', $user->lang['LOGIN_VIEWFORUM']); } // Build navigation links generate_forum_nav($forum_data); +// Forum Rules +generate_forum_rules($forum_data); + // Do we have subforums? $active_forum_ary = $moderators = array(); @@ -198,7 +201,7 @@ if ($forum_data['forum_type'] == FORUM_POST || ($forum_data['forum_flags'] & 16) } $s_forum_rules = ''; - gen_forum_rules('forum', $forum_id); + gen_forum_auth_level('forum', $forum_id); // Topic ordering options $limit_days = array(0 => $user->lang['ALL_TOPICS'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 364 => $user->lang['1_YEAR']); @@ -280,7 +283,6 @@ if ($forum_data['forum_type'] == FORUM_POST || ($forum_data['forum_flags'] & 16) 'S_FORUM_ACTION' => "viewforum.$phpEx$SID&f=$forum_id&start=$start", 'S_DISPLAY_SEARCHBOX' => ($auth->acl_get('f_search', $forum_id)) ? true : false, 'S_SEARCHBOX_ACTION' => "search.$phpEx$SID&f[]=$forum_id", - 'S_FORUM_RULES' => false, 'U_MCP' => ($auth->acl_gets('m_', $forum_id)) ? "mcp.$phpEx?sid=$user->session_id&f=$forum_id&mode=forum_view" : '', 'U_POST_NEW_TOPIC' => "posting.$phpEx$SID&mode=post&f=$forum_id", @@ -407,10 +409,10 @@ if ($forum_data['forum_type'] == FORUM_POST || ($forum_data['forum_flags'] & 16) $topic_type = ''; if ($row['topic_status'] == ITEM_MOVED) { - $topic_type = $user->lang['VIEW_TOPIC_MOVED'] . ' '; + $topic_type = $user->lang['VIEW_TOPIC_MOVED']; $topic_id = $row['topic_moved_id']; - $folder_image = 'folder'; + $folder_img = 'folder'; $folder_alt = 'Topic_Moved'; $newest_post_img = ''; } @@ -576,7 +578,7 @@ if ($forum_data['forum_type'] == FORUM_POST || ($forum_data['forum_flags'] & 16) if ((isset($row['mark_time']) && $row['topic_last_post_time'] > $row['mark_time']) || (empty($row['mark_time']) && $row['topic_last_post_time'] > $forum_data['mark_time'])) { // sync post/topic marking - if (!$unread_topic && !empty($row['mark_time']) && $row['mark_time']) + if (isset($unread_topc) && !$unread_topic && !empty($row['mark_time']) && $row['mark_time']) { markread('topic', $forum_id, $topic_id); } @@ -609,7 +611,7 @@ if ($forum_data['forum_type'] == FORUM_POST || ($forum_data['forum_flags'] & 16) // on all topics (as we do in 2.0.x). It looks for unread or new topics, if it doesn't find // any it updates the forum last read cookie. This requires that the user visit the forum // after reading a topic - if ($forum_data['forum_type'] == FORUM_POST && $user->data['user_id'] != ANONYMOUS && $mark_forum_read) + if ($forum_data['forum_type'] == FORUM_POST && $user->data['user_id'] != ANONYMOUS && count($topic_list) && $mark_forum_read) { markread('mark', $forum_id); } diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 0631a6d0a4..5224eda215 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -162,7 +162,7 @@ if ($user->data['user_id'] != ANONYMOUS) // whereupon we join on the forum_id passed as a parameter ... this // is done so navigation, forum name, etc. remain consistent with where // user clicked to view a global topic -$sql = 'SELECT t.topic_id, t.forum_id, t.topic_title, t.topic_attachment, t.topic_status, t.topic_approved, ' . (($auth->acl_get('m_approve')) ? 't.topic_replies_real AS topic_replies' : 't.topic_replies') . ', t.topic_last_post_id, t.topic_last_poster_id, t.topic_last_post_time, t.topic_poster, t.topic_time, t.topic_time_limit, t.topic_type, t.topic_bumped, t.topic_bumper, t.poll_max_options, t.poll_start, t.poll_length, t.poll_title, f.forum_name, f.forum_desc, f.forum_parents, f.parent_id, f.left_id, f.right_id, f.forum_status, f.forum_type, f.forum_id, f.forum_style, f.forum_password' . $extra_fields . ' +$sql = 'SELECT t.topic_id, t.forum_id, t.topic_title, t.topic_attachment, t.topic_status, t.topic_approved, ' . (($auth->acl_get('m_approve')) ? 't.topic_replies_real AS topic_replies' : 't.topic_replies') . ', t.topic_last_post_id, t.topic_last_poster_id, t.topic_last_post_time, t.topic_poster, t.topic_time, t.topic_time_limit, t.topic_type, t.topic_bumped, t.topic_bumper, t.poll_max_options, t.poll_start, t.poll_length, t.poll_title, f.forum_name, f.forum_desc, f.forum_parents, f.parent_id, f.left_id, f.right_id, f.forum_status, f.forum_type, f.forum_id, f.forum_style, f.forum_password, f.forum_rules, f.forum_rules_link, f.forum_rules_flags' . $extra_fields . ' FROM ' . TOPICS_TABLE . ' t, ' . FORUMS_TABLE . ' f' . $join_sql_table . " WHERE $join_sql AND (f.forum_id = t.forum_id @@ -236,7 +236,7 @@ if (!$auth->acl_get('f_read', $forum_id)) trigger_error($user->lang['SORRY_AUTH_READ']); } - login_box(preg_replace('#.*?([a-z]+?\.' . $phpEx . '.*?)$#i', '\1', htmlspecialchars($_SERVER['REQUEST_URI'])), '', $user->lang['LOGIN_VIEWFORUM']); + login_box($user->cur_page, '', $user->lang['LOGIN_VIEWFORUM']); } // Forum is passworded ... check whether access has been granted to this @@ -334,7 +334,7 @@ if ($hilit_words) // Forum rules listing $s_forum_rules = ''; -gen_forum_rules('topic', $forum_id); +gen_forum_auth_level('topic', $forum_id); // Quick mod tools $topic_mod = ''; @@ -357,6 +357,9 @@ $pagination = generate_pagination($pagination_url, $total_posts, $config['posts_ // Navigation links generate_forum_nav($topic_data); +// Forum Rules +generate_forum_rules($topic_data); + // Moderators $forum_moderators = array(); get_moderators($forum_moderators, $forum_id); @@ -663,7 +666,7 @@ while ($row = $db->sql_fetchrow($result)) if ($row['foe']) { $rowset[$row['post_id']] = array( - 'foe' => TRUE, + 'foe' => true, 'post_id' => $row['post_id'], 'poster' => $poster, ); @@ -728,8 +731,6 @@ while ($row = $db->sql_fetchrow($result)) 'joined' => '', 'posts' => '', 'from' => '', - 'karma' => 0, - 'karma_img' => '', 'sig' => '', 'sig_bbcode_uid' => '', @@ -971,7 +972,7 @@ for ($i = 0; $i < count($post_list); ++$i) // i) The posters karma is below the minimum of the user ... not in 2.2.x // ii) The poster is on the users ignore list // iii) The post was made in a codepage different from the users - if ($row['foe']) + if (isset($row['foe']) && $row['foe']) { $template->assign_block_vars('postrow', array( 'S_IGNORE_POST' => true, |