Verzeichnisstruktur phpBB-3.3.15


Veröffentlicht
28.08.2024

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