Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
2.36% |
21 / 890 |
|
3.85% |
1 / 26 |
CRAP | |
0.00% |
0 / 1 |
acp_board | |
2.36% |
21 / 890 |
|
3.85% |
1 / 26 |
17608.51 | |
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 / 19 |
|
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:yes_no', '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; |
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 | foreach ($act_ary as $key => $data) |
952 | { |
953 | list($available, $value) = $data; |
954 | $act_options[] = [ |
955 | 'value' => $value, |
956 | 'selected' => $selected_value == $value, |
957 | 'label' => $user->lang($key), |
958 | 'class' => !$available ? 'disabled-option' : '', |
959 | ]; |
960 | } |
961 | |
962 | return [ |
963 | 'options' => $act_options, |
964 | ]; |
965 | } |
966 | |
967 | /** |
968 | * Maximum/Minimum username length |
969 | */ |
970 | function username_length($value, $key = '') |
971 | { |
972 | global $user; |
973 | |
974 | return [ |
975 | [ |
976 | 'tag' => 'input', |
977 | 'id' => $key, |
978 | 'type' => 'number', |
979 | 'name' => 'config[min_name_chars]', |
980 | 'min' => 1, |
981 | 'max' => 999, |
982 | 'value' => $value, |
983 | 'append' => $user->lang('MIN_CHARS') . ' ', |
984 | ], |
985 | [ |
986 | 'tag' => 'input', |
987 | 'type' => 'number', |
988 | 'name' => 'config[max_name_chars]', |
989 | 'min' => 8, |
990 | 'max' => 180, |
991 | 'value' => $this->new_config['max_name_chars'], |
992 | 'append' => $user->lang('MAX_CHARS'), |
993 | ], |
994 | ]; |
995 | } |
996 | |
997 | /** |
998 | * Allowed chars in usernames |
999 | */ |
1000 | function select_username_chars($selected_value, $key) |
1001 | { |
1002 | global $user; |
1003 | |
1004 | $user_char_ary = ['USERNAME_CHARS_ANY', 'USERNAME_ALPHA_ONLY', 'USERNAME_ALPHA_SPACERS', 'USERNAME_LETTER_NUM', 'USERNAME_LETTER_NUM_SPACERS', 'USERNAME_ASCII']; |
1005 | $user_char_options = []; |
1006 | foreach ($user_char_ary as $user_type) |
1007 | { |
1008 | $user_char_options[] = [ |
1009 | 'value' => $user_type, |
1010 | 'selected' => $selected_value == $user_type, |
1011 | 'label' => $user->lang($user_type), |
1012 | ]; |
1013 | } |
1014 | |
1015 | return [ |
1016 | 'options' => $user_char_options, |
1017 | ]; |
1018 | } |
1019 | |
1020 | /** |
1021 | * Minimum password length |
1022 | */ |
1023 | function password_length($value, $key) |
1024 | { |
1025 | global $user; |
1026 | |
1027 | return [ |
1028 | [ |
1029 | 'tag' => 'input', |
1030 | 'id' => $key, |
1031 | 'type' => 'number', |
1032 | 'name' => 'config[min_pass_chars]', |
1033 | 'value' => $value, |
1034 | 'append' => $user->lang('MIN_CHARS'), |
1035 | ], |
1036 | ]; |
1037 | } |
1038 | |
1039 | /** |
1040 | * Required chars in passwords |
1041 | */ |
1042 | function select_password_chars($selected_value, $key) |
1043 | { |
1044 | global $user; |
1045 | |
1046 | $pass_type_ary = array('PASS_TYPE_ANY', 'PASS_TYPE_CASE', 'PASS_TYPE_ALPHA', 'PASS_TYPE_SYMBOL'); |
1047 | $pass_char_options = []; |
1048 | foreach ($pass_type_ary as $pass_type) |
1049 | { |
1050 | $pass_char_options[] = [ |
1051 | 'tag' => 'select', |
1052 | 'value' => $pass_type, |
1053 | 'selected' => $selected_value == $pass_type, |
1054 | 'label' => $user->lang[$pass_type], |
1055 | ]; |
1056 | } |
1057 | |
1058 | return [ |
1059 | 'options' => $pass_char_options, |
1060 | ]; |
1061 | } |
1062 | |
1063 | /** |
1064 | * Select bump interval |
1065 | */ |
1066 | public function bump_interval($value, $key): array |
1067 | { |
1068 | $bump_type_options = []; |
1069 | $types = array('m' => 'MINUTES', 'h' => 'HOURS', 'd' => 'DAYS'); |
1070 | foreach ($types as $type => $lang) |
1071 | { |
1072 | $bump_type_options[] = [ |
1073 | 'value' => $type, |
1074 | 'selected' => $this->new_config['bump_type'] == $type, |
1075 | 'label' => $this->language->lang($lang), |
1076 | ]; |
1077 | } |
1078 | |
1079 | return [ |
1080 | [ |
1081 | 'tag' => 'input', |
1082 | 'id' => $key, |
1083 | 'type' => 'text', |
1084 | 'size' => 3, |
1085 | 'maxlength' => 4, |
1086 | 'name' => 'config[bump_interval]', |
1087 | 'value' => $value, |
1088 | ], |
1089 | [ |
1090 | 'tag' => 'select', |
1091 | 'name' => 'config[bump_type]', |
1092 | 'options' => $bump_type_options, |
1093 | ], |
1094 | ]; |
1095 | } |
1096 | |
1097 | /** |
1098 | * Wrapper function for phpbb_language_select() |
1099 | * |
1100 | * @param string $default |
1101 | * @param array $langdata |
1102 | * |
1103 | * @return array |
1104 | */ |
1105 | public function language_select(string $default = '', array $langdata = []): array |
1106 | { |
1107 | global $db; |
1108 | |
1109 | return ['options' => phpbb_language_select($db, $default, $langdata)]; |
1110 | } |
1111 | |
1112 | /** |
1113 | * Wrapper function for style_select() |
1114 | * |
1115 | * @param int|string $default Style ID to be selected in the dropdown list |
1116 | * @param bool $all Flag indicating if all styles data including inactive should be fetched |
1117 | * |
1118 | * @return array |
1119 | */ |
1120 | public function phpbb_style_select(int|string $default, bool $all): array |
1121 | { |
1122 | global $db; |
1123 | |
1124 | return ['options' => style_select($default, $all)]; |
1125 | } |
1126 | |
1127 | /** |
1128 | * Board disable option and message |
1129 | */ |
1130 | function board_disable($value, $key) |
1131 | { |
1132 | $options = phpbb_build_radio($value, $key, [1 => 'YES', 0 => 'NO']); |
1133 | |
1134 | return [ |
1135 | array_merge(['tag' => 'radio'], $options), |
1136 | [ |
1137 | 'tag' => 'input', |
1138 | 'type' => 'text', |
1139 | 'name' => 'config[board_disable_msg]', |
1140 | 'maxlength' => 255, |
1141 | 'size' => 40, |
1142 | 'id' => $key, |
1143 | 'value' => $this->new_config['board_disable_msg'] ?: '', |
1144 | ], |
1145 | ]; |
1146 | } |
1147 | |
1148 | /** |
1149 | * Board disable access for which group: admins: 0; plus global moderators: 1 and plus all moderators: 2 |
1150 | * |
1151 | * @param int $value Value from config |
1152 | * |
1153 | * @return array Options array for select |
1154 | */ |
1155 | public function board_disable_access(int $value) : array |
1156 | { |
1157 | return ['options' => [ |
1158 | [ |
1159 | 'value' => 0, |
1160 | 'selected' => $value == 0, |
1161 | 'label' => $this->language->lang('DISABLE_BOARD_ACCESS_ADMIN'), |
1162 | ], |
1163 | [ |
1164 | 'value' => 1, |
1165 | 'selected' => $value == 1, |
1166 | 'label' => $this->language->lang('DISABLE_BOARD_ACCESS_ADMIN_GLOB_MODS'), |
1167 | ], |
1168 | [ |
1169 | 'value' => 2, |
1170 | 'selected' => $value == 2, |
1171 | 'label' => $this->language->lang('DISABLE_BOARD_ACCESS_ADMIN_ALL_MODS'), |
1172 | ], |
1173 | ]]; |
1174 | } |
1175 | |
1176 | /** |
1177 | * Global quick reply enable/disable setting and button to enable in all forums |
1178 | */ |
1179 | function quick_reply($value, $key) |
1180 | { |
1181 | global $language; |
1182 | |
1183 | $options = phpbb_build_radio($value, $key, [1 => 'YES', 0 => 'NO']); |
1184 | |
1185 | return [ |
1186 | array_merge(['tag' => 'radio', 'append' => '<br><br>'], $options), |
1187 | [ |
1188 | 'tag' => 'input', |
1189 | 'type' => 'submit', |
1190 | 'class' => 'button2', |
1191 | 'name' => $key . '_enable', |
1192 | 'id' => $key . '_enable', |
1193 | 'value' => $language->lang('ALLOW_QUICK_REPLY_BUTTON'), |
1194 | ], |
1195 | ]; |
1196 | } |
1197 | |
1198 | /** |
1199 | * Select guest timezone |
1200 | */ |
1201 | function timezone_select($value, $key) |
1202 | { |
1203 | $timezone_select = phpbb_timezone_select($this->user, $value, true); |
1204 | |
1205 | return [ |
1206 | 'tag' => 'select', |
1207 | 'name' => 'config[' . $key . ']', |
1208 | 'options' => $timezone_select, |
1209 | ]; |
1210 | } |
1211 | |
1212 | /** |
1213 | * Get guest style |
1214 | */ |
1215 | public function guest_style_get() |
1216 | { |
1217 | global $db; |
1218 | |
1219 | $sql = 'SELECT user_style |
1220 | FROM ' . USERS_TABLE . ' |
1221 | WHERE user_id = ' . ANONYMOUS; |
1222 | $result = $db->sql_query($sql); |
1223 | |
1224 | $style = (int) $db->sql_fetchfield('user_style'); |
1225 | $db->sql_freeresult($result); |
1226 | |
1227 | return $style; |
1228 | } |
1229 | |
1230 | /** |
1231 | * Set guest style |
1232 | * |
1233 | * @param int $style_id The style ID |
1234 | */ |
1235 | public function guest_style_set($style_id) |
1236 | { |
1237 | global $db; |
1238 | |
1239 | $sql = 'UPDATE ' . USERS_TABLE . ' |
1240 | SET user_style = ' . (int) $style_id . ' |
1241 | WHERE user_id = ' . ANONYMOUS; |
1242 | $db->sql_query($sql); |
1243 | } |
1244 | |
1245 | /** |
1246 | * Create select for default date format |
1247 | * |
1248 | * @param string $value Current date format value |
1249 | * @param string $key Date format key |
1250 | * |
1251 | * @return array Date format select data |
1252 | */ |
1253 | public function dateformat_select(string $value, string $key): array |
1254 | { |
1255 | // Let the format_date function operate with the acp values |
1256 | $old_tz = $this->user->timezone; |
1257 | try |
1258 | { |
1259 | $this->user->timezone = new DateTimeZone($this->config['board_timezone']); |
1260 | } |
1261 | catch (\Exception $e) |
1262 | { |
1263 | // If the board timezone is invalid, we just use the users timezone. |
1264 | } |
1265 | |
1266 | $dateformat_options = []; |
1267 | |
1268 | $dateformats = $this->language->lang_raw('dateformats'); |
1269 | if (!is_array($dateformats)) |
1270 | { |
1271 | $dateformats = []; |
1272 | } |
1273 | |
1274 | foreach ($dateformats as $format => $null) |
1275 | { |
1276 | $dateformat_options[] = [ |
1277 | 'value' => $format, |
1278 | 'selected' => $format == $value, |
1279 | 'label' => $this->user->format_date(time(), $format, false) . ((strpos($format, '|') !== false) ? $this->language->lang('VARIANT_DATE_SEPARATOR') . $this->user->format_date(time(), $format, true) : '') |
1280 | ]; |
1281 | } |
1282 | |
1283 | // Add custom entry |
1284 | $dateformat_options[] = [ |
1285 | 'value' => 'custom', |
1286 | 'selected' => !isset($dateformats[$value]), |
1287 | 'label' => $this->language->lang('CUSTOM_DATEFORMAT'), |
1288 | ]; |
1289 | |
1290 | // Reset users date options |
1291 | $this->user->timezone = $old_tz; |
1292 | |
1293 | return [ |
1294 | [ |
1295 | 'tag' => 'select', |
1296 | 'name' => 'dateoptions', |
1297 | 'id' => 'dateoptions', |
1298 | 'options' => $dateformat_options, |
1299 | 'data' => [ |
1300 | 'dateoption' => $key, |
1301 | 'dateoption-default' => $value, |
1302 | ] |
1303 | ], |
1304 | [ |
1305 | 'tag' => 'input', |
1306 | 'type' => 'text', |
1307 | 'name' => "config[$key]", |
1308 | 'id' => $key, |
1309 | 'value' => $value, |
1310 | 'maxlength' => 64, |
1311 | ] |
1312 | ]; |
1313 | } |
1314 | |
1315 | /** |
1316 | * Select for multiple forums |
1317 | * |
1318 | * @param mixed $value Config value, unused |
1319 | * @param string $key Config key |
1320 | * |
1321 | * @return array Forum select data |
1322 | */ |
1323 | public function select_news_forums($value, string $key) |
1324 | { |
1325 | return $this->get_forum_select($key); |
1326 | } |
1327 | |
1328 | /** |
1329 | * Select for multiple forums to exclude |
1330 | * |
1331 | * @param mixed $value Config value, unused |
1332 | * @param string $key Config key |
1333 | * |
1334 | * @return array Forum select data |
1335 | */ |
1336 | public function select_exclude_forums($value, string $key): array |
1337 | { |
1338 | return $this->get_forum_select($key, FORUM_OPTION_FEED_EXCLUDE); |
1339 | } |
1340 | |
1341 | /** |
1342 | * Get forum select data for specified key and option |
1343 | * |
1344 | * @param string $key Config key |
1345 | * @param int $forum_option Forum option bit |
1346 | * |
1347 | * @return array Forum select data |
1348 | */ |
1349 | protected function get_forum_select(string $key, int $forum_option = FORUM_OPTION_FEED_NEWS): array |
1350 | { |
1351 | $forum_list = make_forum_select(false, false, true, true, true, false, true); |
1352 | |
1353 | // Build forum options |
1354 | $forum_options = []; |
1355 | foreach ($forum_list as $f_id => $f_row) |
1356 | { |
1357 | $forum_options[] = [ |
1358 | 'value' => $f_id, |
1359 | 'selected' => phpbb_optionget($forum_option, $f_row['forum_options']), |
1360 | 'disabled' => $f_row['disabled'], |
1361 | 'label' => $f_row['padding'] . $f_row['forum_name'], |
1362 | ]; |
1363 | } |
1364 | |
1365 | return [ |
1366 | 'tag' => 'select', |
1367 | 'id' => $key, |
1368 | 'name' => $key . '[]', |
1369 | 'multiple' => true, |
1370 | 'options' => $forum_options, |
1371 | ]; |
1372 | } |
1373 | |
1374 | function store_feed_forums($option, $key) |
1375 | { |
1376 | global $db, $cache, $request; |
1377 | |
1378 | // Get key |
1379 | $values = $request->variable($key, array(0 => 0)); |
1380 | |
1381 | // Empty option bit for all forums |
1382 | $sql = 'UPDATE ' . FORUMS_TABLE . ' |
1383 | SET forum_options = forum_options - ' . (1 << $option) . ' |
1384 | WHERE ' . $db->sql_bit_and('forum_options', $option, '<> 0'); |
1385 | $db->sql_query($sql); |
1386 | |
1387 | // Already emptied for all... |
1388 | if (count($values)) |
1389 | { |
1390 | // Set for selected forums |
1391 | $sql = 'UPDATE ' . FORUMS_TABLE . ' |
1392 | SET forum_options = forum_options + ' . (1 << $option) . ' |
1393 | WHERE ' . $db->sql_in_set('forum_id', $values); |
1394 | $db->sql_query($sql); |
1395 | } |
1396 | |
1397 | // Empty sql cache for forums table because options changed |
1398 | $cache->destroy('sql', FORUMS_TABLE); |
1399 | } |
1400 | |
1401 | /** |
1402 | * Option to enable/disable removal of 'app.php' from URLs |
1403 | * |
1404 | * Note that if mod_rewrite is on, URLs without app.php will still work, |
1405 | * but any paths generated by the controller helper url() method will not |
1406 | * contain app.php. |
1407 | * |
1408 | * @param int $value The current config value |
1409 | * @param string $key The config key |
1410 | * @return string The HTML for the form field |
1411 | */ |
1412 | function enable_mod_rewrite($value, $key) |
1413 | { |
1414 | global $language; |
1415 | |
1416 | // Determine whether mod_rewrite is enabled on the server |
1417 | // NOTE: This only works on Apache servers on which PHP is NOT |
1418 | // installed as CGI. In that case, there is no way for PHP to |
1419 | // determine whether or not the Apache module is enabled. |
1420 | // |
1421 | // To be clear on the value of $mod_rewite: |
1422 | // null = Cannot determine whether or not the server has mod_rewrite |
1423 | // enabled |
1424 | // false = Can determine that the server does NOT have mod_rewrite |
1425 | // enabled |
1426 | // true = Can determine that the server DOES have mod_rewrite_enabled |
1427 | $mod_rewrite = null; |
1428 | if (function_exists('apache_get_modules')) |
1429 | { |
1430 | $mod_rewrite = (bool) in_array('mod_rewrite', apache_get_modules()); |
1431 | } |
1432 | |
1433 | // If $message is false, mod_rewrite is enabled. |
1434 | // Otherwise, it is not and we need to: |
1435 | // 1) disable the form field |
1436 | // 2) make sure the config value is set to 0 |
1437 | // 3) append the message to the return |
1438 | $value = ($mod_rewrite === false) ? 0 : $value; |
1439 | $message = $mod_rewrite === null ? 'MOD_REWRITE_INFORMATION_UNAVAILABLE' : ($mod_rewrite === false ? 'MOD_REWRITE_DISABLED' : false); |
1440 | |
1441 | $options = phpbb_build_radio($value, $key, [1 => 'YES', 0 => 'NO']); |
1442 | foreach ($options['buttons'] as $i => $button) |
1443 | { |
1444 | $options['buttons'][$i]['disabled'] = $message === 'MOD_REWRITE_DISABLED'; |
1445 | } |
1446 | |
1447 | $tpl = array_merge( |
1448 | [ |
1449 | 'tag' => 'radio', |
1450 | 'append' => ($message !== false) ? '<br><span>' . $language->lang($message) . '</span>' : '', |
1451 | ], |
1452 | $options |
1453 | ); |
1454 | |
1455 | return $tpl; |
1456 | } |
1457 | |
1458 | function send_test_email($value, $key) |
1459 | { |
1460 | global $user; |
1461 | |
1462 | return [ |
1463 | [ |
1464 | 'tag' => 'input', |
1465 | 'type' => 'submit', |
1466 | 'name' => $key, |
1467 | 'id' => $key, |
1468 | 'class' => 'button2', |
1469 | 'value' => $user->lang('SEND_TEST_EMAIL'), |
1470 | ], |
1471 | [ |
1472 | 'tag' => 'textarea', |
1473 | 'name' => $key . '_text', |
1474 | 'id' => $key . '_text', |
1475 | 'placeholder' => $user->lang('MESSAGE'), |
1476 | ], |
1477 | ]; |
1478 | } |
1479 | |
1480 | /** |
1481 | * Generate form data for web push enable |
1482 | * |
1483 | * @param string $value Webpush enable value |
1484 | * @param string $key Webpush enable config key |
1485 | * |
1486 | * @return array[] Form data |
1487 | */ |
1488 | public function webpush_enable($value, $key): array |
1489 | { |
1490 | return [ |
1491 | [ |
1492 | 'tag' => 'radio', |
1493 | 'buttons' => [ |
1494 | [ |
1495 | 'name' => "config[$key]", |
1496 | 'label' => $this->language->lang('YES'), |
1497 | 'type' => 'radio', |
1498 | 'class' => 'radio', |
1499 | 'value' => 1, |
1500 | 'checked' => $value, |
1501 | ], |
1502 | [ |
1503 | 'name' => "config[$key]", |
1504 | 'label' => $this->language->lang('NO'), |
1505 | 'type' => 'radio', |
1506 | 'class' => 'radio', |
1507 | 'value' => 0, |
1508 | 'checked' => !$value, |
1509 | ], |
1510 | ], |
1511 | ], |
1512 | [ |
1513 | 'tag' => 'input', |
1514 | 'class' => 'button2', |
1515 | 'name' => "config[$key]", |
1516 | 'type' => 'button', |
1517 | 'value' => $this->language->lang('WEBPUSH_GENERATE_VAPID_KEYS'), |
1518 | 'data' => [ |
1519 | 'ajax' => 'generate_vapid_keys', |
1520 | ] |
1521 | ], |
1522 | ]; |
1523 | } |
1524 | } |