[ Index ] |
PHP Cross Reference of phpBB-3.3.14-deutsch |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * 4 * This file is part of the phpBB Forum Software package. 5 * 6 * @copyright (c) phpBB Limited <https://www.phpbb.com> 7 * @license GNU General Public License, version 2 (GPL-2.0) 8 * 9 * For full copyright and license information, please see 10 * the docs/CREDITS.txt file. 11 * 12 */ 13 14 /** 15 * @todo add cron intervals to server settings? (database_gc, queue_interval, session_gc, search_gc, cache_gc, warnings_gc) 16 */ 17 18 /** 19 * @ignore 20 */ 21 if (!defined('IN_PHPBB')) 22 { 23 exit; 24 } 25 26 class acp_board 27 { 28 var $u_action; 29 var $new_config; 30 31 function main($id, $mode) 32 { 33 global $user, $template, $request, $language; 34 global $config, $phpbb_root_path, $phpEx; 35 global $cache, $phpbb_container, $phpbb_dispatcher, $phpbb_log; 36 37 /** @var \phpbb\language\language $language Language object */ 38 $language = $phpbb_container->get('language'); 39 40 $user->add_lang('acp/board'); 41 42 $submit = (isset($_POST['submit']) || isset($_POST['allow_quick_reply_enable'])) ? true : false; 43 44 $form_key = 'acp_board'; 45 add_form_key($form_key); 46 47 /** 48 * Validation types are: 49 * string, int, bool, 50 * script_path (absolute path in url - beginning with / and no trailing slash), 51 * rpath (relative), rwpath (realtive, writable), path (relative path, but able to escape the root), wpath (writable) 52 */ 53 switch ($mode) 54 { 55 case 'settings': 56 $display_vars = array( 57 'title' => 'ACP_BOARD_SETTINGS', 58 'vars' => array( 59 'legend1' => 'ACP_BOARD_SETTINGS', 60 'sitename' => array('lang' => 'SITE_NAME', 'validate' => 'string', 'type' => 'text:40:255', 'explain' => false), 61 'site_desc' => array('lang' => 'SITE_DESC', 'validate' => 'string', 'type' => 'text:40:255', 'explain' => false), 62 'site_home_url' => array('lang' => 'SITE_HOME_URL', 'validate' => 'url', 'type' => 'url:40:255', 'explain' => true), 63 'site_home_text' => array('lang' => 'SITE_HOME_TEXT', 'validate' => 'string', 'type' => 'text:40:255', 'explain' => true), 64 'board_index_text' => array('lang' => 'BOARD_INDEX_TEXT', 'validate' => 'string', 'type' => 'text:40:255', 'explain' => true), 65 'board_disable' => array('lang' => 'DISABLE_BOARD', 'validate' => 'bool', 'type' => 'custom', 'method' => 'board_disable', 'explain' => true), 66 'board_disable_msg' => false, 67 'default_lang' => array('lang' => 'DEFAULT_LANGUAGE', 'validate' => 'lang', 'type' => 'select', 'function' => 'language_select', 'params' => array('{CONFIG_VALUE}'), 'explain' => false), 68 'default_dateformat' => array('lang' => 'DEFAULT_DATE_FORMAT', 'validate' => 'string', 'type' => 'custom', 'method' => 'dateformat_select', 'explain' => true), 69 'board_timezone' => array('lang' => 'SYSTEM_TIMEZONE', 'validate' => 'timezone', 'type' => 'custom', 'method' => 'timezone_select', 'explain' => true), 70 71 'legend2' => 'BOARD_STYLE', 72 'default_style' => array('lang' => 'DEFAULT_STYLE', 'validate' => 'int', 'type' => 'select', 'function' => 'style_select', 'params' => array('{CONFIG_VALUE}', false), 'explain' => true), 73 'guest_style' => array('lang' => 'GUEST_STYLE', 'validate' => 'int', 'type' => 'select', 'function' => 'style_select', 'params' => array($this->guest_style_get(), false), 'explain' => true), 74 'override_user_style' => array('lang' => 'OVERRIDE_STYLE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 75 76 'legend3' => 'WARNINGS', 77 'warnings_expire_days' => array('lang' => 'WARNINGS_EXPIRE', 'validate' => 'int:0:9999', 'type' => 'number:0:9999', 'explain' => true, 'append' => ' ' . $user->lang['DAYS']), 78 79 'legend4' => 'ACP_SUBMIT_CHANGES', 80 ) 81 ); 82 break; 83 84 case 'features': 85 $display_vars = array( 86 'title' => 'ACP_BOARD_FEATURES', 87 'vars' => array( 88 'legend1' => 'ACP_BOARD_FEATURES', 89 'allow_privmsg' => array('lang' => 'BOARD_PM', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 90 'allow_topic_notify' => array('lang' => 'ALLOW_TOPIC_NOTIFY', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 91 'allow_forum_notify' => array('lang' => 'ALLOW_FORUM_NOTIFY', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 92 'allow_namechange' => array('lang' => 'ALLOW_NAME_CHANGE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 93 'allow_attachments' => array('lang' => 'ALLOW_ATTACHMENTS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 94 'allow_pm_attach' => array('lang' => 'ALLOW_PM_ATTACHMENTS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 95 'allow_pm_report' => array('lang' => 'ALLOW_PM_REPORT', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 96 'allow_bbcode' => array('lang' => 'ALLOW_BBCODE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 97 'allow_smilies' => array('lang' => 'ALLOW_SMILIES', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 98 'allow_sig' => array('lang' => 'ALLOW_SIG', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 99 'allow_board_notifications' => array('lang' => 'ALLOW_BOARD_NOTIFICATIONS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 100 101 'allow_nocensors' => array('lang' => 'ALLOW_NO_CENSORS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 102 'allow_bookmarks' => array('lang' => 'ALLOW_BOOKMARKS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 103 'allow_birthdays' => array('lang' => 'ALLOW_BIRTHDAYS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 104 'display_last_subject' => array('lang' => 'DISPLAY_LAST_SUBJECT', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 105 'display_unapproved_posts' => array('lang' => 'DISPLAY_UNAPPROVED_POSTS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 106 'allow_quick_reply' => array('lang' => 'ALLOW_QUICK_REPLY', 'validate' => 'bool', 'type' => 'custom', 'method' => 'quick_reply', 'explain' => true), 107 108 'legend2' => 'ACP_SUBMIT_CHANGES', 109 ) 110 ); 111 break; 112 113 case 'avatar': 114 /* @var $phpbb_avatar_manager \phpbb\avatar\manager */ 115 $phpbb_avatar_manager = $phpbb_container->get('avatar.manager'); 116 $avatar_drivers = $phpbb_avatar_manager->get_all_drivers(); 117 118 $avatar_vars = array(); 119 foreach ($avatar_drivers as $current_driver) 120 { 121 /** @var \phpbb\avatar\driver\driver_interface $driver */ 122 $driver = $phpbb_avatar_manager->get_driver($current_driver, false); 123 124 /* 125 * First grab the settings for enabling/disabling the avatar 126 * driver and afterwards grab additional settings the driver 127 * might have. 128 */ 129 $avatar_vars += $phpbb_avatar_manager->get_avatar_settings($driver); 130 $avatar_vars += $driver->prepare_form_acp($user); 131 } 132 133 $display_vars = array( 134 'title' => 'ACP_AVATAR_SETTINGS', 135 'vars' => array( 136 'legend1' => 'ACP_AVATAR_SETTINGS', 137 'avatar_min_width' => array('lang' => 'MIN_AVATAR_SIZE', 'validate' => 'int:0', 'type' => false, 'method' => false, 'explain' => false), 138 'avatar_min_height' => array('lang' => 'MIN_AVATAR_SIZE', 'validate' => 'int:0', 'type' => false, 'method' => false, 'explain' => false), 139 'avatar_max_width' => array('lang' => 'MAX_AVATAR_SIZE', 'validate' => 'int:0', 'type' => false, 'method' => false, 'explain' => false), 140 'avatar_max_height' => array('lang' => 'MAX_AVATAR_SIZE', 'validate' => 'int:0', 'type' => false, 'method' => false, 'explain' => false), 141 'allow_avatar' => array('lang' => 'ALLOW_AVATARS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 142 'avatar_min' => array('lang' => 'MIN_AVATAR_SIZE', 'validate' => 'int:0', 'type' => 'dimension:0', 'explain' => true, 'append' => ' ' . $user->lang['PIXEL']), 143 'avatar_max' => array('lang' => 'MAX_AVATAR_SIZE', 'validate' => 'int:0', 'type' => 'dimension:0', 'explain' => true, 'append' => ' ' . $user->lang['PIXEL']), 144 ) 145 ); 146 147 if (!empty($avatar_vars)) 148 { 149 $display_vars['vars'] += $avatar_vars; 150 } 151 152 $display_vars['vars']['legend2'] = 'ACP_SUBMIT_CHANGES'; 153 break; 154 155 case 'message': 156 $display_vars = array( 157 'title' => 'ACP_MESSAGE_SETTINGS', 158 'lang' => 'ucp', 159 'vars' => array( 160 'legend1' => 'GENERAL_SETTINGS', 161 'allow_privmsg' => array('lang' => 'BOARD_PM', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 162 'pm_max_boxes' => array('lang' => 'BOXES_MAX', 'validate' => 'int:0:9999', 'type' => 'number:0:9999', 'explain' => true), 163 'pm_max_msgs' => array('lang' => 'BOXES_LIMIT', 'validate' => 'int:0:9999', 'type' => 'number:0:9999', 'explain' => true), 164 'full_folder_action' => array('lang' => 'FULL_FOLDER_ACTION', 'validate' => 'int', 'type' => 'select', 'method' => 'full_folder_select', 'explain' => true), 165 'pm_edit_time' => array('lang' => 'PM_EDIT_TIME', 'validate' => 'int:0:99999', 'type' => 'number:0:99999', 'explain' => true, 'append' => ' ' . $user->lang['MINUTES']), 166 'pm_max_recipients' => array('lang' => 'PM_MAX_RECIPIENTS', 'validate' => 'int:0:99999', 'type' => 'number:0:99999', 'explain' => true), 167 168 'legend2' => 'GENERAL_OPTIONS', 169 'allow_mass_pm' => array('lang' => 'ALLOW_MASS_PM', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 170 'auth_bbcode_pm' => array('lang' => 'ALLOW_BBCODE_PM', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 171 'auth_smilies_pm' => array('lang' => 'ALLOW_SMILIES_PM', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 172 'allow_pm_attach' => array('lang' => 'ALLOW_PM_ATTACHMENTS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 173 'allow_sig_pm' => array('lang' => 'ALLOW_SIG_PM', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 174 'print_pm' => array('lang' => 'ALLOW_PRINT_PM', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 175 'forward_pm' => array('lang' => 'ALLOW_FORWARD_PM', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 176 'auth_img_pm' => array('lang' => 'ALLOW_IMG_PM', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 177 'auth_flash_pm' => array('lang' => 'ALLOW_FLASH_PM', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 178 'enable_pm_icons' => array('lang' => 'ENABLE_PM_ICONS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 179 180 'legend3' => 'ACP_SUBMIT_CHANGES', 181 ) 182 ); 183 break; 184 185 case 'post': 186 $display_vars = array( 187 'title' => 'ACP_POST_SETTINGS', 188 'vars' => array( 189 'legend1' => 'GENERAL_OPTIONS', 190 'allow_topic_notify' => array('lang' => 'ALLOW_TOPIC_NOTIFY', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 191 'allow_forum_notify' => array('lang' => 'ALLOW_FORUM_NOTIFY', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 192 'allow_bbcode' => array('lang' => 'ALLOW_BBCODE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 193 'allow_post_flash' => array('lang' => 'ALLOW_POST_FLASH', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 194 'allow_smilies' => array('lang' => 'ALLOW_SMILIES', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 195 'allow_post_links' => array('lang' => 'ALLOW_POST_LINKS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 196 'allowed_schemes_links' => array('lang' => 'ALLOWED_SCHEMES_LINKS', 'validate' => 'csv', 'type' => 'text:0:255', 'explain' => true), 197 'allow_nocensors' => array('lang' => 'ALLOW_NO_CENSORS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 198 'allow_bookmarks' => array('lang' => 'ALLOW_BOOKMARKS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 199 'enable_post_confirm' => array('lang' => 'VISUAL_CONFIRM_POST', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 200 'allow_quick_reply' => array('lang' => 'ALLOW_QUICK_REPLY', 'validate' => 'bool', 'type' => 'custom', 'method' => 'quick_reply', 'explain' => true), 201 202 'legend2' => 'POSTING', 203 'bump_type' => false, 204 'edit_time' => array('lang' => 'EDIT_TIME', 'validate' => 'int:0:99999', 'type' => 'number:0:99999', 'explain' => true, 'append' => ' ' . $user->lang['MINUTES']), 205 'delete_time' => array('lang' => 'DELETE_TIME', 'validate' => 'int:0:99999', 'type' => 'number:0:99999', 'explain' => true, 'append' => ' ' . $user->lang['MINUTES']), 206 'display_last_edited' => array('lang' => 'DISPLAY_LAST_EDITED', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 207 'flood_interval' => array('lang' => 'FLOOD_INTERVAL', 'validate' => 'int:0:9999999999', 'type' => 'number:0:9999999999', 'explain' => true, 'append' => ' ' . $user->lang['SECONDS']), 208 'bump_interval' => array('lang' => 'BUMP_INTERVAL', 'validate' => 'int:0', 'type' => 'custom', 'method' => 'bump_interval', 'explain' => true), 209 'topics_per_page' => array('lang' => 'TOPICS_PER_PAGE', 'validate' => 'int:1:9999', 'type' => 'number:1:9999', 'explain' => false), 210 'posts_per_page' => array('lang' => 'POSTS_PER_PAGE', 'validate' => 'int:1:9999', 'type' => 'number:1:9999', 'explain' => false), 211 'smilies_per_page' => array('lang' => 'SMILIES_PER_PAGE', 'validate' => 'int:1:9999', 'type' => 'number:1:9999', 'explain' => false), 212 'hot_threshold' => array('lang' => 'HOT_THRESHOLD', 'validate' => 'int:0:9999', 'type' => 'number:0:9999', 'explain' => true), 213 'max_poll_options' => array('lang' => 'MAX_POLL_OPTIONS', 'validate' => 'int:2:127', 'type' => 'number:2:127', 'explain' => false), 214 'max_post_chars' => array('lang' => 'CHAR_LIMIT', 'validate' => 'int:0:999999', 'type' => 'number:0:999999', 'explain' => true), 215 'min_post_chars' => array('lang' => 'MIN_CHAR_LIMIT', 'validate' => 'int:1:999999', 'type' => 'number:1:999999', 'explain' => true), 216 'max_post_smilies' => array('lang' => 'SMILIES_LIMIT', 'validate' => 'int:0:9999', 'type' => 'number:0:9999', 'explain' => true), 217 'max_post_urls' => array('lang' => 'MAX_POST_URLS', 'validate' => 'int:0:9999', 'type' => 'number:0:9999', 'explain' => true), 218 'max_post_font_size' => array('lang' => 'MAX_POST_FONT_SIZE', 'validate' => 'int:0:9999', 'type' => 'number:0:9999', 'explain' => true, 'append' => ' %'), 219 'max_quote_depth' => array('lang' => 'QUOTE_DEPTH_LIMIT', 'validate' => 'int:0:9999', 'type' => 'number:0:9999', 'explain' => true), 220 'max_post_img_width' => array('lang' => 'MAX_POST_IMG_WIDTH', 'validate' => 'int:0:9999', 'type' => 'number:0:9999', 'explain' => true, 'append' => ' ' . $user->lang['PIXEL']), 221 'max_post_img_height' => array('lang' => 'MAX_POST_IMG_HEIGHT', 'validate' => 'int:0:9999', 'type' => 'number:0:9999', 'explain' => true, 'append' => ' ' . $user->lang['PIXEL']), 222 223 'legend3' => 'ACP_SUBMIT_CHANGES', 224 ) 225 ); 226 break; 227 228 case 'signature': 229 $display_vars = array( 230 'title' => 'ACP_SIGNATURE_SETTINGS', 231 'vars' => array( 232 'legend1' => 'GENERAL_OPTIONS', 233 'allow_sig' => array('lang' => 'ALLOW_SIG', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 234 'allow_sig_bbcode' => array('lang' => 'ALLOW_SIG_BBCODE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 235 'allow_sig_img' => array('lang' => 'ALLOW_SIG_IMG', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 236 'allow_sig_flash' => array('lang' => 'ALLOW_SIG_FLASH', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 237 'allow_sig_smilies' => array('lang' => 'ALLOW_SIG_SMILIES', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 238 'allow_sig_links' => array('lang' => 'ALLOW_SIG_LINKS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 239 240 'legend2' => 'GENERAL_SETTINGS', 241 'max_sig_chars' => array('lang' => 'MAX_SIG_LENGTH', 'validate' => 'int:0:9999', 'type' => 'number:0:9999', 'explain' => true), 242 'max_sig_urls' => array('lang' => 'MAX_SIG_URLS', 'validate' => 'int:0:9999', 'type' => 'number:0:9999', 'explain' => true), 243 'max_sig_font_size' => array('lang' => 'MAX_SIG_FONT_SIZE', 'validate' => 'int:0:9999', 'type' => 'number:0:9999', 'explain' => true, 'append' => ' %'), 244 'max_sig_smilies' => array('lang' => 'MAX_SIG_SMILIES', 'validate' => 'int:0:9999', 'type' => 'number:0:9999', 'explain' => true), 245 'max_sig_img_width' => array('lang' => 'MAX_SIG_IMG_WIDTH', 'validate' => 'int:0:9999', 'type' => 'number:0:9999', 'explain' => true, 'append' => ' ' . $user->lang['PIXEL']), 246 'max_sig_img_height' => array('lang' => 'MAX_SIG_IMG_HEIGHT', 'validate' => 'int:0:9999', 'type' => 'number:0:9999', 'explain' => true, 'append' => ' ' . $user->lang['PIXEL']), 247 248 'legend3' => 'ACP_SUBMIT_CHANGES', 249 ) 250 ); 251 break; 252 253 case 'registration': 254 $display_vars = array( 255 'title' => 'ACP_REGISTER_SETTINGS', 256 'vars' => array( 257 'legend1' => 'GENERAL_SETTINGS', 258 'max_name_chars' => array('lang' => 'USERNAME_LENGTH', 'validate' => 'int:8:180', 'type' => false, 'method' => false, 'explain' => false,), 259 260 'require_activation' => array('lang' => 'ACC_ACTIVATION', 'validate' => 'int', 'type' => 'select', 'method' => 'select_acc_activation', 'explain' => true), 261 'new_member_post_limit' => array('lang' => 'NEW_MEMBER_POST_LIMIT', 'validate' => 'int:0:255', 'type' => 'number:0:255', 'explain' => true, 'append' => ' ' . $user->lang['POSTS']), 262 'new_member_group_default'=> array('lang' => 'NEW_MEMBER_GROUP_DEFAULT', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 263 'min_name_chars' => array('lang' => 'USERNAME_LENGTH', 'validate' => 'int:1', 'type' => 'custom:5:180', 'method' => 'username_length', 'explain' => true), 264 'min_pass_chars' => array('lang' => 'PASSWORD_LENGTH', 'validate' => 'int:1', 'type' => 'custom', 'method' => 'password_length', 'explain' => true), 265 'allow_name_chars' => array('lang' => 'USERNAME_CHARS', 'validate' => 'string', 'type' => 'select', 'method' => 'select_username_chars', 'explain' => true), 266 'pass_complex' => array('lang' => 'PASSWORD_TYPE', 'validate' => 'string', 'type' => 'select', 'method' => 'select_password_chars', 'explain' => true), 267 'chg_passforce' => array('lang' => 'FORCE_PASS_CHANGE', 'validate' => 'int:0:999', 'type' => 'number:0:999', 'explain' => true, 'append' => ' ' . $user->lang['DAYS']), 268 269 'legend2' => 'GENERAL_OPTIONS', 270 'allow_namechange' => array('lang' => 'ALLOW_NAME_CHANGE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 271 'allow_emailreuse' => array('lang' => 'ALLOW_EMAIL_REUSE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 272 'enable_confirm' => array('lang' => 'VISUAL_CONFIRM_REG', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 273 'max_login_attempts' => array('lang' => 'MAX_LOGIN_ATTEMPTS', 'validate' => 'int:0:999', 'type' => 'number:0:999', 'explain' => true), 274 'max_reg_attempts' => array('lang' => 'REG_LIMIT', 'validate' => 'int:0:9999', 'type' => 'number:0:9999', 'explain' => true), 275 276 'legend3' => 'COPPA', 277 'coppa_enable' => array('lang' => 'ENABLE_COPPA', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 278 'coppa_mail' => array('lang' => 'COPPA_MAIL', 'validate' => 'string', 'type' => 'textarea:5:40', 'explain' => true), 279 'coppa_fax' => array('lang' => 'COPPA_FAX', 'validate' => 'string', 'type' => 'text:25:100', 'explain' => false), 280 281 'legend4' => 'ACP_SUBMIT_CHANGES', 282 ) 283 ); 284 break; 285 286 case 'feed': 287 $display_vars = array( 288 'title' => 'ACP_FEED_MANAGEMENT', 289 'vars' => array( 290 'legend1' => 'ACP_FEED_GENERAL', 291 'feed_enable' => array('lang' => 'ACP_FEED_ENABLE', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true ), 292 'feed_item_statistics' => array('lang' => 'ACP_FEED_ITEM_STATISTICS', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), 293 'feed_http_auth' => array('lang' => 'ACP_FEED_HTTP_AUTH', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), 294 295 'legend2' => 'ACP_FEED_POST_BASED', 296 'feed_limit_post' => array('lang' => 'ACP_FEED_LIMIT', 'validate' => 'int:5:9999', 'type' => 'number:5:9999', 'explain' => true), 297 'feed_overall' => array('lang' => 'ACP_FEED_OVERALL', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true ), 298 'feed_forum' => array('lang' => 'ACP_FEED_FORUM', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true ), 299 'feed_topic' => array('lang' => 'ACP_FEED_TOPIC', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true ), 300 301 'legend3' => 'ACP_FEED_TOPIC_BASED', 302 'feed_limit_topic' => array('lang' => 'ACP_FEED_LIMIT', 'validate' => 'int:5:9999', 'type' => 'number:5:9999', 'explain' => true), 303 'feed_topics_new' => array('lang' => 'ACP_FEED_TOPICS_NEW', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true ), 304 'feed_topics_active' => array('lang' => 'ACP_FEED_TOPICS_ACTIVE', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true ), 305 'feed_news_id' => array('lang' => 'ACP_FEED_NEWS', 'validate' => 'string', 'type' => 'custom', 'method' => 'select_news_forums', 'explain' => true), 306 307 'legend4' => 'ACP_FEED_SETTINGS_OTHER', 308 'feed_overall_forums' => array('lang' => 'ACP_FEED_OVERALL_FORUMS', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true ), 309 'feed_exclude_id' => array('lang' => 'ACP_FEED_EXCLUDE_ID', 'validate' => 'string', 'type' => 'custom', 'method' => 'select_exclude_forums', 'explain' => true), 310 311 'legend5' => 'ACP_SUBMIT_CHANGES', 312 ) 313 ); 314 break; 315 316 case 'cookie': 317 $display_vars = array( 318 'title' => 'ACP_COOKIE_SETTINGS', 319 'vars' => array( 320 'legend1' => 'ACP_COOKIE_SETTINGS', 321 'cookie_domain' => array('lang' => 'COOKIE_DOMAIN', 'validate' => 'string', 'type' => 'text::255', 'explain' => true), 322 'cookie_name' => array('lang' => 'COOKIE_NAME', 'validate' => 'string', 'type' => 'text::16', 'explain' => true), 323 'cookie_path' => array('lang' => 'COOKIE_PATH', 'validate' => 'string', 'type' => 'text::255', 'explain' => true), 324 'cookie_secure' => array('lang' => 'COOKIE_SECURE', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), 325 'cookie_notice' => array('lang' => 'COOKIE_NOTICE', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), 326 327 'legend2' => 'ACP_SUBMIT_CHANGES', 328 ) 329 ); 330 break; 331 332 case 'load': 333 $display_vars = array( 334 'title' => 'ACP_LOAD_SETTINGS', 335 'vars' => array( 336 'legend1' => 'GENERAL_SETTINGS', 337 'limit_load' => array('lang' => 'LIMIT_LOAD', 'validate' => 'int:0:9999', 'type' => 'number:0:9999', 'explain' => true), 338 'session_length' => array('lang' => 'SESSION_LENGTH', 'validate' => 'int:60:9999999999', 'type' => 'number:60:9999999999', 'explain' => true, 'append' => ' ' . $user->lang['SECONDS']), 339 'active_sessions' => array('lang' => 'LIMIT_SESSIONS', 'validate' => 'int:0:9999', 'type' => 'number:0:9999', 'explain' => true), 340 'load_online_time' => array('lang' => 'ONLINE_LENGTH', 'validate' => 'int:0:999', 'type' => 'number:0:999', 'explain' => true, 'append' => ' ' . $user->lang['MINUTES']), 341 'read_notification_expire_days' => array('lang' => 'READ_NOTIFICATION_EXPIRE_DAYS', 'validate' => 'int:0', 'type' => 'number:0', 'explain' => true, 'append' => ' ' . $user->lang['DAYS']), 342 343 'legend2' => 'GENERAL_OPTIONS', 344 'load_notifications' => array('lang' => 'LOAD_NOTIFICATIONS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 345 'load_db_track' => array('lang' => 'YES_POST_MARKING', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 346 'load_db_lastread' => array('lang' => 'YES_READ_MARKING', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 347 'load_anon_lastread' => array('lang' => 'YES_ANON_READ_MARKING', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 348 'load_online' => array('lang' => 'YES_ONLINE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 349 'load_online_guests' => array('lang' => 'YES_ONLINE_GUESTS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 350 'load_onlinetrack' => array('lang' => 'YES_ONLINE_TRACK', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 351 'load_birthdays' => array('lang' => 'YES_BIRTHDAYS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 352 'load_unreads_search' => array('lang' => 'YES_UNREAD_SEARCH', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 353 'load_moderators' => array('lang' => 'YES_MODERATORS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 354 'load_jumpbox' => array('lang' => 'YES_JUMPBOX', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 355 'load_user_activity' => array('lang' => 'LOAD_USER_ACTIVITY', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 356 'load_user_activity_limit' => array('lang' => 'LOAD_USER_ACTIVITY_LIMIT', 'validate' => 'int:0:99999999', 'type' => 'number:0:99999999', 'explain' => true), 357 'load_tplcompile' => array('lang' => 'RECOMPILE_STYLES', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 358 'allow_cdn' => array('lang' => 'ALLOW_CDN', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 359 'enable_accurate_pm_button' => array('lang' => 'YES_ACCURATE_PM_BUTTON', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 360 'allow_live_searches' => array('lang' => 'ALLOW_LIVE_SEARCHES', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 361 362 'legend3' => 'CUSTOM_PROFILE_FIELDS', 363 'load_cpf_memberlist' => array('lang' => 'LOAD_CPF_MEMBERLIST', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 364 'load_cpf_pm' => array('lang' => 'LOAD_CPF_PM', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 365 'load_cpf_viewprofile' => array('lang' => 'LOAD_CPF_VIEWPROFILE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 366 'load_cpf_viewtopic' => array('lang' => 'LOAD_CPF_VIEWTOPIC', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 367 368 'legend4' => 'ACP_SUBMIT_CHANGES', 369 ) 370 ); 371 break; 372 373 case 'auth': 374 $display_vars = array( 375 'title' => 'ACP_AUTH_SETTINGS', 376 'vars' => array( 377 'legend1' => 'ACP_AUTH_SETTINGS', 378 'auth_method' => array('lang' => 'AUTH_METHOD', 'validate' => 'string', 'type' => 'select:1:toggable', 'method' => 'select_auth_method', 'explain' => false), 379 ) 380 ); 381 break; 382 383 case 'server': 384 $display_vars = array( 385 'title' => 'ACP_SERVER_SETTINGS', 386 'vars' => array( 387 'legend1' => 'ACP_SERVER_SETTINGS', 388 'gzip_compress' => array('lang' => 'ENABLE_GZIP', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 389 'use_system_cron' => array('lang' => 'USE_SYSTEM_CRON', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 390 391 'legend2' => 'PATH_SETTINGS', 392 'enable_mod_rewrite' => array('lang' => 'MOD_REWRITE_ENABLE', 'validate' => 'bool', 'type' => 'custom', 'method' => 'enable_mod_rewrite', 'explain' => true), 393 'smilies_path' => array('lang' => 'SMILIES_PATH', 'validate' => 'rpath', 'type' => 'text:20:255', 'explain' => true), 394 'icons_path' => array('lang' => 'ICONS_PATH', 'validate' => 'rpath', 'type' => 'text:20:255', 'explain' => true), 395 'upload_icons_path' => array('lang' => 'UPLOAD_ICONS_PATH', 'validate' => 'rpath', 'type' => 'text:20:255', 'explain' => true), 396 'ranks_path' => array('lang' => 'RANKS_PATH', 'validate' => 'rpath', 'type' => 'text:20:255', 'explain' => true), 397 398 'legend3' => 'SERVER_URL_SETTINGS', 399 'force_server_vars' => array('lang' => 'FORCE_SERVER_VARS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 400 'server_protocol' => array('lang' => 'SERVER_PROTOCOL', 'validate' => 'string', 'type' => 'text:10:10', 'explain' => true), 401 'server_name' => array('lang' => 'SERVER_NAME', 'validate' => 'string', 'type' => 'text:40:255', 'explain' => true), 402 'server_port' => array('lang' => 'SERVER_PORT', 'validate' => 'int:0:99999', 'type' => 'number:0:99999', 'explain' => true), 403 'script_path' => array('lang' => 'SCRIPT_PATH', 'validate' => 'script_path', 'type' => 'text::255', 'explain' => true), 404 405 'legend4' => 'ACP_SUBMIT_CHANGES', 406 ) 407 ); 408 break; 409 410 case 'security': 411 $display_vars = array( 412 'title' => 'ACP_SECURITY_SETTINGS', 413 'vars' => array( 414 'legend1' => 'ACP_SECURITY_SETTINGS', 415 'allow_autologin' => array('lang' => 'ALLOW_AUTOLOGIN', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 416 'allow_password_reset' => array('lang' => 'ALLOW_PASSWORD_RESET', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 417 'max_autologin_time' => array('lang' => 'AUTOLOGIN_LENGTH', 'validate' => 'int:0:99999', 'type' => 'number:0:99999', 'explain' => true, 'append' => ' ' . $user->lang['DAYS']), 418 'ip_check' => array('lang' => 'IP_VALID', 'validate' => 'int', 'type' => 'custom', 'method' => 'select_ip_check', 'explain' => true), 419 'browser_check' => array('lang' => 'BROWSER_VALID', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 420 'forwarded_for_check' => array('lang' => 'FORWARDED_FOR_VALID', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 421 'referer_validation' => array('lang' => 'REFERRER_VALID', 'validate' => 'int:0:3','type' => 'custom', 'method' => 'select_ref_check', 'explain' => true), 422 'remote_upload_verify' => array('lang' => 'UPLOAD_CERT_VALID', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 423 'check_dnsbl' => array('lang' => 'CHECK_DNSBL', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 424 'email_check_mx' => array('lang' => 'EMAIL_CHECK_MX', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 425 'min_pass_chars' => array('lang' => 'PASSWORD_LENGTH', 'validate' => 'int:1', 'type' => 'custom', 'method' => 'password_length', 'explain' => true), 426 'pass_complex' => array('lang' => 'PASSWORD_TYPE', 'validate' => 'string', 'type' => 'select', 'method' => 'select_password_chars', 'explain' => true), 427 'chg_passforce' => array('lang' => 'FORCE_PASS_CHANGE', 'validate' => 'int:0:999', 'type' => 'number:0:999', 'explain' => true, 'append' => ' ' . $user->lang['DAYS']), 428 'max_login_attempts' => array('lang' => 'MAX_LOGIN_ATTEMPTS', 'validate' => 'int:0:999', 'type' => 'number:0:999', 'explain' => true), 429 'ip_login_limit_max' => array('lang' => 'IP_LOGIN_LIMIT_MAX', 'validate' => 'int:0:999', 'type' => 'number:0:999', 'explain' => true), 430 'ip_login_limit_time' => array('lang' => 'IP_LOGIN_LIMIT_TIME', 'validate' => 'int:0:99999', 'type' => 'number:0:99999', 'explain' => true, 'append' => ' ' . $user->lang['SECONDS']), 431 'ip_login_limit_use_forwarded' => array('lang' => 'IP_LOGIN_LIMIT_USE_FORWARDED', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 432 'tpl_allow_php' => array('lang' => 'TPL_ALLOW_PHP', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 433 'form_token_lifetime' => array('lang' => 'FORM_TIME_MAX', 'validate' => 'int:-1:99999', 'type' => 'number:-1:99999', 'explain' => true, 'append' => ' ' . $user->lang['SECONDS']), 434 'form_token_sid_guests' => array('lang' => 'FORM_SID_GUESTS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 435 436 'legend2' => 'ACP_SUBMIT_CHANGES', 437 ) 438 ); 439 break; 440 441 case 'email': 442 $display_vars = array( 443 'title' => 'ACP_EMAIL_SETTINGS', 444 'vars' => array( 445 'legend1' => 'GENERAL_SETTINGS', 446 'email_enable' => array('lang' => 'ENABLE_EMAIL', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), 447 'board_email_form' => array('lang' => 'BOARD_EMAIL_FORM', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), 448 'email_package_size' => array('lang' => 'EMAIL_PACKAGE_SIZE', 'validate' => 'int:0', 'type' => 'number:0:99999', 'explain' => true), 449 'email_max_chunk_size' => array('lang' => 'EMAIL_MAX_CHUNK_SIZE', 'validate' => 'int:1:99999', 'type' => 'number:1:99999', 'explain' => true), 450 'board_contact' => array('lang' => 'CONTACT_EMAIL', 'validate' => 'email', 'type' => 'email:25:100', 'explain' => true), 451 'board_contact_name' => array('lang' => 'CONTACT_EMAIL_NAME', 'validate' => 'string', 'type' => 'text:25:50', 'explain' => true), 452 'board_email' => array('lang' => 'ADMIN_EMAIL', 'validate' => 'email', 'type' => 'email:25:100', 'explain' => true), 453 'email_force_sender' => array('lang' => 'EMAIL_FORCE_SENDER', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 454 'board_email_sig' => array('lang' => 'EMAIL_SIG', 'validate' => 'string', 'type' => 'textarea:5:30', 'explain' => true), 455 'board_hide_emails' => array('lang' => 'BOARD_HIDE_EMAILS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 456 'send_test_email' => array('lang' => 'SEND_TEST_EMAIL', 'validate' => 'bool', 'type' => 'custom', 'method' => 'send_test_email', 'explain' => true), 457 458 'legend2' => 'SMTP_SETTINGS', 459 'smtp_delivery' => array('lang' => 'USE_SMTP', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 460 'smtp_host' => array('lang' => 'SMTP_SERVER', 'validate' => 'string', 'type' => 'text:25:50', 'explain' => true), 461 'smtp_port' => array('lang' => 'SMTP_PORT', 'validate' => 'int:0:99999', 'type' => 'number:0:99999', 'explain' => true), 462 'smtp_auth_method' => array('lang' => 'SMTP_AUTH_METHOD', 'validate' => 'string', 'type' => 'select', 'method' => 'mail_auth_select', 'explain' => true), 463 'smtp_username' => array('lang' => 'SMTP_USERNAME', 'validate' => 'string', 'type' => 'text:25:255', 'explain' => true), 464 'smtp_password' => array('lang' => 'SMTP_PASSWORD', 'validate' => 'string', 'type' => 'password:25:255', 'explain' => true), 465 'smtp_verify_peer' => array('lang' => 'SMTP_VERIFY_PEER', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 466 'smtp_verify_peer_name' => array('lang' => 'SMTP_VERIFY_PEER_NAME', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 467 'smtp_allow_self_signed'=> array('lang' => 'SMTP_ALLOW_SELF_SIGNED','validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 468 469 'legend3' => 'ACP_SUBMIT_CHANGES', 470 ) 471 ); 472 break; 473 474 default: 475 trigger_error('NO_MODE', E_USER_ERROR); 476 break; 477 } 478 479 /** 480 * Event to add and/or modify acp_board configurations 481 * 482 * @event core.acp_board_config_edit_add 483 * @var array display_vars Array of config values to display and process 484 * @var string mode Mode of the config page we are displaying 485 * @var boolean submit Do we display the form or process the submission 486 * @since 3.1.0-a4 487 */ 488 $vars = array('display_vars', 'mode', 'submit'); 489 extract($phpbb_dispatcher->trigger_event('core.acp_board_config_edit_add', compact($vars))); 490 491 if (isset($display_vars['lang'])) 492 { 493 $user->add_lang($display_vars['lang']); 494 } 495 496 $this->new_config = clone $config; 497 $cfg_array = (isset($_REQUEST['config'])) ? $request->variable('config', array('' => ''), true) : $this->new_config; 498 $error = array(); 499 500 // Prevalidate allowed URL schemes 501 if ($mode == 'post') 502 { 503 $schemes = array_filter(explode(',', $cfg_array['allowed_schemes_links'])); 504 foreach ($schemes as $scheme) 505 { 506 if (!preg_match('#^[a-z][a-z0-9+\\-.]*$#Di', $scheme)) 507 { 508 $error[] = $language->lang('URL_SCHEME_INVALID', $language->lang('ALLOWED_SCHEMES_LINKS'), $scheme); 509 } 510 } 511 } 512 513 if ($mode == 'avatar' && $cfg_array['allow_avatar_upload']) 514 { 515 // If avatar uploading is enabled but the path setting is empty, 516 // config variable validation is bypassed. Catch the case here 517 if (!$cfg_array['avatar_path']) 518 { 519 $error[] = $language->lang('AVATAR_NO_UPLOAD_PATH'); 520 } 521 else if (!$submit) 522 { 523 $filesystem = $phpbb_container->get('filesystem'); 524 $avatar_path_exists = $filesystem->exists($phpbb_root_path . $cfg_array['avatar_path']); 525 $avatar_path_writable = $filesystem->is_writable($phpbb_root_path . $cfg_array['avatar_path']); 526 527 // Not existing or writable path will be caught on submit by validate_config_vars(). 528 // Display the warning if the directory was changed on the server afterwards 529 if (!$avatar_path_exists || !$avatar_path_writable) 530 { 531 $error[] = $language->lang('AVATAR_NO_UPLOAD_DIR'); 532 } 533 } 534 } 535 536 // We validate the complete config if wished 537 validate_config_vars($display_vars['vars'], $cfg_array, $error); 538 539 if ($submit && !check_form_key($form_key)) 540 { 541 $error[] = $user->lang['FORM_INVALID']; 542 } 543 // Do not write values if there is an error 544 if (count($error)) 545 { 546 $submit = false; 547 } 548 549 // We go through the display_vars to make sure no one is trying to set variables he/she is not allowed to... 550 foreach ($display_vars['vars'] as $config_name => $data) 551 { 552 if (!isset($cfg_array[$config_name]) || strpos($config_name, 'legend') !== false) 553 { 554 continue; 555 } 556 557 if ($config_name == 'auth_method' || $config_name == 'feed_news_id' || $config_name == 'feed_exclude_id') 558 { 559 continue; 560 } 561 562 if ($config_name == 'guest_style') 563 { 564 if (isset($cfg_array[$config_name])) 565 { 566 $this->guest_style_set($cfg_array[$config_name]); 567 } 568 continue; 569 } 570 571 $this->new_config[$config_name] = $config_value = $cfg_array[$config_name]; 572 573 if ($submit) 574 { 575 if (isset($data['type']) && strpos($data['type'], 'password') === 0 && $config_value === '********') 576 { 577 /** 578 * Do not update password fields if the content is ********, 579 * because that is the password replacement we use to not 580 * send the password to the output 581 */ 582 continue; 583 } 584 585 // Array of emoji-enabled configurations 586 $config_name_ary = [ 587 'sitename', 588 'site_desc', 589 'site_home_text', 590 'board_index_text', 591 'board_disable_msg', 592 'board_email_sig', 593 ]; 594 595 /** 596 * Event to manage the array of emoji-enabled configurations 597 * 598 * @event core.acp_board_config_emoji_enabled 599 * @var array config_name_ary Array of config names to process 600 * @since 3.3.3-RC1 601 */ 602 $vars = ['config_name_ary']; 603 extract($phpbb_dispatcher->trigger_event('core.acp_board_config_emoji_enabled', compact($vars))); 604 605 if (in_array($config_name, $config_name_ary)) 606 { 607 /** 608 * Replace Emojis and other 4bit UTF-8 chars not allowed by MySQL to UCR/NCR. 609 * Using their Numeric Character Reference's Hexadecimal notation. 610 */ 611 $config->set($config_name, utf8_encode_ucr($config_value)); 612 } 613 else 614 { 615 $config->set($config_name, $config_value); 616 } 617 618 if ($config_name == 'allow_quick_reply' && isset($_POST['allow_quick_reply_enable'])) 619 { 620 enable_bitfield_column_flag(FORUMS_TABLE, 'forum_flags', round(log(FORUM_FLAG_QUICK_REPLY, 2))); 621 } 622 } 623 } 624 625 // Invalidate the text_formatter cache when posting or server options are changed 626 if (preg_match('(^(?:post|server)$)', $mode) && $submit) 627 { 628 $phpbb_container->get('text_formatter.cache')->invalidate(); 629 } 630 631 // Store news and exclude ids 632 if ($mode == 'feed' && $submit) 633 { 634 $cache->destroy('_feed_news_forum_ids'); 635 $cache->destroy('_feed_excluded_forum_ids'); 636 637 $this->store_feed_forums(FORUM_OPTION_FEED_NEWS, 'feed_news_id'); 638 $this->store_feed_forums(FORUM_OPTION_FEED_EXCLUDE, 'feed_exclude_id'); 639 } 640 641 if ($mode == 'auth') 642 { 643 // Retrieve a list of auth plugins and check their config values 644 /* @var $auth_providers \phpbb\auth\provider_collection */ 645 $auth_providers = $phpbb_container->get('auth.provider_collection'); 646 647 $updated_auth_settings = false; 648 $old_auth_config = array(); 649 foreach ($auth_providers as $provider) 650 { 651 /** @var \phpbb\auth\provider\provider_interface $provider */ 652 if ($fields = $provider->acp()) 653 { 654 // Check if we need to create config fields for this plugin and save config when submit was pressed 655 foreach ($fields as $field) 656 { 657 if (!isset($config[$field])) 658 { 659 $config->set($field, ''); 660 } 661 662 if (!isset($cfg_array[$field]) || strpos($field, 'legend') !== false) 663 { 664 continue; 665 } 666 667 if (substr($field, -9) === '_password' && $cfg_array[$field] === '********') 668 { 669 // Do not update password fields if the content is ********, 670 // because that is the password replacement we use to not 671 // send the password to the output 672 continue; 673 } 674 675 $old_auth_config[$field] = $this->new_config[$field]; 676 $config_value = $cfg_array[$field]; 677 $this->new_config[$field] = $config_value; 678 679 if ($submit) 680 { 681 $updated_auth_settings = true; 682 $config->set($field, $config_value); 683 } 684 } 685 } 686 unset($fields); 687 } 688 689 if ($submit && (($cfg_array['auth_method'] != $this->new_config['auth_method']) || $updated_auth_settings)) 690 { 691 $method = basename($cfg_array['auth_method']); 692 if (array_key_exists('auth.provider.' . $method, (array) $auth_providers)) 693 { 694 $provider = $auth_providers['auth.provider.' . $method]; 695 if ($error = $provider->init()) 696 { 697 foreach ($old_auth_config as $config_name => $config_value) 698 { 699 $config->set($config_name, $config_value); 700 } 701 trigger_error($error . adm_back_link($this->u_action), E_USER_WARNING); 702 } 703 $config->set('auth_method', basename($cfg_array['auth_method'])); 704 } 705 else 706 { 707 trigger_error('NO_AUTH_PLUGIN', E_USER_ERROR); 708 } 709 } 710 } 711 712 if ($mode == 'email' && $request->is_set_post('send_test_email')) 713 { 714 if ($config['email_enable']) 715 { 716 include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx); 717 718 $messenger = new messenger(false); 719 $messenger->template('test'); 720 $messenger->set_addresses($user->data); 721 $messenger->anti_abuse_headers($config, $user); 722 $messenger->assign_vars(array( 723 'USERNAME' => html_entity_decode($user->data['username'], ENT_COMPAT), 724 'MESSAGE' => html_entity_decode($request->variable('send_test_email_text', '', true), ENT_COMPAT), 725 )); 726 $messenger->send(NOTIFY_EMAIL); 727 728 trigger_error($user->lang('TEST_EMAIL_SENT') . adm_back_link($this->u_action)); 729 } 730 else 731 { 732 $user->add_lang('memberlist'); 733 trigger_error($user->lang('EMAIL_DISABLED') . adm_back_link($this->u_action), E_USER_WARNING); 734 } 735 } 736 737 if ($submit) 738 { 739 $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_CONFIG_' . strtoupper($mode)); 740 741 $message = $user->lang('CONFIG_UPDATED'); 742 $message_type = E_USER_NOTICE; 743 if (!$config['email_enable'] && in_array($mode, array('email', 'registration')) && 744 in_array($config['require_activation'], array(USER_ACTIVATION_SELF, USER_ACTIVATION_ADMIN))) 745 { 746 $message .= '<br /><br />' . $user->lang('ACC_ACTIVATION_WARNING'); 747 $message_type = E_USER_WARNING; 748 } 749 trigger_error($message . adm_back_link($this->u_action), $message_type); 750 } 751 752 $this->tpl_name = 'acp_board'; 753 $this->page_title = $display_vars['title']; 754 755 $template->assign_vars(array( 756 'L_TITLE' => $user->lang[$display_vars['title']], 757 'L_TITLE_EXPLAIN' => $user->lang[$display_vars['title'] . '_EXPLAIN'], 758 759 'S_ERROR' => (count($error)) ? true : false, 760 'ERROR_MSG' => implode('<br />', $error), 761 762 'U_ACTION' => $this->u_action) 763 ); 764 765 // Output relevant page 766 foreach ($display_vars['vars'] as $config_key => $vars) 767 { 768 if (!is_array($vars) && strpos($config_key, 'legend') === false) 769 { 770 continue; 771 } 772 773 if (strpos($config_key, 'legend') !== false) 774 { 775 $template->assign_block_vars('options', array( 776 'S_LEGEND' => true, 777 'LEGEND' => (isset($user->lang[$vars])) ? $user->lang[$vars] : $vars) 778 ); 779 780 continue; 781 } 782 783 $type = explode(':', $vars['type']); 784 785 $l_explain = ''; 786 if ($vars['explain'] && isset($vars['lang_explain'])) 787 { 788 $l_explain = (isset($user->lang[$vars['lang_explain']])) ? $user->lang[$vars['lang_explain']] : $vars['lang_explain']; 789 } 790 else if ($vars['explain']) 791 { 792 $l_explain = (isset($user->lang[$vars['lang'] . '_EXPLAIN'])) ? $user->lang[$vars['lang'] . '_EXPLAIN'] : ''; 793 } 794 795 $content = build_cfg_template($type, $config_key, $this->new_config, $config_key, $vars); 796 797 if (empty($content)) 798 { 799 continue; 800 } 801 802 $template->assign_block_vars('options', array( 803 'KEY' => $config_key, 804 'TITLE' => (isset($user->lang[$vars['lang']])) ? $user->lang[$vars['lang']] : $vars['lang'], 805 'S_EXPLAIN' => $vars['explain'] && !empty($l_explain), 806 'TITLE_EXPLAIN' => $l_explain, 807 'CONTENT' => $content, 808 ) 809 ); 810 811 unset($display_vars['vars'][$config_key]); 812 } 813 814 if ($mode == 'auth') 815 { 816 $template->assign_var('S_AUTH', true); 817 818 foreach ($auth_providers as $provider) 819 { 820 $auth_tpl = $provider->get_acp_template($this->new_config); 821 if ($auth_tpl) 822 { 823 if (array_key_exists('BLOCK_VAR_NAME', $auth_tpl)) 824 { 825 foreach ($auth_tpl['BLOCK_VARS'] as $block_vars) 826 { 827 $template->assign_block_vars($auth_tpl['BLOCK_VAR_NAME'], $block_vars); 828 } 829 } 830 $template->assign_vars($auth_tpl['TEMPLATE_VARS']); 831 $template->assign_block_vars('auth_tpl', array( 832 'TEMPLATE_FILE' => $auth_tpl['TEMPLATE_FILE'], 833 )); 834 } 835 } 836 } 837 } 838 839 /** 840 * Select auth method 841 */ 842 function select_auth_method($selected_method, $key = '') 843 { 844 global $phpbb_container; 845 846 /* @var $auth_providers \phpbb\auth\provider_collection */ 847 $auth_providers = $phpbb_container->get('auth.provider_collection'); 848 $auth_plugins = array(); 849 850 foreach ($auth_providers as $key => $value) 851 { 852 if (!($value instanceof \phpbb\auth\provider\provider_interface)) 853 { 854 continue; 855 } 856 $auth_plugins[] = str_replace('auth.provider.', '', $key); 857 } 858 859 sort($auth_plugins); 860 861 $auth_select = ''; 862 foreach ($auth_plugins as $method) 863 { 864 $selected = ($selected_method == $method) ? ' selected="selected"' : ''; 865 $auth_select .= "<option value=\"$method\"$selected data-toggle-setting=\"#auth_{$method}_settings\">" . ucfirst($method) . '</option>'; 866 } 867 868 return $auth_select; 869 } 870 871 /** 872 * Select mail authentication method 873 */ 874 function mail_auth_select($selected_method, $key = '') 875 { 876 global $user; 877 878 $auth_methods = array('PLAIN', 'LOGIN', 'CRAM-MD5', 'DIGEST-MD5', 'POP-BEFORE-SMTP'); 879 $s_smtp_auth_options = ''; 880 881 foreach ($auth_methods as $method) 882 { 883 $s_smtp_auth_options .= '<option value="' . $method . '"' . (($selected_method == $method) ? ' selected="selected"' : '') . '>' . $user->lang['SMTP_' . str_replace('-', '_', $method)] . '</option>'; 884 } 885 886 return $s_smtp_auth_options; 887 } 888 889 /** 890 * Select full folder action 891 */ 892 function full_folder_select($value, $key = '') 893 { 894 global $user; 895 896 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>'; 897 } 898 899 /** 900 * Select ip validation 901 */ 902 function select_ip_check($value, $key = '') 903 { 904 $radio_ary = array(4 => 'ALL', 3 => 'CLASS_C', 2 => 'CLASS_B', 0 => 'NO_IP_VALIDATION'); 905 906 return h_radio('config[ip_check]', $radio_ary, $value, $key); 907 } 908 909 /** 910 * Select referer validation 911 */ 912 function select_ref_check($value, $key = '') 913 { 914 $radio_ary = array(REFERER_VALIDATE_PATH => 'REF_PATH', REFERER_VALIDATE_HOST => 'REF_HOST', REFERER_VALIDATE_NONE => 'NO_REF_VALIDATION'); 915 916 return h_radio('config[referer_validation]', $radio_ary, $value, $key); 917 } 918 919 /** 920 * Select account activation method 921 */ 922 function select_acc_activation($selected_value, $value) 923 { 924 global $user, $config; 925 926 $act_ary = array( 927 'ACC_DISABLE' => array(true, USER_ACTIVATION_DISABLE), 928 'ACC_NONE' => array(true, USER_ACTIVATION_NONE), 929 'ACC_USER' => array($config['email_enable'], USER_ACTIVATION_SELF), 930 'ACC_ADMIN' => array($config['email_enable'], USER_ACTIVATION_ADMIN), 931 ); 932 933 $act_options = ''; 934 foreach ($act_ary as $key => $data) 935 { 936 list($available, $value) = $data; 937 $selected = ($selected_value == $value) ? ' selected="selected"' : ''; 938 $class = (!$available) ? ' class="disabled-option"' : ''; 939 $act_options .= '<option value="' . $value . '"' . $selected . $class . '>' . $user->lang($key) . '</option>'; 940 } 941 942 return $act_options; 943 } 944 945 /** 946 * Maximum/Minimum username length 947 */ 948 function username_length($value, $key = '') 949 { 950 global $user; 951 952 return '<input id="' . $key . '" type="number" min="1" max="999" name="config[min_name_chars]" value="' . $value . '" /> ' . $user->lang['MIN_CHARS'] . ' <input type="number" min="8" max="180" name="config[max_name_chars]" value="' . $this->new_config['max_name_chars'] . '" /> ' . $user->lang['MAX_CHARS']; 953 } 954 955 /** 956 * Allowed chars in usernames 957 */ 958 function select_username_chars($selected_value, $key) 959 { 960 global $user; 961 962 $user_char_ary = array('USERNAME_CHARS_ANY', 'USERNAME_ALPHA_ONLY', 'USERNAME_ALPHA_SPACERS', 'USERNAME_LETTER_NUM', 'USERNAME_LETTER_NUM_SPACERS', 'USERNAME_ASCII'); 963 $user_char_options = ''; 964 foreach ($user_char_ary as $user_type) 965 { 966 $selected = ($selected_value == $user_type) ? ' selected="selected"' : ''; 967 $user_char_options .= '<option value="' . $user_type . '"' . $selected . '>' . $user->lang[$user_type] . '</option>'; 968 } 969 970 return $user_char_options; 971 } 972 973 /** 974 * Minimum password length 975 */ 976 function password_length($value, $key) 977 { 978 global $user; 979 980 return '<input id="' . $key . '" type="number" min="1" max="999" name="config[min_pass_chars]" value="' . $value . '" /> ' . $user->lang['MIN_CHARS']; 981 } 982 983 /** 984 * Required chars in passwords 985 */ 986 function select_password_chars($selected_value, $key) 987 { 988 global $user; 989 990 $pass_type_ary = array('PASS_TYPE_ANY', 'PASS_TYPE_CASE', 'PASS_TYPE_ALPHA', 'PASS_TYPE_SYMBOL'); 991 $pass_char_options = ''; 992 foreach ($pass_type_ary as $pass_type) 993 { 994 $selected = ($selected_value == $pass_type) ? ' selected="selected"' : ''; 995 $pass_char_options .= '<option value="' . $pass_type . '"' . $selected . '>' . $user->lang[$pass_type] . '</option>'; 996 } 997 998 return $pass_char_options; 999 } 1000 1001 /** 1002 * Select bump interval 1003 */ 1004 function bump_interval($value, $key) 1005 { 1006 global $user; 1007 1008 $s_bump_type = ''; 1009 $types = array('m' => 'MINUTES', 'h' => 'HOURS', 'd' => 'DAYS'); 1010 foreach ($types as $type => $lang) 1011 { 1012 $selected = ($this->new_config['bump_type'] == $type) ? ' selected="selected"' : ''; 1013 $s_bump_type .= '<option value="' . $type . '"' . $selected . '>' . $user->lang[$lang] . '</option>'; 1014 } 1015 1016 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>'; 1017 } 1018 1019 /** 1020 * Board disable option and message 1021 */ 1022 function board_disable($value, $key) 1023 { 1024 $radio_ary = array(1 => 'YES', 0 => 'NO'); 1025 1026 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'] . '" />'; 1027 } 1028 1029 /** 1030 * Global quick reply enable/disable setting and button to enable in all forums 1031 */ 1032 function quick_reply($value, $key) 1033 { 1034 global $user; 1035 1036 $radio_ary = array(1 => 'YES', 0 => 'NO'); 1037 1038 return h_radio('config[allow_quick_reply]', $radio_ary, $value) . 1039 '<br /><br /><input class="button2" type="submit" id="' . $key . '_enable" name="' . $key . '_enable" value="' . $user->lang['ALLOW_QUICK_REPLY_BUTTON'] . '" />'; 1040 } 1041 1042 /** 1043 * Select guest timezone 1044 */ 1045 function timezone_select($value, $key) 1046 { 1047 global $template, $user; 1048 1049 $timezone_select = phpbb_timezone_select($template, $user, $value, true); 1050 1051 return '<select name="config[' . $key . ']" id="' . $key . '">' . $timezone_select . '</select>'; 1052 } 1053 1054 /** 1055 * Get guest style 1056 */ 1057 public function guest_style_get() 1058 { 1059 global $db; 1060 1061 $sql = 'SELECT user_style 1062 FROM ' . USERS_TABLE . ' 1063 WHERE user_id = ' . ANONYMOUS; 1064 $result = $db->sql_query($sql); 1065 1066 $style = (int) $db->sql_fetchfield('user_style'); 1067 $db->sql_freeresult($result); 1068 1069 return $style; 1070 } 1071 1072 /** 1073 * Set guest style 1074 * 1075 * @param int $style_id The style ID 1076 */ 1077 public function guest_style_set($style_id) 1078 { 1079 global $db; 1080 1081 $sql = 'UPDATE ' . USERS_TABLE . ' 1082 SET user_style = ' . (int) $style_id . ' 1083 WHERE user_id = ' . ANONYMOUS; 1084 $db->sql_query($sql); 1085 } 1086 1087 /** 1088 * Select default dateformat 1089 */ 1090 function dateformat_select($value, $key) 1091 { 1092 global $user, $config; 1093 1094 // Let the format_date function operate with the acp values 1095 $old_tz = $user->timezone; 1096 try 1097 { 1098 $user->timezone = new DateTimeZone($config['board_timezone']); 1099 } 1100 catch (\Exception $e) 1101 { 1102 // If the board timezone is invalid, we just use the users timezone. 1103 } 1104 1105 $dateformat_options = ''; 1106 1107 foreach ($user->lang['dateformats'] as $format => $null) 1108 { 1109 $dateformat_options .= '<option value="' . $format . '"' . (($format == $value) ? ' selected="selected"' : '') . '>'; 1110 $dateformat_options .= $user->format_date(time(), $format, false) . ((strpos($format, '|') !== false) ? $user->lang['VARIANT_DATE_SEPARATOR'] . $user->format_date(time(), $format, true) : ''); 1111 $dateformat_options .= '</option>'; 1112 } 1113 1114 $dateformat_options .= '<option value="custom"'; 1115 if (!isset($user->lang['dateformats'][$value])) 1116 { 1117 $dateformat_options .= ' selected="selected"'; 1118 } 1119 $dateformat_options .= '>' . $user->lang['CUSTOM_DATEFORMAT'] . '</option>'; 1120 1121 // Reset users date options 1122 $user->timezone = $old_tz; 1123 1124 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> 1125 <input type=\"text\" name=\"config[$key]\" id=\"$key\" value=\"$value\" maxlength=\"64\" />"; 1126 } 1127 1128 /** 1129 * Select multiple forums 1130 */ 1131 function select_news_forums($value, $key) 1132 { 1133 $forum_list = make_forum_select(false, false, true, true, true, false, true); 1134 1135 // Build forum options 1136 $s_forum_options = '<select id="' . $key . '" name="' . $key . '[]" multiple="multiple">'; 1137 foreach ($forum_list as $f_id => $f_row) 1138 { 1139 $f_row['selected'] = phpbb_optionget(FORUM_OPTION_FEED_NEWS, $f_row['forum_options']); 1140 1141 $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>'; 1142 } 1143 $s_forum_options .= '</select>'; 1144 1145 return $s_forum_options; 1146 } 1147 1148 function select_exclude_forums($value, $key) 1149 { 1150 $forum_list = make_forum_select(false, false, true, true, true, false, true); 1151 1152 // Build forum options 1153 $s_forum_options = '<select id="' . $key . '" name="' . $key . '[]" multiple="multiple">'; 1154 foreach ($forum_list as $f_id => $f_row) 1155 { 1156 $f_row['selected'] = phpbb_optionget(FORUM_OPTION_FEED_EXCLUDE, $f_row['forum_options']); 1157 1158 $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>'; 1159 } 1160 $s_forum_options .= '</select>'; 1161 1162 return $s_forum_options; 1163 } 1164 1165 function store_feed_forums($option, $key) 1166 { 1167 global $db, $cache, $request; 1168 1169 // Get key 1170 $values = $request->variable($key, array(0 => 0)); 1171 1172 // Empty option bit for all forums 1173 $sql = 'UPDATE ' . FORUMS_TABLE . ' 1174 SET forum_options = forum_options - ' . (1 << $option) . ' 1175 WHERE ' . $db->sql_bit_and('forum_options', $option, '<> 0'); 1176 $db->sql_query($sql); 1177 1178 // Already emptied for all... 1179 if (count($values)) 1180 { 1181 // Set for selected forums 1182 $sql = 'UPDATE ' . FORUMS_TABLE . ' 1183 SET forum_options = forum_options + ' . (1 << $option) . ' 1184 WHERE ' . $db->sql_in_set('forum_id', $values); 1185 $db->sql_query($sql); 1186 } 1187 1188 // Empty sql cache for forums table because options changed 1189 $cache->destroy('sql', FORUMS_TABLE); 1190 } 1191 1192 /** 1193 * Option to enable/disable removal of 'app.php' from URLs 1194 * 1195 * Note that if mod_rewrite is on, URLs without app.php will still work, 1196 * but any paths generated by the controller helper url() method will not 1197 * contain app.php. 1198 * 1199 * @param int $value The current config value 1200 * @param string $key The config key 1201 * @return string The HTML for the form field 1202 */ 1203 function enable_mod_rewrite($value, $key) 1204 { 1205 global $user; 1206 1207 // Determine whether mod_rewrite is enabled on the server 1208 // NOTE: This only works on Apache servers on which PHP is NOT 1209 // installed as CGI. In that case, there is no way for PHP to 1210 // determine whether or not the Apache module is enabled. 1211 // 1212 // To be clear on the value of $mod_rewite: 1213 // null = Cannot determine whether or not the server has mod_rewrite 1214 // enabled 1215 // false = Can determine that the server does NOT have mod_rewrite 1216 // enabled 1217 // true = Can determine that the server DOES have mod_rewrite_enabled 1218 $mod_rewrite = null; 1219 if (function_exists('apache_get_modules')) 1220 { 1221 $mod_rewrite = (bool) in_array('mod_rewrite', apache_get_modules()); 1222 } 1223 1224 // If $message is false, mod_rewrite is enabled. 1225 // Otherwise, it is not and we need to: 1226 // 1) disable the form field 1227 // 2) make sure the config value is set to 0 1228 // 3) append the message to the return 1229 $value = ($mod_rewrite === false) ? 0 : $value; 1230 $message = $mod_rewrite === null ? 'MOD_REWRITE_INFORMATION_UNAVAILABLE' : ($mod_rewrite === false ? 'MOD_REWRITE_DISABLED' : false); 1231 1232 // Let's do some friendly HTML injection if we want to disable the 1233 // form field because h_radio() has no pretty way of doing so 1234 $field_name = 'config[enable_mod_rewrite]' . ($message === 'MOD_REWRITE_DISABLED' ? '" disabled="disabled' : ''); 1235 1236 return h_radio($field_name, array(1 => 'YES', 0 => 'NO'), $value) . 1237 ($message !== false ? '<br /><span>' . $user->lang($message) . '</span>' : ''); 1238 } 1239 1240 function send_test_email($value, $key) 1241 { 1242 global $user; 1243 1244 return '<input class="button2" type="submit" id="' . $key . '" name="' . $key . '" value="' . $user->lang('SEND_TEST_EMAIL') . '" /> 1245 <textarea id="' . $key . '_text" name="' . $key . '_text" placeholder="' . $user->lang('MESSAGE') . '"></textarea>'; 1246 } 1247 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Mon Nov 25 19:05:08 2024 | Cross-referenced by PHPXref 0.7.1 |