|
1 <?php |
|
2 /** |
|
3 * |
|
4 * @package acp |
|
5 * @version $Id$ |
|
6 * @copyright (c) 2005 phpBB Group |
|
7 * @license http://opensource.org/licenses/gpl-license.php GNU Public License |
|
8 * |
|
9 * @todo add cron intervals to server settings? (database_gc, queue_interval, session_gc, search_gc, cache_gc, warnings_gc) |
|
10 */ |
|
11 |
|
12 /** |
|
13 * @ignore |
|
14 */ |
|
15 if (!defined('IN_PHPBB')) |
|
16 { |
|
17 exit; |
|
18 } |
|
19 |
|
20 /** |
|
21 * @package acp |
|
22 */ |
|
23 class acp_board |
|
24 { |
|
25 var $u_action; |
|
26 var $new_config = array(); |
|
27 |
|
28 function main($id, $mode) |
|
29 { |
|
30 global $db, $user, $auth, $template; |
|
31 global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx; |
|
32 global $cache; |
|
33 |
|
34 $user->add_lang('acp/board'); |
|
35 |
|
36 $action = request_var('action', ''); |
|
37 $submit = (isset($_POST['submit']) || isset($_POST['allow_quick_reply_enable'])) ? true : false; |
|
38 |
|
39 $form_key = 'acp_board'; |
|
40 add_form_key($form_key); |
|
41 |
|
42 /** |
|
43 * Validation types are: |
|
44 * string, int, bool, |
|
45 * script_path (absolute path in url - beginning with / and no trailing slash), |
|
46 * rpath (relative), rwpath (realtive, writable), path (relative path, but able to escape the root), wpath (writable) |
|
47 */ |
|
48 switch ($mode) |
|
49 { |
|
50 case 'settings': |
|
51 $display_vars = array( |
|
52 'title' => 'ACP_BOARD_SETTINGS', |
|
53 'vars' => array( |
|
54 'legend1' => 'ACP_BOARD_SETTINGS', |
|
55 'sitename' => array('lang' => 'SITE_NAME', 'validate' => 'string', 'type' => 'text:40:255', 'explain' => false), |
|
56 'site_desc' => array('lang' => 'SITE_DESC', 'validate' => 'string', 'type' => 'text:40:255', 'explain' => false), |
|
57 'board_disable' => array('lang' => 'DISABLE_BOARD', 'validate' => 'bool', 'type' => 'custom', 'method' => 'board_disable', 'explain' => true), |
|
58 'board_disable_msg' => false, |
|
59 'default_lang' => array('lang' => 'DEFAULT_LANGUAGE', 'validate' => 'lang', 'type' => 'select', 'function' => 'language_select', 'params' => array('{CONFIG_VALUE}'), 'explain' => false), |
|
60 'default_dateformat' => array('lang' => 'DEFAULT_DATE_FORMAT', 'validate' => 'string', 'type' => 'custom', 'method' => 'dateformat_select', 'explain' => true), |
|
61 'board_timezone' => array('lang' => 'SYSTEM_TIMEZONE', 'validate' => 'string', 'type' => 'select', 'function' => 'tz_select', 'params' => array('{CONFIG_VALUE}', 1), 'explain' => true), |
|
62 'board_dst' => array('lang' => 'SYSTEM_DST', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), |
|
63 'default_style' => array('lang' => 'DEFAULT_STYLE', 'validate' => 'int', 'type' => 'select', 'function' => 'style_select', 'params' => array('{CONFIG_VALUE}', false), 'explain' => false), |
|
64 'override_user_style' => array('lang' => 'OVERRIDE_STYLE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), |
|
65 |
|
66 'legend2' => 'WARNINGS', |
|
67 'warnings_expire_days' => array('lang' => 'WARNINGS_EXPIRE', 'validate' => 'int', 'type' => 'text:3:4', 'explain' => true, 'append' => ' ' . $user->lang['DAYS']), |
|
68 |
|
69 'legend3' => 'ACP_SUBMIT_CHANGES', |
|
70 ) |
|
71 ); |
|
72 break; |
|
73 |
|
74 case 'features': |
|
75 $display_vars = array( |
|
76 'title' => 'ACP_BOARD_FEATURES', |
|
77 'vars' => array( |
|
78 'legend1' => 'ACP_BOARD_FEATURES', |
|
79 'allow_privmsg' => array('lang' => 'BOARD_PM', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), |
|
80 'allow_topic_notify' => array('lang' => 'ALLOW_TOPIC_NOTIFY', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), |
|
81 'allow_forum_notify' => array('lang' => 'ALLOW_FORUM_NOTIFY', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), |
|
82 'allow_namechange' => array('lang' => 'ALLOW_NAME_CHANGE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), |
|
83 'allow_attachments' => array('lang' => 'ALLOW_ATTACHMENTS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), |
|
84 'allow_pm_attach' => array('lang' => 'ALLOW_PM_ATTACHMENTS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), |
|
85 'allow_pm_report' => array('lang' => 'ALLOW_PM_REPORT', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), |
|
86 'allow_bbcode' => array('lang' => 'ALLOW_BBCODE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), |
|
87 'allow_smilies' => array('lang' => 'ALLOW_SMILIES', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), |
|
88 'allow_sig' => array('lang' => 'ALLOW_SIG', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), |
|
89 'allow_nocensors' => array('lang' => 'ALLOW_NO_CENSORS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), |
|
90 'allow_bookmarks' => array('lang' => 'ALLOW_BOOKMARKS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), |
|
91 'allow_birthdays' => array('lang' => 'ALLOW_BIRTHDAYS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), |
|
92 'allow_quick_reply' => array('lang' => 'ALLOW_QUICK_REPLY', 'validate' => 'bool', 'type' => 'custom', 'method' => 'quick_reply', 'explain' => true), |
|
93 |
|
94 'legend2' => 'ACP_LOAD_SETTINGS', |
|
95 'load_birthdays' => array('lang' => 'YES_BIRTHDAYS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), |
|
96 'load_moderators' => array('lang' => 'YES_MODERATORS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), |
|
97 'load_jumpbox' => array('lang' => 'YES_JUMPBOX', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), |
|
98 'load_cpf_memberlist' => array('lang' => 'LOAD_CPF_MEMBERLIST', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), |
|
99 'load_cpf_viewprofile' => array('lang' => 'LOAD_CPF_VIEWPROFILE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), |
|
100 'load_cpf_viewtopic' => array('lang' => 'LOAD_CPF_VIEWTOPIC', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), |
|
101 |
|
102 'legend3' => 'ACP_SUBMIT_CHANGES', |
|
103 ) |
|
104 ); |
|
105 break; |
|
106 |
|
107 case 'avatar': |
|
108 $display_vars = array( |
|
109 'title' => 'ACP_AVATAR_SETTINGS', |
|
110 'vars' => array( |
|
111 'legend1' => 'ACP_AVATAR_SETTINGS', |
|
112 |
|
113 'avatar_min_width' => array('lang' => 'MIN_AVATAR_SIZE', 'validate' => 'int:0', 'type' => false, 'method' => false, 'explain' => false,), |
|
114 'avatar_min_height' => array('lang' => 'MIN_AVATAR_SIZE', 'validate' => 'int:0', 'type' => false, 'method' => false, 'explain' => false,), |
|
115 'avatar_max_width' => array('lang' => 'MAX_AVATAR_SIZE', 'validate' => 'int:0', 'type' => false, 'method' => false, 'explain' => false,), |
|
116 'avatar_max_height' => array('lang' => 'MAX_AVATAR_SIZE', 'validate' => 'int:0', 'type' => false, 'method' => false, 'explain' => false,), |
|
117 |
|
118 'allow_avatar' => array('lang' => 'ALLOW_AVATARS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), |
|
119 'allow_avatar_local' => array('lang' => 'ALLOW_LOCAL', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), |
|
120 'allow_avatar_remote' => array('lang' => 'ALLOW_REMOTE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), |
|
121 'allow_avatar_upload' => array('lang' => 'ALLOW_UPLOAD', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), |
|
122 'allow_avatar_remote_upload'=> array('lang' => 'ALLOW_REMOTE_UPLOAD', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), |
|
123 'avatar_filesize' => array('lang' => 'MAX_FILESIZE', 'validate' => 'int:0', 'type' => 'text:4:10', 'explain' => true, 'append' => ' ' . $user->lang['BYTES']), |
|
124 'avatar_min' => array('lang' => 'MIN_AVATAR_SIZE', 'validate' => 'int:0', 'type' => 'dimension:3:4', 'explain' => true, 'append' => ' ' . $user->lang['PIXEL']), |
|
125 'avatar_max' => array('lang' => 'MAX_AVATAR_SIZE', 'validate' => 'int:0', 'type' => 'dimension:3:4', 'explain' => true, 'append' => ' ' . $user->lang['PIXEL']), |
|
126 'avatar_path' => array('lang' => 'AVATAR_STORAGE_PATH', 'validate' => 'rwpath', 'type' => 'text:20:255', 'explain' => true), |
|
127 'avatar_gallery_path' => array('lang' => 'AVATAR_GALLERY_PATH', 'validate' => 'rpath', 'type' => 'text:20:255', 'explain' => true) |
|
128 ) |
|
129 ); |
|
130 break; |
|
131 |
|
132 case 'message': |
|
133 $display_vars = array( |
|
134 'title' => 'ACP_MESSAGE_SETTINGS', |
|
135 'lang' => 'ucp', |
|
136 'vars' => array( |
|
137 'legend1' => 'GENERAL_SETTINGS', |
|
138 'allow_privmsg' => array('lang' => 'BOARD_PM', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), |
|
139 'pm_max_boxes' => array('lang' => 'BOXES_MAX', 'validate' => 'int:0', 'type' => 'text:4:4', 'explain' => true), |
|
140 'pm_max_msgs' => array('lang' => 'BOXES_LIMIT', 'validate' => 'int:0', 'type' => 'text:4:4', 'explain' => true), |
|
141 'full_folder_action' => array('lang' => 'FULL_FOLDER_ACTION', 'validate' => 'int', 'type' => 'select', 'method' => 'full_folder_select', 'explain' => true), |
|
142 'pm_edit_time' => array('lang' => 'PM_EDIT_TIME', 'validate' => 'int:0', 'type' => 'text:5:5', 'explain' => true, 'append' => ' ' . $user->lang['MINUTES']), |
|
143 'pm_max_recipients' => array('lang' => 'PM_MAX_RECIPIENTS', 'validate' => 'int:0', 'type' => 'text:5:5', 'explain' => true), |
|
144 |
|
145 'legend2' => 'GENERAL_OPTIONS', |
|
146 'allow_mass_pm' => array('lang' => 'ALLOW_MASS_PM', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), |
|
147 'auth_bbcode_pm' => array('lang' => 'ALLOW_BBCODE_PM', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), |
|
148 'auth_smilies_pm' => array('lang' => 'ALLOW_SMILIES_PM', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), |
|
149 'allow_pm_attach' => array('lang' => 'ALLOW_PM_ATTACHMENTS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), |
|
150 'allow_sig_pm' => array('lang' => 'ALLOW_SIG_PM', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), |
|
151 'print_pm' => array('lang' => 'ALLOW_PRINT_PM', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), |
|
152 'forward_pm' => array('lang' => 'ALLOW_FORWARD_PM', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), |
|
153 'auth_img_pm' => array('lang' => 'ALLOW_IMG_PM', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), |
|
154 'auth_flash_pm' => array('lang' => 'ALLOW_FLASH_PM', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), |
|
155 'enable_pm_icons' => array('lang' => 'ENABLE_PM_ICONS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), |
|
156 |
|
157 'legend3' => 'ACP_SUBMIT_CHANGES', |
|
158 ) |
|
159 ); |
|
160 break; |
|
161 |
|
162 case 'post': |
|
163 $display_vars = array( |
|
164 'title' => 'ACP_POST_SETTINGS', |
|
165 'vars' => array( |
|
166 'legend1' => 'GENERAL_OPTIONS', |
|
167 'allow_topic_notify' => array('lang' => 'ALLOW_TOPIC_NOTIFY', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), |
|
168 'allow_forum_notify' => array('lang' => 'ALLOW_FORUM_NOTIFY', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), |
|
169 'allow_bbcode' => array('lang' => 'ALLOW_BBCODE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), |
|
170 'allow_post_flash' => array('lang' => 'ALLOW_POST_FLASH', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), |
|
171 'allow_smilies' => array('lang' => 'ALLOW_SMILIES', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), |
|
172 'allow_post_links' => array('lang' => 'ALLOW_POST_LINKS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), |
|
173 'allow_nocensors' => array('lang' => 'ALLOW_NO_CENSORS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), |
|
174 'allow_bookmarks' => array('lang' => 'ALLOW_BOOKMARKS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), |
|
175 'enable_post_confirm' => array('lang' => 'VISUAL_CONFIRM_POST', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), |
|
176 'allow_quick_reply' => array('lang' => 'ALLOW_QUICK_REPLY', 'validate' => 'bool', 'type' => 'custom', 'method' => 'quick_reply', 'explain' => true), |
|
177 |
|
178 'legend2' => 'POSTING', |
|
179 'bump_type' => false, |
|
180 'edit_time' => array('lang' => 'EDIT_TIME', 'validate' => 'int:0', 'type' => 'text:5:5', 'explain' => true, 'append' => ' ' . $user->lang['MINUTES']), |
|
181 'delete_time' => array('lang' => 'DELETE_TIME', 'validate' => 'int:0', 'type' => 'text:5:5', 'explain' => true, 'append' => ' ' . $user->lang['MINUTES']), |
|
182 'display_last_edited' => array('lang' => 'DISPLAY_LAST_EDITED', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), |
|
183 'flood_interval' => array('lang' => 'FLOOD_INTERVAL', 'validate' => 'int:0', 'type' => 'text:3:10', 'explain' => true, 'append' => ' ' . $user->lang['SECONDS']), |
|
184 'bump_interval' => array('lang' => 'BUMP_INTERVAL', 'validate' => 'int:0', 'type' => 'custom', 'method' => 'bump_interval', 'explain' => true), |
|
185 'topics_per_page' => array('lang' => 'TOPICS_PER_PAGE', 'validate' => 'int:1', 'type' => 'text:3:4', 'explain' => false), |
|
186 'posts_per_page' => array('lang' => 'POSTS_PER_PAGE', 'validate' => 'int:1', 'type' => 'text:3:4', 'explain' => false), |
|
187 'smilies_per_page' => array('lang' => 'SMILIES_PER_PAGE', 'validate' => 'int:1', 'type' => 'text:3:4', 'explain' => false), |
|
188 'hot_threshold' => array('lang' => 'HOT_THRESHOLD', 'validate' => 'int:0', 'type' => 'text:3:4', 'explain' => true), |
|
189 'max_poll_options' => array('lang' => 'MAX_POLL_OPTIONS', 'validate' => 'int:2:127', 'type' => 'text:4:4', 'explain' => false), |
|
190 'max_post_chars' => array('lang' => 'CHAR_LIMIT', 'validate' => 'int:0', 'type' => 'text:4:6', 'explain' => true), |
|
191 'min_post_chars' => array('lang' => 'MIN_CHAR_LIMIT', 'validate' => 'int:1', 'type' => 'text:4:6', 'explain' => true), |
|
192 'max_post_smilies' => array('lang' => 'SMILIES_LIMIT', 'validate' => 'int:0', 'type' => 'text:4:4', 'explain' => true), |
|
193 'max_post_urls' => array('lang' => 'MAX_POST_URLS', 'validate' => 'int:0', 'type' => 'text:5:4', 'explain' => true), |
|
194 'max_post_font_size' => array('lang' => 'MAX_POST_FONT_SIZE', 'validate' => 'int:0', 'type' => 'text:5:4', 'explain' => true, 'append' => ' %'), |
|
195 'max_quote_depth' => array('lang' => 'QUOTE_DEPTH_LIMIT', 'validate' => 'int:0', 'type' => 'text:4:4', 'explain' => true), |
|
196 'max_post_img_width' => array('lang' => 'MAX_POST_IMG_WIDTH', 'validate' => 'int:0', 'type' => 'text:5:4', 'explain' => true, 'append' => ' ' . $user->lang['PIXEL']), |
|
197 'max_post_img_height' => array('lang' => 'MAX_POST_IMG_HEIGHT', 'validate' => 'int:0', 'type' => 'text:5:4', 'explain' => true, 'append' => ' ' . $user->lang['PIXEL']), |
|
198 |
|
199 'legend3' => 'ACP_SUBMIT_CHANGES', |
|
200 ) |
|
201 ); |
|
202 break; |
|
203 |
|
204 case 'signature': |
|
205 $display_vars = array( |
|
206 'title' => 'ACP_SIGNATURE_SETTINGS', |
|
207 'vars' => array( |
|
208 'legend1' => 'GENERAL_OPTIONS', |
|
209 'allow_sig' => array('lang' => 'ALLOW_SIG', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), |
|
210 'allow_sig_bbcode' => array('lang' => 'ALLOW_SIG_BBCODE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), |
|
211 'allow_sig_img' => array('lang' => 'ALLOW_SIG_IMG', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), |
|
212 'allow_sig_flash' => array('lang' => 'ALLOW_SIG_FLASH', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), |
|
213 'allow_sig_smilies' => array('lang' => 'ALLOW_SIG_SMILIES', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), |
|
214 'allow_sig_links' => array('lang' => 'ALLOW_SIG_LINKS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), |
|
215 |
|
216 'legend2' => 'GENERAL_SETTINGS', |
|
217 'max_sig_chars' => array('lang' => 'MAX_SIG_LENGTH', 'validate' => 'int:0', 'type' => 'text:5:4', 'explain' => true), |
|
218 'max_sig_urls' => array('lang' => 'MAX_SIG_URLS', 'validate' => 'int:0', 'type' => 'text:5:4', 'explain' => true), |
|
219 'max_sig_font_size' => array('lang' => 'MAX_SIG_FONT_SIZE', 'validate' => 'int:0', 'type' => 'text:5:4', 'explain' => true, 'append' => ' %'), |
|
220 'max_sig_smilies' => array('lang' => 'MAX_SIG_SMILIES', 'validate' => 'int:0', 'type' => 'text:5:4', 'explain' => true), |
|
221 'max_sig_img_width' => array('lang' => 'MAX_SIG_IMG_WIDTH', 'validate' => 'int:0', 'type' => 'text:5:4', 'explain' => true, 'append' => ' ' . $user->lang['PIXEL']), |
|
222 'max_sig_img_height' => array('lang' => 'MAX_SIG_IMG_HEIGHT', 'validate' => 'int:0', 'type' => 'text:5:4', 'explain' => true, 'append' => ' ' . $user->lang['PIXEL']), |
|
223 |
|
224 'legend3' => 'ACP_SUBMIT_CHANGES', |
|
225 ) |
|
226 ); |
|
227 break; |
|
228 |
|
229 case 'registration': |
|
230 $display_vars = array( |
|
231 'title' => 'ACP_REGISTER_SETTINGS', |
|
232 'vars' => array( |
|
233 'legend1' => 'GENERAL_SETTINGS', |
|
234 'max_name_chars' => array('lang' => 'USERNAME_LENGTH', 'validate' => 'int:8:180', 'type' => false, 'method' => false, 'explain' => false,), |
|
235 'max_pass_chars' => array('lang' => 'PASSWORD_LENGTH', 'validate' => 'int:8:255', 'type' => false, 'method' => false, 'explain' => false,), |
|
236 |
|
237 'require_activation' => array('lang' => 'ACC_ACTIVATION', 'validate' => 'int', 'type' => 'custom', 'method' => 'select_acc_activation', 'explain' => true), |
|
238 'new_member_post_limit' => array('lang' => 'NEW_MEMBER_POST_LIMIT', 'validate' => 'int:0:255', 'type' => 'text:4:4', 'explain' => true, 'append' => ' ' . $user->lang['POSTS']), |
|
239 'new_member_group_default'=> array('lang' => 'NEW_MEMBER_GROUP_DEFAULT', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), |
|
240 'min_name_chars' => array('lang' => 'USERNAME_LENGTH', 'validate' => 'int:1', 'type' => 'custom:5:180', 'method' => 'username_length', 'explain' => true), |
|
241 'min_pass_chars' => array('lang' => 'PASSWORD_LENGTH', 'validate' => 'int:1', 'type' => 'custom', 'method' => 'password_length', 'explain' => true), |
|
242 'allow_name_chars' => array('lang' => 'USERNAME_CHARS', 'validate' => 'string', 'type' => 'select', 'method' => 'select_username_chars', 'explain' => true), |
|
243 'pass_complex' => array('lang' => 'PASSWORD_TYPE', 'validate' => 'string', 'type' => 'select', 'method' => 'select_password_chars', 'explain' => true), |
|
244 'chg_passforce' => array('lang' => 'FORCE_PASS_CHANGE', 'validate' => 'int:0', 'type' => 'text:3:3', 'explain' => true, 'append' => ' ' . $user->lang['DAYS']), |
|
245 |
|
246 'legend2' => 'GENERAL_OPTIONS', |
|
247 'allow_namechange' => array('lang' => 'ALLOW_NAME_CHANGE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), |
|
248 'allow_emailreuse' => array('lang' => 'ALLOW_EMAIL_REUSE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), |
|
249 'enable_confirm' => array('lang' => 'VISUAL_CONFIRM_REG', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), |
|
250 'max_login_attempts' => array('lang' => 'MAX_LOGIN_ATTEMPTS', 'validate' => 'int:0', 'type' => 'text:3:3', 'explain' => true), |
|
251 'max_reg_attempts' => array('lang' => 'REG_LIMIT', 'validate' => 'int:0', 'type' => 'text:4:4', 'explain' => true), |
|
252 |
|
253 'legend3' => 'COPPA', |
|
254 'coppa_enable' => array('lang' => 'ENABLE_COPPA', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), |
|
255 'coppa_mail' => array('lang' => 'COPPA_MAIL', 'validate' => 'string', 'type' => 'textarea:5:40', 'explain' => true), |
|
256 'coppa_fax' => array('lang' => 'COPPA_FAX', 'validate' => 'string', 'type' => 'text:25:100', 'explain' => false), |
|
257 |
|
258 'legend4' => 'ACP_SUBMIT_CHANGES', |
|
259 ) |
|
260 ); |
|
261 break; |
|
262 |
|
263 case 'feed': |
|
264 $display_vars = array( |
|
265 'title' => 'ACP_FEED_MANAGEMENT', |
|
266 'vars' => array( |
|
267 'legend1' => 'ACP_FEED_GENERAL', |
|
268 'feed_enable' => array('lang' => 'ACP_FEED_ENABLE', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true ), |
|
269 'feed_item_statistics' => array('lang' => 'ACP_FEED_ITEM_STATISTICS', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), |
|
270 'feed_http_auth' => array('lang' => 'ACP_FEED_HTTP_AUTH', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), |
|
271 |
|
272 'legend2' => 'ACP_FEED_POST_BASED', |
|
273 'feed_limit_post' => array('lang' => 'ACP_FEED_LIMIT', 'validate' => 'int:5', 'type' => 'text:3:4', 'explain' => true), |
|
274 'feed_overall' => array('lang' => 'ACP_FEED_OVERALL', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true ), |
|
275 'feed_forum' => array('lang' => 'ACP_FEED_FORUM', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true ), |
|
276 'feed_topic' => array('lang' => 'ACP_FEED_TOPIC', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true ), |
|
277 |
|
278 'legend3' => 'ACP_FEED_TOPIC_BASED', |
|
279 'feed_limit_topic' => array('lang' => 'ACP_FEED_LIMIT', 'validate' => 'int:5', 'type' => 'text:3:4', 'explain' => true), |
|
280 'feed_topics_new' => array('lang' => 'ACP_FEED_TOPICS_NEW', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true ), |
|
281 'feed_topics_active' => array('lang' => 'ACP_FEED_TOPICS_ACTIVE', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true ), |
|
282 'feed_news_id' => array('lang' => 'ACP_FEED_NEWS', 'validate' => 'string', 'type' => 'custom', 'method' => 'select_news_forums', 'explain' => true), |
|
283 |
|
284 'legend4' => 'ACP_FEED_SETTINGS_OTHER', |
|
285 'feed_overall_forums' => array('lang' => 'ACP_FEED_OVERALL_FORUMS', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true ), |
|
286 'feed_exclude_id' => array('lang' => 'ACP_FEED_EXCLUDE_ID', 'validate' => 'string', 'type' => 'custom', 'method' => 'select_exclude_forums', 'explain' => true), |
|
287 ) |
|
288 ); |
|
289 break; |
|
290 |
|
291 case 'cookie': |
|
292 $display_vars = array( |
|
293 'title' => 'ACP_COOKIE_SETTINGS', |
|
294 'vars' => array( |
|
295 'legend1' => 'ACP_COOKIE_SETTINGS', |
|
296 'cookie_domain' => array('lang' => 'COOKIE_DOMAIN', 'validate' => 'string', 'type' => 'text::255', 'explain' => false), |
|
297 'cookie_name' => array('lang' => 'COOKIE_NAME', 'validate' => 'string', 'type' => 'text::16', 'explain' => false), |
|
298 'cookie_path' => array('lang' => 'COOKIE_PATH', 'validate' => 'string', 'type' => 'text::255', 'explain' => false), |
|
299 'cookie_secure' => array('lang' => 'COOKIE_SECURE', 'validate' => 'bool', 'type' => 'radio:disabled_enabled', 'explain' => true) |
|
300 ) |
|
301 ); |
|
302 break; |
|
303 |
|
304 case 'load': |
|
305 $display_vars = array( |
|
306 'title' => 'ACP_LOAD_SETTINGS', |
|
307 'vars' => array( |
|
308 'legend1' => 'GENERAL_SETTINGS', |
|
309 'limit_load' => array('lang' => 'LIMIT_LOAD', 'validate' => 'string', 'type' => 'text:4:4', 'explain' => true), |
|
310 'session_length' => array('lang' => 'SESSION_LENGTH', 'validate' => 'int:60', 'type' => 'text:5:10', 'explain' => true, 'append' => ' ' . $user->lang['SECONDS']), |
|
311 'active_sessions' => array('lang' => 'LIMIT_SESSIONS', 'validate' => 'int:0', 'type' => 'text:4:4', 'explain' => true), |
|
312 'load_online_time' => array('lang' => 'ONLINE_LENGTH', 'validate' => 'int:0', 'type' => 'text:4:3', 'explain' => true, 'append' => ' ' . $user->lang['MINUTES']), |
|
313 |
|
314 'legend2' => 'GENERAL_OPTIONS', |
|
315 'load_db_track' => array('lang' => 'YES_POST_MARKING', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), |
|
316 'load_db_lastread' => array('lang' => 'YES_READ_MARKING', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), |
|
317 'load_anon_lastread' => array('lang' => 'YES_ANON_READ_MARKING', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), |
|
318 'load_online' => array('lang' => 'YES_ONLINE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), |
|
319 'load_online_guests' => array('lang' => 'YES_ONLINE_GUESTS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), |
|
320 'load_onlinetrack' => array('lang' => 'YES_ONLINE_TRACK', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), |
|
321 'load_birthdays' => array('lang' => 'YES_BIRTHDAYS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), |
|
322 'load_unreads_search' => array('lang' => 'YES_UNREAD_SEARCH', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), |
|
323 'load_moderators' => array('lang' => 'YES_MODERATORS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), |
|
324 'load_jumpbox' => array('lang' => 'YES_JUMPBOX', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), |
|
325 'load_user_activity' => array('lang' => 'LOAD_USER_ACTIVITY', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), |
|
326 'load_tplcompile' => array('lang' => 'RECOMPILE_STYLES', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), |
|
327 |
|
328 'legend3' => 'CUSTOM_PROFILE_FIELDS', |
|
329 'load_cpf_memberlist' => array('lang' => 'LOAD_CPF_MEMBERLIST', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), |
|
330 'load_cpf_viewprofile' => array('lang' => 'LOAD_CPF_VIEWPROFILE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), |
|
331 'load_cpf_viewtopic' => array('lang' => 'LOAD_CPF_VIEWTOPIC', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), |
|
332 |
|
333 'legend4' => 'ACP_SUBMIT_CHANGES', |
|
334 ) |
|
335 ); |
|
336 break; |
|
337 |
|
338 case 'auth': |
|
339 $display_vars = array( |
|
340 'title' => 'ACP_AUTH_SETTINGS', |
|
341 'vars' => array( |
|
342 'legend1' => 'ACP_AUTH_SETTINGS', |
|
343 'auth_method' => array('lang' => 'AUTH_METHOD', 'validate' => 'string', 'type' => 'select', 'method' => 'select_auth_method', 'explain' => false) |
|
344 ) |
|
345 ); |
|
346 break; |
|
347 |
|
348 case 'server': |
|
349 $display_vars = array( |
|
350 'title' => 'ACP_SERVER_SETTINGS', |
|
351 'vars' => array( |
|
352 'legend1' => 'ACP_SERVER_SETTINGS', |
|
353 'gzip_compress' => array('lang' => 'ENABLE_GZIP', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), |
|
354 |
|
355 'legend2' => 'PATH_SETTINGS', |
|
356 'smilies_path' => array('lang' => 'SMILIES_PATH', 'validate' => 'rpath', 'type' => 'text:20:255', 'explain' => true), |
|
357 'icons_path' => array('lang' => 'ICONS_PATH', 'validate' => 'rpath', 'type' => 'text:20:255', 'explain' => true), |
|
358 'upload_icons_path' => array('lang' => 'UPLOAD_ICONS_PATH', 'validate' => 'rpath', 'type' => 'text:20:255', 'explain' => true), |
|
359 'ranks_path' => array('lang' => 'RANKS_PATH', 'validate' => 'rpath', 'type' => 'text:20:255', 'explain' => true), |
|
360 |
|
361 'legend3' => 'SERVER_URL_SETTINGS', |
|
362 'force_server_vars' => array('lang' => 'FORCE_SERVER_VARS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), |
|
363 'server_protocol' => array('lang' => 'SERVER_PROTOCOL', 'validate' => 'string', 'type' => 'text:10:10', 'explain' => true), |
|
364 'server_name' => array('lang' => 'SERVER_NAME', 'validate' => 'string', 'type' => 'text:40:255', 'explain' => true), |
|
365 'server_port' => array('lang' => 'SERVER_PORT', 'validate' => 'int:0', 'type' => 'text:5:5', 'explain' => true), |
|
366 'script_path' => array('lang' => 'SCRIPT_PATH', 'validate' => 'script_path', 'type' => 'text::255', 'explain' => true), |
|
367 |
|
368 'legend4' => 'ACP_SUBMIT_CHANGES', |
|
369 ) |
|
370 ); |
|
371 break; |
|
372 |
|
373 case 'security': |
|
374 $display_vars = array( |
|
375 'title' => 'ACP_SECURITY_SETTINGS', |
|
376 'vars' => array( |
|
377 'legend1' => 'ACP_SECURITY_SETTINGS', |
|
378 'allow_autologin' => array('lang' => 'ALLOW_AUTOLOGIN', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), |
|
379 'max_autologin_time' => array('lang' => 'AUTOLOGIN_LENGTH', 'validate' => 'int:0', 'type' => 'text:5:5', 'explain' => true, 'append' => ' ' . $user->lang['DAYS']), |
|
380 'ip_check' => array('lang' => 'IP_VALID', 'validate' => 'int', 'type' => 'custom', 'method' => 'select_ip_check', 'explain' => true), |
|
381 'browser_check' => array('lang' => 'BROWSER_VALID', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), |
|
382 'forwarded_for_check' => array('lang' => 'FORWARDED_FOR_VALID', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), |
|
383 'referer_validation' => array('lang' => 'REFERER_VALID', 'validate' => 'int:0:3','type' => 'custom', 'method' => 'select_ref_check', 'explain' => true), |
|
384 'check_dnsbl' => array('lang' => 'CHECK_DNSBL', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), |
|
385 'email_check_mx' => array('lang' => 'EMAIL_CHECK_MX', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), |
|
386 'pass_complex' => array('lang' => 'PASSWORD_TYPE', 'validate' => 'string', 'type' => 'select', 'method' => 'select_password_chars', 'explain' => true), |
|
387 'chg_passforce' => array('lang' => 'FORCE_PASS_CHANGE', 'validate' => 'int:0', 'type' => 'text:3:3', 'explain' => true, 'append' => ' ' . $user->lang['DAYS']), |
|
388 'max_login_attempts' => array('lang' => 'MAX_LOGIN_ATTEMPTS', 'validate' => 'int:0', 'type' => 'text:3:3', 'explain' => true), |
|
389 'ip_login_limit_max' => array('lang' => 'IP_LOGIN_LIMIT_MAX', 'validate' => 'int:0', 'type' => 'text:3:3', 'explain' => true), |
|
390 'ip_login_limit_time' => array('lang' => 'IP_LOGIN_LIMIT_TIME', 'validate' => 'int:0', 'type' => 'text:5:5', 'explain' => true, 'append' => ' ' . $user->lang['SECONDS']), |
|
391 'ip_login_limit_use_forwarded' => array('lang' => 'IP_LOGIN_LIMIT_USE_FORWARDED', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), |
|
392 'tpl_allow_php' => array('lang' => 'TPL_ALLOW_PHP', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), |
|
393 'form_token_lifetime' => array('lang' => 'FORM_TIME_MAX', 'validate' => 'int:-1', 'type' => 'text:5:5', 'explain' => true, 'append' => ' ' . $user->lang['SECONDS']), |
|
394 'form_token_sid_guests' => array('lang' => 'FORM_SID_GUESTS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), |
|
395 |
|
396 ) |
|
397 ); |
|
398 break; |
|
399 |
|
400 case 'email': |
|
401 $display_vars = array( |
|
402 'title' => 'ACP_EMAIL_SETTINGS', |
|
403 'vars' => array( |
|
404 'legend1' => 'GENERAL_SETTINGS', |
|
405 'email_enable' => array('lang' => 'ENABLE_EMAIL', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), |
|
406 'board_email_form' => array('lang' => 'BOARD_EMAIL_FORM', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), |
|
407 'email_function_name' => array('lang' => 'EMAIL_FUNCTION_NAME', 'validate' => 'string', 'type' => 'text:20:50', 'explain' => true), |
|
408 'email_package_size' => array('lang' => 'EMAIL_PACKAGE_SIZE', 'validate' => 'int:0', 'type' => 'text:5:5', 'explain' => true), |
|
409 'board_contact' => array('lang' => 'CONTACT_EMAIL', 'validate' => 'string', 'type' => 'text:25:100', 'explain' => true), |
|
410 'board_email' => array('lang' => 'ADMIN_EMAIL', 'validate' => 'string', 'type' => 'text:25:100', 'explain' => true), |
|
411 'board_email_sig' => array('lang' => 'EMAIL_SIG', 'validate' => 'string', 'type' => 'textarea:5:30', 'explain' => true), |
|
412 'board_hide_emails' => array('lang' => 'BOARD_HIDE_EMAILS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), |
|
413 |
|
414 'legend2' => 'SMTP_SETTINGS', |
|
415 'smtp_delivery' => array('lang' => 'USE_SMTP', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), |
|
416 'smtp_host' => array('lang' => 'SMTP_SERVER', 'validate' => 'string', 'type' => 'text:25:50', 'explain' => false), |
|
417 'smtp_port' => array('lang' => 'SMTP_PORT', 'validate' => 'int:0', 'type' => 'text:4:5', 'explain' => true), |
|
418 'smtp_auth_method' => array('lang' => 'SMTP_AUTH_METHOD', 'validate' => 'string', 'type' => 'select', 'method' => 'mail_auth_select', 'explain' => true), |
|
419 'smtp_username' => array('lang' => 'SMTP_USERNAME', 'validate' => 'string', 'type' => 'text:25:255', 'explain' => true), |
|
420 'smtp_password' => array('lang' => 'SMTP_PASSWORD', 'validate' => 'string', 'type' => 'password:25:255', 'explain' => true), |
|
421 |
|
422 'legend3' => 'ACP_SUBMIT_CHANGES', |
|
423 ) |
|
424 ); |
|
425 break; |
|
426 |
|
427 default: |
|
428 trigger_error('NO_MODE', E_USER_ERROR); |
|
429 break; |
|
430 } |
|
431 |
|
432 if (isset($display_vars['lang'])) |
|
433 { |
|
434 $user->add_lang($display_vars['lang']); |
|
435 } |
|
436 |
|
437 $this->new_config = $config; |
|
438 $cfg_array = (isset($_REQUEST['config'])) ? utf8_normalize_nfc(request_var('config', array('' => ''), true)) : $this->new_config; |
|
439 $error = array(); |
|
440 |
|
441 // We validate the complete config if whished |
|
442 validate_config_vars($display_vars['vars'], $cfg_array, $error); |
|
443 |
|
444 if ($submit && !check_form_key($form_key)) |
|
445 { |
|
446 $error[] = $user->lang['FORM_INVALID']; |
|
447 } |
|
448 // Do not write values if there is an error |
|
449 if (sizeof($error)) |
|
450 { |
|
451 $submit = false; |
|
452 } |
|
453 |
|
454 // We go through the display_vars to make sure no one is trying to set variables he/she is not allowed to... |
|
455 foreach ($display_vars['vars'] as $config_name => $null) |
|
456 { |
|
457 if (!isset($cfg_array[$config_name]) || strpos($config_name, 'legend') !== false) |
|
458 { |
|
459 continue; |
|
460 } |
|
461 |
|
462 if ($config_name == 'auth_method' || $config_name == 'feed_news_id' || $config_name == 'feed_exclude_id') |
|
463 { |
|
464 continue; |
|
465 } |
|
466 |
|
467 $this->new_config[$config_name] = $config_value = $cfg_array[$config_name]; |
|
468 |
|
469 if ($config_name == 'email_function_name') |
|
470 { |
|
471 $this->new_config['email_function_name'] = trim(str_replace(array('(', ')'), array('', ''), $this->new_config['email_function_name'])); |
|
472 $this->new_config['email_function_name'] = (empty($this->new_config['email_function_name']) || !function_exists($this->new_config['email_function_name'])) ? 'mail' : $this->new_config['email_function_name']; |
|
473 $config_value = $this->new_config['email_function_name']; |
|
474 } |
|
475 |
|
476 if ($submit) |
|
477 { |
|
478 set_config($config_name, $config_value); |
|
479 |
|
480 if ($config_name == 'allow_quick_reply' && isset($_POST['allow_quick_reply_enable'])) |
|
481 { |
|
482 enable_bitfield_column_flag(FORUMS_TABLE, 'forum_flags', log(FORUM_FLAG_QUICK_REPLY, 2)); |
|
483 } |
|
484 } |
|
485 } |
|
486 |
|
487 // Store news and exclude ids |
|
488 if ($mode == 'feed' && $submit) |
|
489 { |
|
490 $cache->destroy('_feed_news_forum_ids'); |
|
491 $cache->destroy('_feed_excluded_forum_ids'); |
|
492 |
|
493 $this->store_feed_forums(FORUM_OPTION_FEED_NEWS, 'feed_news_id'); |
|
494 $this->store_feed_forums(FORUM_OPTION_FEED_EXCLUDE, 'feed_exclude_id'); |
|
495 } |
|
496 |
|
497 if ($mode == 'auth') |
|
498 { |
|
499 // Retrieve a list of auth plugins and check their config values |
|
500 $auth_plugins = array(); |
|
501 |
|
502 $dp = @opendir($phpbb_root_path . 'includes/auth'); |
|
503 |
|
504 if ($dp) |
|
505 { |
|
506 while (($file = readdir($dp)) !== false) |
|
507 { |
|
508 if (preg_match('#^auth_(.*?)\.' . $phpEx . '$#', $file)) |
|
509 { |
|
510 $auth_plugins[] = basename(preg_replace('#^auth_(.*?)\.' . $phpEx . '$#', '\1', $file)); |
|
511 } |
|
512 } |
|
513 closedir($dp); |
|
514 |
|
515 sort($auth_plugins); |
|
516 } |
|
517 |
|
518 $updated_auth_settings = false; |
|
519 $old_auth_config = array(); |
|
520 foreach ($auth_plugins as $method) |
|
521 { |
|
522 if ($method && file_exists($phpbb_root_path . 'includes/auth/auth_' . $method . '.' . $phpEx)) |
|
523 { |
|
524 include_once($phpbb_root_path . 'includes/auth/auth_' . $method . '.' . $phpEx); |
|
525 |
|
526 $method = 'acp_' . $method; |
|
527 if (function_exists($method)) |
|
528 { |
|
529 if ($fields = $method($this->new_config)) |
|
530 { |
|
531 // Check if we need to create config fields for this plugin and save config when submit was pressed |
|
532 foreach ($fields['config'] as $field) |
|
533 { |
|
534 if (!isset($config[$field])) |
|
535 { |
|
536 set_config($field, ''); |
|
537 } |
|
538 |
|
539 if (!isset($cfg_array[$field]) || strpos($field, 'legend') !== false) |
|
540 { |
|
541 continue; |
|
542 } |
|
543 |
|
544 $old_auth_config[$field] = $this->new_config[$field]; |
|
545 $config_value = $cfg_array[$field]; |
|
546 $this->new_config[$field] = $config_value; |
|
547 |
|
548 if ($submit) |
|
549 { |
|
550 $updated_auth_settings = true; |
|
551 set_config($field, $config_value); |
|
552 } |
|
553 } |
|
554 } |
|
555 unset($fields); |
|
556 } |
|
557 } |
|
558 } |
|
559 |
|
560 if ($submit && (($cfg_array['auth_method'] != $this->new_config['auth_method']) || $updated_auth_settings)) |
|
561 { |
|
562 $method = basename($cfg_array['auth_method']); |
|
563 if ($method && in_array($method, $auth_plugins)) |
|
564 { |
|
565 include_once($phpbb_root_path . 'includes/auth/auth_' . $method . '.' . $phpEx); |
|
566 |
|
567 $method = 'init_' . $method; |
|
568 if (function_exists($method)) |
|
569 { |
|
570 if ($error = $method()) |
|
571 { |
|
572 foreach ($old_auth_config as $config_name => $config_value) |
|
573 { |
|
574 set_config($config_name, $config_value); |
|
575 } |
|
576 trigger_error($error . adm_back_link($this->u_action), E_USER_WARNING); |
|
577 } |
|
578 } |
|
579 set_config('auth_method', basename($cfg_array['auth_method'])); |
|
580 } |
|
581 else |
|
582 { |
|
583 trigger_error('NO_AUTH_PLUGIN', E_USER_ERROR); |
|
584 } |
|
585 } |
|
586 } |
|
587 |
|
588 if ($submit) |
|
589 { |
|
590 add_log('admin', 'LOG_CONFIG_' . strtoupper($mode)); |
|
591 |
|
592 trigger_error($user->lang['CONFIG_UPDATED'] . adm_back_link($this->u_action)); |
|
593 } |
|
594 |
|
595 $this->tpl_name = 'acp_board'; |
|
596 $this->page_title = $display_vars['title']; |
|
597 |
|
598 $template->assign_vars(array( |
|
599 'L_TITLE' => $user->lang[$display_vars['title']], |
|
600 'L_TITLE_EXPLAIN' => $user->lang[$display_vars['title'] . '_EXPLAIN'], |
|
601 |
|
602 'S_ERROR' => (sizeof($error)) ? true : false, |
|
603 'ERROR_MSG' => implode('<br />', $error), |
|
604 |
|
605 'U_ACTION' => $this->u_action) |
|
606 ); |
|
607 |
|
608 // Output relevant page |
|
609 foreach ($display_vars['vars'] as $config_key => $vars) |
|
610 { |
|
611 if (!is_array($vars) && strpos($config_key, 'legend') === false) |
|
612 { |
|
613 continue; |
|
614 } |
|
615 |
|
616 if (strpos($config_key, 'legend') !== false) |
|
617 { |
|
618 $template->assign_block_vars('options', array( |
|
619 'S_LEGEND' => true, |
|
620 'LEGEND' => (isset($user->lang[$vars])) ? $user->lang[$vars] : $vars) |
|
621 ); |
|
622 |
|
623 continue; |
|
624 } |
|
625 |
|
626 $type = explode(':', $vars['type']); |
|
627 |
|
628 $l_explain = ''; |
|
629 if ($vars['explain'] && isset($vars['lang_explain'])) |
|
630 { |
|
631 $l_explain = (isset($user->lang[$vars['lang_explain']])) ? $user->lang[$vars['lang_explain']] : $vars['lang_explain']; |
|
632 } |
|
633 else if ($vars['explain']) |
|
634 { |
|
635 $l_explain = (isset($user->lang[$vars['lang'] . '_EXPLAIN'])) ? $user->lang[$vars['lang'] . '_EXPLAIN'] : ''; |
|
636 } |
|
637 |
|
638 $content = build_cfg_template($type, $config_key, $this->new_config, $config_key, $vars); |
|
639 |
|
640 if (empty($content)) |
|
641 { |
|
642 continue; |
|
643 } |
|
644 |
|
645 $template->assign_block_vars('options', array( |
|
646 'KEY' => $config_key, |
|
647 'TITLE' => (isset($user->lang[$vars['lang']])) ? $user->lang[$vars['lang']] : $vars['lang'], |
|
648 'S_EXPLAIN' => $vars['explain'], |
|
649 'TITLE_EXPLAIN' => $l_explain, |
|
650 'CONTENT' => $content, |
|
651 ) |
|
652 ); |
|
653 |
|
654 unset($display_vars['vars'][$config_key]); |
|
655 } |
|
656 |
|
657 if ($mode == 'auth') |
|
658 { |
|
659 $template->assign_var('S_AUTH', true); |
|
660 |
|
661 foreach ($auth_plugins as $method) |
|
662 { |
|
663 if ($method && file_exists($phpbb_root_path . 'includes/auth/auth_' . $method . '.' . $phpEx)) |
|
664 { |
|
665 $method = 'acp_' . $method; |
|
666 if (function_exists($method)) |
|
667 { |
|
668 $fields = $method($this->new_config); |
|
669 |
|
670 if ($fields['tpl']) |
|
671 { |
|
672 $template->assign_block_vars('auth_tpl', array( |
|
673 'TPL' => $fields['tpl']) |
|
674 ); |
|
675 } |
|
676 unset($fields); |
|
677 } |
|
678 } |
|
679 } |
|
680 } |
|
681 } |
|
682 |
|
683 /** |
|
684 * Select auth method |
|
685 */ |
|
686 function select_auth_method($selected_method, $key = '') |
|
687 { |
|
688 global $phpbb_root_path, $phpEx; |
|
689 |
|
690 $auth_plugins = array(); |
|
691 |
|
692 $dp = @opendir($phpbb_root_path . 'includes/auth'); |
|
693 |
|
694 if (!$dp) |
|
695 { |
|
696 return ''; |
|
697 } |
|
698 |
|
699 while (($file = readdir($dp)) !== false) |
|
700 { |
|
701 if (preg_match('#^auth_(.*?)\.' . $phpEx . '$#', $file)) |
|
702 { |
|
703 $auth_plugins[] = preg_replace('#^auth_(.*?)\.' . $phpEx . '$#', '\1', $file); |
|
704 } |
|
705 } |
|
706 closedir($dp); |
|
707 |
|
708 sort($auth_plugins); |
|
709 |
|
710 $auth_select = ''; |
|
711 foreach ($auth_plugins as $method) |
|
712 { |
|
713 $selected = ($selected_method == $method) ? ' selected="selected"' : ''; |
|
714 $auth_select .= '<option value="' . $method . '"' . $selected . '>' . ucfirst($method) . '</option>'; |
|
715 } |
|
716 |
|
717 return $auth_select; |
|
718 } |
|
719 |
|
720 /** |
|
721 * Select mail authentication method |
|
722 */ |
|
723 function mail_auth_select($selected_method, $key = '') |
|
724 { |
|
725 global $user; |
|
726 |
|
727 $auth_methods = array('PLAIN', 'LOGIN', 'CRAM-MD5', 'DIGEST-MD5', 'POP-BEFORE-SMTP'); |
|
728 $s_smtp_auth_options = ''; |
|
729 |
|
730 foreach ($auth_methods as $method) |
|
731 { |
|
732 $s_smtp_auth_options .= '<option value="' . $method . '"' . (($selected_method == $method) ? ' selected="selected"' : '') . '>' . $user->lang['SMTP_' . str_replace('-', '_', $method)] . '</option>'; |
|
733 } |
|
734 |
|
735 return $s_smtp_auth_options; |
|
736 } |
|
737 |
|
738 /** |
|
739 * Select full folder action |
|
740 */ |
|
741 function full_folder_select($value, $key = '') |
|
742 { |
|
743 global $user; |
|
744 |
|
745 return '<option value="1"' . (($value == 1) ? ' selected="selected"' : '') . '>' . $user->lang['DELETE_OLDEST_MESSAGES'] . '</option><option value="2"' . (($value == 2) ? ' selected="selected"' : '') . '>' . $user->lang['HOLD_NEW_MESSAGES_SHORT'] . '</option>'; |
|
746 } |
|
747 |
|
748 /** |
|
749 * Select ip validation |
|
750 */ |
|
751 function select_ip_check($value, $key = '') |
|
752 { |
|
753 $radio_ary = array(4 => 'ALL', 3 => 'CLASS_C', 2 => 'CLASS_B', 0 => 'NO_IP_VALIDATION'); |
|
754 |
|
755 return h_radio('config[ip_check]', $radio_ary, $value, $key); |
|
756 } |
|
757 |
|
758 /** |
|
759 * Select referer validation |
|
760 */ |
|
761 function select_ref_check($value, $key = '') |
|
762 { |
|
763 $radio_ary = array(REFERER_VALIDATE_PATH => 'REF_PATH', REFERER_VALIDATE_HOST => 'REF_HOST', REFERER_VALIDATE_NONE => 'NO_REF_VALIDATION'); |
|
764 |
|
765 return h_radio('config[referer_validation]', $radio_ary, $value, $key); |
|
766 } |
|
767 |
|
768 /** |
|
769 * Select account activation method |
|
770 */ |
|
771 function select_acc_activation($value, $key = '') |
|
772 { |
|
773 global $user, $config; |
|
774 |
|
775 $radio_ary = array( |
|
776 USER_ACTIVATION_DISABLE => 'ACC_DISABLE', |
|
777 USER_ACTIVATION_NONE => 'ACC_NONE', |
|
778 ); |
|
779 |
|
780 if ($config['email_enable']) |
|
781 { |
|
782 $radio_ary[USER_ACTIVATION_SELF] = 'ACC_USER'; |
|
783 $radio_ary[USER_ACTIVATION_ADMIN] = 'ACC_ADMIN'; |
|
784 } |
|
785 |
|
786 $radio_text = h_radio('config[require_activation]', $radio_ary, $value, 'require_activation', $key, '<br />'); |
|
787 |
|
788 return $radio_text; |
|
789 } |
|
790 |
|
791 /** |
|
792 * Maximum/Minimum username length |
|
793 */ |
|
794 function username_length($value, $key = '') |
|
795 { |
|
796 global $user; |
|
797 |
|
798 return '<input id="' . $key . '" type="text" size="3" maxlength="3" name="config[min_name_chars]" value="' . $value . '" /> ' . $user->lang['MIN_CHARS'] . ' <input type="text" size="3" maxlength="3" name="config[max_name_chars]" value="' . $this->new_config['max_name_chars'] . '" /> ' . $user->lang['MAX_CHARS']; |
|
799 } |
|
800 |
|
801 /** |
|
802 * Allowed chars in usernames |
|
803 */ |
|
804 function select_username_chars($selected_value, $key) |
|
805 { |
|
806 global $user; |
|
807 |
|
808 $user_char_ary = array('USERNAME_CHARS_ANY', 'USERNAME_ALPHA_ONLY', 'USERNAME_ALPHA_SPACERS', 'USERNAME_LETTER_NUM', 'USERNAME_LETTER_NUM_SPACERS', 'USERNAME_ASCII'); |
|
809 $user_char_options = ''; |
|
810 foreach ($user_char_ary as $user_type) |
|
811 { |
|
812 $selected = ($selected_value == $user_type) ? ' selected="selected"' : ''; |
|
813 $user_char_options .= '<option value="' . $user_type . '"' . $selected . '>' . $user->lang[$user_type] . '</option>'; |
|
814 } |
|
815 |
|
816 return $user_char_options; |
|
817 } |
|
818 |
|
819 /** |
|
820 * Maximum/Minimum password length |
|
821 */ |
|
822 function password_length($value, $key) |
|
823 { |
|
824 global $user; |
|
825 |
|
826 return '<input id="' . $key . '" type="text" size="3" maxlength="3" name="config[min_pass_chars]" value="' . $value . '" /> ' . $user->lang['MIN_CHARS'] . ' <input type="text" size="3" maxlength="3" name="config[max_pass_chars]" value="' . $this->new_config['max_pass_chars'] . '" /> ' . $user->lang['MAX_CHARS']; |
|
827 } |
|
828 |
|
829 /** |
|
830 * Required chars in passwords |
|
831 */ |
|
832 function select_password_chars($selected_value, $key) |
|
833 { |
|
834 global $user; |
|
835 |
|
836 $pass_type_ary = array('PASS_TYPE_ANY', 'PASS_TYPE_CASE', 'PASS_TYPE_ALPHA', 'PASS_TYPE_SYMBOL'); |
|
837 $pass_char_options = ''; |
|
838 foreach ($pass_type_ary as $pass_type) |
|
839 { |
|
840 $selected = ($selected_value == $pass_type) ? ' selected="selected"' : ''; |
|
841 $pass_char_options .= '<option value="' . $pass_type . '"' . $selected . '>' . $user->lang[$pass_type] . '</option>'; |
|
842 } |
|
843 |
|
844 return $pass_char_options; |
|
845 } |
|
846 |
|
847 /** |
|
848 * Select bump interval |
|
849 */ |
|
850 function bump_interval($value, $key) |
|
851 { |
|
852 global $user; |
|
853 |
|
854 $s_bump_type = ''; |
|
855 $types = array('m' => 'MINUTES', 'h' => 'HOURS', 'd' => 'DAYS'); |
|
856 foreach ($types as $type => $lang) |
|
857 { |
|
858 $selected = ($this->new_config['bump_type'] == $type) ? ' selected="selected"' : ''; |
|
859 $s_bump_type .= '<option value="' . $type . '"' . $selected . '>' . $user->lang[$lang] . '</option>'; |
|
860 } |
|
861 |
|
862 return '<input id="' . $key . '" type="text" size="3" maxlength="4" name="config[bump_interval]" value="' . $value . '" /> <select name="config[bump_type]">' . $s_bump_type . '</select>'; |
|
863 } |
|
864 |
|
865 /** |
|
866 * Board disable option and message |
|
867 */ |
|
868 function board_disable($value, $key) |
|
869 { |
|
870 global $user; |
|
871 |
|
872 $radio_ary = array(1 => 'YES', 0 => 'NO'); |
|
873 |
|
874 return h_radio('config[board_disable]', $radio_ary, $value) . '<br /><input id="' . $key . '" type="text" name="config[board_disable_msg]" maxlength="255" size="40" value="' . $this->new_config['board_disable_msg'] . '" />'; |
|
875 } |
|
876 |
|
877 /** |
|
878 * Global quick reply enable/disable setting and button to enable in all forums |
|
879 */ |
|
880 function quick_reply($value, $key) |
|
881 { |
|
882 global $user; |
|
883 |
|
884 $radio_ary = array(1 => 'YES', 0 => 'NO'); |
|
885 |
|
886 return h_radio('config[allow_quick_reply]', $radio_ary, $value) . |
|
887 '<br /><br /><input class="button2" type="submit" id="' . $key . '_enable" name="' . $key . '_enable" value="' . $user->lang['ALLOW_QUICK_REPLY_BUTTON'] . '" />'; |
|
888 } |
|
889 |
|
890 |
|
891 /** |
|
892 * Select default dateformat |
|
893 */ |
|
894 function dateformat_select($value, $key) |
|
895 { |
|
896 global $user, $config; |
|
897 |
|
898 // Let the format_date function operate with the acp values |
|
899 $old_tz = $user->timezone; |
|
900 $old_dst = $user->dst; |
|
901 |
|
902 $user->timezone = $config['board_timezone'] * 3600; |
|
903 $user->dst = $config['board_dst'] * 3600; |
|
904 |
|
905 $dateformat_options = ''; |
|
906 |
|
907 foreach ($user->lang['dateformats'] as $format => $null) |
|
908 { |
|
909 $dateformat_options .= '<option value="' . $format . '"' . (($format == $value) ? ' selected="selected"' : '') . '>'; |
|
910 $dateformat_options .= $user->format_date(time(), $format, false) . ((strpos($format, '|') !== false) ? $user->lang['VARIANT_DATE_SEPARATOR'] . $user->format_date(time(), $format, true) : ''); |
|
911 $dateformat_options .= '</option>'; |
|
912 } |
|
913 |
|
914 $dateformat_options .= '<option value="custom"'; |
|
915 if (!isset($user->lang['dateformats'][$value])) |
|
916 { |
|
917 $dateformat_options .= ' selected="selected"'; |
|
918 } |
|
919 $dateformat_options .= '>' . $user->lang['CUSTOM_DATEFORMAT'] . '</option>'; |
|
920 |
|
921 // Reset users date options |
|
922 $user->timezone = $old_tz; |
|
923 $user->dst = $old_dst; |
|
924 |
|
925 return "<select name=\"dateoptions\" id=\"dateoptions\" onchange=\"if (this.value == 'custom') { document.getElementById('" . addslashes($key) . "').value = '" . addslashes($value) . "'; } else { document.getElementById('" . addslashes($key) . "').value = this.value; }\">$dateformat_options</select> |
|
926 <input type=\"text\" name=\"config[$key]\" id=\"$key\" value=\"$value\" maxlength=\"30\" />"; |
|
927 } |
|
928 |
|
929 /** |
|
930 * Select multiple forums |
|
931 */ |
|
932 function select_news_forums($value, $key) |
|
933 { |
|
934 global $user, $config; |
|
935 |
|
936 $forum_list = make_forum_select(false, false, true, true, true, false, true); |
|
937 |
|
938 // Build forum options |
|
939 $s_forum_options = '<select id="' . $key . '" name="' . $key . '[]" multiple="multiple">'; |
|
940 foreach ($forum_list as $f_id => $f_row) |
|
941 { |
|
942 $f_row['selected'] = phpbb_optionget(FORUM_OPTION_FEED_NEWS, $f_row['forum_options']); |
|
943 |
|
944 $s_forum_options .= '<option value="' . $f_id . '"' . (($f_row['selected']) ? ' selected="selected"' : '') . (($f_row['disabled']) ? ' disabled="disabled" class="disabled-option"' : '') . '>' . $f_row['padding'] . $f_row['forum_name'] . '</option>'; |
|
945 } |
|
946 $s_forum_options .= '</select>'; |
|
947 |
|
948 return $s_forum_options; |
|
949 } |
|
950 |
|
951 function select_exclude_forums($value, $key) |
|
952 { |
|
953 global $user, $config; |
|
954 |
|
955 $forum_list = make_forum_select(false, false, true, true, true, false, true); |
|
956 |
|
957 // Build forum options |
|
958 $s_forum_options = '<select id="' . $key . '" name="' . $key . '[]" multiple="multiple">'; |
|
959 foreach ($forum_list as $f_id => $f_row) |
|
960 { |
|
961 $f_row['selected'] = phpbb_optionget(FORUM_OPTION_FEED_EXCLUDE, $f_row['forum_options']); |
|
962 |
|
963 $s_forum_options .= '<option value="' . $f_id . '"' . (($f_row['selected']) ? ' selected="selected"' : '') . (($f_row['disabled']) ? ' disabled="disabled" class="disabled-option"' : '') . '>' . $f_row['padding'] . $f_row['forum_name'] . '</option>'; |
|
964 } |
|
965 $s_forum_options .= '</select>'; |
|
966 |
|
967 return $s_forum_options; |
|
968 } |
|
969 |
|
970 function store_feed_forums($option, $key) |
|
971 { |
|
972 global $db, $cache; |
|
973 |
|
974 // Get key |
|
975 $values = request_var($key, array(0 => 0)); |
|
976 |
|
977 // Empty option bit for all forums |
|
978 $sql = 'UPDATE ' . FORUMS_TABLE . ' |
|
979 SET forum_options = forum_options - ' . (1 << $option) . ' |
|
980 WHERE ' . $db->sql_bit_and('forum_options', $option, '<> 0'); |
|
981 $db->sql_query($sql); |
|
982 |
|
983 // Already emptied for all... |
|
984 if (sizeof($values)) |
|
985 { |
|
986 // Set for selected forums |
|
987 $sql = 'UPDATE ' . FORUMS_TABLE . ' |
|
988 SET forum_options = forum_options + ' . (1 << $option) . ' |
|
989 WHERE ' . $db->sql_in_set('forum_id', $values); |
|
990 $db->sql_query($sql); |
|
991 } |
|
992 |
|
993 // Empty sql cache for forums table because options changed |
|
994 $cache->destroy('sql', FORUMS_TABLE); |
|
995 } |
|
996 |
|
997 } |
|
998 |
|
999 ?> |