Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
2.35% |
21 / 892 |
|
3.85% |
1 / 26 |
CRAP | |
0.00% |
0 / 1 |
acp_board | |
2.35% |
21 / 892 |
|
3.85% |
1 / 26 |
17611.35 | |
0.00% |
0 / 1 |
main | |
0.00% |
0 / 538 |
|
0.00% |
0 / 1 |
8190 | |||
select_auth_method | |
100.00% |
21 / 21 |
|
100.00% |
1 / 1 |
4 | |||
mail_auth_select | |
0.00% |
0 / 12 |
|
0.00% |
0 / 1 |
6 | |||
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_auth_method' => array('lang' => 'SMTP_AUTH_METHOD', 'validate' => 'string', 'type' => 'select', 'method' => 'mail_auth_select', 'explain' => true), |
477 | 'smtp_username' => array('lang' => 'SMTP_USERNAME', 'validate' => 'string', 'type' => 'text:25:255', 'explain' => true), |
478 | 'smtp_password' => array('lang' => 'SMTP_PASSWORD', 'validate' => 'string', 'type' => 'password:25:255', 'explain' => true), |
479 | 'smtp_verify_peer' => array('lang' => 'SMTP_VERIFY_PEER', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), |
480 | 'smtp_verify_peer_name' => array('lang' => 'SMTP_VERIFY_PEER_NAME', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), |
481 | 'smtp_allow_self_signed'=> array('lang' => 'SMTP_ALLOW_SELF_SIGNED','validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), |
482 | |
483 | 'legend3' => 'ACP_SUBMIT_CHANGES', |
484 | ) |
485 | ); |
486 | break; |
487 | |
488 | case 'webpush': |
489 | $display_vars = [ |
490 | 'title' => 'ACP_WEBPUSH_SETTINGS', |
491 | 'vars' => [ |
492 | 'legend1' => 'GENERAL_SETTINGS', |
493 | 'webpush_enable' => ['lang' => 'WEBPUSH_ENABLE', 'validate' => 'bool', 'type' => 'custom', 'method' => 'webpush_enable', 'explain' => true], |
494 | 'webpush_vapid_public' => ['lang' => 'WEBPUSH_VAPID_PUBLIC', 'validate' => 'string', 'type' => 'text:25:255', 'explain' => true], |
495 | 'webpush_vapid_private' => ['lang' => 'WEBPUSH_VAPID_PRIVATE', 'validate' => 'string', 'type' => 'password:25:255', 'explain' => true], |
496 | 'webpush_method_default_enable' => ['lang' => 'WEBPUSH_METHOD_DEFAULT_ENABLE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true], |
497 | 'webpush_dropdown_subscribe' => ['lang' => 'WEBPUSH_DROPDOWN_SUBSCRIBE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true], |
498 | |
499 | 'legend3' => 'ACP_SUBMIT_CHANGES', |
500 | ], |
501 | ]; |
502 | break; |
503 | |
504 | default: |
505 | trigger_error('NO_MODE', E_USER_ERROR); |
506 | break; |
507 | } |
508 | |
509 | /** |
510 | * Event to add and/or modify acp_board configurations |
511 | * |
512 | * @event core.acp_board_config_edit_add |
513 | * @var array display_vars Array of config values to display and process |
514 | * @var string mode Mode of the config page we are displaying |
515 | * @var boolean submit Do we display the form or process the submission |
516 | * @since 3.1.0-a4 |
517 | */ |
518 | $vars = array('display_vars', 'mode', 'submit'); |
519 | extract($phpbb_dispatcher->trigger_event('core.acp_board_config_edit_add', compact($vars))); |
520 | |
521 | if (isset($display_vars['lang'])) |
522 | { |
523 | $user->add_lang($display_vars['lang']); |
524 | } |
525 | |
526 | $this->new_config = clone $config; |
527 | $cfg_array = (isset($_REQUEST['config'])) ? $request->variable('config', array('' => ''), true) : $this->new_config; |
528 | $error = array(); |
529 | |
530 | // Prevalidate allowed URL schemes |
531 | if ($mode == 'post') |
532 | { |
533 | $schemes = array_filter(explode(',', $cfg_array['allowed_schemes_links'])); |
534 | foreach ($schemes as $scheme) |
535 | { |
536 | if (!preg_match('#^[a-z][a-z0-9+\\-.]*$#Di', $scheme)) |
537 | { |
538 | $error[] = $this->language->lang('URL_SCHEME_INVALID', $this->language->lang('ALLOWED_SCHEMES_LINKS'), $scheme); |
539 | } |
540 | } |
541 | } |
542 | |
543 | // We validate the complete config if wished |
544 | validate_config_vars($display_vars['vars'], $cfg_array, $error); |
545 | |
546 | if ($submit && !check_form_key($form_key)) |
547 | { |
548 | $error[] = $user->lang['FORM_INVALID']; |
549 | } |
550 | // Do not write values if there is an error |
551 | if (count($error)) |
552 | { |
553 | $submit = false; |
554 | } |
555 | |
556 | // We go through the display_vars to make sure no one is trying to set variables he/she is not allowed to... |
557 | foreach ($display_vars['vars'] as $config_name => $data) |
558 | { |
559 | if (!isset($cfg_array[$config_name]) || strpos($config_name, 'legend') !== false) |
560 | { |
561 | continue; |
562 | } |
563 | |
564 | if ($config_name == 'auth_method' || $config_name == 'feed_news_id' || $config_name == 'feed_exclude_id') |
565 | { |
566 | continue; |
567 | } |
568 | |
569 | if ($config_name == 'guest_style') |
570 | { |
571 | if (isset($cfg_array[$config_name])) |
572 | { |
573 | $this->guest_style_set($cfg_array[$config_name]); |
574 | } |
575 | continue; |
576 | } |
577 | |
578 | $this->new_config[$config_name] = $config_value = $cfg_array[$config_name]; |
579 | |
580 | if ($submit) |
581 | { |
582 | if (isset($data['type']) && strpos($data['type'], 'password') === 0 && $config_value === '********') |
583 | { |
584 | /** |
585 | * Do not update password fields if the content is ********, |
586 | * because that is the password replacement we use to not |
587 | * send the password to the output |
588 | */ |
589 | continue; |
590 | } |
591 | |
592 | // Array of emoji-enabled configurations |
593 | $config_name_ary = [ |
594 | 'sitename', |
595 | 'sitename_short', |
596 | 'site_desc', |
597 | 'site_home_text', |
598 | 'board_index_text', |
599 | 'board_disable_msg', |
600 | 'board_email_sig', |
601 | ]; |
602 | |
603 | /** |
604 | * Event to manage the array of emoji-enabled configurations |
605 | * |
606 | * @event core.acp_board_config_emoji_enabled |
607 | * @var array config_name_ary Array of config names to process |
608 | * @since 3.3.3-RC1 |
609 | */ |
610 | $vars = ['config_name_ary']; |
611 | extract($phpbb_dispatcher->trigger_event('core.acp_board_config_emoji_enabled', compact($vars))); |
612 | |
613 | if (in_array($config_name, $config_name_ary)) |
614 | { |
615 | /** |
616 | * Replace Emojis and other 4bit UTF-8 chars not allowed by MySQL to UCR/NCR. |
617 | * Using their Numeric Character Reference's Hexadecimal notation. |
618 | */ |
619 | $config->set($config_name, utf8_encode_ucr($config_value)); |
620 | } |
621 | else |
622 | { |
623 | $config->set($config_name, $config_value); |
624 | } |
625 | |
626 | if ($config_name == 'allow_quick_reply' && isset($_POST['allow_quick_reply_enable'])) |
627 | { |
628 | enable_bitfield_column_flag(FORUMS_TABLE, 'forum_flags', round(log(FORUM_FLAG_QUICK_REPLY, 2))); |
629 | } |
630 | } |
631 | } |
632 | |
633 | // Invalidate the text_formatter cache when posting or server options are changed |
634 | if (preg_match('(^(?:post|server)$)', $mode) && $submit) |
635 | { |
636 | $phpbb_container->get('text_formatter.cache')->invalidate(); |
637 | } |
638 | |
639 | // Store news and exclude ids |
640 | if ($mode == 'feed' && $submit) |
641 | { |
642 | $cache->destroy('_feed_news_forum_ids'); |
643 | $cache->destroy('_feed_excluded_forum_ids'); |
644 | |
645 | $this->store_feed_forums(FORUM_OPTION_FEED_NEWS, 'feed_news_id'); |
646 | $this->store_feed_forums(FORUM_OPTION_FEED_EXCLUDE, 'feed_exclude_id'); |
647 | } |
648 | |
649 | if ($mode == 'auth') |
650 | { |
651 | // Retrieve a list of auth plugins and check their config values |
652 | /* @var $auth_providers \phpbb\auth\provider_collection */ |
653 | $auth_providers = $phpbb_container->get('auth.provider_collection'); |
654 | |
655 | $updated_auth_settings = false; |
656 | $old_auth_config = array(); |
657 | foreach ($auth_providers as $provider) |
658 | { |
659 | /** @var \phpbb\auth\provider\provider_interface $provider */ |
660 | if ($fields = $provider->acp()) |
661 | { |
662 | // Check if we need to create config fields for this plugin and save config when submit was pressed |
663 | foreach ($fields as $field) |
664 | { |
665 | if (!isset($config[$field])) |
666 | { |
667 | $config->set($field, ''); |
668 | } |
669 | |
670 | if (!isset($cfg_array[$field]) || strpos($field, 'legend') !== false) |
671 | { |
672 | continue; |
673 | } |
674 | |
675 | if (substr($field, -9) === '_password' && $cfg_array[$field] === '********') |
676 | { |
677 | // Do not update password fields if the content is ********, |
678 | // because that is the password replacement we use to not |
679 | // send the password to the output |
680 | continue; |
681 | } |
682 | |
683 | $old_auth_config[$field] = $this->new_config[$field]; |
684 | $config_value = $cfg_array[$field]; |
685 | $this->new_config[$field] = $config_value; |
686 | |
687 | if ($submit) |
688 | { |
689 | $updated_auth_settings = true; |
690 | $config->set($field, $config_value); |
691 | } |
692 | } |
693 | } |
694 | unset($fields); |
695 | } |
696 | |
697 | if ($submit && (($cfg_array['auth_method'] != $this->new_config['auth_method']) || $updated_auth_settings)) |
698 | { |
699 | $method = basename($cfg_array['auth_method']); |
700 | if (array_key_exists('auth.provider.' . $method, (array) $auth_providers)) |
701 | { |
702 | $provider = $auth_providers['auth.provider.' . $method]; |
703 | if ($error = $provider->init()) |
704 | { |
705 | foreach ($old_auth_config as $config_name => $config_value) |
706 | { |
707 | $config->set($config_name, $config_value); |
708 | } |
709 | trigger_error($error . adm_back_link($this->u_action), E_USER_WARNING); |
710 | } |
711 | $config->set('auth_method', basename($cfg_array['auth_method'])); |
712 | } |
713 | else |
714 | { |
715 | trigger_error('NO_AUTH_PLUGIN', E_USER_ERROR); |
716 | } |
717 | } |
718 | } |
719 | |
720 | if ($mode == 'email' && $request->is_set_post('send_test_email')) |
721 | { |
722 | if ($config['email_enable']) |
723 | { |
724 | include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx); |
725 | |
726 | $messenger = new messenger(false); |
727 | $messenger->template('test'); |
728 | $messenger->set_addresses($user->data); |
729 | $messenger->anti_abuse_headers($config, $user); |
730 | $messenger->assign_vars(array( |
731 | 'USERNAME' => html_entity_decode($user->data['username'], ENT_COMPAT), |
732 | 'MESSAGE' => html_entity_decode($request->variable('send_test_email_text', '', true), ENT_COMPAT), |
733 | )); |
734 | $messenger->send(NOTIFY_EMAIL); |
735 | |
736 | trigger_error($user->lang('TEST_EMAIL_SENT') . adm_back_link($this->u_action)); |
737 | } |
738 | else |
739 | { |
740 | $user->add_lang('memberlist'); |
741 | trigger_error($user->lang('EMAIL_DISABLED') . adm_back_link($this->u_action), E_USER_WARNING); |
742 | } |
743 | } |
744 | |
745 | if ($submit) |
746 | { |
747 | $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_CONFIG_' . strtoupper($mode)); |
748 | |
749 | $message = $user->lang('CONFIG_UPDATED'); |
750 | $message_type = E_USER_NOTICE; |
751 | if (!$config['email_enable'] && in_array($mode, array('email', 'registration')) && |
752 | in_array($config['require_activation'], array(USER_ACTIVATION_SELF, USER_ACTIVATION_ADMIN))) |
753 | { |
754 | $message .= '<br /><br />' . $user->lang('ACC_ACTIVATION_WARNING'); |
755 | $message_type = E_USER_WARNING; |
756 | } |
757 | trigger_error($message . adm_back_link($this->u_action), $message_type); |
758 | } |
759 | |
760 | $this->tpl_name = 'acp_board'; |
761 | $this->page_title = $display_vars['title']; |
762 | |
763 | $template->assign_vars(array( |
764 | 'L_TITLE' => $user->lang[$display_vars['title']], |
765 | 'L_TITLE_EXPLAIN' => $user->lang[$display_vars['title'] . '_EXPLAIN'], |
766 | |
767 | 'S_ERROR' => (count($error)) ? true : false, |
768 | 'ERROR_MSG' => implode('<br />', $error), |
769 | |
770 | 'U_ACTION' => $this->u_action) |
771 | ); |
772 | |
773 | // Output relevant page |
774 | foreach ($display_vars['vars'] as $config_key => $vars) |
775 | { |
776 | if (!is_array($vars) && strpos($config_key, 'legend') === false) |
777 | { |
778 | continue; |
779 | } |
780 | |
781 | if (strpos($config_key, 'legend') !== false) |
782 | { |
783 | $template->assign_block_vars('options', array( |
784 | 'S_LEGEND' => true, |
785 | 'LEGEND' => (isset($user->lang[$vars])) ? $user->lang[$vars] : $vars) |
786 | ); |
787 | |
788 | continue; |
789 | } |
790 | |
791 | $type = explode(':', $vars['type']); |
792 | |
793 | $l_explain = ''; |
794 | if ($vars['explain'] && isset($vars['lang_explain'])) |
795 | { |
796 | $l_explain = (isset($user->lang[$vars['lang_explain']])) ? $user->lang[$vars['lang_explain']] : $vars['lang_explain']; |
797 | } |
798 | else if ($vars['explain']) |
799 | { |
800 | $l_explain = (isset($user->lang[$vars['lang'] . '_EXPLAIN'])) ? $user->lang[$vars['lang'] . '_EXPLAIN'] : ''; |
801 | } |
802 | |
803 | $content = phpbb_build_cfg_template($type, $config_key, $this->new_config, $config_key, $vars); |
804 | |
805 | if (empty($content)) |
806 | { |
807 | continue; |
808 | } |
809 | |
810 | $template->assign_block_vars('options', array( |
811 | 'KEY' => $config_key, |
812 | 'TITLE' => (isset($user->lang[$vars['lang']])) ? $user->lang[$vars['lang']] : $vars['lang'], |
813 | 'S_EXPLAIN' => $vars['explain'] && !empty($l_explain), |
814 | 'TITLE_EXPLAIN' => $l_explain, |
815 | 'CONTENT' => $content, |
816 | ) |
817 | ); |
818 | |
819 | unset($display_vars['vars'][$config_key]); |
820 | } |
821 | |
822 | if ($mode == 'auth') |
823 | { |
824 | $template->assign_var('S_AUTH', true); |
825 | |
826 | foreach ($auth_providers as $provider) |
827 | { |
828 | $auth_tpl = $provider->get_acp_template($this->new_config); |
829 | if ($auth_tpl) |
830 | { |
831 | if (array_key_exists('BLOCK_VAR_NAME', $auth_tpl)) |
832 | { |
833 | foreach ($auth_tpl['BLOCK_VARS'] as $block_vars) |
834 | { |
835 | $template->assign_block_vars($auth_tpl['BLOCK_VAR_NAME'], $block_vars); |
836 | } |
837 | } |
838 | $template->assign_vars($auth_tpl['TEMPLATE_VARS']); |
839 | $template->assign_block_vars('auth_tpl', array( |
840 | 'TEMPLATE_FILE' => $auth_tpl['TEMPLATE_FILE'], |
841 | )); |
842 | } |
843 | } |
844 | } |
845 | } |
846 | |
847 | /** |
848 | * Select auth method |
849 | */ |
850 | function select_auth_method($selected_method, $key = '') |
851 | { |
852 | global $phpbb_container; |
853 | |
854 | /* @var $auth_providers \phpbb\auth\provider_collection */ |
855 | $auth_providers = $phpbb_container->get('auth.provider_collection'); |
856 | $auth_plugins = []; |
857 | |
858 | foreach ($auth_providers as $key => $value) |
859 | { |
860 | if (!($value instanceof \phpbb\auth\provider\provider_interface)) |
861 | { |
862 | continue; |
863 | } |
864 | $auth_plugins[] = str_replace('auth.provider.', '', $key); |
865 | } |
866 | |
867 | sort($auth_plugins); |
868 | |
869 | $auth_select_options = []; |
870 | foreach ($auth_plugins as $method) |
871 | { |
872 | $auth_select_options[] = [ |
873 | 'value' => $method, |
874 | 'selected' => $selected_method == $method, |
875 | 'label' => ucfirst($method), |
876 | 'data' => [ |
877 | 'toggle-setting' => "#auth_{$method}_settings", |
878 | ], |
879 | ]; |
880 | } |
881 | |
882 | return [ |
883 | 'options' => $auth_select_options, |
884 | ]; |
885 | } |
886 | |
887 | /** |
888 | * Select mail authentication method |
889 | */ |
890 | function mail_auth_select($selected_method, $key = '') |
891 | { |
892 | global $user; |
893 | |
894 | $auth_methods = ['PLAIN', 'LOGIN', 'CRAM-MD5', 'DIGEST-MD5', 'POP-BEFORE-SMTP']; |
895 | $s_smtp_auth_options = []; |
896 | |
897 | foreach ($auth_methods as $method) |
898 | { |
899 | $s_smtp_auth_options[] = [ |
900 | 'value' => $method, |
901 | 'selected' => $selected_method == $method, |
902 | 'label' => $user->lang('SMTP_' . str_replace('-', '_', $method)), |
903 | ]; |
904 | } |
905 | |
906 | return [ |
907 | 'options' => $s_smtp_auth_options, |
908 | ]; |
909 | } |
910 | |
911 | /** |
912 | * Select full folder action |
913 | */ |
914 | function full_folder_select($value, $key = '') |
915 | { |
916 | global $user; |
917 | |
918 | $full_folder_select_options = [ |
919 | 0 => [ |
920 | 'value' => 1, |
921 | 'selected' => $value == 1, |
922 | 'label' => $user->lang('DELETE_OLDEST_MESSAGES'), |
923 | ], |
924 | 1 => [ |
925 | 'value' => 2, |
926 | 'selected' => $value == 2, |
927 | 'label' => $user->lang('HOLD_NEW_MESSAGES_SHORT'), |
928 | ], |
929 | ]; |
930 | |
931 | return [ |
932 | 'options' => $full_folder_select_options, |
933 | ]; |
934 | } |
935 | |
936 | /** |
937 | * Select account activation method |
938 | */ |
939 | function select_acc_activation($selected_value, $value) |
940 | { |
941 | global $user, $config, $phpbb_dispatcher; |
942 | |
943 | $act_ary = [ |
944 | 'ACC_DISABLE' => [true, USER_ACTIVATION_DISABLE], |
945 | 'ACC_NONE' => [true, USER_ACTIVATION_NONE], |
946 | 'ACC_USER' => [$config['email_enable'], USER_ACTIVATION_SELF], |
947 | 'ACC_ADMIN' => [$config['email_enable'], USER_ACTIVATION_ADMIN], |
948 | ]; |
949 | |
950 | $act_options = []; |
951 | |
952 | /** |
953 | * Event to add and/or modify account activation configurations |
954 | * |
955 | * @event core.acp_account_activation_edit_add |
956 | * @var array act_ary Array of account activation methods |
957 | * @var array act_options Options available in the activation method |
958 | * @since 3.3.15-RC1 |
959 | */ |
960 | $vars = ['act_ary', 'act_options']; |
961 | extract($phpbb_dispatcher->trigger_event('core.acp_account_activation_edit_add', compact($vars))); |
962 | |
963 | foreach ($act_ary as $key => $data) |
964 | { |
965 | list($available, $value) = $data; |
966 | $act_options[] = [ |
967 | 'value' => $value, |
968 | 'selected' => $selected_value == $value, |
969 | 'label' => $user->lang($key), |
970 | 'class' => !$available ? 'disabled-option' : '', |
971 | ]; |
972 | } |
973 | |
974 | return [ |
975 | 'options' => $act_options, |
976 | ]; |
977 | } |
978 | |
979 | /** |
980 | * Maximum/Minimum username length |
981 | */ |
982 | function username_length($value, $key = '') |
983 | { |
984 | global $user; |
985 | |
986 | return [ |
987 | [ |
988 | 'tag' => 'input', |
989 | 'id' => $key, |
990 | 'type' => 'number', |
991 | 'name' => 'config[min_name_chars]', |
992 | 'min' => 1, |
993 | 'max' => 999, |
994 | 'value' => $value, |
995 | 'append' => $user->lang('MIN_CHARS') . ' ', |
996 | ], |
997 | [ |
998 | 'tag' => 'input', |
999 | 'type' => 'number', |
1000 | 'name' => 'config[max_name_chars]', |
1001 | 'min' => 8, |
1002 | 'max' => 180, |
1003 | 'value' => $this->new_config['max_name_chars'], |
1004 | 'append' => $user->lang('MAX_CHARS'), |
1005 | ], |
1006 | ]; |
1007 | } |
1008 | |
1009 | /** |
1010 | * Allowed chars in usernames |
1011 | */ |
1012 | function select_username_chars($selected_value, $key) |
1013 | { |
1014 | global $user; |
1015 | |
1016 | $user_char_ary = ['USERNAME_CHARS_ANY', 'USERNAME_ALPHA_ONLY', 'USERNAME_ALPHA_SPACERS', 'USERNAME_LETTER_NUM', 'USERNAME_LETTER_NUM_SPACERS', 'USERNAME_ASCII']; |
1017 | $user_char_options = []; |
1018 | foreach ($user_char_ary as $user_type) |
1019 | { |
1020 | $user_char_options[] = [ |
1021 | 'value' => $user_type, |
1022 | 'selected' => $selected_value == $user_type, |
1023 | 'label' => $user->lang($user_type), |
1024 | ]; |
1025 | } |
1026 | |
1027 | return [ |
1028 | 'options' => $user_char_options, |
1029 | ]; |
1030 | } |
1031 | |
1032 | /** |
1033 | * Minimum password length |
1034 | */ |
1035 | function password_length($value, $key) |
1036 | { |
1037 | global $user; |
1038 | |
1039 | return [ |
1040 | [ |
1041 | 'tag' => 'input', |
1042 | 'id' => $key, |
1043 | 'type' => 'number', |
1044 | 'name' => 'config[min_pass_chars]', |
1045 | 'value' => $value, |
1046 | 'append' => $user->lang('MIN_CHARS'), |
1047 | ], |
1048 | ]; |
1049 | } |
1050 | |
1051 | /** |
1052 | * Required chars in passwords |
1053 | */ |
1054 | function select_password_chars($selected_value, $key) |
1055 | { |
1056 | global $user; |
1057 | |
1058 | $pass_type_ary = array('PASS_TYPE_ANY', 'PASS_TYPE_CASE', 'PASS_TYPE_ALPHA', 'PASS_TYPE_SYMBOL'); |
1059 | $pass_char_options = []; |
1060 | foreach ($pass_type_ary as $pass_type) |
1061 | { |
1062 | $pass_char_options[] = [ |
1063 | 'tag' => 'select', |
1064 | 'value' => $pass_type, |
1065 | 'selected' => $selected_value == $pass_type, |
1066 | 'label' => $user->lang[$pass_type], |
1067 | ]; |
1068 | } |
1069 | |
1070 | return [ |
1071 | 'options' => $pass_char_options, |
1072 | ]; |
1073 | } |
1074 | |
1075 | /** |
1076 | * Select bump interval |
1077 | */ |
1078 | public function bump_interval($value, $key): array |
1079 | { |
1080 | $bump_type_options = []; |
1081 | $types = array('m' => 'MINUTES', 'h' => 'HOURS', 'd' => 'DAYS'); |
1082 | foreach ($types as $type => $lang) |
1083 | { |
1084 | $bump_type_options[] = [ |
1085 | 'value' => $type, |
1086 | 'selected' => $this->new_config['bump_type'] == $type, |
1087 | 'label' => $this->language->lang($lang), |
1088 | ]; |
1089 | } |
1090 | |
1091 | return [ |
1092 | [ |
1093 | 'tag' => 'input', |
1094 | 'id' => $key, |
1095 | 'type' => 'text', |
1096 | 'size' => 3, |
1097 | 'maxlength' => 4, |
1098 | 'name' => 'config[bump_interval]', |
1099 | 'value' => $value, |
1100 | ], |
1101 | [ |
1102 | 'tag' => 'select', |
1103 | 'name' => 'config[bump_type]', |
1104 | 'options' => $bump_type_options, |
1105 | ], |
1106 | ]; |
1107 | } |
1108 | |
1109 | /** |
1110 | * Wrapper function for phpbb_language_select() |
1111 | * |
1112 | * @param string $default |
1113 | * @param array $langdata |
1114 | * |
1115 | * @return array |
1116 | */ |
1117 | public function language_select(string $default = '', array $langdata = []): array |
1118 | { |
1119 | global $db; |
1120 | |
1121 | return ['options' => phpbb_language_select($db, $default, $langdata)]; |
1122 | } |
1123 | |
1124 | /** |
1125 | * Wrapper function for style_select() |
1126 | * |
1127 | * @param int|string $default Style ID to be selected in the dropdown list |
1128 | * @param bool $all Flag indicating if all styles data including inactive should be fetched |
1129 | * |
1130 | * @return array |
1131 | */ |
1132 | public function phpbb_style_select(int|string $default, bool $all): array |
1133 | { |
1134 | global $db; |
1135 | |
1136 | return ['options' => style_select($default, $all)]; |
1137 | } |
1138 | |
1139 | /** |
1140 | * Board disable option and message |
1141 | */ |
1142 | function board_disable($value, $key) |
1143 | { |
1144 | $options = phpbb_build_radio($value, $key, [1 => 'YES', 0 => 'NO']); |
1145 | |
1146 | return [ |
1147 | array_merge(['tag' => 'radio'], $options), |
1148 | [ |
1149 | 'tag' => 'input', |
1150 | 'type' => 'text', |
1151 | 'name' => 'config[board_disable_msg]', |
1152 | 'maxlength' => 255, |
1153 | 'size' => 40, |
1154 | 'id' => $key, |
1155 | 'value' => $this->new_config['board_disable_msg'] ?: '', |
1156 | ], |
1157 | ]; |
1158 | } |
1159 | |
1160 | /** |
1161 | * Board disable access for which group: admins: 0; plus global moderators: 1 and plus all moderators: 2 |
1162 | * |
1163 | * @param int $value Value from config |
1164 | * |
1165 | * @return array Options array for select |
1166 | */ |
1167 | public function board_disable_access(int $value) : array |
1168 | { |
1169 | return ['options' => [ |
1170 | [ |
1171 | 'value' => 0, |
1172 | 'selected' => $value == 0, |
1173 | 'label' => $this->language->lang('DISABLE_BOARD_ACCESS_ADMIN'), |
1174 | ], |
1175 | [ |
1176 | 'value' => 1, |
1177 | 'selected' => $value == 1, |
1178 | 'label' => $this->language->lang('DISABLE_BOARD_ACCESS_ADMIN_GLOB_MODS'), |
1179 | ], |
1180 | [ |
1181 | 'value' => 2, |
1182 | 'selected' => $value == 2, |
1183 | 'label' => $this->language->lang('DISABLE_BOARD_ACCESS_ADMIN_ALL_MODS'), |
1184 | ], |
1185 | ]]; |
1186 | } |
1187 | |
1188 | /** |
1189 | * Global quick reply enable/disable setting and button to enable in all forums |
1190 | */ |
1191 | function quick_reply($value, $key) |
1192 | { |
1193 | global $language; |
1194 | |
1195 | $options = phpbb_build_radio($value, $key, [1 => 'YES', 0 => 'NO']); |
1196 | |
1197 | return [ |
1198 | array_merge(['tag' => 'radio', 'append' => '<br><br>'], $options), |
1199 | [ |
1200 | 'tag' => 'input', |
1201 | 'type' => 'submit', |
1202 | 'class' => 'button2', |
1203 | 'name' => $key . '_enable', |
1204 | 'id' => $key . '_enable', |
1205 | 'value' => $language->lang('ALLOW_QUICK_REPLY_BUTTON'), |
1206 | ], |
1207 | ]; |
1208 | } |
1209 | |
1210 | /** |
1211 | * Select guest timezone |
1212 | */ |
1213 | function timezone_select($value, $key) |
1214 | { |
1215 | $timezone_select = phpbb_timezone_select($this->user, $value, true); |
1216 | |
1217 | return [ |
1218 | 'tag' => 'select', |
1219 | 'name' => 'config[' . $key . ']', |
1220 | 'options' => $timezone_select, |
1221 | ]; |
1222 | } |
1223 | |
1224 | /** |
1225 | * Get guest style |
1226 | */ |
1227 | public function guest_style_get() |
1228 | { |
1229 | global $db; |
1230 | |
1231 | $sql = 'SELECT user_style |
1232 | FROM ' . USERS_TABLE . ' |
1233 | WHERE user_id = ' . ANONYMOUS; |
1234 | $result = $db->sql_query($sql); |
1235 | |
1236 | $style = (int) $db->sql_fetchfield('user_style'); |
1237 | $db->sql_freeresult($result); |
1238 | |
1239 | return $style; |
1240 | } |
1241 | |
1242 | /** |
1243 | * Set guest style |
1244 | * |
1245 | * @param int $style_id The style ID |
1246 | */ |
1247 | public function guest_style_set($style_id) |
1248 | { |
1249 | global $db; |
1250 | |
1251 | $sql = 'UPDATE ' . USERS_TABLE . ' |
1252 | SET user_style = ' . (int) $style_id . ' |
1253 | WHERE user_id = ' . ANONYMOUS; |
1254 | $db->sql_query($sql); |
1255 | } |
1256 | |
1257 | /** |
1258 | * Create select for default date format |
1259 | * |
1260 | * @param string $value Current date format value |
1261 | * @param string $key Date format key |
1262 | * |
1263 | * @return array Date format select data |
1264 | */ |
1265 | public function dateformat_select(string $value, string $key): array |
1266 | { |
1267 | // Let the format_date function operate with the acp values |
1268 | $old_tz = $this->user->timezone; |
1269 | try |
1270 | { |
1271 | $this->user->timezone = new DateTimeZone($this->config['board_timezone']); |
1272 | } |
1273 | catch (\Exception $e) |
1274 | { |
1275 | // If the board timezone is invalid, we just use the users timezone. |
1276 | } |
1277 | |
1278 | $dateformat_options = []; |
1279 | |
1280 | $dateformats = $this->language->lang_raw('dateformats'); |
1281 | if (!is_array($dateformats)) |
1282 | { |
1283 | $dateformats = []; |
1284 | } |
1285 | |
1286 | foreach ($dateformats as $format => $null) |
1287 | { |
1288 | $dateformat_options[] = [ |
1289 | 'value' => $format, |
1290 | 'selected' => $format == $value, |
1291 | 'label' => $this->user->format_date(time(), $format, false) . ((strpos($format, '|') !== false) ? $this->language->lang('VARIANT_DATE_SEPARATOR') . $this->user->format_date(time(), $format, true) : '') |
1292 | ]; |
1293 | } |
1294 | |
1295 | // Add custom entry |
1296 | $dateformat_options[] = [ |
1297 | 'value' => 'custom', |
1298 | 'selected' => !isset($dateformats[$value]), |
1299 | 'label' => $this->language->lang('CUSTOM_DATEFORMAT'), |
1300 | ]; |
1301 | |
1302 | // Reset users date options |
1303 | $this->user->timezone = $old_tz; |
1304 | |
1305 | return [ |
1306 | [ |
1307 | 'tag' => 'select', |
1308 | 'name' => 'dateoptions', |
1309 | 'id' => 'dateoptions', |
1310 | 'options' => $dateformat_options, |
1311 | 'data' => [ |
1312 | 'dateoption' => $key, |
1313 | 'dateoption-default' => $value, |
1314 | ] |
1315 | ], |
1316 | [ |
1317 | 'tag' => 'input', |
1318 | 'type' => 'text', |
1319 | 'name' => "config[$key]", |
1320 | 'id' => $key, |
1321 | 'value' => $value, |
1322 | 'maxlength' => 64, |
1323 | ] |
1324 | ]; |
1325 | } |
1326 | |
1327 | /** |
1328 | * Select for multiple forums |
1329 | * |
1330 | * @param mixed $value Config value, unused |
1331 | * @param string $key Config key |
1332 | * |
1333 | * @return array Forum select data |
1334 | */ |
1335 | public function select_news_forums($value, string $key) |
1336 | { |
1337 | return $this->get_forum_select($key); |
1338 | } |
1339 | |
1340 | /** |
1341 | * Select for multiple forums to exclude |
1342 | * |
1343 | * @param mixed $value Config value, unused |
1344 | * @param string $key Config key |
1345 | * |
1346 | * @return array Forum select data |
1347 | */ |
1348 | public function select_exclude_forums($value, string $key): array |
1349 | { |
1350 | return $this->get_forum_select($key, FORUM_OPTION_FEED_EXCLUDE); |
1351 | } |
1352 | |
1353 | /** |
1354 | * Get forum select data for specified key and option |
1355 | * |
1356 | * @param string $key Config key |
1357 | * @param int $forum_option Forum option bit |
1358 | * |
1359 | * @return array Forum select data |
1360 | */ |
1361 | protected function get_forum_select(string $key, int $forum_option = FORUM_OPTION_FEED_NEWS): array |
1362 | { |
1363 | $forum_list = make_forum_select(false, false, true, true, true, false, true); |
1364 | |
1365 | // Build forum options |
1366 | $forum_options = []; |
1367 | foreach ($forum_list as $f_id => $f_row) |
1368 | { |
1369 | $forum_options[] = [ |
1370 | 'value' => $f_id, |
1371 | 'selected' => phpbb_optionget($forum_option, $f_row['forum_options']), |
1372 | 'disabled' => $f_row['disabled'], |
1373 | 'label' => $f_row['padding'] . $f_row['forum_name'], |
1374 | ]; |
1375 | } |
1376 | |
1377 | return [ |
1378 | 'tag' => 'select', |
1379 | 'id' => $key, |
1380 | 'name' => $key . '[]', |
1381 | 'multiple' => true, |
1382 | 'options' => $forum_options, |
1383 | ]; |
1384 | } |
1385 | |
1386 | function store_feed_forums($option, $key) |
1387 | { |
1388 | global $db, $cache, $request; |
1389 | |
1390 | // Get key |
1391 | $values = $request->variable($key, array(0 => 0)); |
1392 | |
1393 | // Empty option bit for all forums |
1394 | $sql = 'UPDATE ' . FORUMS_TABLE . ' |
1395 | SET forum_options = forum_options - ' . (1 << $option) . ' |
1396 | WHERE ' . $db->sql_bit_and('forum_options', $option, '<> 0'); |
1397 | $db->sql_query($sql); |
1398 | |
1399 | // Already emptied for all... |
1400 | if (count($values)) |
1401 | { |
1402 | // Set for selected forums |
1403 | $sql = 'UPDATE ' . FORUMS_TABLE . ' |
1404 | SET forum_options = forum_options + ' . (1 << $option) . ' |
1405 | WHERE ' . $db->sql_in_set('forum_id', $values); |
1406 | $db->sql_query($sql); |
1407 | } |
1408 | |
1409 | // Empty sql cache for forums table because options changed |
1410 | $cache->destroy('sql', FORUMS_TABLE); |
1411 | } |
1412 | |
1413 | /** |
1414 | * Option to enable/disable removal of 'app.php' from URLs |
1415 | * |
1416 | * Note that if mod_rewrite is on, URLs without app.php will still work, |
1417 | * but any paths generated by the controller helper url() method will not |
1418 | * contain app.php. |
1419 | * |
1420 | * @param int $value The current config value |
1421 | * @param string $key The config key |
1422 | * @return string The HTML for the form field |
1423 | */ |
1424 | function enable_mod_rewrite($value, $key) |
1425 | { |
1426 | global $language; |
1427 | |
1428 | // Determine whether mod_rewrite is enabled on the server |
1429 | // NOTE: This only works on Apache servers on which PHP is NOT |
1430 | // installed as CGI. In that case, there is no way for PHP to |
1431 | // determine whether or not the Apache module is enabled. |
1432 | // |
1433 | // To be clear on the value of $mod_rewite: |
1434 | // null = Cannot determine whether or not the server has mod_rewrite |
1435 | // enabled |
1436 | // false = Can determine that the server does NOT have mod_rewrite |
1437 | // enabled |
1438 | // true = Can determine that the server DOES have mod_rewrite_enabled |
1439 | $mod_rewrite = null; |
1440 | if (function_exists('apache_get_modules')) |
1441 | { |
1442 | $mod_rewrite = (bool) in_array('mod_rewrite', apache_get_modules()); |
1443 | } |
1444 | |
1445 | // If $message is false, mod_rewrite is enabled. |
1446 | // Otherwise, it is not and we need to: |
1447 | // 1) disable the form field |
1448 | // 2) make sure the config value is set to 0 |
1449 | // 3) append the message to the return |
1450 | $value = ($mod_rewrite === false) ? 0 : $value; |
1451 | $message = $mod_rewrite === null ? 'MOD_REWRITE_INFORMATION_UNAVAILABLE' : ($mod_rewrite === false ? 'MOD_REWRITE_DISABLED' : false); |
1452 | |
1453 | $options = phpbb_build_radio($value, $key, [1 => 'YES', 0 => 'NO']); |
1454 | foreach ($options['buttons'] as $i => $button) |
1455 | { |
1456 | $options['buttons'][$i]['disabled'] = $message === 'MOD_REWRITE_DISABLED'; |
1457 | } |
1458 | |
1459 | $tpl = array_merge( |
1460 | [ |
1461 | 'tag' => 'radio', |
1462 | 'append' => ($message !== false) ? '<br><span>' . $language->lang($message) . '</span>' : '', |
1463 | ], |
1464 | $options |
1465 | ); |
1466 | |
1467 | return $tpl; |
1468 | } |
1469 | |
1470 | function send_test_email($value, $key) |
1471 | { |
1472 | global $user; |
1473 | |
1474 | return [ |
1475 | [ |
1476 | 'tag' => 'input', |
1477 | 'type' => 'submit', |
1478 | 'name' => $key, |
1479 | 'id' => $key, |
1480 | 'class' => 'button2', |
1481 | 'value' => $user->lang('SEND_TEST_EMAIL'), |
1482 | ], |
1483 | [ |
1484 | 'tag' => 'textarea', |
1485 | 'name' => $key . '_text', |
1486 | 'id' => $key . '_text', |
1487 | 'placeholder' => $user->lang('MESSAGE'), |
1488 | ], |
1489 | ]; |
1490 | } |
1491 | |
1492 | /** |
1493 | * Generate form data for web push enable |
1494 | * |
1495 | * @param string $value Webpush enable value |
1496 | * @param string $key Webpush enable config key |
1497 | * |
1498 | * @return array[] Form data |
1499 | */ |
1500 | public function webpush_enable($value, $key): array |
1501 | { |
1502 | return [ |
1503 | [ |
1504 | 'tag' => 'radio', |
1505 | 'buttons' => [ |
1506 | [ |
1507 | 'name' => "config[$key]", |
1508 | 'label' => $this->language->lang('YES'), |
1509 | 'type' => 'radio', |
1510 | 'class' => 'radio', |
1511 | 'value' => 1, |
1512 | 'checked' => $value, |
1513 | ], |
1514 | [ |
1515 | 'name' => "config[$key]", |
1516 | 'label' => $this->language->lang('NO'), |
1517 | 'type' => 'radio', |
1518 | 'class' => 'radio', |
1519 | 'value' => 0, |
1520 | 'checked' => !$value, |
1521 | ], |
1522 | ], |
1523 | ], |
1524 | [ |
1525 | 'tag' => 'input', |
1526 | 'class' => 'button2', |
1527 | 'name' => "config[$key]", |
1528 | 'type' => 'button', |
1529 | 'value' => $this->language->lang('WEBPUSH_GENERATE_VAPID_KEYS'), |
1530 | 'data' => [ |
1531 | 'ajax' => 'generate_vapid_keys', |
1532 | ] |
1533 | ], |
1534 | ]; |
1535 | } |
1536 | } |