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