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