source: branches/old/forum/includes/acp/acp_board.php@ 480

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