Verzeichnisstruktur phpBB-3.2.0


Veröffentlicht
06.01.2017

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