1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/includes/acp/acp_board.php Wed Mar 07 16:41:10 2012 +0400
1.3 @@ -0,0 +1,999 @@
1.4 +<?php
1.5 +/**
1.6 +*
1.7 +* @package acp
1.8 +* @version $Id$
1.9 +* @copyright (c) 2005 phpBB Group
1.10 +* @license http://opensource.org/licenses/gpl-license.php GNU Public License
1.11 +*
1.12 +* @todo add cron intervals to server settings? (database_gc, queue_interval, session_gc, search_gc, cache_gc, warnings_gc)
1.13 +*/
1.14 +
1.15 +/**
1.16 +* @ignore
1.17 +*/
1.18 +if (!defined('IN_PHPBB'))
1.19 +{
1.20 + exit;
1.21 +}
1.22 +
1.23 +/**
1.24 +* @package acp
1.25 +*/
1.26 +class acp_board
1.27 +{
1.28 + var $u_action;
1.29 + var $new_config = array();
1.30 +
1.31 + function main($id, $mode)
1.32 + {
1.33 + global $db, $user, $auth, $template;
1.34 + global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx;
1.35 + global $cache;
1.36 +
1.37 + $user->add_lang('acp/board');
1.38 +
1.39 + $action = request_var('action', '');
1.40 + $submit = (isset($_POST['submit']) || isset($_POST['allow_quick_reply_enable'])) ? true : false;
1.41 +
1.42 + $form_key = 'acp_board';
1.43 + add_form_key($form_key);
1.44 +
1.45 + /**
1.46 + * Validation types are:
1.47 + * string, int, bool,
1.48 + * script_path (absolute path in url - beginning with / and no trailing slash),
1.49 + * rpath (relative), rwpath (realtive, writable), path (relative path, but able to escape the root), wpath (writable)
1.50 + */
1.51 + switch ($mode)
1.52 + {
1.53 + case 'settings':
1.54 + $display_vars = array(
1.55 + 'title' => 'ACP_BOARD_SETTINGS',
1.56 + 'vars' => array(
1.57 + 'legend1' => 'ACP_BOARD_SETTINGS',
1.58 + 'sitename' => array('lang' => 'SITE_NAME', 'validate' => 'string', 'type' => 'text:40:255', 'explain' => false),
1.59 + 'site_desc' => array('lang' => 'SITE_DESC', 'validate' => 'string', 'type' => 'text:40:255', 'explain' => false),
1.60 + 'board_disable' => array('lang' => 'DISABLE_BOARD', 'validate' => 'bool', 'type' => 'custom', 'method' => 'board_disable', 'explain' => true),
1.61 + 'board_disable_msg' => false,
1.62 + 'default_lang' => array('lang' => 'DEFAULT_LANGUAGE', 'validate' => 'lang', 'type' => 'select', 'function' => 'language_select', 'params' => array('{CONFIG_VALUE}'), 'explain' => false),
1.63 + 'default_dateformat' => array('lang' => 'DEFAULT_DATE_FORMAT', 'validate' => 'string', 'type' => 'custom', 'method' => 'dateformat_select', 'explain' => true),
1.64 + 'board_timezone' => array('lang' => 'SYSTEM_TIMEZONE', 'validate' => 'string', 'type' => 'select', 'function' => 'tz_select', 'params' => array('{CONFIG_VALUE}', 1), 'explain' => true),
1.65 + 'board_dst' => array('lang' => 'SYSTEM_DST', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false),
1.66 + 'default_style' => array('lang' => 'DEFAULT_STYLE', 'validate' => 'int', 'type' => 'select', 'function' => 'style_select', 'params' => array('{CONFIG_VALUE}', false), 'explain' => false),
1.67 + 'override_user_style' => array('lang' => 'OVERRIDE_STYLE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
1.68 +
1.69 + 'legend2' => 'WARNINGS',
1.70 + 'warnings_expire_days' => array('lang' => 'WARNINGS_EXPIRE', 'validate' => 'int', 'type' => 'text:3:4', 'explain' => true, 'append' => ' ' . $user->lang['DAYS']),
1.71 +
1.72 + 'legend3' => 'ACP_SUBMIT_CHANGES',
1.73 + )
1.74 + );
1.75 + break;
1.76 +
1.77 + case 'features':
1.78 + $display_vars = array(
1.79 + 'title' => 'ACP_BOARD_FEATURES',
1.80 + 'vars' => array(
1.81 + 'legend1' => 'ACP_BOARD_FEATURES',
1.82 + 'allow_privmsg' => array('lang' => 'BOARD_PM', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
1.83 + 'allow_topic_notify' => array('lang' => 'ALLOW_TOPIC_NOTIFY', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false),
1.84 + 'allow_forum_notify' => array('lang' => 'ALLOW_FORUM_NOTIFY', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false),
1.85 + 'allow_namechange' => array('lang' => 'ALLOW_NAME_CHANGE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false),
1.86 + 'allow_attachments' => array('lang' => 'ALLOW_ATTACHMENTS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false),
1.87 + 'allow_pm_attach' => array('lang' => 'ALLOW_PM_ATTACHMENTS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false),
1.88 + 'allow_pm_report' => array('lang' => 'ALLOW_PM_REPORT', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
1.89 + 'allow_bbcode' => array('lang' => 'ALLOW_BBCODE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false),
1.90 + 'allow_smilies' => array('lang' => 'ALLOW_SMILIES', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false),
1.91 + 'allow_sig' => array('lang' => 'ALLOW_SIG', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false),
1.92 + 'allow_nocensors' => array('lang' => 'ALLOW_NO_CENSORS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
1.93 + 'allow_bookmarks' => array('lang' => 'ALLOW_BOOKMARKS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
1.94 + 'allow_birthdays' => array('lang' => 'ALLOW_BIRTHDAYS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
1.95 + 'allow_quick_reply' => array('lang' => 'ALLOW_QUICK_REPLY', 'validate' => 'bool', 'type' => 'custom', 'method' => 'quick_reply', 'explain' => true),
1.96 +
1.97 + 'legend2' => 'ACP_LOAD_SETTINGS',
1.98 + 'load_birthdays' => array('lang' => 'YES_BIRTHDAYS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
1.99 + 'load_moderators' => array('lang' => 'YES_MODERATORS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false),
1.100 + 'load_jumpbox' => array('lang' => 'YES_JUMPBOX', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false),
1.101 + 'load_cpf_memberlist' => array('lang' => 'LOAD_CPF_MEMBERLIST', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false),
1.102 + 'load_cpf_viewprofile' => array('lang' => 'LOAD_CPF_VIEWPROFILE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false),
1.103 + 'load_cpf_viewtopic' => array('lang' => 'LOAD_CPF_VIEWTOPIC', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false),
1.104 +
1.105 + 'legend3' => 'ACP_SUBMIT_CHANGES',
1.106 + )
1.107 + );
1.108 + break;
1.109 +
1.110 + case 'avatar':
1.111 + $display_vars = array(
1.112 + 'title' => 'ACP_AVATAR_SETTINGS',
1.113 + 'vars' => array(
1.114 + 'legend1' => 'ACP_AVATAR_SETTINGS',
1.115 +
1.116 + 'avatar_min_width' => array('lang' => 'MIN_AVATAR_SIZE', 'validate' => 'int:0', 'type' => false, 'method' => false, 'explain' => false,),
1.117 + 'avatar_min_height' => array('lang' => 'MIN_AVATAR_SIZE', 'validate' => 'int:0', 'type' => false, 'method' => false, 'explain' => false,),
1.118 + 'avatar_max_width' => array('lang' => 'MAX_AVATAR_SIZE', 'validate' => 'int:0', 'type' => false, 'method' => false, 'explain' => false,),
1.119 + 'avatar_max_height' => array('lang' => 'MAX_AVATAR_SIZE', 'validate' => 'int:0', 'type' => false, 'method' => false, 'explain' => false,),
1.120 +
1.121 + 'allow_avatar' => array('lang' => 'ALLOW_AVATARS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
1.122 + 'allow_avatar_local' => array('lang' => 'ALLOW_LOCAL', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false),
1.123 + 'allow_avatar_remote' => array('lang' => 'ALLOW_REMOTE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
1.124 + 'allow_avatar_upload' => array('lang' => 'ALLOW_UPLOAD', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false),
1.125 + 'allow_avatar_remote_upload'=> array('lang' => 'ALLOW_REMOTE_UPLOAD', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
1.126 + 'avatar_filesize' => array('lang' => 'MAX_FILESIZE', 'validate' => 'int:0', 'type' => 'text:4:10', 'explain' => true, 'append' => ' ' . $user->lang['BYTES']),
1.127 + 'avatar_min' => array('lang' => 'MIN_AVATAR_SIZE', 'validate' => 'int:0', 'type' => 'dimension:3:4', 'explain' => true, 'append' => ' ' . $user->lang['PIXEL']),
1.128 + 'avatar_max' => array('lang' => 'MAX_AVATAR_SIZE', 'validate' => 'int:0', 'type' => 'dimension:3:4', 'explain' => true, 'append' => ' ' . $user->lang['PIXEL']),
1.129 + 'avatar_path' => array('lang' => 'AVATAR_STORAGE_PATH', 'validate' => 'rwpath', 'type' => 'text:20:255', 'explain' => true),
1.130 + 'avatar_gallery_path' => array('lang' => 'AVATAR_GALLERY_PATH', 'validate' => 'rpath', 'type' => 'text:20:255', 'explain' => true)
1.131 + )
1.132 + );
1.133 + break;
1.134 +
1.135 + case 'message':
1.136 + $display_vars = array(
1.137 + 'title' => 'ACP_MESSAGE_SETTINGS',
1.138 + 'lang' => 'ucp',
1.139 + 'vars' => array(
1.140 + 'legend1' => 'GENERAL_SETTINGS',
1.141 + 'allow_privmsg' => array('lang' => 'BOARD_PM', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
1.142 + 'pm_max_boxes' => array('lang' => 'BOXES_MAX', 'validate' => 'int:0', 'type' => 'text:4:4', 'explain' => true),
1.143 + 'pm_max_msgs' => array('lang' => 'BOXES_LIMIT', 'validate' => 'int:0', 'type' => 'text:4:4', 'explain' => true),
1.144 + 'full_folder_action' => array('lang' => 'FULL_FOLDER_ACTION', 'validate' => 'int', 'type' => 'select', 'method' => 'full_folder_select', 'explain' => true),
1.145 + 'pm_edit_time' => array('lang' => 'PM_EDIT_TIME', 'validate' => 'int:0', 'type' => 'text:5:5', 'explain' => true, 'append' => ' ' . $user->lang['MINUTES']),
1.146 + 'pm_max_recipients' => array('lang' => 'PM_MAX_RECIPIENTS', 'validate' => 'int:0', 'type' => 'text:5:5', 'explain' => true),
1.147 +
1.148 + 'legend2' => 'GENERAL_OPTIONS',
1.149 + 'allow_mass_pm' => array('lang' => 'ALLOW_MASS_PM', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false),
1.150 + 'auth_bbcode_pm' => array('lang' => 'ALLOW_BBCODE_PM', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false),
1.151 + 'auth_smilies_pm' => array('lang' => 'ALLOW_SMILIES_PM', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false),
1.152 + 'allow_pm_attach' => array('lang' => 'ALLOW_PM_ATTACHMENTS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false),
1.153 + 'allow_sig_pm' => array('lang' => 'ALLOW_SIG_PM', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false),
1.154 + 'print_pm' => array('lang' => 'ALLOW_PRINT_PM', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false),
1.155 + 'forward_pm' => array('lang' => 'ALLOW_FORWARD_PM', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false),
1.156 + 'auth_img_pm' => array('lang' => 'ALLOW_IMG_PM', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false),
1.157 + 'auth_flash_pm' => array('lang' => 'ALLOW_FLASH_PM', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
1.158 + 'enable_pm_icons' => array('lang' => 'ENABLE_PM_ICONS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false),
1.159 +
1.160 + 'legend3' => 'ACP_SUBMIT_CHANGES',
1.161 + )
1.162 + );
1.163 + break;
1.164 +
1.165 + case 'post':
1.166 + $display_vars = array(
1.167 + 'title' => 'ACP_POST_SETTINGS',
1.168 + 'vars' => array(
1.169 + 'legend1' => 'GENERAL_OPTIONS',
1.170 + 'allow_topic_notify' => array('lang' => 'ALLOW_TOPIC_NOTIFY', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false),
1.171 + 'allow_forum_notify' => array('lang' => 'ALLOW_FORUM_NOTIFY', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false),
1.172 + 'allow_bbcode' => array('lang' => 'ALLOW_BBCODE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false),
1.173 + 'allow_post_flash' => array('lang' => 'ALLOW_POST_FLASH', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
1.174 + 'allow_smilies' => array('lang' => 'ALLOW_SMILIES', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false),
1.175 + 'allow_post_links' => array('lang' => 'ALLOW_POST_LINKS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
1.176 + 'allow_nocensors' => array('lang' => 'ALLOW_NO_CENSORS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
1.177 + 'allow_bookmarks' => array('lang' => 'ALLOW_BOOKMARKS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
1.178 + 'enable_post_confirm' => array('lang' => 'VISUAL_CONFIRM_POST', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
1.179 + 'allow_quick_reply' => array('lang' => 'ALLOW_QUICK_REPLY', 'validate' => 'bool', 'type' => 'custom', 'method' => 'quick_reply', 'explain' => true),
1.180 +
1.181 + 'legend2' => 'POSTING',
1.182 + 'bump_type' => false,
1.183 + 'edit_time' => array('lang' => 'EDIT_TIME', 'validate' => 'int:0', 'type' => 'text:5:5', 'explain' => true, 'append' => ' ' . $user->lang['MINUTES']),
1.184 + 'delete_time' => array('lang' => 'DELETE_TIME', 'validate' => 'int:0', 'type' => 'text:5:5', 'explain' => true, 'append' => ' ' . $user->lang['MINUTES']),
1.185 + 'display_last_edited' => array('lang' => 'DISPLAY_LAST_EDITED', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
1.186 + 'flood_interval' => array('lang' => 'FLOOD_INTERVAL', 'validate' => 'int:0', 'type' => 'text:3:10', 'explain' => true, 'append' => ' ' . $user->lang['SECONDS']),
1.187 + 'bump_interval' => array('lang' => 'BUMP_INTERVAL', 'validate' => 'int:0', 'type' => 'custom', 'method' => 'bump_interval', 'explain' => true),
1.188 + 'topics_per_page' => array('lang' => 'TOPICS_PER_PAGE', 'validate' => 'int:1', 'type' => 'text:3:4', 'explain' => false),
1.189 + 'posts_per_page' => array('lang' => 'POSTS_PER_PAGE', 'validate' => 'int:1', 'type' => 'text:3:4', 'explain' => false),
1.190 + 'smilies_per_page' => array('lang' => 'SMILIES_PER_PAGE', 'validate' => 'int:1', 'type' => 'text:3:4', 'explain' => false),
1.191 + 'hot_threshold' => array('lang' => 'HOT_THRESHOLD', 'validate' => 'int:0', 'type' => 'text:3:4', 'explain' => true),
1.192 + 'max_poll_options' => array('lang' => 'MAX_POLL_OPTIONS', 'validate' => 'int:2:127', 'type' => 'text:4:4', 'explain' => false),
1.193 + 'max_post_chars' => array('lang' => 'CHAR_LIMIT', 'validate' => 'int:0', 'type' => 'text:4:6', 'explain' => true),
1.194 + 'min_post_chars' => array('lang' => 'MIN_CHAR_LIMIT', 'validate' => 'int:1', 'type' => 'text:4:6', 'explain' => true),
1.195 + 'max_post_smilies' => array('lang' => 'SMILIES_LIMIT', 'validate' => 'int:0', 'type' => 'text:4:4', 'explain' => true),
1.196 + 'max_post_urls' => array('lang' => 'MAX_POST_URLS', 'validate' => 'int:0', 'type' => 'text:5:4', 'explain' => true),
1.197 + 'max_post_font_size' => array('lang' => 'MAX_POST_FONT_SIZE', 'validate' => 'int:0', 'type' => 'text:5:4', 'explain' => true, 'append' => ' %'),
1.198 + 'max_quote_depth' => array('lang' => 'QUOTE_DEPTH_LIMIT', 'validate' => 'int:0', 'type' => 'text:4:4', 'explain' => true),
1.199 + 'max_post_img_width' => array('lang' => 'MAX_POST_IMG_WIDTH', 'validate' => 'int:0', 'type' => 'text:5:4', 'explain' => true, 'append' => ' ' . $user->lang['PIXEL']),
1.200 + 'max_post_img_height' => array('lang' => 'MAX_POST_IMG_HEIGHT', 'validate' => 'int:0', 'type' => 'text:5:4', 'explain' => true, 'append' => ' ' . $user->lang['PIXEL']),
1.201 +
1.202 + 'legend3' => 'ACP_SUBMIT_CHANGES',
1.203 + )
1.204 + );
1.205 + break;
1.206 +
1.207 + case 'signature':
1.208 + $display_vars = array(
1.209 + 'title' => 'ACP_SIGNATURE_SETTINGS',
1.210 + 'vars' => array(
1.211 + 'legend1' => 'GENERAL_OPTIONS',
1.212 + 'allow_sig' => array('lang' => 'ALLOW_SIG', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false),
1.213 + 'allow_sig_bbcode' => array('lang' => 'ALLOW_SIG_BBCODE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false),
1.214 + 'allow_sig_img' => array('lang' => 'ALLOW_SIG_IMG', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false),
1.215 + 'allow_sig_flash' => array('lang' => 'ALLOW_SIG_FLASH', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false),
1.216 + 'allow_sig_smilies' => array('lang' => 'ALLOW_SIG_SMILIES', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false),
1.217 + 'allow_sig_links' => array('lang' => 'ALLOW_SIG_LINKS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
1.218 +
1.219 + 'legend2' => 'GENERAL_SETTINGS',
1.220 + 'max_sig_chars' => array('lang' => 'MAX_SIG_LENGTH', 'validate' => 'int:0', 'type' => 'text:5:4', 'explain' => true),
1.221 + 'max_sig_urls' => array('lang' => 'MAX_SIG_URLS', 'validate' => 'int:0', 'type' => 'text:5:4', 'explain' => true),
1.222 + 'max_sig_font_size' => array('lang' => 'MAX_SIG_FONT_SIZE', 'validate' => 'int:0', 'type' => 'text:5:4', 'explain' => true, 'append' => ' %'),
1.223 + 'max_sig_smilies' => array('lang' => 'MAX_SIG_SMILIES', 'validate' => 'int:0', 'type' => 'text:5:4', 'explain' => true),
1.224 + 'max_sig_img_width' => array('lang' => 'MAX_SIG_IMG_WIDTH', 'validate' => 'int:0', 'type' => 'text:5:4', 'explain' => true, 'append' => ' ' . $user->lang['PIXEL']),
1.225 + 'max_sig_img_height' => array('lang' => 'MAX_SIG_IMG_HEIGHT', 'validate' => 'int:0', 'type' => 'text:5:4', 'explain' => true, 'append' => ' ' . $user->lang['PIXEL']),
1.226 +
1.227 + 'legend3' => 'ACP_SUBMIT_CHANGES',
1.228 + )
1.229 + );
1.230 + break;
1.231 +
1.232 + case 'registration':
1.233 + $display_vars = array(
1.234 + 'title' => 'ACP_REGISTER_SETTINGS',
1.235 + 'vars' => array(
1.236 + 'legend1' => 'GENERAL_SETTINGS',
1.237 + 'max_name_chars' => array('lang' => 'USERNAME_LENGTH', 'validate' => 'int:8:180', 'type' => false, 'method' => false, 'explain' => false,),
1.238 + 'max_pass_chars' => array('lang' => 'PASSWORD_LENGTH', 'validate' => 'int:8:255', 'type' => false, 'method' => false, 'explain' => false,),
1.239 +
1.240 + 'require_activation' => array('lang' => 'ACC_ACTIVATION', 'validate' => 'int', 'type' => 'custom', 'method' => 'select_acc_activation', 'explain' => true),
1.241 + 'new_member_post_limit' => array('lang' => 'NEW_MEMBER_POST_LIMIT', 'validate' => 'int:0:255', 'type' => 'text:4:4', 'explain' => true, 'append' => ' ' . $user->lang['POSTS']),
1.242 + 'new_member_group_default'=> array('lang' => 'NEW_MEMBER_GROUP_DEFAULT', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
1.243 + 'min_name_chars' => array('lang' => 'USERNAME_LENGTH', 'validate' => 'int:1', 'type' => 'custom:5:180', 'method' => 'username_length', 'explain' => true),
1.244 + 'min_pass_chars' => array('lang' => 'PASSWORD_LENGTH', 'validate' => 'int:1', 'type' => 'custom', 'method' => 'password_length', 'explain' => true),
1.245 + 'allow_name_chars' => array('lang' => 'USERNAME_CHARS', 'validate' => 'string', 'type' => 'select', 'method' => 'select_username_chars', 'explain' => true),
1.246 + 'pass_complex' => array('lang' => 'PASSWORD_TYPE', 'validate' => 'string', 'type' => 'select', 'method' => 'select_password_chars', 'explain' => true),
1.247 + 'chg_passforce' => array('lang' => 'FORCE_PASS_CHANGE', 'validate' => 'int:0', 'type' => 'text:3:3', 'explain' => true, 'append' => ' ' . $user->lang['DAYS']),
1.248 +
1.249 + 'legend2' => 'GENERAL_OPTIONS',
1.250 + 'allow_namechange' => array('lang' => 'ALLOW_NAME_CHANGE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false),
1.251 + 'allow_emailreuse' => array('lang' => 'ALLOW_EMAIL_REUSE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
1.252 + 'enable_confirm' => array('lang' => 'VISUAL_CONFIRM_REG', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
1.253 + 'max_login_attempts' => array('lang' => 'MAX_LOGIN_ATTEMPTS', 'validate' => 'int:0', 'type' => 'text:3:3', 'explain' => true),
1.254 + 'max_reg_attempts' => array('lang' => 'REG_LIMIT', 'validate' => 'int:0', 'type' => 'text:4:4', 'explain' => true),
1.255 +
1.256 + 'legend3' => 'COPPA',
1.257 + 'coppa_enable' => array('lang' => 'ENABLE_COPPA', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
1.258 + 'coppa_mail' => array('lang' => 'COPPA_MAIL', 'validate' => 'string', 'type' => 'textarea:5:40', 'explain' => true),
1.259 + 'coppa_fax' => array('lang' => 'COPPA_FAX', 'validate' => 'string', 'type' => 'text:25:100', 'explain' => false),
1.260 +
1.261 + 'legend4' => 'ACP_SUBMIT_CHANGES',
1.262 + )
1.263 + );
1.264 + break;
1.265 +
1.266 + case 'feed':
1.267 + $display_vars = array(
1.268 + 'title' => 'ACP_FEED_MANAGEMENT',
1.269 + 'vars' => array(
1.270 + 'legend1' => 'ACP_FEED_GENERAL',
1.271 + 'feed_enable' => array('lang' => 'ACP_FEED_ENABLE', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true ),
1.272 + 'feed_item_statistics' => array('lang' => 'ACP_FEED_ITEM_STATISTICS', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true),
1.273 + 'feed_http_auth' => array('lang' => 'ACP_FEED_HTTP_AUTH', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true),
1.274 +
1.275 + 'legend2' => 'ACP_FEED_POST_BASED',
1.276 + 'feed_limit_post' => array('lang' => 'ACP_FEED_LIMIT', 'validate' => 'int:5', 'type' => 'text:3:4', 'explain' => true),
1.277 + 'feed_overall' => array('lang' => 'ACP_FEED_OVERALL', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true ),
1.278 + 'feed_forum' => array('lang' => 'ACP_FEED_FORUM', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true ),
1.279 + 'feed_topic' => array('lang' => 'ACP_FEED_TOPIC', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true ),
1.280 +
1.281 + 'legend3' => 'ACP_FEED_TOPIC_BASED',
1.282 + 'feed_limit_topic' => array('lang' => 'ACP_FEED_LIMIT', 'validate' => 'int:5', 'type' => 'text:3:4', 'explain' => true),
1.283 + 'feed_topics_new' => array('lang' => 'ACP_FEED_TOPICS_NEW', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true ),
1.284 + 'feed_topics_active' => array('lang' => 'ACP_FEED_TOPICS_ACTIVE', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true ),
1.285 + 'feed_news_id' => array('lang' => 'ACP_FEED_NEWS', 'validate' => 'string', 'type' => 'custom', 'method' => 'select_news_forums', 'explain' => true),
1.286 +
1.287 + 'legend4' => 'ACP_FEED_SETTINGS_OTHER',
1.288 + 'feed_overall_forums' => array('lang' => 'ACP_FEED_OVERALL_FORUMS', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true ),
1.289 + 'feed_exclude_id' => array('lang' => 'ACP_FEED_EXCLUDE_ID', 'validate' => 'string', 'type' => 'custom', 'method' => 'select_exclude_forums', 'explain' => true),
1.290 + )
1.291 + );
1.292 + break;
1.293 +
1.294 + case 'cookie':
1.295 + $display_vars = array(
1.296 + 'title' => 'ACP_COOKIE_SETTINGS',
1.297 + 'vars' => array(
1.298 + 'legend1' => 'ACP_COOKIE_SETTINGS',
1.299 + 'cookie_domain' => array('lang' => 'COOKIE_DOMAIN', 'validate' => 'string', 'type' => 'text::255', 'explain' => false),
1.300 + 'cookie_name' => array('lang' => 'COOKIE_NAME', 'validate' => 'string', 'type' => 'text::16', 'explain' => false),
1.301 + 'cookie_path' => array('lang' => 'COOKIE_PATH', 'validate' => 'string', 'type' => 'text::255', 'explain' => false),
1.302 + 'cookie_secure' => array('lang' => 'COOKIE_SECURE', 'validate' => 'bool', 'type' => 'radio:disabled_enabled', 'explain' => true)
1.303 + )
1.304 + );
1.305 + break;
1.306 +
1.307 + case 'load':
1.308 + $display_vars = array(
1.309 + 'title' => 'ACP_LOAD_SETTINGS',
1.310 + 'vars' => array(
1.311 + 'legend1' => 'GENERAL_SETTINGS',
1.312 + 'limit_load' => array('lang' => 'LIMIT_LOAD', 'validate' => 'string', 'type' => 'text:4:4', 'explain' => true),
1.313 + 'session_length' => array('lang' => 'SESSION_LENGTH', 'validate' => 'int:60', 'type' => 'text:5:10', 'explain' => true, 'append' => ' ' . $user->lang['SECONDS']),
1.314 + 'active_sessions' => array('lang' => 'LIMIT_SESSIONS', 'validate' => 'int:0', 'type' => 'text:4:4', 'explain' => true),
1.315 + 'load_online_time' => array('lang' => 'ONLINE_LENGTH', 'validate' => 'int:0', 'type' => 'text:4:3', 'explain' => true, 'append' => ' ' . $user->lang['MINUTES']),
1.316 +
1.317 + 'legend2' => 'GENERAL_OPTIONS',
1.318 + 'load_db_track' => array('lang' => 'YES_POST_MARKING', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
1.319 + 'load_db_lastread' => array('lang' => 'YES_READ_MARKING', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
1.320 + 'load_anon_lastread' => array('lang' => 'YES_ANON_READ_MARKING', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
1.321 + 'load_online' => array('lang' => 'YES_ONLINE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
1.322 + 'load_online_guests' => array('lang' => 'YES_ONLINE_GUESTS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
1.323 + 'load_onlinetrack' => array('lang' => 'YES_ONLINE_TRACK', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
1.324 + 'load_birthdays' => array('lang' => 'YES_BIRTHDAYS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
1.325 + 'load_unreads_search' => array('lang' => 'YES_UNREAD_SEARCH', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false),
1.326 + 'load_moderators' => array('lang' => 'YES_MODERATORS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false),
1.327 + 'load_jumpbox' => array('lang' => 'YES_JUMPBOX', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false),
1.328 + 'load_user_activity' => array('lang' => 'LOAD_USER_ACTIVITY', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
1.329 + 'load_tplcompile' => array('lang' => 'RECOMPILE_STYLES', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
1.330 +
1.331 + 'legend3' => 'CUSTOM_PROFILE_FIELDS',
1.332 + 'load_cpf_memberlist' => array('lang' => 'LOAD_CPF_MEMBERLIST', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false),
1.333 + 'load_cpf_viewprofile' => array('lang' => 'LOAD_CPF_VIEWPROFILE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false),
1.334 + 'load_cpf_viewtopic' => array('lang' => 'LOAD_CPF_VIEWTOPIC', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false),
1.335 +
1.336 + 'legend4' => 'ACP_SUBMIT_CHANGES',
1.337 + )
1.338 + );
1.339 + break;
1.340 +
1.341 + case 'auth':
1.342 + $display_vars = array(
1.343 + 'title' => 'ACP_AUTH_SETTINGS',
1.344 + 'vars' => array(
1.345 + 'legend1' => 'ACP_AUTH_SETTINGS',
1.346 + 'auth_method' => array('lang' => 'AUTH_METHOD', 'validate' => 'string', 'type' => 'select', 'method' => 'select_auth_method', 'explain' => false)
1.347 + )
1.348 + );
1.349 + break;
1.350 +
1.351 + case 'server':
1.352 + $display_vars = array(
1.353 + 'title' => 'ACP_SERVER_SETTINGS',
1.354 + 'vars' => array(
1.355 + 'legend1' => 'ACP_SERVER_SETTINGS',
1.356 + 'gzip_compress' => array('lang' => 'ENABLE_GZIP', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
1.357 +
1.358 + 'legend2' => 'PATH_SETTINGS',
1.359 + 'smilies_path' => array('lang' => 'SMILIES_PATH', 'validate' => 'rpath', 'type' => 'text:20:255', 'explain' => true),
1.360 + 'icons_path' => array('lang' => 'ICONS_PATH', 'validate' => 'rpath', 'type' => 'text:20:255', 'explain' => true),
1.361 + 'upload_icons_path' => array('lang' => 'UPLOAD_ICONS_PATH', 'validate' => 'rpath', 'type' => 'text:20:255', 'explain' => true),
1.362 + 'ranks_path' => array('lang' => 'RANKS_PATH', 'validate' => 'rpath', 'type' => 'text:20:255', 'explain' => true),
1.363 +
1.364 + 'legend3' => 'SERVER_URL_SETTINGS',
1.365 + 'force_server_vars' => array('lang' => 'FORCE_SERVER_VARS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
1.366 + 'server_protocol' => array('lang' => 'SERVER_PROTOCOL', 'validate' => 'string', 'type' => 'text:10:10', 'explain' => true),
1.367 + 'server_name' => array('lang' => 'SERVER_NAME', 'validate' => 'string', 'type' => 'text:40:255', 'explain' => true),
1.368 + 'server_port' => array('lang' => 'SERVER_PORT', 'validate' => 'int:0', 'type' => 'text:5:5', 'explain' => true),
1.369 + 'script_path' => array('lang' => 'SCRIPT_PATH', 'validate' => 'script_path', 'type' => 'text::255', 'explain' => true),
1.370 +
1.371 + 'legend4' => 'ACP_SUBMIT_CHANGES',
1.372 + )
1.373 + );
1.374 + break;
1.375 +
1.376 + case 'security':
1.377 + $display_vars = array(
1.378 + 'title' => 'ACP_SECURITY_SETTINGS',
1.379 + 'vars' => array(
1.380 + 'legend1' => 'ACP_SECURITY_SETTINGS',
1.381 + 'allow_autologin' => array('lang' => 'ALLOW_AUTOLOGIN', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
1.382 + 'max_autologin_time' => array('lang' => 'AUTOLOGIN_LENGTH', 'validate' => 'int:0', 'type' => 'text:5:5', 'explain' => true, 'append' => ' ' . $user->lang['DAYS']),
1.383 + 'ip_check' => array('lang' => 'IP_VALID', 'validate' => 'int', 'type' => 'custom', 'method' => 'select_ip_check', 'explain' => true),
1.384 + 'browser_check' => array('lang' => 'BROWSER_VALID', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
1.385 + 'forwarded_for_check' => array('lang' => 'FORWARDED_FOR_VALID', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
1.386 + 'referer_validation' => array('lang' => 'REFERER_VALID', 'validate' => 'int:0:3','type' => 'custom', 'method' => 'select_ref_check', 'explain' => true),
1.387 + 'check_dnsbl' => array('lang' => 'CHECK_DNSBL', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
1.388 + 'email_check_mx' => array('lang' => 'EMAIL_CHECK_MX', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
1.389 + 'pass_complex' => array('lang' => 'PASSWORD_TYPE', 'validate' => 'string', 'type' => 'select', 'method' => 'select_password_chars', 'explain' => true),
1.390 + 'chg_passforce' => array('lang' => 'FORCE_PASS_CHANGE', 'validate' => 'int:0', 'type' => 'text:3:3', 'explain' => true, 'append' => ' ' . $user->lang['DAYS']),
1.391 + 'max_login_attempts' => array('lang' => 'MAX_LOGIN_ATTEMPTS', 'validate' => 'int:0', 'type' => 'text:3:3', 'explain' => true),
1.392 + 'ip_login_limit_max' => array('lang' => 'IP_LOGIN_LIMIT_MAX', 'validate' => 'int:0', 'type' => 'text:3:3', 'explain' => true),
1.393 + 'ip_login_limit_time' => array('lang' => 'IP_LOGIN_LIMIT_TIME', 'validate' => 'int:0', 'type' => 'text:5:5', 'explain' => true, 'append' => ' ' . $user->lang['SECONDS']),
1.394 + 'ip_login_limit_use_forwarded' => array('lang' => 'IP_LOGIN_LIMIT_USE_FORWARDED', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
1.395 + 'tpl_allow_php' => array('lang' => 'TPL_ALLOW_PHP', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
1.396 + 'form_token_lifetime' => array('lang' => 'FORM_TIME_MAX', 'validate' => 'int:-1', 'type' => 'text:5:5', 'explain' => true, 'append' => ' ' . $user->lang['SECONDS']),
1.397 + 'form_token_sid_guests' => array('lang' => 'FORM_SID_GUESTS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
1.398 +
1.399 + )
1.400 + );
1.401 + break;
1.402 +
1.403 + case 'email':
1.404 + $display_vars = array(
1.405 + 'title' => 'ACP_EMAIL_SETTINGS',
1.406 + 'vars' => array(
1.407 + 'legend1' => 'GENERAL_SETTINGS',
1.408 + 'email_enable' => array('lang' => 'ENABLE_EMAIL', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true),
1.409 + 'board_email_form' => array('lang' => 'BOARD_EMAIL_FORM', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true),
1.410 + 'email_function_name' => array('lang' => 'EMAIL_FUNCTION_NAME', 'validate' => 'string', 'type' => 'text:20:50', 'explain' => true),
1.411 + 'email_package_size' => array('lang' => 'EMAIL_PACKAGE_SIZE', 'validate' => 'int:0', 'type' => 'text:5:5', 'explain' => true),
1.412 + 'board_contact' => array('lang' => 'CONTACT_EMAIL', 'validate' => 'string', 'type' => 'text:25:100', 'explain' => true),
1.413 + 'board_email' => array('lang' => 'ADMIN_EMAIL', 'validate' => 'string', 'type' => 'text:25:100', 'explain' => true),
1.414 + 'board_email_sig' => array('lang' => 'EMAIL_SIG', 'validate' => 'string', 'type' => 'textarea:5:30', 'explain' => true),
1.415 + 'board_hide_emails' => array('lang' => 'BOARD_HIDE_EMAILS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
1.416 +
1.417 + 'legend2' => 'SMTP_SETTINGS',
1.418 + 'smtp_delivery' => array('lang' => 'USE_SMTP', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
1.419 + 'smtp_host' => array('lang' => 'SMTP_SERVER', 'validate' => 'string', 'type' => 'text:25:50', 'explain' => false),
1.420 + 'smtp_port' => array('lang' => 'SMTP_PORT', 'validate' => 'int:0', 'type' => 'text:4:5', 'explain' => true),
1.421 + 'smtp_auth_method' => array('lang' => 'SMTP_AUTH_METHOD', 'validate' => 'string', 'type' => 'select', 'method' => 'mail_auth_select', 'explain' => true),
1.422 + 'smtp_username' => array('lang' => 'SMTP_USERNAME', 'validate' => 'string', 'type' => 'text:25:255', 'explain' => true),
1.423 + 'smtp_password' => array('lang' => 'SMTP_PASSWORD', 'validate' => 'string', 'type' => 'password:25:255', 'explain' => true),
1.424 +
1.425 + 'legend3' => 'ACP_SUBMIT_CHANGES',
1.426 + )
1.427 + );
1.428 + break;
1.429 +
1.430 + default:
1.431 + trigger_error('NO_MODE', E_USER_ERROR);
1.432 + break;
1.433 + }
1.434 +
1.435 + if (isset($display_vars['lang']))
1.436 + {
1.437 + $user->add_lang($display_vars['lang']);
1.438 + }
1.439 +
1.440 + $this->new_config = $config;
1.441 + $cfg_array = (isset($_REQUEST['config'])) ? utf8_normalize_nfc(request_var('config', array('' => ''), true)) : $this->new_config;
1.442 + $error = array();
1.443 +
1.444 + // We validate the complete config if whished
1.445 + validate_config_vars($display_vars['vars'], $cfg_array, $error);
1.446 +
1.447 + if ($submit && !check_form_key($form_key))
1.448 + {
1.449 + $error[] = $user->lang['FORM_INVALID'];
1.450 + }
1.451 + // Do not write values if there is an error
1.452 + if (sizeof($error))
1.453 + {
1.454 + $submit = false;
1.455 + }
1.456 +
1.457 + // We go through the display_vars to make sure no one is trying to set variables he/she is not allowed to...
1.458 + foreach ($display_vars['vars'] as $config_name => $null)
1.459 + {
1.460 + if (!isset($cfg_array[$config_name]) || strpos($config_name, 'legend') !== false)
1.461 + {
1.462 + continue;
1.463 + }
1.464 +
1.465 + if ($config_name == 'auth_method' || $config_name == 'feed_news_id' || $config_name == 'feed_exclude_id')
1.466 + {
1.467 + continue;
1.468 + }
1.469 +
1.470 + $this->new_config[$config_name] = $config_value = $cfg_array[$config_name];
1.471 +
1.472 + if ($config_name == 'email_function_name')
1.473 + {
1.474 + $this->new_config['email_function_name'] = trim(str_replace(array('(', ')'), array('', ''), $this->new_config['email_function_name']));
1.475 + $this->new_config['email_function_name'] = (empty($this->new_config['email_function_name']) || !function_exists($this->new_config['email_function_name'])) ? 'mail' : $this->new_config['email_function_name'];
1.476 + $config_value = $this->new_config['email_function_name'];
1.477 + }
1.478 +
1.479 + if ($submit)
1.480 + {
1.481 + set_config($config_name, $config_value);
1.482 +
1.483 + if ($config_name == 'allow_quick_reply' && isset($_POST['allow_quick_reply_enable']))
1.484 + {
1.485 + enable_bitfield_column_flag(FORUMS_TABLE, 'forum_flags', log(FORUM_FLAG_QUICK_REPLY, 2));
1.486 + }
1.487 + }
1.488 + }
1.489 +
1.490 + // Store news and exclude ids
1.491 + if ($mode == 'feed' && $submit)
1.492 + {
1.493 + $cache->destroy('_feed_news_forum_ids');
1.494 + $cache->destroy('_feed_excluded_forum_ids');
1.495 +
1.496 + $this->store_feed_forums(FORUM_OPTION_FEED_NEWS, 'feed_news_id');
1.497 + $this->store_feed_forums(FORUM_OPTION_FEED_EXCLUDE, 'feed_exclude_id');
1.498 + }
1.499 +
1.500 + if ($mode == 'auth')
1.501 + {
1.502 + // Retrieve a list of auth plugins and check their config values
1.503 + $auth_plugins = array();
1.504 +
1.505 + $dp = @opendir($phpbb_root_path . 'includes/auth');
1.506 +
1.507 + if ($dp)
1.508 + {
1.509 + while (($file = readdir($dp)) !== false)
1.510 + {
1.511 + if (preg_match('#^auth_(.*?)\.' . $phpEx . '$#', $file))
1.512 + {
1.513 + $auth_plugins[] = basename(preg_replace('#^auth_(.*?)\.' . $phpEx . '$#', '\1', $file));
1.514 + }
1.515 + }
1.516 + closedir($dp);
1.517 +
1.518 + sort($auth_plugins);
1.519 + }
1.520 +
1.521 + $updated_auth_settings = false;
1.522 + $old_auth_config = array();
1.523 + foreach ($auth_plugins as $method)
1.524 + {
1.525 + if ($method && file_exists($phpbb_root_path . 'includes/auth/auth_' . $method . '.' . $phpEx))
1.526 + {
1.527 + include_once($phpbb_root_path . 'includes/auth/auth_' . $method . '.' . $phpEx);
1.528 +
1.529 + $method = 'acp_' . $method;
1.530 + if (function_exists($method))
1.531 + {
1.532 + if ($fields = $method($this->new_config))
1.533 + {
1.534 + // Check if we need to create config fields for this plugin and save config when submit was pressed
1.535 + foreach ($fields['config'] as $field)
1.536 + {
1.537 + if (!isset($config[$field]))
1.538 + {
1.539 + set_config($field, '');
1.540 + }
1.541 +
1.542 + if (!isset($cfg_array[$field]) || strpos($field, 'legend') !== false)
1.543 + {
1.544 + continue;
1.545 + }
1.546 +
1.547 + $old_auth_config[$field] = $this->new_config[$field];
1.548 + $config_value = $cfg_array[$field];
1.549 + $this->new_config[$field] = $config_value;
1.550 +
1.551 + if ($submit)
1.552 + {
1.553 + $updated_auth_settings = true;
1.554 + set_config($field, $config_value);
1.555 + }
1.556 + }
1.557 + }
1.558 + unset($fields);
1.559 + }
1.560 + }
1.561 + }
1.562 +
1.563 + if ($submit && (($cfg_array['auth_method'] != $this->new_config['auth_method']) || $updated_auth_settings))
1.564 + {
1.565 + $method = basename($cfg_array['auth_method']);
1.566 + if ($method && in_array($method, $auth_plugins))
1.567 + {
1.568 + include_once($phpbb_root_path . 'includes/auth/auth_' . $method . '.' . $phpEx);
1.569 +
1.570 + $method = 'init_' . $method;
1.571 + if (function_exists($method))
1.572 + {
1.573 + if ($error = $method())
1.574 + {
1.575 + foreach ($old_auth_config as $config_name => $config_value)
1.576 + {
1.577 + set_config($config_name, $config_value);
1.578 + }
1.579 + trigger_error($error . adm_back_link($this->u_action), E_USER_WARNING);
1.580 + }
1.581 + }
1.582 + set_config('auth_method', basename($cfg_array['auth_method']));
1.583 + }
1.584 + else
1.585 + {
1.586 + trigger_error('NO_AUTH_PLUGIN', E_USER_ERROR);
1.587 + }
1.588 + }
1.589 + }
1.590 +
1.591 + if ($submit)
1.592 + {
1.593 + add_log('admin', 'LOG_CONFIG_' . strtoupper($mode));
1.594 +
1.595 + trigger_error($user->lang['CONFIG_UPDATED'] . adm_back_link($this->u_action));
1.596 + }
1.597 +
1.598 + $this->tpl_name = 'acp_board';
1.599 + $this->page_title = $display_vars['title'];
1.600 +
1.601 + $template->assign_vars(array(
1.602 + 'L_TITLE' => $user->lang[$display_vars['title']],
1.603 + 'L_TITLE_EXPLAIN' => $user->lang[$display_vars['title'] . '_EXPLAIN'],
1.604 +
1.605 + 'S_ERROR' => (sizeof($error)) ? true : false,
1.606 + 'ERROR_MSG' => implode('<br />', $error),
1.607 +
1.608 + 'U_ACTION' => $this->u_action)
1.609 + );
1.610 +
1.611 + // Output relevant page
1.612 + foreach ($display_vars['vars'] as $config_key => $vars)
1.613 + {
1.614 + if (!is_array($vars) && strpos($config_key, 'legend') === false)
1.615 + {
1.616 + continue;
1.617 + }
1.618 +
1.619 + if (strpos($config_key, 'legend') !== false)
1.620 + {
1.621 + $template->assign_block_vars('options', array(
1.622 + 'S_LEGEND' => true,
1.623 + 'LEGEND' => (isset($user->lang[$vars])) ? $user->lang[$vars] : $vars)
1.624 + );
1.625 +
1.626 + continue;
1.627 + }
1.628 +
1.629 + $type = explode(':', $vars['type']);
1.630 +
1.631 + $l_explain = '';
1.632 + if ($vars['explain'] && isset($vars['lang_explain']))
1.633 + {
1.634 + $l_explain = (isset($user->lang[$vars['lang_explain']])) ? $user->lang[$vars['lang_explain']] : $vars['lang_explain'];
1.635 + }
1.636 + else if ($vars['explain'])
1.637 + {
1.638 + $l_explain = (isset($user->lang[$vars['lang'] . '_EXPLAIN'])) ? $user->lang[$vars['lang'] . '_EXPLAIN'] : '';
1.639 + }
1.640 +
1.641 + $content = build_cfg_template($type, $config_key, $this->new_config, $config_key, $vars);
1.642 +
1.643 + if (empty($content))
1.644 + {
1.645 + continue;
1.646 + }
1.647 +
1.648 + $template->assign_block_vars('options', array(
1.649 + 'KEY' => $config_key,
1.650 + 'TITLE' => (isset($user->lang[$vars['lang']])) ? $user->lang[$vars['lang']] : $vars['lang'],
1.651 + 'S_EXPLAIN' => $vars['explain'],
1.652 + 'TITLE_EXPLAIN' => $l_explain,
1.653 + 'CONTENT' => $content,
1.654 + )
1.655 + );
1.656 +
1.657 + unset($display_vars['vars'][$config_key]);
1.658 + }
1.659 +
1.660 + if ($mode == 'auth')
1.661 + {
1.662 + $template->assign_var('S_AUTH', true);
1.663 +
1.664 + foreach ($auth_plugins as $method)
1.665 + {
1.666 + if ($method && file_exists($phpbb_root_path . 'includes/auth/auth_' . $method . '.' . $phpEx))
1.667 + {
1.668 + $method = 'acp_' . $method;
1.669 + if (function_exists($method))
1.670 + {
1.671 + $fields = $method($this->new_config);
1.672 +
1.673 + if ($fields['tpl'])
1.674 + {
1.675 + $template->assign_block_vars('auth_tpl', array(
1.676 + 'TPL' => $fields['tpl'])
1.677 + );
1.678 + }
1.679 + unset($fields);
1.680 + }
1.681 + }
1.682 + }
1.683 + }
1.684 + }
1.685 +
1.686 + /**
1.687 + * Select auth method
1.688 + */
1.689 + function select_auth_method($selected_method, $key = '')
1.690 + {
1.691 + global $phpbb_root_path, $phpEx;
1.692 +
1.693 + $auth_plugins = array();
1.694 +
1.695 + $dp = @opendir($phpbb_root_path . 'includes/auth');
1.696 +
1.697 + if (!$dp)
1.698 + {
1.699 + return '';
1.700 + }
1.701 +
1.702 + while (($file = readdir($dp)) !== false)
1.703 + {
1.704 + if (preg_match('#^auth_(.*?)\.' . $phpEx . '$#', $file))
1.705 + {
1.706 + $auth_plugins[] = preg_replace('#^auth_(.*?)\.' . $phpEx . '$#', '\1', $file);
1.707 + }
1.708 + }
1.709 + closedir($dp);
1.710 +
1.711 + sort($auth_plugins);
1.712 +
1.713 + $auth_select = '';
1.714 + foreach ($auth_plugins as $method)
1.715 + {
1.716 + $selected = ($selected_method == $method) ? ' selected="selected"' : '';
1.717 + $auth_select .= '<option value="' . $method . '"' . $selected . '>' . ucfirst($method) . '</option>';
1.718 + }
1.719 +
1.720 + return $auth_select;
1.721 + }
1.722 +
1.723 + /**
1.724 + * Select mail authentication method
1.725 + */
1.726 + function mail_auth_select($selected_method, $key = '')
1.727 + {
1.728 + global $user;
1.729 +
1.730 + $auth_methods = array('PLAIN', 'LOGIN', 'CRAM-MD5', 'DIGEST-MD5', 'POP-BEFORE-SMTP');
1.731 + $s_smtp_auth_options = '';
1.732 +
1.733 + foreach ($auth_methods as $method)
1.734 + {
1.735 + $s_smtp_auth_options .= '<option value="' . $method . '"' . (($selected_method == $method) ? ' selected="selected"' : '') . '>' . $user->lang['SMTP_' . str_replace('-', '_', $method)] . '</option>';
1.736 + }
1.737 +
1.738 + return $s_smtp_auth_options;
1.739 + }
1.740 +
1.741 + /**
1.742 + * Select full folder action
1.743 + */
1.744 + function full_folder_select($value, $key = '')
1.745 + {
1.746 + global $user;
1.747 +
1.748 + return '<option value="1"' . (($value == 1) ? ' selected="selected"' : '') . '>' . $user->lang['DELETE_OLDEST_MESSAGES'] . '</option><option value="2"' . (($value == 2) ? ' selected="selected"' : '') . '>' . $user->lang['HOLD_NEW_MESSAGES_SHORT'] . '</option>';
1.749 + }
1.750 +
1.751 + /**
1.752 + * Select ip validation
1.753 + */
1.754 + function select_ip_check($value, $key = '')
1.755 + {
1.756 + $radio_ary = array(4 => 'ALL', 3 => 'CLASS_C', 2 => 'CLASS_B', 0 => 'NO_IP_VALIDATION');
1.757 +
1.758 + return h_radio('config[ip_check]', $radio_ary, $value, $key);
1.759 + }
1.760 +
1.761 + /**
1.762 + * Select referer validation
1.763 + */
1.764 + function select_ref_check($value, $key = '')
1.765 + {
1.766 + $radio_ary = array(REFERER_VALIDATE_PATH => 'REF_PATH', REFERER_VALIDATE_HOST => 'REF_HOST', REFERER_VALIDATE_NONE => 'NO_REF_VALIDATION');
1.767 +
1.768 + return h_radio('config[referer_validation]', $radio_ary, $value, $key);
1.769 + }
1.770 +
1.771 + /**
1.772 + * Select account activation method
1.773 + */
1.774 + function select_acc_activation($value, $key = '')
1.775 + {
1.776 + global $user, $config;
1.777 +
1.778 + $radio_ary = array(
1.779 + USER_ACTIVATION_DISABLE => 'ACC_DISABLE',
1.780 + USER_ACTIVATION_NONE => 'ACC_NONE',
1.781 + );
1.782 +
1.783 + if ($config['email_enable'])
1.784 + {
1.785 + $radio_ary[USER_ACTIVATION_SELF] = 'ACC_USER';
1.786 + $radio_ary[USER_ACTIVATION_ADMIN] = 'ACC_ADMIN';
1.787 + }
1.788 +
1.789 + $radio_text = h_radio('config[require_activation]', $radio_ary, $value, 'require_activation', $key, '<br />');
1.790 +
1.791 + return $radio_text;
1.792 + }
1.793 +
1.794 + /**
1.795 + * Maximum/Minimum username length
1.796 + */
1.797 + function username_length($value, $key = '')
1.798 + {
1.799 + global $user;
1.800 +
1.801 + return '<input id="' . $key . '" type="text" size="3" maxlength="3" name="config[min_name_chars]" value="' . $value . '" /> ' . $user->lang['MIN_CHARS'] . ' <input type="text" size="3" maxlength="3" name="config[max_name_chars]" value="' . $this->new_config['max_name_chars'] . '" /> ' . $user->lang['MAX_CHARS'];
1.802 + }
1.803 +
1.804 + /**
1.805 + * Allowed chars in usernames
1.806 + */
1.807 + function select_username_chars($selected_value, $key)
1.808 + {
1.809 + global $user;
1.810 +
1.811 + $user_char_ary = array('USERNAME_CHARS_ANY', 'USERNAME_ALPHA_ONLY', 'USERNAME_ALPHA_SPACERS', 'USERNAME_LETTER_NUM', 'USERNAME_LETTER_NUM_SPACERS', 'USERNAME_ASCII');
1.812 + $user_char_options = '';
1.813 + foreach ($user_char_ary as $user_type)
1.814 + {
1.815 + $selected = ($selected_value == $user_type) ? ' selected="selected"' : '';
1.816 + $user_char_options .= '<option value="' . $user_type . '"' . $selected . '>' . $user->lang[$user_type] . '</option>';
1.817 + }
1.818 +
1.819 + return $user_char_options;
1.820 + }
1.821 +
1.822 + /**
1.823 + * Maximum/Minimum password length
1.824 + */
1.825 + function password_length($value, $key)
1.826 + {
1.827 + global $user;
1.828 +
1.829 + return '<input id="' . $key . '" type="text" size="3" maxlength="3" name="config[min_pass_chars]" value="' . $value . '" /> ' . $user->lang['MIN_CHARS'] . ' <input type="text" size="3" maxlength="3" name="config[max_pass_chars]" value="' . $this->new_config['max_pass_chars'] . '" /> ' . $user->lang['MAX_CHARS'];
1.830 + }
1.831 +
1.832 + /**
1.833 + * Required chars in passwords
1.834 + */
1.835 + function select_password_chars($selected_value, $key)
1.836 + {
1.837 + global $user;
1.838 +
1.839 + $pass_type_ary = array('PASS_TYPE_ANY', 'PASS_TYPE_CASE', 'PASS_TYPE_ALPHA', 'PASS_TYPE_SYMBOL');
1.840 + $pass_char_options = '';
1.841 + foreach ($pass_type_ary as $pass_type)
1.842 + {
1.843 + $selected = ($selected_value == $pass_type) ? ' selected="selected"' : '';
1.844 + $pass_char_options .= '<option value="' . $pass_type . '"' . $selected . '>' . $user->lang[$pass_type] . '</option>';
1.845 + }
1.846 +
1.847 + return $pass_char_options;
1.848 + }
1.849 +
1.850 + /**
1.851 + * Select bump interval
1.852 + */
1.853 + function bump_interval($value, $key)
1.854 + {
1.855 + global $user;
1.856 +
1.857 + $s_bump_type = '';
1.858 + $types = array('m' => 'MINUTES', 'h' => 'HOURS', 'd' => 'DAYS');
1.859 + foreach ($types as $type => $lang)
1.860 + {
1.861 + $selected = ($this->new_config['bump_type'] == $type) ? ' selected="selected"' : '';
1.862 + $s_bump_type .= '<option value="' . $type . '"' . $selected . '>' . $user->lang[$lang] . '</option>';
1.863 + }
1.864 +
1.865 + return '<input id="' . $key . '" type="text" size="3" maxlength="4" name="config[bump_interval]" value="' . $value . '" /> <select name="config[bump_type]">' . $s_bump_type . '</select>';
1.866 + }
1.867 +
1.868 + /**
1.869 + * Board disable option and message
1.870 + */
1.871 + function board_disable($value, $key)
1.872 + {
1.873 + global $user;
1.874 +
1.875 + $radio_ary = array(1 => 'YES', 0 => 'NO');
1.876 +
1.877 + return h_radio('config[board_disable]', $radio_ary, $value) . '<br /><input id="' . $key . '" type="text" name="config[board_disable_msg]" maxlength="255" size="40" value="' . $this->new_config['board_disable_msg'] . '" />';
1.878 + }
1.879 +
1.880 + /**
1.881 + * Global quick reply enable/disable setting and button to enable in all forums
1.882 + */
1.883 + function quick_reply($value, $key)
1.884 + {
1.885 + global $user;
1.886 +
1.887 + $radio_ary = array(1 => 'YES', 0 => 'NO');
1.888 +
1.889 + return h_radio('config[allow_quick_reply]', $radio_ary, $value) .
1.890 + '<br /><br /><input class="button2" type="submit" id="' . $key . '_enable" name="' . $key . '_enable" value="' . $user->lang['ALLOW_QUICK_REPLY_BUTTON'] . '" />';
1.891 + }
1.892 +
1.893 +
1.894 + /**
1.895 + * Select default dateformat
1.896 + */
1.897 + function dateformat_select($value, $key)
1.898 + {
1.899 + global $user, $config;
1.900 +
1.901 + // Let the format_date function operate with the acp values
1.902 + $old_tz = $user->timezone;
1.903 + $old_dst = $user->dst;
1.904 +
1.905 + $user->timezone = $config['board_timezone'] * 3600;
1.906 + $user->dst = $config['board_dst'] * 3600;
1.907 +
1.908 + $dateformat_options = '';
1.909 +
1.910 + foreach ($user->lang['dateformats'] as $format => $null)
1.911 + {
1.912 + $dateformat_options .= '<option value="' . $format . '"' . (($format == $value) ? ' selected="selected"' : '') . '>';
1.913 + $dateformat_options .= $user->format_date(time(), $format, false) . ((strpos($format, '|') !== false) ? $user->lang['VARIANT_DATE_SEPARATOR'] . $user->format_date(time(), $format, true) : '');
1.914 + $dateformat_options .= '</option>';
1.915 + }
1.916 +
1.917 + $dateformat_options .= '<option value="custom"';
1.918 + if (!isset($user->lang['dateformats'][$value]))
1.919 + {
1.920 + $dateformat_options .= ' selected="selected"';
1.921 + }
1.922 + $dateformat_options .= '>' . $user->lang['CUSTOM_DATEFORMAT'] . '</option>';
1.923 +
1.924 + // Reset users date options
1.925 + $user->timezone = $old_tz;
1.926 + $user->dst = $old_dst;
1.927 +
1.928 + return "<select name=\"dateoptions\" id=\"dateoptions\" onchange=\"if (this.value == 'custom') { document.getElementById('" . addslashes($key) . "').value = '" . addslashes($value) . "'; } else { document.getElementById('" . addslashes($key) . "').value = this.value; }\">$dateformat_options</select>
1.929 + <input type=\"text\" name=\"config[$key]\" id=\"$key\" value=\"$value\" maxlength=\"30\" />";
1.930 + }
1.931 +
1.932 + /**
1.933 + * Select multiple forums
1.934 + */
1.935 + function select_news_forums($value, $key)
1.936 + {
1.937 + global $user, $config;
1.938 +
1.939 + $forum_list = make_forum_select(false, false, true, true, true, false, true);
1.940 +
1.941 + // Build forum options
1.942 + $s_forum_options = '<select id="' . $key . '" name="' . $key . '[]" multiple="multiple">';
1.943 + foreach ($forum_list as $f_id => $f_row)
1.944 + {
1.945 + $f_row['selected'] = phpbb_optionget(FORUM_OPTION_FEED_NEWS, $f_row['forum_options']);
1.946 +
1.947 + $s_forum_options .= '<option value="' . $f_id . '"' . (($f_row['selected']) ? ' selected="selected"' : '') . (($f_row['disabled']) ? ' disabled="disabled" class="disabled-option"' : '') . '>' . $f_row['padding'] . $f_row['forum_name'] . '</option>';
1.948 + }
1.949 + $s_forum_options .= '</select>';
1.950 +
1.951 + return $s_forum_options;
1.952 + }
1.953 +
1.954 + function select_exclude_forums($value, $key)
1.955 + {
1.956 + global $user, $config;
1.957 +
1.958 + $forum_list = make_forum_select(false, false, true, true, true, false, true);
1.959 +
1.960 + // Build forum options
1.961 + $s_forum_options = '<select id="' . $key . '" name="' . $key . '[]" multiple="multiple">';
1.962 + foreach ($forum_list as $f_id => $f_row)
1.963 + {
1.964 + $f_row['selected'] = phpbb_optionget(FORUM_OPTION_FEED_EXCLUDE, $f_row['forum_options']);
1.965 +
1.966 + $s_forum_options .= '<option value="' . $f_id . '"' . (($f_row['selected']) ? ' selected="selected"' : '') . (($f_row['disabled']) ? ' disabled="disabled" class="disabled-option"' : '') . '>' . $f_row['padding'] . $f_row['forum_name'] . '</option>';
1.967 + }
1.968 + $s_forum_options .= '</select>';
1.969 +
1.970 + return $s_forum_options;
1.971 + }
1.972 +
1.973 + function store_feed_forums($option, $key)
1.974 + {
1.975 + global $db, $cache;
1.976 +
1.977 + // Get key
1.978 + $values = request_var($key, array(0 => 0));
1.979 +
1.980 + // Empty option bit for all forums
1.981 + $sql = 'UPDATE ' . FORUMS_TABLE . '
1.982 + SET forum_options = forum_options - ' . (1 << $option) . '
1.983 + WHERE ' . $db->sql_bit_and('forum_options', $option, '<> 0');
1.984 + $db->sql_query($sql);
1.985 +
1.986 + // Already emptied for all...
1.987 + if (sizeof($values))
1.988 + {
1.989 + // Set for selected forums
1.990 + $sql = 'UPDATE ' . FORUMS_TABLE . '
1.991 + SET forum_options = forum_options + ' . (1 << $option) . '
1.992 + WHERE ' . $db->sql_in_set('forum_id', $values);
1.993 + $db->sql_query($sql);
1.994 + }
1.995 +
1.996 + // Empty sql cache for forums table because options changed
1.997 + $cache->destroy('sql', FORUMS_TABLE);
1.998 + }
1.999 +
1.1000 +}
1.1001 +
1.1002 +?>
1.1003 \ No newline at end of file