Verzeichnisstruktur phpBB-3.1.0


Veröffentlicht
27.10.2014

So funktioniert es


Auf das letzte Element klicken. Dies geht jeweils ein Schritt zurück

Auf das Icon klicken, dies öffnet das Verzeichnis. Nochmal klicken schließt das Verzeichnis.
Auf den Verzeichnisnamen klicken, dies zeigt nur das Verzeichnis mit Inhalt an

(Beispiel Datei-Icons)

Auf das Icon klicken um den Quellcode anzuzeigen

acp_board.php

Zuletzt modifiziert: 09.10.2024, 12:52 - Dateigröße: 53.63 KiB


0001  <?php
0002  /**
0003  *
0004  * This file is part of the phpBB Forum Software package.
0005  *
0006  * @copyright (c) phpBB Limited <https://www.phpbb.com>
0007  * @license GNU General Public License, version 2 (GPL-2.0)
0008  *
0009  * For full copyright and license information, please see
0010  * the docs/CREDITS.txt file.
0011  *
0012  */
0013   
0014  /**
0015  * @todo add cron intervals to server settings? (database_gc, queue_interval, session_gc, search_gc, cache_gc, warnings_gc)
0016  */
0017   
0018  /**
0019  * @ignore
0020  */
0021  if (!defined('IN_PHPBB'))
0022  {
0023      exit;
0024  }
0025   
0026  class acp_board
0027  {
0028      var $u_action;
0029      var $new_config = array();
0030   
0031      function main($id, $mode)
0032      {
0033          global $db, $user, $auth, $template;
0034          global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx;
0035          global $cache, $phpbb_container, $phpbb_dispatcher;
0036   
0037          $user->add_lang('acp/board');
0038   
0039          $action    = request_var('action', '');
0040          $submit = (isset($_POST['submit']) || isset($_POST['allow_quick_reply_enable'])) ? true : false;
0041   
0042          $form_key = 'acp_board';
0043          add_form_key($form_key);
0044   
0045          /**
0046          *    Validation types are:
0047          *        string, int, bool,
0048          *        script_path (absolute path in url - beginning with / and no trailing slash),
0049          *        rpath (relative), rwpath (realtive, writable), path (relative path, but able to escape the root), wpath (writable)
0050          */
0051          switch ($mode)
0052          {
0053              case 'settings':
0054                  $display_vars = array(
0055                      'title'    => 'ACP_BOARD_SETTINGS',
0056                      'vars'    => array(
0057                          'legend1'                => 'ACP_BOARD_SETTINGS',
0058                          'sitename'                => array('lang' => 'SITE_NAME',                'validate' => 'string',    'type' => 'text:40:255', 'explain' => false),
0059                          'site_desc'                => array('lang' => 'SITE_DESC',                'validate' => 'string',    'type' => 'text:40:255', 'explain' => false),
0060                          'site_home_url'            => array('lang' => 'SITE_HOME_URL',            'validate' => 'string',    'type' => 'url:40:255', 'explain' => true),
0061                          'site_home_text'        => array('lang' => 'SITE_HOME_TEXT',        'validate' => 'string',    'type' => 'text:40:255', 'explain' => true),
0062                          'board_index_text'        => array('lang' => 'BOARD_INDEX_TEXT',        'validate' => 'string',    'type' => 'text:40:255', 'explain' => true),
0063                          'board_disable'            => array('lang' => 'DISABLE_BOARD',            'validate' => 'bool',    'type' => 'custom', 'method' => 'board_disable', 'explain' => true),
0064                          'board_disable_msg'        => false,
0065                          'default_lang'            => array('lang' => 'DEFAULT_LANGUAGE',        'validate' => 'lang',    'type' => 'select', 'function' => 'language_select', 'params' => array('{CONFIG_VALUE}'), 'explain' => false),
0066                          'default_dateformat'    => array('lang' => 'DEFAULT_DATE_FORMAT',    'validate' => 'string',    'type' => 'custom', 'method' => 'dateformat_select', 'explain' => true),
0067                          'board_timezone'        => array('lang' => 'SYSTEM_TIMEZONE',        'validate' => 'timezone',    'type' => 'custom', 'method' => 'timezone_select', 'explain' => true),
0068   
0069                          'legend2'                => 'BOARD_STYLE',
0070                          'default_style'            => array('lang' => 'DEFAULT_STYLE',            'validate' => 'int',    'type' => 'select', 'function' => 'style_select', 'params' => array('{CONFIG_VALUE}', false), 'explain' => true),
0071                          'guest_style'            => array('lang' => 'GUEST_STYLE',            'validate' => 'int',    'type' => 'select', 'function' => 'style_select', 'params' => array($this->guest_style_get(), false), 'explain' => true),
0072                          'override_user_style'    => array('lang' => 'OVERRIDE_STYLE',        'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => true),
0073   
0074                          'legend3'                => 'WARNINGS',
0075                          'warnings_expire_days'    => array('lang' => 'WARNINGS_EXPIRE',        'validate' => 'int:0:9999',    'type' => 'number:0:9999', 'explain' => true, 'append' => ' ' . $user->lang['DAYS']),
0076   
0077                          'legend4'                    => 'ACP_SUBMIT_CHANGES',
0078                      )
0079                  );
0080              break;
0081   
0082              case 'features':
0083                  $display_vars = array(
0084                      'title'    => 'ACP_BOARD_FEATURES',
0085                      'vars'    => array(
0086                          'legend1'                => 'ACP_BOARD_FEATURES',
0087                          'allow_privmsg'            => array('lang' => 'BOARD_PM',                'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => true),
0088                          'allow_topic_notify'    => array('lang' => 'ALLOW_TOPIC_NOTIFY',    'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => false),
0089                          'allow_forum_notify'    => array('lang' => 'ALLOW_FORUM_NOTIFY',    'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => false),
0090                          'allow_namechange'        => array('lang' => 'ALLOW_NAME_CHANGE',        'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => false),
0091                          'allow_attachments'        => array('lang' => 'ALLOW_ATTACHMENTS',        'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => false),
0092                          'allow_pm_attach'        => array('lang' => 'ALLOW_PM_ATTACHMENTS',    'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => false),
0093                          'allow_pm_report'        => array('lang' => 'ALLOW_PM_REPORT',        'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => true),
0094                          'allow_bbcode'            => array('lang' => 'ALLOW_BBCODE',            'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => false),
0095                          'allow_smilies'            => array('lang' => 'ALLOW_SMILIES',            'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => false),
0096                          'allow_sig'                => array('lang' => 'ALLOW_SIG',                'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => false),
0097                          'allow_nocensors'        => array('lang' => 'ALLOW_NO_CENSORS',        'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => true),
0098                          'allow_bookmarks'        => array('lang' => 'ALLOW_BOOKMARKS',        'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => true),
0099                          'allow_birthdays'        => array('lang' => 'ALLOW_BIRTHDAYS',        'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => true),
0100                          'display_last_subject'    => array('lang' => 'DISPLAY_LAST_SUBJECT',        'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => true),
0101                          'allow_quick_reply'        => array('lang' => 'ALLOW_QUICK_REPLY',        'validate' => 'bool',    'type' => 'custom', 'method' => 'quick_reply', 'explain' => true),
0102   
0103                          'legend2'                => 'ACP_LOAD_SETTINGS',
0104                          'load_birthdays'        => array('lang' => 'YES_BIRTHDAYS',            'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => true),
0105                          'load_moderators'        => array('lang' => 'YES_MODERATORS',        'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => false),
0106                          'load_jumpbox'            => array('lang' => 'YES_JUMPBOX',            'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => false),
0107                          'load_cpf_memberlist'    => array('lang' => 'LOAD_CPF_MEMBERLIST',    'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => false),
0108                          'load_cpf_pm'            => array('lang' => 'LOAD_CPF_PM',            'validate' => 'bool',    'type' => 'radio:yes_no', 'explain'    => false),
0109                          'load_cpf_viewprofile'    => array('lang' => 'LOAD_CPF_VIEWPROFILE',    'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => false),
0110                          'load_cpf_viewtopic'    => array('lang' => 'LOAD_CPF_VIEWTOPIC',    'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => false),
0111   
0112                          'legend3'                    => 'ACP_SUBMIT_CHANGES',
0113                      )
0114                  );
0115              break;
0116   
0117              case 'avatar':
0118                  $phpbb_avatar_manager = $phpbb_container->get('avatar.manager');
0119                  $avatar_drivers = $phpbb_avatar_manager->get_all_drivers();
0120   
0121                  $avatar_vars = array();
0122                  foreach ($avatar_drivers as $current_driver)
0123                  {
0124                      $driver = $phpbb_avatar_manager->get_driver($current_driver, false);
0125   
0126                      /*
0127                      * First grab the settings for enabling/disabling the avatar
0128                      * driver and afterwards grab additional settings the driver
0129                      * might have.
0130                      */
0131                      $avatar_vars += $phpbb_avatar_manager->get_avatar_settings($driver);
0132                      $avatar_vars += $driver->prepare_form_acp($user);
0133                  }
0134   
0135                  $display_vars = array(
0136                      'title'    => 'ACP_AVATAR_SETTINGS',
0137                      'vars'    => array(
0138                          'legend1'                => 'ACP_AVATAR_SETTINGS',
0139   
0140                          'avatar_min_width'        => array('lang' => 'MIN_AVATAR_SIZE', 'validate' => 'int:0', 'type' => false, 'method' => false, 'explain' => false),
0141                          'avatar_min_height'        => array('lang' => 'MIN_AVATAR_SIZE', 'validate' => 'int:0', 'type' => false, 'method' => false, 'explain' => false),
0142                          'avatar_max_width'        => array('lang' => 'MAX_AVATAR_SIZE', 'validate' => 'int:0', 'type' => false, 'method' => false, 'explain' => false),
0143                          'avatar_max_height'        => array('lang' => 'MAX_AVATAR_SIZE', 'validate' => 'int:0', 'type' => false, 'method' => false, 'explain' => false),
0144   
0145                          'allow_avatar'            => array('lang' => 'ALLOW_AVATARS',            'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => true),
0146                          'avatar_min'            => array('lang' => 'MIN_AVATAR_SIZE',        'validate' => 'int:0',    'type' => 'dimension:0', 'explain' => true, 'append' => ' ' . $user->lang['PIXEL']),
0147                          'avatar_max'            => array('lang' => 'MAX_AVATAR_SIZE',        'validate' => 'int:0',    'type' => 'dimension:0', 'explain' => true, 'append' => ' ' . $user->lang['PIXEL']),
0148                      )
0149                  );
0150   
0151                  if (!empty($avatar_vars))
0152                  {
0153                      $display_vars['vars'] += $avatar_vars;
0154                  }
0155              break;
0156   
0157              case 'message':
0158                  $display_vars = array(
0159                      'title'    => 'ACP_MESSAGE_SETTINGS',
0160                      'lang'    => 'ucp',
0161                      'vars'    => array(
0162                          'legend1'                => 'GENERAL_SETTINGS',
0163                          'allow_privmsg'            => array('lang' => 'BOARD_PM',                'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => true),
0164                          'pm_max_boxes'            => array('lang' => 'BOXES_MAX',                'validate' => 'int:0:9999',    'type' => 'number:0:9999', 'explain' => true),
0165                          'pm_max_msgs'            => array('lang' => 'BOXES_LIMIT',            'validate' => 'int:0:9999',    'type' => 'number:0:9999', 'explain' => true),
0166                          'full_folder_action'    => array('lang' => 'FULL_FOLDER_ACTION',    'validate' => 'int',    'type' => 'select', 'method' => 'full_folder_select', 'explain' => true),
0167                          'pm_edit_time'            => array('lang' => 'PM_EDIT_TIME',            'validate' => 'int:0:99999',    'type' => 'number:0:99999', 'explain' => true, 'append' => ' ' . $user->lang['MINUTES']),
0168                          'pm_max_recipients'        => array('lang' => 'PM_MAX_RECIPIENTS',        'validate' => 'int:0:99999',    'type' => 'number:0:99999', 'explain' => true),
0169   
0170                          'legend2'                => 'GENERAL_OPTIONS',
0171                          'allow_mass_pm'            => array('lang' => 'ALLOW_MASS_PM',            'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => false),
0172                          'auth_bbcode_pm'        => array('lang' => 'ALLOW_BBCODE_PM',        'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => false),
0173                          'auth_smilies_pm'        => array('lang' => 'ALLOW_SMILIES_PM',        'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => false),
0174                          'allow_pm_attach'        => array('lang' => 'ALLOW_PM_ATTACHMENTS',    'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => false),
0175                          'allow_sig_pm'            => array('lang' => 'ALLOW_SIG_PM',            'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => false),
0176                          'print_pm'                => array('lang' => 'ALLOW_PRINT_PM',        'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => false),
0177                          'forward_pm'            => array('lang' => 'ALLOW_FORWARD_PM',        'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => false),
0178                          'auth_img_pm'            => array('lang' => 'ALLOW_IMG_PM',            'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => false),
0179                          'auth_flash_pm'            => array('lang' => 'ALLOW_FLASH_PM',        'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => true),
0180                          'enable_pm_icons'        => array('lang' => 'ENABLE_PM_ICONS',        'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => false),
0181   
0182                          'legend3'                    => 'ACP_SUBMIT_CHANGES',
0183                      )
0184                  );
0185              break;
0186   
0187              case 'post':
0188                  $display_vars = array(
0189                      'title'    => 'ACP_POST_SETTINGS',
0190                      'vars'    => array(
0191                          'legend1'                => 'GENERAL_OPTIONS',
0192                          'allow_topic_notify'    => array('lang' => 'ALLOW_TOPIC_NOTIFY',    'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => false),
0193                          'allow_forum_notify'    => array('lang' => 'ALLOW_FORUM_NOTIFY',    'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => false),
0194                          'allow_bbcode'            => array('lang' => 'ALLOW_BBCODE',            'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => false),
0195                          'allow_post_flash'        => array('lang' => 'ALLOW_POST_FLASH',        'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => true),
0196                          'allow_smilies'            => array('lang' => 'ALLOW_SMILIES',            'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => false),
0197                          'allow_post_links'        => array('lang' => 'ALLOW_POST_LINKS',        'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => true),
0198                          'allow_nocensors'        => array('lang' => 'ALLOW_NO_CENSORS',        'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => true),
0199                          'allow_bookmarks'        => array('lang' => 'ALLOW_BOOKMARKS',        'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => true),
0200                          'enable_post_confirm'    => array('lang' => 'VISUAL_CONFIRM_POST',    'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => true),
0201                          'allow_quick_reply'        => array('lang' => 'ALLOW_QUICK_REPLY',        'validate' => 'bool',    'type' => 'custom', 'method' => 'quick_reply', 'explain' => true),
0202   
0203                          'legend2'                => 'POSTING',
0204                          'bump_type'                => false,
0205                          'edit_time'                => array('lang' => 'EDIT_TIME',                'validate' => 'int:0:99999',        'type' => 'number:0:99999', 'explain' => true, 'append' => ' ' . $user->lang['MINUTES']),
0206                          'delete_time'            => array('lang' => 'DELETE_TIME',            'validate' => 'int:0:99999',        'type' => 'number:0:99999', 'explain' => true, 'append' => ' ' . $user->lang['MINUTES']),
0207                          'display_last_edited'    => array('lang' => 'DISPLAY_LAST_EDITED',    'validate' => 'bool',        'type' => 'radio:yes_no', 'explain' => true),
0208                          'flood_interval'        => array('lang' => 'FLOOD_INTERVAL',        'validate' => 'int:0:9999999999',        'type' => 'number:0:9999999999', 'explain' => true, 'append' => ' ' . $user->lang['SECONDS']),
0209                          'bump_interval'            => array('lang' => 'BUMP_INTERVAL',            'validate' => 'int:0',        'type' => 'custom', 'method' => 'bump_interval', 'explain' => true),
0210                          'topics_per_page'        => array('lang' => 'TOPICS_PER_PAGE',        'validate' => 'int:1:9999',        'type' => 'number:1:9999', 'explain' => false),
0211                          'posts_per_page'        => array('lang' => 'POSTS_PER_PAGE',        'validate' => 'int:1:9999',        'type' => 'number:1:9999', 'explain' => false),
0212                          'smilies_per_page'        => array('lang' => 'SMILIES_PER_PAGE',        'validate' => 'int:1:9999',        'type' => 'number:1:9999', 'explain' => false),
0213                          'hot_threshold'            => array('lang' => 'HOT_THRESHOLD',            'validate' => 'int:0:9999',        'type' => 'number:0:9999', 'explain' => true),
0214                          'max_poll_options'        => array('lang' => 'MAX_POLL_OPTIONS',        'validate' => 'int:2:127',    'type' => 'number:2:127', 'explain' => false),
0215                          'max_post_chars'        => array('lang' => 'CHAR_LIMIT',            'validate' => 'int:0:999999',        'type' => 'number:0:999999', 'explain' => true),
0216                          'min_post_chars'        => array('lang' => 'MIN_CHAR_LIMIT',        'validate' => 'int:1:999999',        'type' => 'number:1:999999', 'explain' => true),
0217                          'max_post_smilies'        => array('lang' => 'SMILIES_LIMIT',            'validate' => 'int:0:9999',        'type' => 'number:0:9999', 'explain' => true),
0218                          'max_post_urls'            => array('lang' => 'MAX_POST_URLS',            'validate' => 'int:0:9999',        'type' => 'number:0:9999', 'explain' => true),
0219                          'max_post_font_size'    => array('lang' => 'MAX_POST_FONT_SIZE',    'validate' => 'int:0:9999',        'type' => 'number:0:9999', 'explain' => true, 'append' => ' %'),
0220                          'max_quote_depth'        => array('lang' => 'QUOTE_DEPTH_LIMIT',        'validate' => 'int:0:9999',        'type' => 'number:0:9999', 'explain' => true),
0221                          'max_post_img_width'    => array('lang' => 'MAX_POST_IMG_WIDTH',    'validate' => 'int:0:9999',        'type' => 'number:0:9999', 'explain' => true, 'append' => ' ' . $user->lang['PIXEL']),
0222                          'max_post_img_height'    => array('lang' => 'MAX_POST_IMG_HEIGHT',    'validate' => 'int:0:9999',        'type' => 'number:0:9999', 'explain' => true, 'append' => ' ' . $user->lang['PIXEL']),
0223   
0224                          'legend3'                    => 'ACP_SUBMIT_CHANGES',
0225                      )
0226                  );
0227              break;
0228   
0229              case 'signature':
0230                  $display_vars = array(
0231                      'title'    => 'ACP_SIGNATURE_SETTINGS',
0232                      'vars'    => array(
0233                          'legend1'                => 'GENERAL_OPTIONS',
0234                          'allow_sig'                => array('lang' => 'ALLOW_SIG',                'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => false),
0235                          'allow_sig_bbcode'        => array('lang' => 'ALLOW_SIG_BBCODE',        'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => false),
0236                          'allow_sig_img'            => array('lang' => 'ALLOW_SIG_IMG',            'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => false),
0237                          'allow_sig_flash'        => array('lang' => 'ALLOW_SIG_FLASH',        'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => false),
0238                          'allow_sig_smilies'        => array('lang' => 'ALLOW_SIG_SMILIES',        'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => false),
0239                          'allow_sig_links'        => array('lang' => 'ALLOW_SIG_LINKS',        'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => true),
0240   
0241                          'legend2'                => 'GENERAL_SETTINGS',
0242                          'max_sig_chars'            => array('lang' => 'MAX_SIG_LENGTH',        'validate' => 'int:0:9999',    'type' => 'number:0:9999', 'explain' => true),
0243                          'max_sig_urls'            => array('lang' => 'MAX_SIG_URLS',            'validate' => 'int:0:9999',    'type' => 'number:0:9999', 'explain' => true),
0244                          'max_sig_font_size'        => array('lang' => 'MAX_SIG_FONT_SIZE',        'validate' => 'int:0:9999',    'type' => 'number:0:9999', 'explain' => true, 'append' => ' %'),
0245                          'max_sig_smilies'        => array('lang' => 'MAX_SIG_SMILIES',        'validate' => 'int:0:9999',    'type' => 'number:0:9999', 'explain' => true),
0246                          'max_sig_img_width'        => array('lang' => 'MAX_SIG_IMG_WIDTH',        'validate' => 'int:0:9999',    'type' => 'number:0:9999', 'explain' => true, 'append' => ' ' . $user->lang['PIXEL']),
0247                          'max_sig_img_height'    => array('lang' => 'MAX_SIG_IMG_HEIGHT',    'validate' => 'int:0:9999',    'type' => 'number:0:9999', 'explain' => true, 'append' => ' ' . $user->lang['PIXEL']),
0248   
0249                          'legend3'                    => 'ACP_SUBMIT_CHANGES',
0250                      )
0251                  );
0252              break;
0253   
0254              case 'registration':
0255                  $display_vars = array(
0256                      'title'    => 'ACP_REGISTER_SETTINGS',
0257                      'vars'    => array(
0258                          'legend1'                => 'GENERAL_SETTINGS',
0259                          'max_name_chars'        => array('lang' => 'USERNAME_LENGTH', 'validate' => 'int:8:180', 'type' => false, 'method' => false, 'explain' => false,),
0260                          'max_pass_chars'        => array('lang' => 'PASSWORD_LENGTH', 'validate' => 'int:8:255', 'type' => false, 'method' => false, 'explain' => false,),
0261   
0262                          'require_activation'    => array('lang' => 'ACC_ACTIVATION',    'validate' => 'int',    'type' => 'select', 'method' => 'select_acc_activation', 'explain' => true),
0263                          'new_member_post_limit'    => array('lang' => 'NEW_MEMBER_POST_LIMIT', 'validate' => 'int:0:255', 'type' => 'number:0:255', 'explain' => true, 'append' => ' ' . $user->lang['POSTS']),
0264                          'new_member_group_default'=> array('lang' => 'NEW_MEMBER_GROUP_DEFAULT', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
0265                          'min_name_chars'        => array('lang' => 'USERNAME_LENGTH',    'validate' => 'int:1',    'type' => 'custom:5:180', 'method' => 'username_length', 'explain' => true),
0266                          'min_pass_chars'        => array('lang' => 'PASSWORD_LENGTH',    'validate' => 'int:1',    'type' => 'custom', 'method' => 'password_length', 'explain' => true),
0267                          'allow_name_chars'        => array('lang' => 'USERNAME_CHARS',    'validate' => 'string',    'type' => 'select', 'method' => 'select_username_chars', 'explain' => true),
0268                          'pass_complex'            => array('lang' => 'PASSWORD_TYPE',        'validate' => 'string',    'type' => 'select', 'method' => 'select_password_chars', 'explain' => true),
0269                          'chg_passforce'            => array('lang' => 'FORCE_PASS_CHANGE',    'validate' => 'int:0:999',    'type' => 'number:0:999', 'explain' => true, 'append' => ' ' . $user->lang['DAYS']),
0270   
0271                          'legend2'                => 'GENERAL_OPTIONS',
0272                          'allow_namechange'        => array('lang' => 'ALLOW_NAME_CHANGE',        'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => false),
0273                          'allow_emailreuse'        => array('lang' => 'ALLOW_EMAIL_REUSE',        'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => true),
0274                          'enable_confirm'        => array('lang' => 'VISUAL_CONFIRM_REG',    'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => true),
0275                          'max_login_attempts'    => array('lang' => 'MAX_LOGIN_ATTEMPTS',    'validate' => 'int:0:999',    'type' => 'number:0:999', 'explain' => true),
0276                          'max_reg_attempts'        => array('lang' => 'REG_LIMIT',                'validate' => 'int:0:9999',    'type' => 'number:0:9999', 'explain' => true),
0277   
0278                          'legend3'            => 'COPPA',
0279                          'coppa_enable'        => array('lang' => 'ENABLE_COPPA',        'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => true),
0280                          'coppa_mail'        => array('lang' => 'COPPA_MAIL',        'validate' => 'string',    'type' => 'textarea:5:40', 'explain' => true),
0281                          'coppa_fax'            => array('lang' => 'COPPA_FAX',            'validate' => 'string',    'type' => 'text:25:100', 'explain' => false),
0282   
0283                          'legend4'            => 'ACP_SUBMIT_CHANGES',
0284                      )
0285                  );
0286              break;
0287   
0288              case 'feed':
0289                  $display_vars = array(
0290                      'title'    => 'ACP_FEED_MANAGEMENT',
0291                      'vars'    => array(
0292                          'legend1'                    => 'ACP_FEED_GENERAL',
0293                          'feed_enable'                => array('lang' => 'ACP_FEED_ENABLE',                'validate' => 'bool',    'type' => 'radio:enabled_disabled',    'explain' => true ),
0294                          'feed_item_statistics'        => array('lang' => 'ACP_FEED_ITEM_STATISTICS',        'validate' => 'bool',    'type' => 'radio:enabled_disabled',    'explain' => true),
0295                          'feed_http_auth'            => array('lang' => 'ACP_FEED_HTTP_AUTH',            'validate' => 'bool',    'type' => 'radio:enabled_disabled',    'explain' => true),
0296   
0297                          'legend2'                    => 'ACP_FEED_POST_BASED',
0298                          'feed_limit_post'            => array('lang' => 'ACP_FEED_LIMIT',                'validate' => 'int:5:9999',    'type' => 'number:5:9999',                'explain' => true),
0299                          'feed_overall'                => array('lang' => 'ACP_FEED_OVERALL',                'validate' => 'bool',    'type' => 'radio:enabled_disabled',    'explain' => true ),
0300                          'feed_forum'                => array('lang' => 'ACP_FEED_FORUM',                'validate' => 'bool',    'type' => 'radio:enabled_disabled',    'explain' => true ),
0301                          'feed_topic'                => array('lang' => 'ACP_FEED_TOPIC',                'validate' => 'bool',    'type' => 'radio:enabled_disabled',    'explain' => true ),
0302   
0303                          'legend3'                    => 'ACP_FEED_TOPIC_BASED',
0304                          'feed_limit_topic'            => array('lang' => 'ACP_FEED_LIMIT',                'validate' => 'int:5:9999',    'type' => 'number:5:9999',                'explain' => true),
0305                          'feed_topics_new'            => array('lang' => 'ACP_FEED_TOPICS_NEW',            'validate' => 'bool',    'type' => 'radio:enabled_disabled',    'explain' => true ),
0306                          'feed_topics_active'        => array('lang' => 'ACP_FEED_TOPICS_ACTIVE',        'validate' => 'bool',    'type' => 'radio:enabled_disabled',    'explain' => true ),
0307                          'feed_news_id'                => array('lang' => 'ACP_FEED_NEWS',                    'validate' => 'string',    'type' => 'custom', 'method' => 'select_news_forums', 'explain' => true),
0308   
0309                          'legend4'                    => 'ACP_FEED_SETTINGS_OTHER',
0310                          'feed_overall_forums'        => array('lang'    => 'ACP_FEED_OVERALL_FORUMS',        'validate' => 'bool',    'type' => 'radio:enabled_disabled',    'explain' => true ),
0311                          'feed_exclude_id'            => array('lang' => 'ACP_FEED_EXCLUDE_ID',            'validate' => 'string',    'type' => 'custom', 'method' => 'select_exclude_forums', 'explain' => true),
0312                      )
0313                  );
0314              break;
0315   
0316              case 'cookie':
0317                  $display_vars = array(
0318                      'title'    => 'ACP_COOKIE_SETTINGS',
0319                      'vars'    => array(
0320                          'legend1'        => 'ACP_COOKIE_SETTINGS',
0321                          'cookie_domain'    => array('lang' => 'COOKIE_DOMAIN',    'validate' => 'string',    'type' => 'text::255', 'explain' => false),
0322                          'cookie_name'    => array('lang' => 'COOKIE_NAME',    'validate' => 'string',    'type' => 'text::16', 'explain' => false),
0323                          'cookie_path'    => array('lang'    => 'COOKIE_PATH',    'validate' => 'string',    'type' => 'text::255', 'explain' => false),
0324                          'cookie_secure'    => array('lang' => 'COOKIE_SECURE',    'validate' => 'bool',    'type' => 'radio:disabled_enabled', 'explain' => true),
0325                      )
0326                  );
0327              break;
0328   
0329              case 'load':
0330                  $display_vars = array(
0331                      'title'    => 'ACP_LOAD_SETTINGS',
0332                      'vars'    => array(
0333                          'legend1'            => 'GENERAL_SETTINGS',
0334                          'limit_load'        => array('lang' => 'LIMIT_LOAD',        'validate' => 'int:0:9999',    'type' => 'number:0:9999', 'explain' => true),
0335                          'session_length'    => array('lang' => 'SESSION_LENGTH',    'validate' => 'int:60:9999999999',    'type' => 'number:60:9999999999', 'explain' => true, 'append' => ' ' . $user->lang['SECONDS']),
0336                          'active_sessions'    => array('lang' => 'LIMIT_SESSIONS',    'validate' => 'int:0:9999',    'type' => 'number:0:9999', 'explain' => true),
0337                          'load_online_time'    => array('lang' => 'ONLINE_LENGTH',        'validate' => 'int:0:999',    'type' => 'number:0:999', 'explain' => true, 'append' => ' ' . $user->lang['MINUTES']),
0338                          'read_notification_expire_days'    => array('lang' => 'READ_NOTIFICATION_EXPIRE_DAYS',    'validate' => 'int:0',    'type' => 'number:0', 'explain' => true, 'append' => ' ' . $user->lang['DAYS']),
0339   
0340                          'legend2'                => 'GENERAL_OPTIONS',
0341                          'load_notifications'    => array('lang' => 'LOAD_NOTIFICATIONS',    'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => true),
0342                          'load_db_track'            => array('lang' => 'YES_POST_MARKING',        'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => true),
0343                          'load_db_lastread'        => array('lang' => 'YES_READ_MARKING',        'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => true),
0344                          'load_anon_lastread'    => array('lang' => 'YES_ANON_READ_MARKING',    'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => true),
0345                          'load_online'            => array('lang' => 'YES_ONLINE',            'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => true),
0346                          'load_online_guests'    => array('lang' => 'YES_ONLINE_GUESTS',        'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => true),
0347                          'load_onlinetrack'        => array('lang' => 'YES_ONLINE_TRACK',        'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => true),
0348                          'load_birthdays'        => array('lang' => 'YES_BIRTHDAYS',            'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => true),
0349                          'load_unreads_search'    => array('lang' => 'YES_UNREAD_SEARCH',        'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => false),
0350                          'load_moderators'        => array('lang' => 'YES_MODERATORS',        'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => false),
0351                          'load_jumpbox'            => array('lang' => 'YES_JUMPBOX',            'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => false),
0352                          'load_user_activity'    => array('lang' => 'LOAD_USER_ACTIVITY',    'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => true),
0353                          'load_tplcompile'        => array('lang' => 'RECOMPILE_STYLES',        'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => true),
0354                          'allow_cdn'                => array('lang' => 'ALLOW_CDN',                'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => true),
0355                          'allow_live_searches'    => array('lang' => 'ALLOW_LIVE_SEARCHES',    'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => true),
0356   
0357                          'legend3'                => 'CUSTOM_PROFILE_FIELDS',
0358                          'load_cpf_memberlist'    => array('lang' => 'LOAD_CPF_MEMBERLIST',    'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => false),
0359                          'load_cpf_pm'            => array('lang' => 'LOAD_CPF_PM',            'validate' => 'bool',    'type' => 'radio:yes_no', 'explain'    => false),
0360                          'load_cpf_viewprofile'    => array('lang' => 'LOAD_CPF_VIEWPROFILE',    'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => false),
0361                          'load_cpf_viewtopic'    => array('lang' => 'LOAD_CPF_VIEWTOPIC',    'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => false),
0362   
0363                          'legend4'                    => 'ACP_SUBMIT_CHANGES',
0364                      )
0365                  );
0366              break;
0367   
0368              case 'auth':
0369                  $display_vars = array(
0370                      'title'    => 'ACP_AUTH_SETTINGS',
0371                      'vars'    => array(
0372                          'legend1'        => 'ACP_AUTH_SETTINGS',
0373                          'auth_method'    => array('lang' => 'AUTH_METHOD',    'validate' => 'string',    'type' => 'select:1:toggable', 'method' => 'select_auth_method', 'explain' => false),
0374                      )
0375                  );
0376              break;
0377   
0378              case 'server':
0379                  $display_vars = array(
0380                      'title'    => 'ACP_SERVER_SETTINGS',
0381                      'vars'    => array(
0382                          'legend1'                => 'ACP_SERVER_SETTINGS',
0383                          'gzip_compress'            => array('lang' => 'ENABLE_GZIP',        'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => true),
0384                          'use_system_cron'        => array('lang' => 'USE_SYSTEM_CRON',        'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => true),
0385   
0386                          'legend2'                => 'PATH_SETTINGS',
0387                          'enable_mod_rewrite'    => array('lang' => 'MOD_REWRITE_ENABLE',    'validate' => 'bool',    'type' => 'custom', 'method' => 'enable_mod_rewrite', 'explain' => true),
0388                          'smilies_path'            => array('lang' => 'SMILIES_PATH',        'validate' => 'rpath',    'type' => 'text:20:255', 'explain' => true),
0389                          'icons_path'            => array('lang' => 'ICONS_PATH',        'validate' => 'rpath',    'type' => 'text:20:255', 'explain' => true),
0390                          'upload_icons_path'        => array('lang' => 'UPLOAD_ICONS_PATH',    'validate' => 'rpath',    'type' => 'text:20:255', 'explain' => true),
0391                          'ranks_path'            => array('lang' => 'RANKS_PATH',        'validate' => 'rpath',    'type' => 'text:20:255', 'explain' => true),
0392   
0393                          'legend3'                => 'SERVER_URL_SETTINGS',
0394                          'force_server_vars'        => array('lang' => 'FORCE_SERVER_VARS',    'validate' => 'bool',            'type' => 'radio:yes_no', 'explain' => true),
0395                          'server_protocol'        => array('lang' => 'SERVER_PROTOCOL',    'validate' => 'string',            'type' => 'text:10:10', 'explain' => true),
0396                          'server_name'            => array('lang' => 'SERVER_NAME',        'validate' => 'string',            'type' => 'text:40:255', 'explain' => true),
0397                          'server_port'            => array('lang' => 'SERVER_PORT',        'validate' => 'int:0:99999',            'type' => 'number:0:99999', 'explain' => true),
0398                          'script_path'            => array('lang' => 'SCRIPT_PATH',        'validate' => 'script_path',    'type' => 'text::255', 'explain' => true),
0399   
0400                          'legend4'                    => 'ACP_SUBMIT_CHANGES',
0401                      )
0402                  );
0403              break;
0404   
0405              case 'security':
0406                  $display_vars = array(
0407                      'title'    => 'ACP_SECURITY_SETTINGS',
0408                      'vars'    => array(
0409                          'legend1'                => 'ACP_SECURITY_SETTINGS',
0410                          'allow_autologin'        => array('lang' => 'ALLOW_AUTOLOGIN',        'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => true),
0411                          'allow_password_reset'    => array('lang' => 'ALLOW_PASSWORD_RESET',    'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => true),
0412                          'max_autologin_time'    => array('lang' => 'AUTOLOGIN_LENGTH',        'validate' => 'int:0:99999',    'type' => 'number:0:99999',    'explain' => true,    'append' => ' ' . $user->lang['DAYS']),
0413                          'ip_check'                => array('lang' => 'IP_VALID',                'validate' => 'int',    'type' => 'custom', 'method' => 'select_ip_check', 'explain' => true),
0414                          'browser_check'            => array('lang' => 'BROWSER_VALID',            'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => true),
0415                          'forwarded_for_check'    => array('lang' => 'FORWARDED_FOR_VALID',    'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => true),
0416                          'referer_validation'    => array('lang' => 'REFERRER_VALID',        'validate' => 'int:0:3','type' => 'custom', 'method' => 'select_ref_check', 'explain' => true),
0417                          'check_dnsbl'            => array('lang' => 'CHECK_DNSBL',            'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => true),
0418                          'email_check_mx'        => array('lang' => 'EMAIL_CHECK_MX',        'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => true),
0419                          'max_pass_chars'        => array('lang' => 'PASSWORD_LENGTH', 'validate' => 'int:8:255', 'type' => false, 'method' => false, 'explain' => false,),
0420                          'min_pass_chars'        => array('lang' => 'PASSWORD_LENGTH',    'validate' => 'int:1',    'type' => 'custom', 'method' => 'password_length', 'explain' => true),
0421                          'pass_complex'            => array('lang' => 'PASSWORD_TYPE',            'validate' => 'string',    'type' => 'select', 'method' => 'select_password_chars', 'explain' => true),
0422                          'chg_passforce'            => array('lang' => 'FORCE_PASS_CHANGE',        'validate' => 'int:0:999',    'type' => 'number:0:999', 'explain' => true, 'append' => ' ' . $user->lang['DAYS']),
0423                          'max_login_attempts'    => array('lang' => 'MAX_LOGIN_ATTEMPTS',    'validate' => 'int:0:999',    'type' => 'number:0:999', 'explain' => true),
0424                          'ip_login_limit_max'    => array('lang' => 'IP_LOGIN_LIMIT_MAX',    'validate' => 'int:0:999',    'type' => 'number:0:999', 'explain' => true),
0425                          'ip_login_limit_time'    => array('lang' => 'IP_LOGIN_LIMIT_TIME',    'validate' => 'int:0:99999',    'type' => 'number:0:99999', 'explain' => true, 'append' => ' ' . $user->lang['SECONDS']),
0426                          'ip_login_limit_use_forwarded'    => array('lang' => 'IP_LOGIN_LIMIT_USE_FORWARDED',    'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => true),
0427                          'tpl_allow_php'            => array('lang' => 'TPL_ALLOW_PHP',            'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => true),
0428                          'form_token_lifetime'    => array('lang' => 'FORM_TIME_MAX',            'validate' => 'int:-1:99999',    'type' => 'number:-1:99999', 'explain' => true, 'append' => ' ' . $user->lang['SECONDS']),
0429                          'form_token_sid_guests'    => array('lang' => 'FORM_SID_GUESTS',        'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => true),
0430   
0431                      )
0432                  );
0433              break;
0434   
0435              case 'email':
0436                  $display_vars = array(
0437                      'title'    => 'ACP_EMAIL_SETTINGS',
0438                      'vars'    => array(
0439                          'legend1'                => 'GENERAL_SETTINGS',
0440                          'email_enable'            => array('lang' => 'ENABLE_EMAIL',            'validate' => 'bool',    'type' => 'radio:enabled_disabled', 'explain' => true),
0441                          'board_email_form'        => array('lang' => 'BOARD_EMAIL_FORM',        'validate' => 'bool',    'type' => 'radio:enabled_disabled', 'explain' => true),
0442                          'email_function_name'    => array('lang' => 'EMAIL_FUNCTION_NAME',    'validate' => 'string',    'type' => 'text:20:50', 'explain' => true),
0443                          'email_package_size'    => array('lang' => 'EMAIL_PACKAGE_SIZE',    'validate' => 'int:0',    'type' => 'number:0:99999', 'explain' => true),
0444                          'board_contact'            => array('lang' => 'CONTACT_EMAIL',            'validate' => 'email',    'type' => 'email:25:100', 'explain' => true),
0445                          'board_contact_name'    => array('lang' => 'CONTACT_EMAIL_NAME',    'validate' => 'string',    'type' => 'text:25:50', 'explain' => true),
0446                          'board_email'            => array('lang' => 'ADMIN_EMAIL',            'validate' => 'email',    'type' => 'email:25:100', 'explain' => true),
0447                          'board_email_sig'        => array('lang' => 'EMAIL_SIG',                'validate' => 'string',    'type' => 'textarea:5:30', 'explain' => true),
0448                          'board_hide_emails'        => array('lang' => 'BOARD_HIDE_EMAILS',        'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => true),
0449   
0450                          'legend2'                => 'SMTP_SETTINGS',
0451                          'smtp_delivery'            => array('lang' => 'USE_SMTP',                'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => true),
0452                          'smtp_host'                => array('lang' => 'SMTP_SERVER',            'validate' => 'string',    'type' => 'text:25:50', 'explain' => false),
0453                          'smtp_port'                => array('lang' => 'SMTP_PORT',                'validate' => 'int:0:99999',    'type' => 'number:0:99999', 'explain' => true),
0454                          'smtp_auth_method'        => array('lang' => 'SMTP_AUTH_METHOD',        'validate' => 'string',    'type' => 'select', 'method' => 'mail_auth_select', 'explain' => true),
0455                          'smtp_username'            => array('lang' => 'SMTP_USERNAME',            'validate' => 'string',    'type' => 'text:25:255', 'explain' => true),
0456                          'smtp_password'            => array('lang' => 'SMTP_PASSWORD',            'validate' => 'string',    'type' => 'password:25:255', 'explain' => true),
0457   
0458                          'legend3'                    => 'ACP_SUBMIT_CHANGES',
0459                      )
0460                  );
0461              break;
0462   
0463              default:
0464                  trigger_error('NO_MODE', E_USER_ERROR);
0465              break;
0466          }
0467   
0468          /**
0469          * Event to add and/or modify acp_board configurations
0470          *
0471          * @event core.acp_board_config_edit_add
0472          * @var    array    display_vars    Array of config values to display and process
0473          * @var    string    mode            Mode of the config page we are displaying
0474          * @var    boolean    submit            Do we display the form or process the submission
0475          * @since 3.1.0-a4
0476          */
0477          $vars = array('display_vars', 'mode', 'submit');
0478          extract($phpbb_dispatcher->trigger_event('core.acp_board_config_edit_add', compact($vars)));
0479   
0480          if (isset($display_vars['lang']))
0481          {
0482              $user->add_lang($display_vars['lang']);
0483          }
0484   
0485          $this->new_config = $config;
0486          $cfg_array = (isset($_REQUEST['config'])) ? utf8_normalize_nfc(request_var('config', array('' => ''), true)) : $this->new_config;
0487          $error = array();
0488   
0489          // We validate the complete config if wished
0490          validate_config_vars($display_vars['vars'], $cfg_array, $error);
0491   
0492          if ($submit && !check_form_key($form_key))
0493          {
0494              $error[] = $user->lang['FORM_INVALID'];
0495          }
0496          // Do not write values if there is an error
0497          if (sizeof($error))
0498          {
0499              $submit = false;
0500          }
0501   
0502          // We go through the display_vars to make sure no one is trying to set variables he/she is not allowed to...
0503          foreach ($display_vars['vars'] as $config_name => $null)
0504          {
0505              if (!isset($cfg_array[$config_name]) || strpos($config_name, 'legend') !== false)
0506              {
0507                  continue;
0508              }
0509   
0510              if ($config_name == 'auth_method' || $config_name == 'feed_news_id' || $config_name == 'feed_exclude_id')
0511              {
0512                  continue;
0513              }
0514   
0515              if ($config_name == 'guest_style')
0516              {
0517                  if (isset($cfg_array[$config_name])) {
0518                      $this->guest_style_set($cfg_array[$config_name]);
0519                  }
0520                  continue;
0521              }
0522   
0523              $this->new_config[$config_name] = $config_value = $cfg_array[$config_name];
0524   
0525              if ($config_name == 'email_function_name')
0526              {
0527                  $this->new_config['email_function_name'] = trim(str_replace(array('(', ')'), array('', ''), $this->new_config['email_function_name']));
0528                  $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'];
0529                  $config_value = $this->new_config['email_function_name'];
0530              }
0531   
0532              if ($submit)
0533              {
0534                  set_config($config_name, $config_value);
0535   
0536                  if ($config_name == 'allow_quick_reply' && isset($_POST['allow_quick_reply_enable']))
0537                  {
0538                      enable_bitfield_column_flag(FORUMS_TABLE, 'forum_flags', log(FORUM_FLAG_QUICK_REPLY, 2));
0539                  }
0540              }
0541          }
0542   
0543          // Store news and exclude ids
0544          if ($mode == 'feed' && $submit)
0545          {
0546              $cache->destroy('_feed_news_forum_ids');
0547              $cache->destroy('_feed_excluded_forum_ids');
0548   
0549              $this->store_feed_forums(FORUM_OPTION_FEED_NEWS, 'feed_news_id');
0550              $this->store_feed_forums(FORUM_OPTION_FEED_EXCLUDE, 'feed_exclude_id');
0551          }
0552   
0553          if ($mode == 'auth')
0554          {
0555              // Retrieve a list of auth plugins and check their config values
0556              $auth_providers = $phpbb_container->get('auth.provider_collection');
0557   
0558              $updated_auth_settings = false;
0559              $old_auth_config = array();
0560              foreach ($auth_providers as $provider)
0561              {
0562                  if ($fields = $provider->acp())
0563                  {
0564                      // Check if we need to create config fields for this plugin and save config when submit was pressed
0565                      foreach ($fields as $field)
0566                      {
0567                          if (!isset($config[$field]))
0568                          {
0569                              set_config($field, '');
0570                          }
0571   
0572                          if (!isset($cfg_array[$field]) || strpos($field, 'legend') !== false)
0573                          {
0574                              continue;
0575                          }
0576   
0577                          $old_auth_config[$field] = $this->new_config[$field];
0578                          $config_value = $cfg_array[$field];
0579                          $this->new_config[$field] = $config_value;
0580   
0581                          if ($submit)
0582                          {
0583                              $updated_auth_settings = true;
0584                              set_config($field, $config_value);
0585                          }
0586                      }
0587                  }
0588                  unset($fields);
0589              }
0590   
0591              if ($submit && (($cfg_array['auth_method'] != $this->new_config['auth_method']) || $updated_auth_settings))
0592              {
0593                  $method = basename($cfg_array['auth_method']);
0594                  if (array_key_exists('auth.provider.' . $method, $auth_providers))
0595                  {
0596                      $provider = $auth_providers['auth.provider.' . $method];
0597                      if ($error = $provider->init())
0598                      {
0599                          foreach ($old_auth_config as $config_name => $config_value)
0600                          {
0601                              set_config($config_name, $config_value);
0602                          }
0603                          trigger_error($error . adm_back_link($this->u_action), E_USER_WARNING);
0604                      }
0605                      set_config('auth_method', basename($cfg_array['auth_method']));
0606                  }
0607                  else
0608                  {
0609                      trigger_error('NO_AUTH_PLUGIN', E_USER_ERROR);
0610                  }
0611              }
0612          }
0613   
0614          if ($submit)
0615          {
0616              add_log('admin', 'LOG_CONFIG_' . strtoupper($mode));
0617   
0618              trigger_error($user->lang['CONFIG_UPDATED'] . adm_back_link($this->u_action));
0619          }
0620   
0621          $this->tpl_name = 'acp_board';
0622          $this->page_title = $display_vars['title'];
0623   
0624          $template->assign_vars(array(
0625              'L_TITLE'            => $user->lang[$display_vars['title']],
0626              'L_TITLE_EXPLAIN'    => $user->lang[$display_vars['title'] . '_EXPLAIN'],
0627   
0628              'S_ERROR'            => (sizeof($error)) ? true : false,
0629              'ERROR_MSG'            => implode('<br />', $error),
0630   
0631              'U_ACTION'            => $this->u_action)
0632          );
0633   
0634          // Output relevant page
0635          foreach ($display_vars['vars'] as $config_key => $vars)
0636          {
0637              if (!is_array($vars) && strpos($config_key, 'legend') === false)
0638              {
0639                  continue;
0640              }
0641   
0642              if (strpos($config_key, 'legend') !== false)
0643              {
0644                  $template->assign_block_vars('options', array(
0645                      'S_LEGEND'        => true,
0646                      'LEGEND'        => (isset($user->lang[$vars])) ? $user->lang[$vars] : $vars)
0647                  );
0648   
0649                  continue;
0650              }
0651   
0652              $type = explode(':', $vars['type']);
0653   
0654              $l_explain = '';
0655              if ($vars['explain'] && isset($vars['lang_explain']))
0656              {
0657                  $l_explain = (isset($user->lang[$vars['lang_explain']])) ? $user->lang[$vars['lang_explain']] : $vars['lang_explain'];
0658              }
0659              else if ($vars['explain'])
0660              {
0661                  $l_explain = (isset($user->lang[$vars['lang'] . '_EXPLAIN'])) ? $user->lang[$vars['lang'] . '_EXPLAIN'] : '';
0662              }
0663   
0664              $content = build_cfg_template($type, $config_key, $this->new_config, $config_key, $vars);
0665   
0666              if (empty($content))
0667              {
0668                  continue;
0669              }
0670   
0671              $template->assign_block_vars('options', array(
0672                  'KEY'            => $config_key,
0673                  'TITLE'            => (isset($user->lang[$vars['lang']])) ? $user->lang[$vars['lang']] : $vars['lang'],
0674                  'S_EXPLAIN'        => $vars['explain'],
0675                  'TITLE_EXPLAIN'    => $l_explain,
0676                  'CONTENT'        => $content,
0677                  )
0678              );
0679   
0680              unset($display_vars['vars'][$config_key]);
0681          }
0682   
0683          if ($mode == 'auth')
0684          {
0685              $template->assign_var('S_AUTH', true);
0686   
0687              foreach ($auth_providers as $provider)
0688              {
0689                  $auth_tpl = $provider->get_acp_template($this->new_config);
0690                  if ($auth_tpl)
0691                  {
0692                      if (array_key_exists('BLOCK_VAR_NAME', $auth_tpl))
0693                      {
0694                          foreach ($auth_tpl['BLOCK_VARS'] as $block_vars)
0695                          {
0696                              $template->assign_block_vars($auth_tpl['BLOCK_VAR_NAME'], $block_vars);
0697                          }
0698                      }
0699                      $template->assign_vars($auth_tpl['TEMPLATE_VARS']);
0700                      $template->assign_block_vars('auth_tpl', array(
0701                          'TEMPLATE_FILE'    => $auth_tpl['TEMPLATE_FILE'],
0702                      ));
0703                  }
0704              }
0705          }
0706      }
0707   
0708      /**
0709      * Select auth method
0710      */
0711      function select_auth_method($selected_method, $key = '')
0712      {
0713          global $phpbb_root_path, $phpEx, $phpbb_container;
0714   
0715          $auth_plugins = array();
0716          $auth_providers = $phpbb_container->get('auth.provider_collection');
0717   
0718          foreach ($auth_providers as $key => $value)
0719          {
0720              if (!($value instanceof \phpbb\auth\provider\provider_interface))
0721              {
0722                  continue;
0723              }
0724              $auth_plugins[] = str_replace('auth.provider.', '', $key);
0725          }
0726   
0727          sort($auth_plugins);
0728   
0729          $auth_select = '';
0730          foreach ($auth_plugins as $method)
0731          {
0732              $selected = ($selected_method == $method) ? ' selected="selected"' : '';
0733              $auth_select .= "<option value=\"$method\"$selected data-toggle-setting=\"#auth_{$method}_settings\">" . ucfirst($method) . '</option>';
0734          }
0735   
0736          return $auth_select;
0737      }
0738   
0739      /**
0740      * Select mail authentication method
0741      */
0742      function mail_auth_select($selected_method, $key = '')
0743      {
0744          global $user;
0745   
0746          $auth_methods = array('PLAIN', 'LOGIN', 'CRAM-MD5', 'DIGEST-MD5', 'POP-BEFORE-SMTP');
0747          $s_smtp_auth_options = '';
0748   
0749          foreach ($auth_methods as $method)
0750          {
0751              $s_smtp_auth_options .= '<option value="' . $method . '"' . (($selected_method == $method) ? ' selected="selected"' : '') . '>' . $user->lang['SMTP_' . str_replace('-', '_', $method)] . '</option>';
0752          }
0753   
0754          return $s_smtp_auth_options;
0755      }
0756   
0757      /**
0758      * Select full folder action
0759      */
0760      function full_folder_select($value, $key = '')
0761      {
0762          global $user;
0763   
0764          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>';
0765      }
0766   
0767      /**
0768      * Select ip validation
0769      */
0770      function select_ip_check($value, $key = '')
0771      {
0772          $radio_ary = array(4 => 'ALL', 3 => 'CLASS_C', 2 => 'CLASS_B', 0 => 'NO_IP_VALIDATION');
0773   
0774          return h_radio('config[ip_check]', $radio_ary, $value, $key);
0775      }
0776   
0777      /**
0778      * Select referer validation
0779      */
0780      function select_ref_check($value, $key = '')
0781      {
0782          $radio_ary = array(REFERER_VALIDATE_PATH => 'REF_PATH', REFERER_VALIDATE_HOST => 'REF_HOST', REFERER_VALIDATE_NONE => 'NO_REF_VALIDATION');
0783   
0784          return h_radio('config[referer_validation]', $radio_ary, $value, $key);
0785      }
0786   
0787      /**
0788      * Select account activation method
0789      */
0790      function select_acc_activation($selected_value, $value)
0791      {
0792          global $user, $config;
0793   
0794          $act_ary = array(
0795              'ACC_DISABLE' => USER_ACTIVATION_DISABLE,
0796              'ACC_NONE' => USER_ACTIVATION_NONE,
0797          );
0798          if ($config['email_enable'])
0799          {
0800              $act_ary['ACC_USER'] = USER_ACTIVATION_SELF;
0801              $act_ary['ACC_ADMIN'] = USER_ACTIVATION_ADMIN;
0802          }
0803          $act_options = '';
0804   
0805          foreach ($act_ary as $key => $value)
0806          {
0807              $selected = ($selected_value == $value) ? ' selected="selected"' : '';
0808              $act_options .= '<option value="' . $value . '"' . $selected . '>' . $user->lang[$key] . '</option>';
0809          }
0810   
0811          return $act_options;
0812      }
0813   
0814      /**
0815      * Maximum/Minimum username length
0816      */
0817      function username_length($value, $key = '')
0818      {
0819          global $user;
0820   
0821          return '<input id="' . $key . '" type="number" size="3" maxlength="3" min="1" max="999" name="config[min_name_chars]" value="' . $value . '" /> ' . $user->lang['MIN_CHARS'] . '&nbsp;&nbsp;<input type="number" size="3" maxlength="3" min="8" max="180" name="config[max_name_chars]" value="' . $this->new_config['max_name_chars'] . '" /> ' . $user->lang['MAX_CHARS'];
0822      }
0823   
0824      /**
0825      * Allowed chars in usernames
0826      */
0827      function select_username_chars($selected_value, $key)
0828      {
0829          global $user;
0830   
0831          $user_char_ary = array('USERNAME_CHARS_ANY', 'USERNAME_ALPHA_ONLY', 'USERNAME_ALPHA_SPACERS', 'USERNAME_LETTER_NUM', 'USERNAME_LETTER_NUM_SPACERS', 'USERNAME_ASCII');
0832          $user_char_options = '';
0833          foreach ($user_char_ary as $user_type)
0834          {
0835              $selected = ($selected_value == $user_type) ? ' selected="selected"' : '';
0836              $user_char_options .= '<option value="' . $user_type . '"' . $selected . '>' . $user->lang[$user_type] . '</option>';
0837          }
0838   
0839          return $user_char_options;
0840      }
0841   
0842      /**
0843      * Maximum/Minimum password length
0844      */
0845      function password_length($value, $key)
0846      {
0847          global $user;
0848   
0849          return '<input id="' . $key . '" type="number" size="3" maxlength="3" min="1" max="999" name="config[min_pass_chars]" value="' . $value . '" /> ' . $user->lang['MIN_CHARS'] . '&nbsp;&nbsp;<input type="number" size="3" maxlength="3" min="8" max="255" name="config[max_pass_chars]" value="' . $this->new_config['max_pass_chars'] . '" /> ' . $user->lang['MAX_CHARS'];
0850      }
0851   
0852      /**
0853      * Required chars in passwords
0854      */
0855      function select_password_chars($selected_value, $key)
0856      {
0857          global $user;
0858   
0859          $pass_type_ary = array('PASS_TYPE_ANY', 'PASS_TYPE_CASE', 'PASS_TYPE_ALPHA', 'PASS_TYPE_SYMBOL');
0860          $pass_char_options = '';
0861          foreach ($pass_type_ary as $pass_type)
0862          {
0863              $selected = ($selected_value == $pass_type) ? ' selected="selected"' : '';
0864              $pass_char_options .= '<option value="' . $pass_type . '"' . $selected . '>' . $user->lang[$pass_type] . '</option>';
0865          }
0866   
0867          return $pass_char_options;
0868      }
0869   
0870      /**
0871      * Select bump interval
0872      */
0873      function bump_interval($value, $key)
0874      {
0875          global $user;
0876   
0877          $s_bump_type = '';
0878          $types = array('m' => 'MINUTES', 'h' => 'HOURS', 'd' => 'DAYS');
0879          foreach ($types as $type => $lang)
0880          {
0881              $selected = ($this->new_config['bump_type'] == $type) ? ' selected="selected"' : '';
0882              $s_bump_type .= '<option value="' . $type . '"' . $selected . '>' . $user->lang[$lang] . '</option>';
0883          }
0884   
0885          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>';
0886      }
0887   
0888      /**
0889      * Board disable option and message
0890      */
0891      function board_disable($value, $key)
0892      {
0893          global $user;
0894   
0895          $radio_ary = array(1 => 'YES', 0 => 'NO');
0896   
0897          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'] . '" />';
0898      }
0899   
0900      /**
0901      * Global quick reply enable/disable setting and button to enable in all forums
0902      */
0903      function quick_reply($value, $key)
0904      {
0905          global $user;
0906   
0907          $radio_ary = array(1 => 'YES', 0 => 'NO');
0908   
0909          return h_radio('config[allow_quick_reply]', $radio_ary, $value) .
0910              '<br /><br /><input class="button2" type="submit" id="' . $key . '_enable" name="' . $key . '_enable" value="' . $user->lang['ALLOW_QUICK_REPLY_BUTTON'] . '" />';
0911      }
0912   
0913      /**
0914      * Select guest timezone
0915      */
0916      function timezone_select($value, $key)
0917      {
0918          global $template, $user;
0919   
0920          $timezone_select = phpbb_timezone_select($template, $user, $value, true);
0921   
0922          return '<select name="config[' . $key . ']" id="' . $key . '">' . $timezone_select . '</select>';
0923      }
0924   
0925      /**
0926      * Get guest style
0927      */
0928      public function guest_style_get()
0929      {
0930          global $db;
0931   
0932          $sql = 'SELECT user_style
0933              FROM ' . USERS_TABLE . '
0934              WHERE user_id = ' . ANONYMOUS;
0935          $result = $db->sql_query($sql);
0936   
0937          $style = (int) $db->sql_fetchfield('user_style');
0938          $db->sql_freeresult($result);
0939   
0940          return $style;
0941      }
0942   
0943      /**
0944      * Set guest style
0945      *
0946      * @param    int        $style_id    The style ID
0947      */
0948      public function guest_style_set($style_id)
0949      {
0950          global $db;
0951   
0952          $sql = 'UPDATE ' . USERS_TABLE . '
0953              SET user_style = ' . (int) $style_id . '
0954              WHERE user_id = ' . ANONYMOUS;
0955          $db->sql_query($sql);
0956      }
0957   
0958      /**
0959      * Select default dateformat
0960      */
0961      function dateformat_select($value, $key)
0962      {
0963          global $user, $config;
0964   
0965          // Let the format_date function operate with the acp values
0966          $old_tz = $user->timezone;
0967          try
0968          {
0969              $user->timezone = new DateTimeZone($config['board_timezone']);
0970          }
0971          catch (\Exception $e)
0972          {
0973              // If the board timezone is invalid, we just use the users timezone.
0974          }
0975   
0976          $dateformat_options = '';
0977   
0978          foreach ($user->lang['dateformats'] as $format => $null)
0979          {
0980              $dateformat_options .= '<option value="' . $format . '"' . (($format == $value) ? ' selected="selected"' : '') . '>';
0981              $dateformat_options .= $user->format_date(time(), $format, false) . ((strpos($format, '|') !== false) ? $user->lang['VARIANT_DATE_SEPARATOR'] . $user->format_date(time(), $format, true) : '');
0982              $dateformat_options .= '</option>';
0983          }
0984   
0985          $dateformat_options .= '<option value="custom"';
0986          if (!isset($user->lang['dateformats'][$value]))
0987          {
0988              $dateformat_options .= ' selected="selected"';
0989          }
0990          $dateformat_options .= '>' . $user->lang['CUSTOM_DATEFORMAT'] . '</option>';
0991   
0992          // Reset users date options
0993          $user->timezone = $old_tz;
0994   
0995          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>
0996          <input type=\"text\" name=\"config[$key]\" id=\"$key\" value=\"$value\" maxlength=\"30\" />";
0997      }
0998   
0999      /**
1000      * Select multiple forums
1001      */
1002      function select_news_forums($value, $key)
1003      {
1004          global $user, $config;
1005   
1006          $forum_list = make_forum_select(false, false, true, true, true, false, true);
1007   
1008          // Build forum options
1009          $s_forum_options = '<select id="' . $key . '" name="' . $key . '[]" multiple="multiple">';
1010          foreach ($forum_list as $f_id => $f_row)
1011          {
1012              $f_row['selected'] = phpbb_optionget(FORUM_OPTION_FEED_NEWS, $f_row['forum_options']);
1013   
1014              $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>';
1015          }
1016          $s_forum_options .= '</select>';
1017   
1018          return $s_forum_options;
1019      }
1020   
1021      function select_exclude_forums($value, $key)
1022      {
1023          global $user, $config;
1024   
1025          $forum_list = make_forum_select(false, false, true, true, true, false, true);
1026   
1027          // Build forum options
1028          $s_forum_options = '<select id="' . $key . '" name="' . $key . '[]" multiple="multiple">';
1029          foreach ($forum_list as $f_id => $f_row)
1030          {
1031              $f_row['selected'] = phpbb_optionget(FORUM_OPTION_FEED_EXCLUDE, $f_row['forum_options']);
1032   
1033              $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>';
1034          }
1035          $s_forum_options .= '</select>';
1036   
1037          return $s_forum_options;
1038      }
1039   
1040      function store_feed_forums($option, $key)
1041      {
1042          global $db, $cache;
1043   
1044          // Get key
1045          $values = request_var($key, array(0 => 0));
1046   
1047          // Empty option bit for all forums
1048          $sql = 'UPDATE ' . FORUMS_TABLE . '
1049              SET forum_options = forum_options - ' . (1 << $option) . '
1050              WHERE ' . $db->sql_bit_and('forum_options', $option, '<> 0');
1051          $db->sql_query($sql);
1052   
1053          // Already emptied for all...
1054          if (sizeof($values))
1055          {
1056              // Set for selected forums
1057              $sql = 'UPDATE ' . FORUMS_TABLE . '
1058                  SET forum_options = forum_options + ' . (1 << $option) . '
1059                  WHERE ' . $db->sql_in_set('forum_id', $values);
1060              $db->sql_query($sql);
1061          }
1062   
1063          // Empty sql cache for forums table because options changed
1064          $cache->destroy('sql', FORUMS_TABLE);
1065      }
1066   
1067      /**
1068      * Option to enable/disable removal of 'app.php' from URLs
1069      *
1070      * Note that if mod_rewrite is on, URLs without app.php will still work,
1071      * but any paths generated by the controller helper url() method will not
1072      * contain app.php.
1073      *
1074      * @param int $value The current config value
1075      * @param string $key The config key
1076      * @return string The HTML for the form field
1077      */
1078      function enable_mod_rewrite($value, $key)
1079      {
1080          global $user, $config;
1081   
1082          // Determine whether mod_rewrite is enabled on the server
1083          // NOTE: This only works on Apache servers on which PHP is NOT
1084          // installed as CGI. In that case, there is no way for PHP to
1085          // determine whether or not the Apache module is enabled.
1086          //
1087          // To be clear on the value of $mod_rewite:
1088          // null = Cannot determine whether or not the server has mod_rewrite
1089          //        enabled
1090          // false = Can determine that the server does NOT have mod_rewrite
1091          //         enabled
1092          // true = Can determine that the server DOES have mod_rewrite_enabled
1093          $mod_rewrite = null;
1094          if (function_exists('apache_get_modules'))
1095          {
1096              $mod_rewrite = (bool) in_array('mod_rewrite', apache_get_modules());
1097          }
1098   
1099          // If $message is false, mod_rewrite is enabled.
1100          // Otherwise, it is not and we need to:
1101          // 1) disable the form field
1102          // 2) make sure the config value is set to 0
1103          // 3) append the message to the return
1104          $value = ($mod_rewrite === false) ? 0 : $value;
1105          $message = $mod_rewrite === null ? 'MOD_REWRITE_INFORMATION_UNAVAILABLE' : ($mod_rewrite === false ? 'MOD_REWRITE_DISABLED' : false);
1106   
1107          // Let's do some friendly HTML injection if we want to disable the
1108          // form field because h_radio() has no pretty way of doing so
1109          $field_name = 'config[enable_mod_rewrite]' . ($message === 'MOD_REWRITE_DISABLED' ? '" disabled="disabled' : '');
1110   
1111          return h_radio($field_name, array(1 => 'YES', 0 => 'NO'), $value) .
1112              ($message !== false ? '<br /><span>' . $user->lang($message) . '</span>' : '');
1113      }
1114  }
1115