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