[ Index ]

PHP Cross Reference of phpBB-3.1.12-deutsch

title

Body

[close]

/includes/acp/ -> acp_board.php (source)

   1  <?php
   2  /**
   3  *
   4  * This file is part of the phpBB Forum Software package.
   5  *
   6  * @copyright (c) phpBB Limited <https://www.phpbb.com>
   7  * @license GNU General Public License, version 2 (GPL-2.0)
   8  *
   9  * For full copyright and license information, please see
  10  * the docs/CREDITS.txt file.
  11  *
  12  */
  13  
  14  /**
  15  * @todo add cron intervals to server settings? (database_gc, queue_interval, session_gc, search_gc, cache_gc, warnings_gc)
  16  */
  17  
  18  /**
  19  * @ignore
  20  */
  21  if (!defined('IN_PHPBB'))
  22  {
  23      exit;
  24  }
  25  
  26  class acp_board
  27  {
  28      var $u_action;
  29      var $new_config;
  30  
  31  	function main($id, $mode)
  32      {
  33          global $db, $user, $auth, $template;
  34          global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx;
  35          global $cache, $phpbb_container, $phpbb_dispatcher;
  36  
  37          $user->add_lang('acp/board');
  38  
  39          $action    = request_var('action', '');
  40          $submit = (isset($_POST['submit']) || isset($_POST['allow_quick_reply_enable'])) ? true : false;
  41  
  42          $form_key = 'acp_board';
  43          add_form_key($form_key);
  44  
  45          /**
  46          *    Validation types are:
  47          *        string, int, bool,
  48          *        script_path (absolute path in url - beginning with / and no trailing slash),
  49          *        rpath (relative), rwpath (realtive, writable), path (relative path, but able to escape the root), wpath (writable)
  50          */
  51          switch ($mode)
  52          {
  53              case 'settings':
  54                  $display_vars = array(
  55                      'title'    => 'ACP_BOARD_SETTINGS',
  56                      'vars'    => array(
  57                          'legend1'                => 'ACP_BOARD_SETTINGS',
  58                          'sitename'                => array('lang' => 'SITE_NAME',                'validate' => 'string',    'type' => 'text:40:255', 'explain' => false),
  59                          'site_desc'                => array('lang' => 'SITE_DESC',                'validate' => 'string',    'type' => 'text:40:255', 'explain' => false),
  60                          'site_home_url'            => array('lang' => 'SITE_HOME_URL',            'validate' => 'string',    'type' => 'url:40:255', 'explain' => true),
  61                          'site_home_text'        => array('lang' => 'SITE_HOME_TEXT',        'validate' => 'string',    'type' => 'text:40:255', 'explain' => true),
  62                          'board_index_text'        => array('lang' => 'BOARD_INDEX_TEXT',        'validate' => 'string',    'type' => 'text:40:255', 'explain' => true),
  63                          'board_disable'            => array('lang' => 'DISABLE_BOARD',            'validate' => 'bool',    'type' => 'custom', 'method' => 'board_disable', 'explain' => true),
  64                          'board_disable_msg'        => false,
  65                          'default_lang'            => array('lang' => 'DEFAULT_LANGUAGE',        'validate' => 'lang',    'type' => 'select', 'function' => 'language_select', 'params' => array('{CONFIG_VALUE}'), 'explain' => false),
  66                          'default_dateformat'    => array('lang' => 'DEFAULT_DATE_FORMAT',    'validate' => 'string',    'type' => 'custom', 'method' => 'dateformat_select', 'explain' => true),
  67                          'board_timezone'        => array('lang' => 'SYSTEM_TIMEZONE',        'validate' => 'timezone',    'type' => 'custom', 'method' => 'timezone_select', 'explain' => true),
  68  
  69                          'legend2'                => 'BOARD_STYLE',
  70                          'default_style'            => array('lang' => 'DEFAULT_STYLE',            'validate' => 'int',    'type' => 'select', 'function' => 'style_select', 'params' => array('{CONFIG_VALUE}', false), 'explain' => true),
  71                          'guest_style'            => array('lang' => 'GUEST_STYLE',            'validate' => 'int',    'type' => 'select', 'function' => 'style_select', 'params' => array($this->guest_style_get(), false), 'explain' => true),
  72                          'override_user_style'    => array('lang' => 'OVERRIDE_STYLE',        'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => true),
  73  
  74                          'legend3'                => 'WARNINGS',
  75                          'warnings_expire_days'    => array('lang' => 'WARNINGS_EXPIRE',        'validate' => 'int:0:9999',    'type' => 'number:0:9999', 'explain' => true, 'append' => ' ' . $user->lang['DAYS']),
  76  
  77                          'legend4'                    => 'ACP_SUBMIT_CHANGES',
  78                      )
  79                  );
  80              break;
  81  
  82              case 'features':
  83                  $display_vars = array(
  84                      'title'    => 'ACP_BOARD_FEATURES',
  85                      'vars'    => array(
  86                          'legend1'                => 'ACP_BOARD_FEATURES',
  87                          'allow_privmsg'            => array('lang' => 'BOARD_PM',                'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => true),
  88                          'allow_topic_notify'    => array('lang' => 'ALLOW_TOPIC_NOTIFY',    'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => false),
  89                          'allow_forum_notify'    => array('lang' => 'ALLOW_FORUM_NOTIFY',    'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => false),
  90                          'allow_namechange'        => array('lang' => 'ALLOW_NAME_CHANGE',        'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => false),
  91                          'allow_attachments'        => array('lang' => 'ALLOW_ATTACHMENTS',        'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => false),
  92                          'allow_pm_attach'        => array('lang' => 'ALLOW_PM_ATTACHMENTS',    'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => false),
  93                          'allow_pm_report'        => array('lang' => 'ALLOW_PM_REPORT',        'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => true),
  94                          'allow_bbcode'            => array('lang' => 'ALLOW_BBCODE',            'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => false),
  95                          'allow_smilies'            => array('lang' => 'ALLOW_SMILIES',            'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => false),
  96                          'allow_sig'                => array('lang' => 'ALLOW_SIG',                'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => false),
  97                          'allow_nocensors'        => array('lang' => 'ALLOW_NO_CENSORS',        'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => true),
  98                          'allow_bookmarks'        => array('lang' => 'ALLOW_BOOKMARKS',        'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => true),
  99                          'allow_birthdays'        => array('lang' => 'ALLOW_BIRTHDAYS',        'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => true),
 100                          'display_last_subject'    => array('lang' => 'DISPLAY_LAST_SUBJECT',        'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => true),
 101                          'allow_quick_reply'        => array('lang' => 'ALLOW_QUICK_REPLY',        'validate' => 'bool',    'type' => 'custom', 'method' => 'quick_reply', 'explain' => true),
 102  
 103                          'legend2'                => 'ACP_LOAD_SETTINGS',
 104                          'load_birthdays'        => array('lang' => 'YES_BIRTHDAYS',            'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => true),
 105                          'load_moderators'        => array('lang' => 'YES_MODERATORS',        'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => false),
 106                          'load_jumpbox'            => array('lang' => 'YES_JUMPBOX',            'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => false),
 107                          'load_cpf_memberlist'    => array('lang' => 'LOAD_CPF_MEMBERLIST',    'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => false),
 108                          'load_cpf_pm'            => array('lang' => 'LOAD_CPF_PM',            'validate' => 'bool',    'type' => 'radio:yes_no', 'explain'    => false),
 109                          'load_cpf_viewprofile'    => array('lang' => 'LOAD_CPF_VIEWPROFILE',    'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => false),
 110                          'load_cpf_viewtopic'    => array('lang' => 'LOAD_CPF_VIEWTOPIC',    'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => false),
 111  
 112                          'legend3'                    => 'ACP_SUBMIT_CHANGES',
 113                      )
 114                  );
 115              break;
 116  
 117              case 'avatar':
 118                  $phpbb_avatar_manager = $phpbb_container->get('avatar.manager');
 119                  $avatar_drivers = $phpbb_avatar_manager->get_all_drivers();
 120  
 121                  $avatar_vars = array();
 122                  foreach ($avatar_drivers as $current_driver)
 123                  {
 124                      $driver = $phpbb_avatar_manager->get_driver($current_driver, false);
 125  
 126                      /*
 127                      * First grab the settings for enabling/disabling the avatar
 128                      * driver and afterwards grab additional settings the driver
 129                      * might have.
 130                      */
 131                      $avatar_vars += $phpbb_avatar_manager->get_avatar_settings($driver);
 132                      $avatar_vars += $driver->prepare_form_acp($user);
 133                  }
 134  
 135                  $display_vars = array(
 136                      'title'    => 'ACP_AVATAR_SETTINGS',
 137                      'vars'    => array(
 138                          'legend1'                => 'ACP_AVATAR_SETTINGS',
 139  
 140                          'avatar_min_width'        => array('lang' => 'MIN_AVATAR_SIZE', 'validate' => 'int:0', 'type' => false, 'method' => false, 'explain' => false),
 141                          'avatar_min_height'        => array('lang' => 'MIN_AVATAR_SIZE', 'validate' => 'int:0', 'type' => false, 'method' => false, 'explain' => false),
 142                          'avatar_max_width'        => array('lang' => 'MAX_AVATAR_SIZE', 'validate' => 'int:0', 'type' => false, 'method' => false, 'explain' => false),
 143                          'avatar_max_height'        => array('lang' => 'MAX_AVATAR_SIZE', 'validate' => 'int:0', 'type' => false, 'method' => false, 'explain' => false),
 144  
 145                          'allow_avatar'            => array('lang' => 'ALLOW_AVATARS',            'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => true),
 146                          'avatar_min'            => array('lang' => 'MIN_AVATAR_SIZE',        'validate' => 'int:0',    'type' => 'dimension:0', 'explain' => true, 'append' => ' ' . $user->lang['PIXEL']),
 147                          'avatar_max'            => array('lang' => 'MAX_AVATAR_SIZE',        'validate' => 'int:0',    'type' => 'dimension:0', 'explain' => true, 'append' => ' ' . $user->lang['PIXEL']),
 148                      )
 149                  );
 150  
 151                  if (!empty($avatar_vars))
 152                  {
 153                      $display_vars['vars'] += $avatar_vars;
 154                  }
 155              break;
 156  
 157              case 'message':
 158                  $display_vars = array(
 159                      'title'    => 'ACP_MESSAGE_SETTINGS',
 160                      'lang'    => 'ucp',
 161                      'vars'    => array(
 162                          'legend1'                => 'GENERAL_SETTINGS',
 163                          'allow_privmsg'            => array('lang' => 'BOARD_PM',                'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => true),
 164                          'pm_max_boxes'            => array('lang' => 'BOXES_MAX',                'validate' => 'int:0:9999',    'type' => 'number:0:9999', 'explain' => true),
 165                          'pm_max_msgs'            => array('lang' => 'BOXES_LIMIT',            'validate' => 'int:0:9999',    'type' => 'number:0:9999', 'explain' => true),
 166                          'full_folder_action'    => array('lang' => 'FULL_FOLDER_ACTION',    'validate' => 'int',    'type' => 'select', 'method' => 'full_folder_select', 'explain' => true),
 167                          'pm_edit_time'            => array('lang' => 'PM_EDIT_TIME',            'validate' => 'int:0:99999',    'type' => 'number:0:99999', 'explain' => true, 'append' => ' ' . $user->lang['MINUTES']),
 168                          'pm_max_recipients'        => array('lang' => 'PM_MAX_RECIPIENTS',        'validate' => 'int:0:99999',    'type' => 'number:0:99999', 'explain' => true),
 169  
 170                          'legend2'                => 'GENERAL_OPTIONS',
 171                          'allow_mass_pm'            => array('lang' => 'ALLOW_MASS_PM',            'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => false),
 172                          'auth_bbcode_pm'        => array('lang' => 'ALLOW_BBCODE_PM',        'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => false),
 173                          'auth_smilies_pm'        => array('lang' => 'ALLOW_SMILIES_PM',        'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => false),
 174                          'allow_pm_attach'        => array('lang' => 'ALLOW_PM_ATTACHMENTS',    'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => false),
 175                          'allow_sig_pm'            => array('lang' => 'ALLOW_SIG_PM',            'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => false),
 176                          'print_pm'                => array('lang' => 'ALLOW_PRINT_PM',        'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => false),
 177                          'forward_pm'            => array('lang' => 'ALLOW_FORWARD_PM',        'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => false),
 178                          'auth_img_pm'            => array('lang' => 'ALLOW_IMG_PM',            'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => false),
 179                          'auth_flash_pm'            => array('lang' => 'ALLOW_FLASH_PM',        'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => true),
 180                          'enable_pm_icons'        => array('lang' => 'ENABLE_PM_ICONS',        'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => false),
 181  
 182                          'legend3'                    => 'ACP_SUBMIT_CHANGES',
 183                      )
 184                  );
 185              break;
 186  
 187              case 'post':
 188                  $display_vars = array(
 189                      'title'    => 'ACP_POST_SETTINGS',
 190                      'vars'    => array(
 191                          'legend1'                => 'GENERAL_OPTIONS',
 192                          'allow_topic_notify'    => array('lang' => 'ALLOW_TOPIC_NOTIFY',    'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => false),
 193                          'allow_forum_notify'    => array('lang' => 'ALLOW_FORUM_NOTIFY',    'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => false),
 194                          'allow_bbcode'            => array('lang' => 'ALLOW_BBCODE',            'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => false),
 195                          'allow_post_flash'        => array('lang' => 'ALLOW_POST_FLASH',        'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => true),
 196                          'allow_smilies'            => array('lang' => 'ALLOW_SMILIES',            'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => false),
 197                          'allow_post_links'        => array('lang' => 'ALLOW_POST_LINKS',        'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => true),
 198                          'allow_nocensors'        => array('lang' => 'ALLOW_NO_CENSORS',        'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => true),
 199                          'allow_bookmarks'        => array('lang' => 'ALLOW_BOOKMARKS',        'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => true),
 200                          'enable_post_confirm'    => array('lang' => 'VISUAL_CONFIRM_POST',    'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => true),
 201                          'allow_quick_reply'        => array('lang' => 'ALLOW_QUICK_REPLY',        'validate' => 'bool',    'type' => 'custom', 'method' => 'quick_reply', 'explain' => true),
 202  
 203                          'legend2'                => 'POSTING',
 204                          'bump_type'                => false,
 205                          'edit_time'                => array('lang' => 'EDIT_TIME',                'validate' => 'int:0:99999',        'type' => 'number:0:99999', 'explain' => true, 'append' => ' ' . $user->lang['MINUTES']),
 206                          'delete_time'            => array('lang' => 'DELETE_TIME',            'validate' => 'int:0:99999',        'type' => 'number:0:99999', 'explain' => true, 'append' => ' ' . $user->lang['MINUTES']),
 207                          'display_last_edited'    => array('lang' => 'DISPLAY_LAST_EDITED',    'validate' => 'bool',        'type' => 'radio:yes_no', 'explain' => true),
 208                          'flood_interval'        => array('lang' => 'FLOOD_INTERVAL',        'validate' => 'int:0:9999999999',        'type' => 'number:0:9999999999', 'explain' => true, 'append' => ' ' . $user->lang['SECONDS']),
 209                          'bump_interval'            => array('lang' => 'BUMP_INTERVAL',            'validate' => 'int:0',        'type' => 'custom', 'method' => 'bump_interval', 'explain' => true),
 210                          'topics_per_page'        => array('lang' => 'TOPICS_PER_PAGE',        'validate' => 'int:1:9999',        'type' => 'number:1:9999', 'explain' => false),
 211                          'posts_per_page'        => array('lang' => 'POSTS_PER_PAGE',        'validate' => 'int:1:9999',        'type' => 'number:1:9999', 'explain' => false),
 212                          'smilies_per_page'        => array('lang' => 'SMILIES_PER_PAGE',        'validate' => 'int:1:9999',        'type' => 'number:1:9999', 'explain' => false),
 213                          'hot_threshold'            => array('lang' => 'HOT_THRESHOLD',            'validate' => 'int:0:9999',        'type' => 'number:0:9999', 'explain' => true),
 214                          'max_poll_options'        => array('lang' => 'MAX_POLL_OPTIONS',        'validate' => 'int:2:127',    'type' => 'number:2:127', 'explain' => false),
 215                          'max_post_chars'        => array('lang' => 'CHAR_LIMIT',            'validate' => 'int:0:999999',        'type' => 'number:0:999999', 'explain' => true),
 216                          'min_post_chars'        => array('lang' => 'MIN_CHAR_LIMIT',        'validate' => 'int:1:999999',        'type' => 'number:1:999999', 'explain' => true),
 217                          'max_post_smilies'        => array('lang' => 'SMILIES_LIMIT',            'validate' => 'int:0:9999',        'type' => 'number:0:9999', 'explain' => true),
 218                          'max_post_urls'            => array('lang' => 'MAX_POST_URLS',            'validate' => 'int:0:9999',        'type' => 'number:0:9999', 'explain' => true),
 219                          'max_post_font_size'    => array('lang' => 'MAX_POST_FONT_SIZE',    'validate' => 'int:0:9999',        'type' => 'number:0:9999', 'explain' => true, 'append' => ' %'),
 220                          'max_quote_depth'        => array('lang' => 'QUOTE_DEPTH_LIMIT',        'validate' => 'int:0:9999',        'type' => 'number:0:9999', 'explain' => true),
 221                          'max_post_img_width'    => array('lang' => 'MAX_POST_IMG_WIDTH',    'validate' => 'int:0:9999',        'type' => 'number:0:9999', 'explain' => true, 'append' => ' ' . $user->lang['PIXEL']),
 222                          'max_post_img_height'    => array('lang' => 'MAX_POST_IMG_HEIGHT',    'validate' => 'int:0:9999',        'type' => 'number:0:9999', 'explain' => true, 'append' => ' ' . $user->lang['PIXEL']),
 223  
 224                          'legend3'                    => 'ACP_SUBMIT_CHANGES',
 225                      )
 226                  );
 227              break;
 228  
 229              case 'signature':
 230                  $display_vars = array(
 231                      'title'    => 'ACP_SIGNATURE_SETTINGS',
 232                      'vars'    => array(
 233                          'legend1'                => 'GENERAL_OPTIONS',
 234                          'allow_sig'                => array('lang' => 'ALLOW_SIG',                'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => false),
 235                          'allow_sig_bbcode'        => array('lang' => 'ALLOW_SIG_BBCODE',        'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => false),
 236                          'allow_sig_img'            => array('lang' => 'ALLOW_SIG_IMG',            'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => false),
 237                          'allow_sig_flash'        => array('lang' => 'ALLOW_SIG_FLASH',        'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => false),
 238                          'allow_sig_smilies'        => array('lang' => 'ALLOW_SIG_SMILIES',        'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => false),
 239                          'allow_sig_links'        => array('lang' => 'ALLOW_SIG_LINKS',        'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => true),
 240  
 241                          'legend2'                => 'GENERAL_SETTINGS',
 242                          'max_sig_chars'            => array('lang' => 'MAX_SIG_LENGTH',        'validate' => 'int:0:9999',    'type' => 'number:0:9999', 'explain' => true),
 243                          'max_sig_urls'            => array('lang' => 'MAX_SIG_URLS',            'validate' => 'int:0:9999',    'type' => 'number:0:9999', 'explain' => true),
 244                          'max_sig_font_size'        => array('lang' => 'MAX_SIG_FONT_SIZE',        'validate' => 'int:0:9999',    'type' => 'number:0:9999', 'explain' => true, 'append' => ' %'),
 245                          'max_sig_smilies'        => array('lang' => 'MAX_SIG_SMILIES',        'validate' => 'int:0:9999',    'type' => 'number:0:9999', 'explain' => true),
 246                          'max_sig_img_width'        => array('lang' => 'MAX_SIG_IMG_WIDTH',        'validate' => 'int:0:9999',    'type' => 'number:0:9999', 'explain' => true, 'append' => ' ' . $user->lang['PIXEL']),
 247                          'max_sig_img_height'    => array('lang' => 'MAX_SIG_IMG_HEIGHT',    'validate' => 'int:0:9999',    'type' => 'number:0:9999', 'explain' => true, 'append' => ' ' . $user->lang['PIXEL']),
 248  
 249                          'legend3'                    => 'ACP_SUBMIT_CHANGES',
 250                      )
 251                  );
 252              break;
 253  
 254              case 'registration':
 255                  $display_vars = array(
 256                      'title'    => 'ACP_REGISTER_SETTINGS',
 257                      'vars'    => array(
 258                          'legend1'                => 'GENERAL_SETTINGS',
 259                          'max_name_chars'        => array('lang' => 'USERNAME_LENGTH', 'validate' => 'int:8:180', 'type' => false, 'method' => false, 'explain' => false,),
 260                          'max_pass_chars'        => array('lang' => 'PASSWORD_LENGTH', 'validate' => 'int:8:255', 'type' => false, 'method' => false, 'explain' => false,),
 261  
 262                          'require_activation'    => array('lang' => 'ACC_ACTIVATION',    'validate' => 'int',    'type' => 'select', 'method' => 'select_acc_activation', 'explain' => true),
 263                          'new_member_post_limit'    => array('lang' => 'NEW_MEMBER_POST_LIMIT', 'validate' => 'int:0:255', 'type' => 'number:0:255', 'explain' => true, 'append' => ' ' . $user->lang['POSTS']),
 264                          'new_member_group_default'=> array('lang' => 'NEW_MEMBER_GROUP_DEFAULT', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
 265                          'min_name_chars'        => array('lang' => 'USERNAME_LENGTH',    'validate' => 'int:1',    'type' => 'custom:5:180', 'method' => 'username_length', 'explain' => true),
 266                          'min_pass_chars'        => array('lang' => 'PASSWORD_LENGTH',    'validate' => 'int:1',    'type' => 'custom', 'method' => 'password_length', 'explain' => true),
 267                          'allow_name_chars'        => array('lang' => 'USERNAME_CHARS',    'validate' => 'string',    'type' => 'select', 'method' => 'select_username_chars', 'explain' => true),
 268                          'pass_complex'            => array('lang' => 'PASSWORD_TYPE',        'validate' => 'string',    'type' => 'select', 'method' => 'select_password_chars', 'explain' => true),
 269                          'chg_passforce'            => array('lang' => 'FORCE_PASS_CHANGE',    'validate' => 'int:0:999',    'type' => 'number:0:999', 'explain' => true, 'append' => ' ' . $user->lang['DAYS']),
 270  
 271                          'legend2'                => 'GENERAL_OPTIONS',
 272                          'allow_namechange'        => array('lang' => 'ALLOW_NAME_CHANGE',        'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => false),
 273                          'allow_emailreuse'        => array('lang' => 'ALLOW_EMAIL_REUSE',        'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => true),
 274                          'enable_confirm'        => array('lang' => 'VISUAL_CONFIRM_REG',    'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => true),
 275                          'max_login_attempts'    => array('lang' => 'MAX_LOGIN_ATTEMPTS',    'validate' => 'int:0:999',    'type' => 'number:0:999', 'explain' => true),
 276                          'max_reg_attempts'        => array('lang' => 'REG_LIMIT',                'validate' => 'int:0:9999',    'type' => 'number:0:9999', 'explain' => true),
 277  
 278                          'legend3'            => 'COPPA',
 279                          'coppa_enable'        => array('lang' => 'ENABLE_COPPA',        'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => true),
 280                          'coppa_mail'        => array('lang' => 'COPPA_MAIL',        'validate' => 'string',    'type' => 'textarea:5:40', 'explain' => true),
 281                          'coppa_fax'            => array('lang' => 'COPPA_FAX',            'validate' => 'string',    'type' => 'text:25:100', 'explain' => false),
 282  
 283                          'legend4'            => 'ACP_SUBMIT_CHANGES',
 284                      )
 285                  );
 286              break;
 287  
 288              case 'feed':
 289                  $display_vars = array(
 290                      'title'    => 'ACP_FEED_MANAGEMENT',
 291                      'vars'    => array(
 292                          'legend1'                    => 'ACP_FEED_GENERAL',
 293                          'feed_enable'                => array('lang' => 'ACP_FEED_ENABLE',                'validate' => 'bool',    'type' => 'radio:enabled_disabled',    'explain' => true ),
 294                          'feed_item_statistics'        => array('lang' => 'ACP_FEED_ITEM_STATISTICS',        'validate' => 'bool',    'type' => 'radio:enabled_disabled',    'explain' => true),
 295                          'feed_http_auth'            => array('lang' => 'ACP_FEED_HTTP_AUTH',            'validate' => 'bool',    'type' => 'radio:enabled_disabled',    'explain' => true),
 296  
 297                          'legend2'                    => 'ACP_FEED_POST_BASED',
 298                          'feed_limit_post'            => array('lang' => 'ACP_FEED_LIMIT',                'validate' => 'int:5:9999',    'type' => 'number:5:9999',                'explain' => true),
 299                          'feed_overall'                => array('lang' => 'ACP_FEED_OVERALL',                'validate' => 'bool',    'type' => 'radio:enabled_disabled',    'explain' => true ),
 300                          'feed_forum'                => array('lang' => 'ACP_FEED_FORUM',                'validate' => 'bool',    'type' => 'radio:enabled_disabled',    'explain' => true ),
 301                          'feed_topic'                => array('lang' => 'ACP_FEED_TOPIC',                'validate' => 'bool',    'type' => 'radio:enabled_disabled',    'explain' => true ),
 302  
 303                          'legend3'                    => 'ACP_FEED_TOPIC_BASED',
 304                          'feed_limit_topic'            => array('lang' => 'ACP_FEED_LIMIT',                'validate' => 'int:5:9999',    'type' => 'number:5:9999',                'explain' => true),
 305                          'feed_topics_new'            => array('lang' => 'ACP_FEED_TOPICS_NEW',            'validate' => 'bool',    'type' => 'radio:enabled_disabled',    'explain' => true ),
 306                          'feed_topics_active'        => array('lang' => 'ACP_FEED_TOPICS_ACTIVE',        'validate' => 'bool',    'type' => 'radio:enabled_disabled',    'explain' => true ),
 307                          'feed_news_id'                => array('lang' => 'ACP_FEED_NEWS',                    'validate' => 'string',    'type' => 'custom', 'method' => 'select_news_forums', 'explain' => true),
 308  
 309                          'legend4'                    => 'ACP_FEED_SETTINGS_OTHER',
 310                          'feed_overall_forums'        => array('lang'    => 'ACP_FEED_OVERALL_FORUMS',        'validate' => 'bool',    'type' => 'radio:enabled_disabled',    'explain' => true ),
 311                          'feed_exclude_id'            => array('lang' => 'ACP_FEED_EXCLUDE_ID',            'validate' => 'string',    'type' => 'custom', 'method' => 'select_exclude_forums', 'explain' => true),
 312                      )
 313                  );
 314              break;
 315  
 316              case 'cookie':
 317                  $display_vars = array(
 318                      'title'    => 'ACP_COOKIE_SETTINGS',
 319                      'vars'    => array(
 320                          'legend1'        => 'ACP_COOKIE_SETTINGS',
 321                          'cookie_domain'    => array('lang' => 'COOKIE_DOMAIN',    'validate' => 'string',    'type' => 'text::255', 'explain' => true),
 322                          'cookie_name'    => array('lang' => 'COOKIE_NAME',    'validate' => 'string',    'type' => 'text::16', 'explain' => true),
 323                          'cookie_path'    => array('lang'    => 'COOKIE_PATH',    'validate' => 'string',    'type' => 'text::255', 'explain' => true),
 324                          'cookie_secure'    => array('lang' => 'COOKIE_SECURE',    'validate' => 'bool',    'type' => 'radio:disabled_enabled', 'explain' => true),
 325                      )
 326                  );
 327              break;
 328  
 329              case 'load':
 330                  $display_vars = array(
 331                      'title'    => 'ACP_LOAD_SETTINGS',
 332                      'vars'    => array(
 333                          'legend1'            => 'GENERAL_SETTINGS',
 334                          'limit_load'        => array('lang' => 'LIMIT_LOAD',        'validate' => 'int:0:9999',    'type' => 'number:0:9999', 'explain' => true),
 335                          'session_length'    => array('lang' => 'SESSION_LENGTH',    'validate' => 'int:60:9999999999',    'type' => 'number:60:9999999999', 'explain' => true, 'append' => ' ' . $user->lang['SECONDS']),
 336                          'active_sessions'    => array('lang' => 'LIMIT_SESSIONS',    'validate' => 'int:0:9999',    'type' => 'number:0:9999', 'explain' => true),
 337                          'load_online_time'    => array('lang' => 'ONLINE_LENGTH',        'validate' => 'int:0:999',    'type' => 'number:0:999', 'explain' => true, 'append' => ' ' . $user->lang['MINUTES']),
 338                          'read_notification_expire_days'    => array('lang' => 'READ_NOTIFICATION_EXPIRE_DAYS',    'validate' => 'int:0',    'type' => 'number:0', 'explain' => true, 'append' => ' ' . $user->lang['DAYS']),
 339  
 340                          'legend2'                => 'GENERAL_OPTIONS',
 341                          'load_notifications'    => array('lang' => 'LOAD_NOTIFICATIONS',    'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => true),
 342                          'load_db_track'            => array('lang' => 'YES_POST_MARKING',        'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => true),
 343                          'load_db_lastread'        => array('lang' => 'YES_READ_MARKING',        'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => true),
 344                          'load_anon_lastread'    => array('lang' => 'YES_ANON_READ_MARKING',    'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => true),
 345                          'load_online'            => array('lang' => 'YES_ONLINE',            'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => true),
 346                          'load_online_guests'    => array('lang' => 'YES_ONLINE_GUESTS',        'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => true),
 347                          'load_onlinetrack'        => array('lang' => 'YES_ONLINE_TRACK',        'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => true),
 348                          'load_birthdays'        => array('lang' => 'YES_BIRTHDAYS',            'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => true),
 349                          'load_unreads_search'    => array('lang' => 'YES_UNREAD_SEARCH',        'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => false),
 350                          'load_moderators'        => array('lang' => 'YES_MODERATORS',        'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => false),
 351                          'load_jumpbox'            => array('lang' => 'YES_JUMPBOX',            'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => false),
 352                          'load_user_activity'    => array('lang' => 'LOAD_USER_ACTIVITY',    'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => true),
 353                          'load_tplcompile'        => array('lang' => 'RECOMPILE_STYLES',        'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => true),
 354                          'allow_cdn'                => array('lang' => 'ALLOW_CDN',                'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => true),
 355                          'allow_live_searches'    => array('lang' => 'ALLOW_LIVE_SEARCHES',    'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => true),
 356  
 357                          'legend3'                => 'CUSTOM_PROFILE_FIELDS',
 358                          'load_cpf_memberlist'    => array('lang' => 'LOAD_CPF_MEMBERLIST',    'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => false),
 359                          'load_cpf_pm'            => array('lang' => 'LOAD_CPF_PM',            'validate' => 'bool',    'type' => 'radio:yes_no', 'explain'    => false),
 360                          'load_cpf_viewprofile'    => array('lang' => 'LOAD_CPF_VIEWPROFILE',    'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => false),
 361                          'load_cpf_viewtopic'    => array('lang' => 'LOAD_CPF_VIEWTOPIC',    'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => false),
 362  
 363                          'legend4'                    => 'ACP_SUBMIT_CHANGES',
 364                      )
 365                  );
 366              break;
 367  
 368              case 'auth':
 369                  $display_vars = array(
 370                      'title'    => 'ACP_AUTH_SETTINGS',
 371                      'vars'    => array(
 372                          'legend1'        => 'ACP_AUTH_SETTINGS',
 373                          'auth_method'    => array('lang' => 'AUTH_METHOD',    'validate' => 'string',    'type' => 'select:1:toggable', 'method' => 'select_auth_method', 'explain' => false),
 374                      )
 375                  );
 376              break;
 377  
 378              case 'server':
 379                  $display_vars = array(
 380                      'title'    => 'ACP_SERVER_SETTINGS',
 381                      'vars'    => array(
 382                          'legend1'                => 'ACP_SERVER_SETTINGS',
 383                          'gzip_compress'            => array('lang' => 'ENABLE_GZIP',        'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => true),
 384                          'use_system_cron'        => array('lang' => 'USE_SYSTEM_CRON',        'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => true),
 385  
 386                          'legend2'                => 'PATH_SETTINGS',
 387                          'enable_mod_rewrite'    => array('lang' => 'MOD_REWRITE_ENABLE',    'validate' => 'bool',    'type' => 'custom', 'method' => 'enable_mod_rewrite', 'explain' => true),
 388                          'smilies_path'            => array('lang' => 'SMILIES_PATH',        'validate' => 'rpath',    'type' => 'text:20:255', 'explain' => true),
 389                          'icons_path'            => array('lang' => 'ICONS_PATH',        'validate' => 'rpath',    'type' => 'text:20:255', 'explain' => true),
 390                          'upload_icons_path'        => array('lang' => 'UPLOAD_ICONS_PATH',    'validate' => 'rpath',    'type' => 'text:20:255', 'explain' => true),
 391                          'ranks_path'            => array('lang' => 'RANKS_PATH',        'validate' => 'rpath',    'type' => 'text:20:255', 'explain' => true),
 392  
 393                          'legend3'                => 'SERVER_URL_SETTINGS',
 394                          'force_server_vars'        => array('lang' => 'FORCE_SERVER_VARS',    'validate' => 'bool',            'type' => 'radio:yes_no', 'explain' => true),
 395                          'server_protocol'        => array('lang' => 'SERVER_PROTOCOL',    'validate' => 'string',            'type' => 'text:10:10', 'explain' => true),
 396                          'server_name'            => array('lang' => 'SERVER_NAME',        'validate' => 'string',            'type' => 'text:40:255', 'explain' => true),
 397                          'server_port'            => array('lang' => 'SERVER_PORT',        'validate' => 'int:0:99999',            'type' => 'number:0:99999', 'explain' => true),
 398                          'script_path'            => array('lang' => 'SCRIPT_PATH',        'validate' => 'script_path',    'type' => 'text::255', 'explain' => true),
 399  
 400                          'legend4'                    => 'ACP_SUBMIT_CHANGES',
 401                      )
 402                  );
 403              break;
 404  
 405              case 'security':
 406                  $display_vars = array(
 407                      'title'    => 'ACP_SECURITY_SETTINGS',
 408                      'vars'    => array(
 409                          'legend1'                => 'ACP_SECURITY_SETTINGS',
 410                          'allow_autologin'        => array('lang' => 'ALLOW_AUTOLOGIN',        'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => true),
 411                          'allow_password_reset'    => array('lang' => 'ALLOW_PASSWORD_RESET',    'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => true),
 412                          'max_autologin_time'    => array('lang' => 'AUTOLOGIN_LENGTH',        'validate' => 'int:0:99999',    'type' => 'number:0:99999',    'explain' => true,    'append' => ' ' . $user->lang['DAYS']),
 413                          'ip_check'                => array('lang' => 'IP_VALID',                'validate' => 'int',    'type' => 'custom', 'method' => 'select_ip_check', 'explain' => true),
 414                          'browser_check'            => array('lang' => 'BROWSER_VALID',            'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => true),
 415                          'forwarded_for_check'    => array('lang' => 'FORWARDED_FOR_VALID',    'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => true),
 416                          'referer_validation'    => array('lang' => 'REFERRER_VALID',        'validate' => 'int:0:3','type' => 'custom', 'method' => 'select_ref_check', 'explain' => true),
 417                          'check_dnsbl'            => array('lang' => 'CHECK_DNSBL',            'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => true),
 418                          'email_check_mx'        => array('lang' => 'EMAIL_CHECK_MX',        'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => true),
 419                          'max_pass_chars'        => array('lang' => 'PASSWORD_LENGTH', 'validate' => 'int:8:255', 'type' => false, 'method' => false, 'explain' => false,),
 420                          'min_pass_chars'        => array('lang' => 'PASSWORD_LENGTH',    'validate' => 'int:1',    'type' => 'custom', 'method' => 'password_length', 'explain' => true),
 421                          'pass_complex'            => array('lang' => 'PASSWORD_TYPE',            'validate' => 'string',    'type' => 'select', 'method' => 'select_password_chars', 'explain' => true),
 422                          'chg_passforce'            => array('lang' => 'FORCE_PASS_CHANGE',        'validate' => 'int:0:999',    'type' => 'number:0:999', 'explain' => true, 'append' => ' ' . $user->lang['DAYS']),
 423                          'max_login_attempts'    => array('lang' => 'MAX_LOGIN_ATTEMPTS',    'validate' => 'int:0:999',    'type' => 'number:0:999', 'explain' => true),
 424                          'ip_login_limit_max'    => array('lang' => 'IP_LOGIN_LIMIT_MAX',    'validate' => 'int:0:999',    'type' => 'number:0:999', 'explain' => true),
 425                          'ip_login_limit_time'    => array('lang' => 'IP_LOGIN_LIMIT_TIME',    'validate' => 'int:0:99999',    'type' => 'number:0:99999', 'explain' => true, 'append' => ' ' . $user->lang['SECONDS']),
 426                          'ip_login_limit_use_forwarded'    => array('lang' => 'IP_LOGIN_LIMIT_USE_FORWARDED',    'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => true),
 427                          'tpl_allow_php'            => array('lang' => 'TPL_ALLOW_PHP',            'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => true),
 428                          'form_token_lifetime'    => array('lang' => 'FORM_TIME_MAX',            'validate' => 'int:-1:99999',    'type' => 'number:-1:99999', 'explain' => true, 'append' => ' ' . $user->lang['SECONDS']),
 429                          'form_token_sid_guests'    => array('lang' => 'FORM_SID_GUESTS',        'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => true),
 430  
 431                      )
 432                  );
 433              break;
 434  
 435              case 'email':
 436                  $display_vars = array(
 437                      'title'    => 'ACP_EMAIL_SETTINGS',
 438                      'vars'    => array(
 439                          'legend1'                => 'GENERAL_SETTINGS',
 440                          'email_enable'            => array('lang' => 'ENABLE_EMAIL',            'validate' => 'bool',    'type' => 'radio:enabled_disabled', 'explain' => true),
 441                          'board_email_form'        => array('lang' => 'BOARD_EMAIL_FORM',        'validate' => 'bool',    'type' => 'radio:enabled_disabled', 'explain' => true),
 442                          'email_function_name'    => array('lang' => 'EMAIL_FUNCTION_NAME',    'validate' => 'string',    'type' => 'text:20:50', 'explain' => true),
 443                          'email_package_size'    => array('lang' => 'EMAIL_PACKAGE_SIZE',    'validate' => 'int:0',    'type' => 'number:0:99999', 'explain' => true),
 444                          'board_contact'            => array('lang' => 'CONTACT_EMAIL',            'validate' => 'email',    'type' => 'email:25:100', 'explain' => true),
 445                          'board_contact_name'    => array('lang' => 'CONTACT_EMAIL_NAME',    'validate' => 'string',    'type' => 'text:25:50', 'explain' => true),
 446                          'board_email'            => array('lang' => 'ADMIN_EMAIL',            'validate' => 'email',    'type' => 'email:25:100', 'explain' => true),
 447                          'board_email_sig'        => array('lang' => 'EMAIL_SIG',                'validate' => 'string',    'type' => 'textarea:5:30', 'explain' => true),
 448                          'board_hide_emails'        => array('lang' => 'BOARD_HIDE_EMAILS',        'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => true),
 449  
 450                          'legend2'                => 'SMTP_SETTINGS',
 451                          'smtp_delivery'            => array('lang' => 'USE_SMTP',                'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => true),
 452                          'smtp_host'                => array('lang' => 'SMTP_SERVER',            'validate' => 'string',    'type' => 'text:25:50', 'explain' => true),
 453                          'smtp_port'                => array('lang' => 'SMTP_PORT',                'validate' => 'int:0:99999',    'type' => 'number:0:99999', 'explain' => true),
 454                          'smtp_auth_method'        => array('lang' => 'SMTP_AUTH_METHOD',        'validate' => 'string',    'type' => 'select', 'method' => 'mail_auth_select', 'explain' => true),
 455                          'smtp_username'            => array('lang' => 'SMTP_USERNAME',            'validate' => 'string',    'type' => 'text:25:255', 'explain' => true),
 456                          'smtp_password'            => array('lang' => 'SMTP_PASSWORD',            'validate' => 'string',    'type' => 'password:25:255', 'explain' => true),
 457                          'smtp_verify_peer'        => array('lang' => 'SMTP_VERIFY_PEER',        'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => true),
 458                          'smtp_verify_peer_name'    => array('lang' => 'SMTP_VERIFY_PEER_NAME',    'validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => true),
 459                          'smtp_allow_self_signed'=> array('lang' => 'SMTP_ALLOW_SELF_SIGNED','validate' => 'bool',    'type' => 'radio:yes_no', 'explain' => true),
 460  
 461                          'legend3'                    => 'ACP_SUBMIT_CHANGES',
 462                      )
 463                  );
 464              break;
 465  
 466              default:
 467                  trigger_error('NO_MODE', E_USER_ERROR);
 468              break;
 469          }
 470  
 471          /**
 472          * Event to add and/or modify acp_board configurations
 473          *
 474          * @event core.acp_board_config_edit_add
 475          * @var    array    display_vars    Array of config values to display and process
 476          * @var    string    mode            Mode of the config page we are displaying
 477          * @var    boolean    submit            Do we display the form or process the submission
 478          * @since 3.1.0-a4
 479          */
 480          $vars = array('display_vars', 'mode', 'submit');
 481          extract($phpbb_dispatcher->trigger_event('core.acp_board_config_edit_add', compact($vars)));
 482  
 483          if (isset($display_vars['lang']))
 484          {
 485              $user->add_lang($display_vars['lang']);
 486          }
 487  
 488          $this->new_config = clone $config;
 489          $cfg_array = (isset($_REQUEST['config'])) ? utf8_normalize_nfc(request_var('config', array('' => ''), true)) : $this->new_config;
 490          $error = array();
 491  
 492          // We validate the complete config if wished
 493          validate_config_vars($display_vars['vars'], $cfg_array, $error);
 494  
 495          if ($submit && !check_form_key($form_key))
 496          {
 497              $error[] = $user->lang['FORM_INVALID'];
 498          }
 499          // Do not write values if there is an error
 500          if (sizeof($error))
 501          {
 502              $submit = false;
 503          }
 504  
 505          // We go through the display_vars to make sure no one is trying to set variables he/she is not allowed to...
 506          foreach ($display_vars['vars'] as $config_name => $data)
 507          {
 508              if (!isset($cfg_array[$config_name]) || strpos($config_name, 'legend') !== false)
 509              {
 510                  continue;
 511              }
 512  
 513              if ($config_name == 'auth_method' || $config_name == 'feed_news_id' || $config_name == 'feed_exclude_id')
 514              {
 515                  continue;
 516              }
 517  
 518              if ($config_name == 'guest_style')
 519              {
 520                  if (isset($cfg_array[$config_name]))
 521                  {
 522                      $this->guest_style_set($cfg_array[$config_name]);
 523                  }
 524                  continue;
 525              }
 526  
 527              $this->new_config[$config_name] = $config_value = $cfg_array[$config_name];
 528  
 529              if ($config_name == 'email_function_name')
 530              {
 531                  $this->new_config['email_function_name'] = trim(str_replace(array('(', ')'), array('', ''), $this->new_config['email_function_name']));
 532                  $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'];
 533                  $config_value = $this->new_config['email_function_name'];
 534              }
 535  
 536              if ($submit)
 537              {
 538                  if (strpos($data['type'], 'password') === 0 && $config_value === '********')
 539                  {
 540                      // Do not update password fields if the content is ********,
 541                      // because that is the password replacement we use to not
 542                      // send the password to the output
 543                      continue;
 544                  }
 545                  set_config($config_name, $config_value);
 546  
 547                  if ($config_name == 'allow_quick_reply' && isset($_POST['allow_quick_reply_enable']))
 548                  {
 549                      enable_bitfield_column_flag(FORUMS_TABLE, 'forum_flags', log(FORUM_FLAG_QUICK_REPLY, 2));
 550                  }
 551              }
 552          }
 553  
 554          // Store news and exclude ids
 555          if ($mode == 'feed' && $submit)
 556          {
 557              $cache->destroy('_feed_news_forum_ids');
 558              $cache->destroy('_feed_excluded_forum_ids');
 559  
 560              $this->store_feed_forums(FORUM_OPTION_FEED_NEWS, 'feed_news_id');
 561              $this->store_feed_forums(FORUM_OPTION_FEED_EXCLUDE, 'feed_exclude_id');
 562          }
 563  
 564          if ($mode == 'auth')
 565          {
 566              // Retrieve a list of auth plugins and check their config values
 567              $auth_providers = $phpbb_container->get('auth.provider_collection');
 568  
 569              $updated_auth_settings = false;
 570              $old_auth_config = array();
 571              foreach ($auth_providers as $provider)
 572              {
 573                  /** @var \phpbb\auth\provider\provider_interface $provider */
 574                  if ($fields = $provider->acp())
 575                  {
 576                      // Check if we need to create config fields for this plugin and save config when submit was pressed
 577                      foreach ($fields as $field)
 578                      {
 579                          if (!isset($config[$field]))
 580                          {
 581                              set_config($field, '');
 582                          }
 583  
 584                          if (!isset($cfg_array[$field]) || strpos($field, 'legend') !== false)
 585                          {
 586                              continue;
 587                          }
 588  
 589                          if (substr($field, -9) === '_password' && $cfg_array[$field] === '********')
 590                          {
 591                              // Do not update password fields if the content is ********,
 592                              // because that is the password replacement we use to not
 593                              // send the password to the output
 594                              continue;
 595                          }
 596  
 597                          $old_auth_config[$field] = $this->new_config[$field];
 598                          $config_value = $cfg_array[$field];
 599                          $this->new_config[$field] = $config_value;
 600  
 601                          if ($submit)
 602                          {
 603                              $updated_auth_settings = true;
 604                              set_config($field, $config_value);
 605                          }
 606                      }
 607                  }
 608                  unset($fields);
 609              }
 610  
 611              if ($submit && (($cfg_array['auth_method'] != $this->new_config['auth_method']) || $updated_auth_settings))
 612              {
 613                  $method = basename($cfg_array['auth_method']);
 614                  if (array_key_exists('auth.provider.' . $method, $auth_providers))
 615                  {
 616                      $provider = $auth_providers['auth.provider.' . $method];
 617                      if ($error = $provider->init())
 618                      {
 619                          foreach ($old_auth_config as $config_name => $config_value)
 620                          {
 621                              set_config($config_name, $config_value);
 622                          }
 623                          trigger_error($error . adm_back_link($this->u_action), E_USER_WARNING);
 624                      }
 625                      set_config('auth_method', basename($cfg_array['auth_method']));
 626                  }
 627                  else
 628                  {
 629                      trigger_error('NO_AUTH_PLUGIN', E_USER_ERROR);
 630                  }
 631              }
 632          }
 633  
 634          if ($submit)
 635          {
 636              add_log('admin', 'LOG_CONFIG_' . strtoupper($mode));
 637  
 638              $message = $user->lang('CONFIG_UPDATED');
 639              $message_type = E_USER_NOTICE;
 640              if (!$config['email_enable'] && in_array($mode, array('email', 'registration')) &&
 641                  in_array($config['require_activation'], array(USER_ACTIVATION_SELF, USER_ACTIVATION_ADMIN)))
 642              {
 643                  $message .= '<br /><br />' . $user->lang('ACC_ACTIVATION_WARNING');
 644                  $message_type = E_USER_WARNING;
 645              }
 646              trigger_error($message . adm_back_link($this->u_action), $message_type);
 647          }
 648  
 649          $this->tpl_name = 'acp_board';
 650          $this->page_title = $display_vars['title'];
 651  
 652          $template->assign_vars(array(
 653              'L_TITLE'            => $user->lang[$display_vars['title']],
 654              'L_TITLE_EXPLAIN'    => $user->lang[$display_vars['title'] . '_EXPLAIN'],
 655  
 656              'S_ERROR'            => (sizeof($error)) ? true : false,
 657              'ERROR_MSG'            => implode('<br />', $error),
 658  
 659              'U_ACTION'            => $this->u_action)
 660          );
 661  
 662          // Output relevant page
 663          foreach ($display_vars['vars'] as $config_key => $vars)
 664          {
 665              if (!is_array($vars) && strpos($config_key, 'legend') === false)
 666              {
 667                  continue;
 668              }
 669  
 670              if (strpos($config_key, 'legend') !== false)
 671              {
 672                  $template->assign_block_vars('options', array(
 673                      'S_LEGEND'        => true,
 674                      'LEGEND'        => (isset($user->lang[$vars])) ? $user->lang[$vars] : $vars)
 675                  );
 676  
 677                  continue;
 678              }
 679  
 680              $type = explode(':', $vars['type']);
 681  
 682              $l_explain = '';
 683              if ($vars['explain'] && isset($vars['lang_explain']))
 684              {
 685                  $l_explain = (isset($user->lang[$vars['lang_explain']])) ? $user->lang[$vars['lang_explain']] : $vars['lang_explain'];
 686              }
 687              else if ($vars['explain'])
 688              {
 689                  $l_explain = (isset($user->lang[$vars['lang'] . '_EXPLAIN'])) ? $user->lang[$vars['lang'] . '_EXPLAIN'] : '';
 690              }
 691  
 692              $content = build_cfg_template($type, $config_key, $this->new_config, $config_key, $vars);
 693  
 694              if (empty($content))
 695              {
 696                  continue;
 697              }
 698  
 699              $template->assign_block_vars('options', array(
 700                  'KEY'            => $config_key,
 701                  'TITLE'            => (isset($user->lang[$vars['lang']])) ? $user->lang[$vars['lang']] : $vars['lang'],
 702                  'S_EXPLAIN'        => $vars['explain'],
 703                  'TITLE_EXPLAIN'    => $l_explain,
 704                  'CONTENT'        => $content,
 705                  )
 706              );
 707  
 708              unset($display_vars['vars'][$config_key]);
 709          }
 710  
 711          if ($mode == 'auth')
 712          {
 713              $template->assign_var('S_AUTH', true);
 714  
 715              foreach ($auth_providers as $provider)
 716              {
 717                  $auth_tpl = $provider->get_acp_template($this->new_config);
 718                  if ($auth_tpl)
 719                  {
 720                      if (array_key_exists('BLOCK_VAR_NAME', $auth_tpl))
 721                      {
 722                          foreach ($auth_tpl['BLOCK_VARS'] as $block_vars)
 723                          {
 724                              $template->assign_block_vars($auth_tpl['BLOCK_VAR_NAME'], $block_vars);
 725                          }
 726                      }
 727                      $template->assign_vars($auth_tpl['TEMPLATE_VARS']);
 728                      $template->assign_block_vars('auth_tpl', array(
 729                          'TEMPLATE_FILE'    => $auth_tpl['TEMPLATE_FILE'],
 730                      ));
 731                  }
 732              }
 733          }
 734      }
 735  
 736      /**
 737      * Select auth method
 738      */
 739  	function select_auth_method($selected_method, $key = '')
 740      {
 741          global $phpbb_root_path, $phpEx, $phpbb_container;
 742  
 743          $auth_plugins = array();
 744          $auth_providers = $phpbb_container->get('auth.provider_collection');
 745  
 746          foreach ($auth_providers as $key => $value)
 747          {
 748              if (!($value instanceof \phpbb\auth\provider\provider_interface))
 749              {
 750                  continue;
 751              }
 752              $auth_plugins[] = str_replace('auth.provider.', '', $key);
 753          }
 754  
 755          sort($auth_plugins);
 756  
 757          $auth_select = '';
 758          foreach ($auth_plugins as $method)
 759          {
 760              $selected = ($selected_method == $method) ? ' selected="selected"' : '';
 761              $auth_select .= "<option value=\"$method\"$selected data-toggle-setting=\"#auth_{$method}_settings\">" . ucfirst($method) . '</option>';
 762          }
 763  
 764          return $auth_select;
 765      }
 766  
 767      /**
 768      * Select mail authentication method
 769      */
 770  	function mail_auth_select($selected_method, $key = '')
 771      {
 772          global $user;
 773  
 774          $auth_methods = array('PLAIN', 'LOGIN', 'CRAM-MD5', 'DIGEST-MD5', 'POP-BEFORE-SMTP');
 775          $s_smtp_auth_options = '';
 776  
 777          foreach ($auth_methods as $method)
 778          {
 779              $s_smtp_auth_options .= '<option value="' . $method . '"' . (($selected_method == $method) ? ' selected="selected"' : '') . '>' . $user->lang['SMTP_' . str_replace('-', '_', $method)] . '</option>';
 780          }
 781  
 782          return $s_smtp_auth_options;
 783      }
 784  
 785      /**
 786      * Select full folder action
 787      */
 788  	function full_folder_select($value, $key = '')
 789      {
 790          global $user;
 791  
 792          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>';
 793      }
 794  
 795      /**
 796      * Select ip validation
 797      */
 798  	function select_ip_check($value, $key = '')
 799      {
 800          $radio_ary = array(4 => 'ALL', 3 => 'CLASS_C', 2 => 'CLASS_B', 0 => 'NO_IP_VALIDATION');
 801  
 802          return h_radio('config[ip_check]', $radio_ary, $value, $key);
 803      }
 804  
 805      /**
 806      * Select referer validation
 807      */
 808  	function select_ref_check($value, $key = '')
 809      {
 810          $radio_ary = array(REFERER_VALIDATE_PATH => 'REF_PATH', REFERER_VALIDATE_HOST => 'REF_HOST', REFERER_VALIDATE_NONE => 'NO_REF_VALIDATION');
 811  
 812          return h_radio('config[referer_validation]', $radio_ary, $value, $key);
 813      }
 814  
 815      /**
 816      * Select account activation method
 817      */
 818  	function select_acc_activation($selected_value, $value)
 819      {
 820          global $user, $config;
 821  
 822          $act_ary = array(
 823              'ACC_DISABLE'    => array(true, USER_ACTIVATION_DISABLE),
 824              'ACC_NONE'        => array(true, USER_ACTIVATION_NONE),
 825              'ACC_USER'        => array($config['email_enable'], USER_ACTIVATION_SELF),
 826              'ACC_ADMIN'        => array($config['email_enable'], USER_ACTIVATION_ADMIN),
 827          );
 828  
 829          $act_options = '';
 830          foreach ($act_ary as $key => $data)
 831          {
 832              list($available, $value) = $data;
 833              $selected = ($selected_value == $value) ? ' selected="selected"' : '';
 834              $class = (!$available) ? ' class="disabled-option"' : '';
 835              $act_options .= '<option value="' . $value . '"' . $selected . $class . '>' . $user->lang($key) . '</option>';
 836          }
 837  
 838          return $act_options;
 839      }
 840  
 841      /**
 842      * Maximum/Minimum username length
 843      */
 844  	function username_length($value, $key = '')
 845      {
 846          global $user;
 847  
 848          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'];
 849      }
 850  
 851      /**
 852      * Allowed chars in usernames
 853      */
 854  	function select_username_chars($selected_value, $key)
 855      {
 856          global $user;
 857  
 858          $user_char_ary = array('USERNAME_CHARS_ANY', 'USERNAME_ALPHA_ONLY', 'USERNAME_ALPHA_SPACERS', 'USERNAME_LETTER_NUM', 'USERNAME_LETTER_NUM_SPACERS', 'USERNAME_ASCII');
 859          $user_char_options = '';
 860          foreach ($user_char_ary as $user_type)
 861          {
 862              $selected = ($selected_value == $user_type) ? ' selected="selected"' : '';
 863              $user_char_options .= '<option value="' . $user_type . '"' . $selected . '>' . $user->lang[$user_type] . '</option>';
 864          }
 865  
 866          return $user_char_options;
 867      }
 868  
 869      /**
 870      * Maximum/Minimum password length
 871      */
 872  	function password_length($value, $key)
 873      {
 874          global $user;
 875  
 876          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'];
 877      }
 878  
 879      /**
 880      * Required chars in passwords
 881      */
 882  	function select_password_chars($selected_value, $key)
 883      {
 884          global $user;
 885  
 886          $pass_type_ary = array('PASS_TYPE_ANY', 'PASS_TYPE_CASE', 'PASS_TYPE_ALPHA', 'PASS_TYPE_SYMBOL');
 887          $pass_char_options = '';
 888          foreach ($pass_type_ary as $pass_type)
 889          {
 890              $selected = ($selected_value == $pass_type) ? ' selected="selected"' : '';
 891              $pass_char_options .= '<option value="' . $pass_type . '"' . $selected . '>' . $user->lang[$pass_type] . '</option>';
 892          }
 893  
 894          return $pass_char_options;
 895      }
 896  
 897      /**
 898      * Select bump interval
 899      */
 900  	function bump_interval($value, $key)
 901      {
 902          global $user;
 903  
 904          $s_bump_type = '';
 905          $types = array('m' => 'MINUTES', 'h' => 'HOURS', 'd' => 'DAYS');
 906          foreach ($types as $type => $lang)
 907          {
 908              $selected = ($this->new_config['bump_type'] == $type) ? ' selected="selected"' : '';
 909              $s_bump_type .= '<option value="' . $type . '"' . $selected . '>' . $user->lang[$lang] . '</option>';
 910          }
 911  
 912          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>';
 913      }
 914  
 915      /**
 916      * Board disable option and message
 917      */
 918  	function board_disable($value, $key)
 919      {
 920          global $user;
 921  
 922          $radio_ary = array(1 => 'YES', 0 => 'NO');
 923  
 924          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'] . '" />';
 925      }
 926  
 927      /**
 928      * Global quick reply enable/disable setting and button to enable in all forums
 929      */
 930  	function quick_reply($value, $key)
 931      {
 932          global $user;
 933  
 934          $radio_ary = array(1 => 'YES', 0 => 'NO');
 935  
 936          return h_radio('config[allow_quick_reply]', $radio_ary, $value) .
 937              '<br /><br /><input class="button2" type="submit" id="' . $key . '_enable" name="' . $key . '_enable" value="' . $user->lang['ALLOW_QUICK_REPLY_BUTTON'] . '" />';
 938      }
 939  
 940      /**
 941      * Select guest timezone
 942      */
 943  	function timezone_select($value, $key)
 944      {
 945          global $template, $user;
 946  
 947          $timezone_select = phpbb_timezone_select($template, $user, $value, true);
 948  
 949          return '<select name="config[' . $key . ']" id="' . $key . '">' . $timezone_select . '</select>';
 950      }
 951  
 952      /**
 953      * Get guest style
 954      */
 955  	public function guest_style_get()
 956      {
 957          global $db;
 958  
 959          $sql = 'SELECT user_style
 960              FROM ' . USERS_TABLE . '
 961              WHERE user_id = ' . ANONYMOUS;
 962          $result = $db->sql_query($sql);
 963  
 964          $style = (int) $db->sql_fetchfield('user_style');
 965          $db->sql_freeresult($result);
 966  
 967          return $style;
 968      }
 969  
 970      /**
 971      * Set guest style
 972      *
 973      * @param    int        $style_id    The style ID
 974      */
 975  	public function guest_style_set($style_id)
 976      {
 977          global $db;
 978  
 979          $sql = 'UPDATE ' . USERS_TABLE . '
 980              SET user_style = ' . (int) $style_id . '
 981              WHERE user_id = ' . ANONYMOUS;
 982          $db->sql_query($sql);
 983      }
 984  
 985      /**
 986      * Select default dateformat
 987      */
 988  	function dateformat_select($value, $key)
 989      {
 990          global $user, $config;
 991  
 992          // Let the format_date function operate with the acp values
 993          $old_tz = $user->timezone;
 994          try
 995          {
 996              $user->timezone = new DateTimeZone($config['board_timezone']);
 997          }
 998          catch (\Exception $e)
 999          {
1000              // If the board timezone is invalid, we just use the users timezone.
1001          }
1002  
1003          $dateformat_options = '';
1004  
1005          foreach ($user->lang['dateformats'] as $format => $null)
1006          {
1007              $dateformat_options .= '<option value="' . $format . '"' . (($format == $value) ? ' selected="selected"' : '') . '>';
1008              $dateformat_options .= $user->format_date(time(), $format, false) . ((strpos($format, '|') !== false) ? $user->lang['VARIANT_DATE_SEPARATOR'] . $user->format_date(time(), $format, true) : '');
1009              $dateformat_options .= '</option>';
1010          }
1011  
1012          $dateformat_options .= '<option value="custom"';
1013          if (!isset($user->lang['dateformats'][$value]))
1014          {
1015              $dateformat_options .= ' selected="selected"';
1016          }
1017          $dateformat_options .= '>' . $user->lang['CUSTOM_DATEFORMAT'] . '</option>';
1018  
1019          // Reset users date options
1020          $user->timezone = $old_tz;
1021  
1022          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>
1023          <input type=\"text\" name=\"config[$key]\" id=\"$key\" value=\"$value\" maxlength=\"64\" />";
1024      }
1025  
1026      /**
1027      * Select multiple forums
1028      */
1029  	function select_news_forums($value, $key)
1030      {
1031          global $user, $config;
1032  
1033          $forum_list = make_forum_select(false, false, true, true, true, false, true);
1034  
1035          // Build forum options
1036          $s_forum_options = '<select id="' . $key . '" name="' . $key . '[]" multiple="multiple">';
1037          foreach ($forum_list as $f_id => $f_row)
1038          {
1039              $f_row['selected'] = phpbb_optionget(FORUM_OPTION_FEED_NEWS, $f_row['forum_options']);
1040  
1041              $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>';
1042          }
1043          $s_forum_options .= '</select>';
1044  
1045          return $s_forum_options;
1046      }
1047  
1048  	function select_exclude_forums($value, $key)
1049      {
1050          global $user, $config;
1051  
1052          $forum_list = make_forum_select(false, false, true, true, true, false, true);
1053  
1054          // Build forum options
1055          $s_forum_options = '<select id="' . $key . '" name="' . $key . '[]" multiple="multiple">';
1056          foreach ($forum_list as $f_id => $f_row)
1057          {
1058              $f_row['selected'] = phpbb_optionget(FORUM_OPTION_FEED_EXCLUDE, $f_row['forum_options']);
1059  
1060              $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>';
1061          }
1062          $s_forum_options .= '</select>';
1063  
1064          return $s_forum_options;
1065      }
1066  
1067  	function store_feed_forums($option, $key)
1068      {
1069          global $db, $cache;
1070  
1071          // Get key
1072          $values = request_var($key, array(0 => 0));
1073  
1074          // Empty option bit for all forums
1075          $sql = 'UPDATE ' . FORUMS_TABLE . '
1076              SET forum_options = forum_options - ' . (1 << $option) . '
1077              WHERE ' . $db->sql_bit_and('forum_options', $option, '<> 0');
1078          $db->sql_query($sql);
1079  
1080          // Already emptied for all...
1081          if (sizeof($values))
1082          {
1083              // Set for selected forums
1084              $sql = 'UPDATE ' . FORUMS_TABLE . '
1085                  SET forum_options = forum_options + ' . (1 << $option) . '
1086                  WHERE ' . $db->sql_in_set('forum_id', $values);
1087              $db->sql_query($sql);
1088          }
1089  
1090          // Empty sql cache for forums table because options changed
1091          $cache->destroy('sql', FORUMS_TABLE);
1092      }
1093  
1094      /**
1095      * Option to enable/disable removal of 'app.php' from URLs
1096      *
1097      * Note that if mod_rewrite is on, URLs without app.php will still work,
1098      * but any paths generated by the controller helper url() method will not
1099      * contain app.php.
1100      *
1101      * @param int $value The current config value
1102      * @param string $key The config key
1103      * @return string The HTML for the form field
1104      */
1105  	function enable_mod_rewrite($value, $key)
1106      {
1107          global $user, $config;
1108  
1109          // Determine whether mod_rewrite is enabled on the server
1110          // NOTE: This only works on Apache servers on which PHP is NOT
1111          // installed as CGI. In that case, there is no way for PHP to
1112          // determine whether or not the Apache module is enabled.
1113          //
1114          // To be clear on the value of $mod_rewite:
1115          // null = Cannot determine whether or not the server has mod_rewrite
1116          //        enabled
1117          // false = Can determine that the server does NOT have mod_rewrite
1118          //         enabled
1119          // true = Can determine that the server DOES have mod_rewrite_enabled
1120          $mod_rewrite = null;
1121          if (function_exists('apache_get_modules'))
1122          {
1123              $mod_rewrite = (bool) in_array('mod_rewrite', apache_get_modules());
1124          }
1125  
1126          // If $message is false, mod_rewrite is enabled.
1127          // Otherwise, it is not and we need to:
1128          // 1) disable the form field
1129          // 2) make sure the config value is set to 0
1130          // 3) append the message to the return
1131          $value = ($mod_rewrite === false) ? 0 : $value;
1132          $message = $mod_rewrite === null ? 'MOD_REWRITE_INFORMATION_UNAVAILABLE' : ($mod_rewrite === false ? 'MOD_REWRITE_DISABLED' : false);
1133  
1134          // Let's do some friendly HTML injection if we want to disable the
1135          // form field because h_radio() has no pretty way of doing so
1136          $field_name = 'config[enable_mod_rewrite]' . ($message === 'MOD_REWRITE_DISABLED' ? '" disabled="disabled' : '');
1137  
1138          return h_radio($field_name, array(1 => 'YES', 0 => 'NO'), $value) .
1139              ($message !== false ? '<br /><span>' . $user->lang($message) . '</span>' : '');
1140      }
1141  }


Generated: Thu Jan 11 00:25:41 2018 Cross-referenced by PHPXref 0.7.1