[ Index ]

PHP Cross Reference of phpBB-3.2.8-deutsch

title

Body

[close]

/includes/acp/ -> acp_forums.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  * @ignore
  16  */
  17  if (!defined('IN_PHPBB'))
  18  {
  19      exit;
  20  }
  21  
  22  class acp_forums
  23  {
  24      var $u_action;
  25      var $parent_id = 0;
  26  
  27  	function main($id, $mode)
  28      {
  29          global $db, $user, $auth, $template, $cache, $request, $phpbb_dispatcher;
  30          global $phpbb_admin_path, $phpbb_root_path, $phpEx, $phpbb_log;
  31  
  32          $user->add_lang('acp/forums');
  33          $this->tpl_name = 'acp_forums';
  34          $this->page_title = 'ACP_MANAGE_FORUMS';
  35  
  36          $form_key = 'acp_forums';
  37          add_form_key($form_key);
  38  
  39          $action        = $request->variable('action', '');
  40          $update        = (isset($_POST['update'])) ? true : false;
  41          $forum_id    = $request->variable('f', 0);
  42  
  43          $this->parent_id    = $request->variable('parent_id', 0);
  44          $forum_data = $errors = array();
  45          if ($update && !check_form_key($form_key))
  46          {
  47              $update = false;
  48              $errors[] = $user->lang['FORM_INVALID'];
  49          }
  50  
  51          // Check additional permissions
  52          switch ($action)
  53          {
  54              case 'progress_bar':
  55                  $start = $request->variable('start', 0);
  56                  $total = $request->variable('total', 0);
  57  
  58                  $this->display_progress_bar($start, $total);
  59              break;
  60  
  61              case 'delete':
  62  
  63                  if (!$auth->acl_get('a_forumdel'))
  64                  {
  65                      trigger_error($user->lang['NO_PERMISSION_FORUM_DELETE'] . adm_back_link($this->u_action . '&amp;parent_id=' . $this->parent_id), E_USER_WARNING);
  66                  }
  67  
  68              break;
  69  
  70              case 'add':
  71  
  72                  if (!$auth->acl_get('a_forumadd'))
  73                  {
  74                      trigger_error($user->lang['NO_PERMISSION_FORUM_ADD'] . adm_back_link($this->u_action . '&amp;parent_id=' . $this->parent_id), E_USER_WARNING);
  75                  }
  76  
  77              break;
  78          }
  79  
  80          // Major routines
  81          if ($update)
  82          {
  83              switch ($action)
  84              {
  85                  case 'delete':
  86                      $action_subforums    = $request->variable('action_subforums', '');
  87                      $subforums_to_id    = $request->variable('subforums_to_id', 0);
  88                      $action_posts        = $request->variable('action_posts', '');
  89                      $posts_to_id        = $request->variable('posts_to_id', 0);
  90  
  91                      $errors = $this->delete_forum($forum_id, $action_posts, $action_subforums, $posts_to_id, $subforums_to_id);
  92  
  93                      if (count($errors))
  94                      {
  95                          break;
  96                      }
  97  
  98                      $auth->acl_clear_prefetch();
  99                      $cache->destroy('sql', FORUMS_TABLE);
 100  
 101                      trigger_error($user->lang['FORUM_DELETED'] . adm_back_link($this->u_action . '&amp;parent_id=' . $this->parent_id));
 102  
 103                  break;
 104  
 105                  case 'edit':
 106                      $forum_data = array(
 107                          'forum_id'        =>    $forum_id
 108                      );
 109  
 110                  // No break here
 111  
 112                  case 'add':
 113  
 114                      $forum_data += array(
 115                          'parent_id'                => $request->variable('forum_parent_id', $this->parent_id),
 116                          'forum_type'            => $request->variable('forum_type', FORUM_POST),
 117                          'type_action'            => $request->variable('type_action', ''),
 118                          'forum_status'            => $request->variable('forum_status', ITEM_UNLOCKED),
 119                          'forum_parents'            => '',
 120                          'forum_name'            => $request->variable('forum_name', '', true),
 121                          'forum_link'            => $request->variable('forum_link', ''),
 122                          'forum_link_track'        => $request->variable('forum_link_track', false),
 123                          'forum_desc'            => $request->variable('forum_desc', '', true),
 124                          'forum_desc_uid'        => '',
 125                          'forum_desc_options'    => 7,
 126                          'forum_desc_bitfield'    => '',
 127                          'forum_rules'            => $request->variable('forum_rules', '', true),
 128                          'forum_rules_uid'        => '',
 129                          'forum_rules_options'    => 7,
 130                          'forum_rules_bitfield'    => '',
 131                          'forum_rules_link'        => $request->variable('forum_rules_link', ''),
 132                          'forum_image'            => $request->variable('forum_image', ''),
 133                          'forum_style'            => $request->variable('forum_style', 0),
 134                          'display_subforum_list'    => $request->variable('display_subforum_list', false),
 135                          'display_on_index'        => $request->variable('display_on_index', false),
 136                          'forum_topics_per_page'    => $request->variable('topics_per_page', 0),
 137                          'enable_indexing'        => $request->variable('enable_indexing', true),
 138                          'enable_icons'            => $request->variable('enable_icons', false),
 139                          'enable_prune'            => $request->variable('enable_prune', false),
 140                          'enable_post_review'    => $request->variable('enable_post_review', true),
 141                          'enable_quick_reply'    => $request->variable('enable_quick_reply', false),
 142                          'enable_shadow_prune'    => $request->variable('enable_shadow_prune', false),
 143                          'prune_days'            => $request->variable('prune_days', 7),
 144                          'prune_viewed'            => $request->variable('prune_viewed', 7),
 145                          'prune_freq'            => $request->variable('prune_freq', 1),
 146                          'prune_old_polls'        => $request->variable('prune_old_polls', false),
 147                          'prune_announce'        => $request->variable('prune_announce', false),
 148                          'prune_sticky'            => $request->variable('prune_sticky', false),
 149                          'prune_shadow_days'        => $request->variable('prune_shadow_days', 7),
 150                          'prune_shadow_freq'        => $request->variable('prune_shadow_freq', 1),
 151                          'forum_password'        => $request->variable('forum_password', '', true),
 152                          'forum_password_confirm'=> $request->variable('forum_password_confirm', '', true),
 153                          'forum_password_unset'    => $request->variable('forum_password_unset', false),
 154                      );
 155  
 156                      /**
 157                      * Request forum data and operate on it (parse texts, etc.)
 158                      *
 159                      * @event core.acp_manage_forums_request_data
 160                      * @var    string    action        Type of the action: add|edit
 161                      * @var    array    forum_data    Array with new forum data
 162                      * @since 3.1.0-a1
 163                      */
 164                      $vars = array('action', 'forum_data');
 165                      extract($phpbb_dispatcher->trigger_event('core.acp_manage_forums_request_data', compact($vars)));
 166  
 167                      // On add, add empty forum_options... else do not consider it (not updating it)
 168                      if ($action == 'add')
 169                      {
 170                          $forum_data['forum_options'] = 0;
 171                      }
 172  
 173                      // Use link_display_on_index setting if forum type is link
 174                      if ($forum_data['forum_type'] == FORUM_LINK)
 175                      {
 176                          $forum_data['display_on_index'] = $request->variable('link_display_on_index', false);
 177                      }
 178  
 179                      // Linked forums and categories are not able to be locked...
 180                      if ($forum_data['forum_type'] == FORUM_LINK || $forum_data['forum_type'] == FORUM_CAT)
 181                      {
 182                          $forum_data['forum_status'] = ITEM_UNLOCKED;
 183                      }
 184  
 185                      $forum_data['show_active'] = ($forum_data['forum_type'] == FORUM_POST) ? $request->variable('display_recent', true) : $request->variable('display_active', false);
 186  
 187                      // Get data for forum rules if specified...
 188                      if ($forum_data['forum_rules'])
 189                      {
 190                          generate_text_for_storage($forum_data['forum_rules'], $forum_data['forum_rules_uid'], $forum_data['forum_rules_bitfield'], $forum_data['forum_rules_options'], $request->variable('rules_parse_bbcode', false), $request->variable('rules_parse_urls', false), $request->variable('rules_parse_smilies', false));
 191                      }
 192  
 193                      // Get data for forum description if specified
 194                      if ($forum_data['forum_desc'])
 195                      {
 196                          generate_text_for_storage($forum_data['forum_desc'], $forum_data['forum_desc_uid'], $forum_data['forum_desc_bitfield'], $forum_data['forum_desc_options'], $request->variable('desc_parse_bbcode', false), $request->variable('desc_parse_urls', false), $request->variable('desc_parse_smilies', false));
 197                      }
 198  
 199                      $errors = $this->update_forum_data($forum_data);
 200  
 201                      if (!count($errors))
 202                      {
 203                          $forum_perm_from = $request->variable('forum_perm_from', 0);
 204                          $cache->destroy('sql', FORUMS_TABLE);
 205  
 206                          $copied_permissions = false;
 207                          // Copy permissions?
 208                          if ($forum_perm_from && $forum_perm_from != $forum_data['forum_id'] &&
 209                              ($action != 'edit' || empty($forum_id) || ($auth->acl_get('a_fauth') && $auth->acl_get('a_authusers') && $auth->acl_get('a_authgroups') && $auth->acl_get('a_mauth'))))
 210                          {
 211                              copy_forum_permissions($forum_perm_from, $forum_data['forum_id'], ($action == 'edit') ? true : false);
 212                              phpbb_cache_moderators($db, $cache, $auth);
 213                              $copied_permissions = true;
 214                          }
 215  /* Commented out because of questionable UI workflow - re-visit for 3.0.7
 216                          else if (!$this->parent_id && $action != 'edit' && $auth->acl_get('a_fauth') && $auth->acl_get('a_authusers') && $auth->acl_get('a_authgroups') && $auth->acl_get('a_mauth'))
 217                          {
 218                              $this->copy_permission_page($forum_data);
 219                              return;
 220                          }
 221  */
 222                          $auth->acl_clear_prefetch();
 223  
 224                          $acl_url = '&amp;mode=setting_forum_local&amp;forum_id[]=' . $forum_data['forum_id'];
 225  
 226                          $message = ($action == 'add') ? $user->lang['FORUM_CREATED'] : $user->lang['FORUM_UPDATED'];
 227  
 228                          // redirect directly to permission settings screen if authed
 229                          if ($action == 'add' && !$copied_permissions && $auth->acl_get('a_fauth'))
 230                          {
 231                              $message .= '<br /><br />' . sprintf($user->lang['REDIRECT_ACL'], '<a href="' . append_sid("{$phpbb_admin_path}index.$phpEx", 'i=permissions' . $acl_url) . '">', '</a>');
 232  
 233                              meta_refresh(4, append_sid("{$phpbb_admin_path}index.$phpEx", 'i=permissions' . $acl_url));
 234                          }
 235  
 236                          trigger_error($message . adm_back_link($this->u_action . '&amp;parent_id=' . $this->parent_id));
 237                      }
 238  
 239                  break;
 240              }
 241          }
 242  
 243          switch ($action)
 244          {
 245              case 'move_up':
 246              case 'move_down':
 247  
 248                  if (!$forum_id)
 249                  {
 250                      trigger_error($user->lang['NO_FORUM'] . adm_back_link($this->u_action . '&amp;parent_id=' . $this->parent_id), E_USER_WARNING);
 251                  }
 252  
 253                  $sql = 'SELECT *
 254                      FROM ' . FORUMS_TABLE . "
 255                      WHERE forum_id = $forum_id";
 256                  $result = $db->sql_query($sql);
 257                  $row = $db->sql_fetchrow($result);
 258                  $db->sql_freeresult($result);
 259  
 260                  if (!$row)
 261                  {
 262                      trigger_error($user->lang['NO_FORUM'] . adm_back_link($this->u_action . '&amp;parent_id=' . $this->parent_id), E_USER_WARNING);
 263                  }
 264  
 265                  $move_forum_name = $this->move_forum_by($row, $action, 1);
 266  
 267                  if ($move_forum_name !== false)
 268                  {
 269                      $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_FORUM_' . strtoupper($action), false, array($row['forum_name'], $move_forum_name));
 270                      $cache->destroy('sql', FORUMS_TABLE);
 271                  }
 272  
 273                  if ($request->is_ajax())
 274                  {
 275                      $json_response = new \phpbb\json_response;
 276                      $json_response->send(array('success' => ($move_forum_name !== false)));
 277                  }
 278  
 279              break;
 280  
 281              case 'sync':
 282                  if (!$forum_id)
 283                  {
 284                      trigger_error($user->lang['NO_FORUM'] . adm_back_link($this->u_action . '&amp;parent_id=' . $this->parent_id), E_USER_WARNING);
 285                  }
 286  
 287                  @set_time_limit(0);
 288  
 289                  $sql = 'SELECT forum_name, (forum_topics_approved + forum_topics_unapproved + forum_topics_softdeleted) AS total_topics
 290                      FROM ' . FORUMS_TABLE . "
 291                      WHERE forum_id = $forum_id";
 292                  $result = $db->sql_query($sql);
 293                  $row = $db->sql_fetchrow($result);
 294                  $db->sql_freeresult($result);
 295  
 296                  if (!$row)
 297                  {
 298                      trigger_error($user->lang['NO_FORUM'] . adm_back_link($this->u_action . '&amp;parent_id=' . $this->parent_id), E_USER_WARNING);
 299                  }
 300  
 301                  if ($row['total_topics'])
 302                  {
 303                      $sql = 'SELECT MIN(topic_id) as min_topic_id, MAX(topic_id) as max_topic_id
 304                          FROM ' . TOPICS_TABLE . '
 305                          WHERE forum_id = ' . $forum_id;
 306                      $result = $db->sql_query($sql);
 307                      $row2 = $db->sql_fetchrow($result);
 308                      $db->sql_freeresult($result);
 309  
 310                      // Typecast to int if there is no data available
 311                      $row2['min_topic_id'] = (int) $row2['min_topic_id'];
 312                      $row2['max_topic_id'] = (int) $row2['max_topic_id'];
 313  
 314                      $start = $request->variable('start', $row2['min_topic_id']);
 315  
 316                      $batch_size = 2000;
 317                      $end = $start + $batch_size;
 318  
 319                      // Sync all topics in batch mode...
 320                      sync('topic', 'range', 'topic_id BETWEEN ' . $start . ' AND ' . $end, true, true);
 321  
 322                      if ($end < $row2['max_topic_id'])
 323                      {
 324                          // We really need to find a way of showing statistics... no progress here
 325                          $sql = 'SELECT COUNT(topic_id) as num_topics
 326                              FROM ' . TOPICS_TABLE . '
 327                              WHERE forum_id = ' . $forum_id . '
 328                                  AND topic_id BETWEEN ' . $start . ' AND ' . $end;
 329                          $result = $db->sql_query($sql);
 330                          $topics_done = $request->variable('topics_done', 0) + (int) $db->sql_fetchfield('num_topics');
 331                          $db->sql_freeresult($result);
 332  
 333                          $start += $batch_size;
 334  
 335                          $url = $this->u_action . "&amp;parent_id={$this->parent_id}&amp;f=$forum_id&amp;action=sync&amp;start=$start&amp;topics_done=$topics_done&amp;total={$row['total_topics']}";
 336  
 337                          meta_refresh(0, $url);
 338  
 339                          $template->assign_vars(array(
 340                              'U_PROGRESS_BAR'        => $this->u_action . "&amp;action=progress_bar&amp;start=$topics_done&amp;total={$row['total_topics']}",
 341                              'UA_PROGRESS_BAR'        => addslashes($this->u_action . "&amp;action=progress_bar&amp;start=$topics_done&amp;total={$row['total_topics']}"),
 342                              'S_CONTINUE_SYNC'        => true,
 343                              'L_PROGRESS_EXPLAIN'    => sprintf($user->lang['SYNC_IN_PROGRESS_EXPLAIN'], $topics_done, $row['total_topics']))
 344                          );
 345  
 346                          return;
 347                      }
 348                  }
 349  
 350                  $url = $this->u_action . "&amp;parent_id={$this->parent_id}&amp;f=$forum_id&amp;action=sync_forum";
 351                  meta_refresh(0, $url);
 352  
 353                  $template->assign_vars(array(
 354                      'U_PROGRESS_BAR'        => $this->u_action . '&amp;action=progress_bar',
 355                      'UA_PROGRESS_BAR'        => addslashes($this->u_action . '&amp;action=progress_bar'),
 356                      'S_CONTINUE_SYNC'        => true,
 357                      'L_PROGRESS_EXPLAIN'    => sprintf($user->lang['SYNC_IN_PROGRESS_EXPLAIN'], 0, $row['total_topics']))
 358                  );
 359  
 360                  return;
 361  
 362              break;
 363  
 364              case 'sync_forum':
 365  
 366                  $sql = 'SELECT forum_name, forum_type
 367                      FROM ' . FORUMS_TABLE . "
 368                      WHERE forum_id = $forum_id";
 369                  $result = $db->sql_query($sql);
 370                  $row = $db->sql_fetchrow($result);
 371                  $db->sql_freeresult($result);
 372  
 373                  if (!$row)
 374                  {
 375                      trigger_error($user->lang['NO_FORUM'] . adm_back_link($this->u_action . '&amp;parent_id=' . $this->parent_id), E_USER_WARNING);
 376                  }
 377  
 378                  sync('forum', 'forum_id', $forum_id, false, true);
 379  
 380                  $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_FORUM_SYNC', false, array($row['forum_name']));
 381  
 382                  $cache->destroy('sql', FORUMS_TABLE);
 383  
 384                  $template->assign_var('L_FORUM_RESYNCED', sprintf($user->lang['FORUM_RESYNCED'], $row['forum_name']));
 385  
 386              break;
 387  
 388              case 'add':
 389              case 'edit':
 390  
 391                  if ($update)
 392                  {
 393                      $forum_data['forum_flags'] = 0;
 394                      $forum_data['forum_flags'] += ($request->variable('forum_link_track', false)) ? FORUM_FLAG_LINK_TRACK : 0;
 395                      $forum_data['forum_flags'] += ($request->variable('prune_old_polls', false)) ? FORUM_FLAG_PRUNE_POLL : 0;
 396                      $forum_data['forum_flags'] += ($request->variable('prune_announce', false)) ? FORUM_FLAG_PRUNE_ANNOUNCE : 0;
 397                      $forum_data['forum_flags'] += ($request->variable('prune_sticky', false)) ? FORUM_FLAG_PRUNE_STICKY : 0;
 398                      $forum_data['forum_flags'] += ($forum_data['show_active']) ? FORUM_FLAG_ACTIVE_TOPICS : 0;
 399                      $forum_data['forum_flags'] += ($request->variable('enable_post_review', true)) ? FORUM_FLAG_POST_REVIEW : 0;
 400                      $forum_data['forum_flags'] += ($request->variable('enable_quick_reply', false)) ? FORUM_FLAG_QUICK_REPLY : 0;
 401                  }
 402  
 403                  // Initialise $row, so we always have it in the event
 404                  $row = array();
 405  
 406                  // Show form to create/modify a forum
 407                  if ($action == 'edit')
 408                  {
 409                      $this->page_title = 'EDIT_FORUM';
 410                      $row = $this->get_forum_info($forum_id);
 411                      $old_forum_type = $row['forum_type'];
 412  
 413                      if (!$update)
 414                      {
 415                          $forum_data = $row;
 416                      }
 417                      else
 418                      {
 419                          $forum_data['left_id'] = $row['left_id'];
 420                          $forum_data['right_id'] = $row['right_id'];
 421                      }
 422  
 423                      // Make sure no direct child forums are able to be selected as parents.
 424                      $exclude_forums = array();
 425                      foreach (get_forum_branch($forum_id, 'children') as $row)
 426                      {
 427                          $exclude_forums[] = $row['forum_id'];
 428                      }
 429  
 430                      $parents_list = make_forum_select($forum_data['parent_id'], $exclude_forums, false, false, false);
 431  
 432                      $forum_data['forum_password_confirm'] = $forum_data['forum_password'];
 433                  }
 434                  else
 435                  {
 436                      $this->page_title = 'CREATE_FORUM';
 437  
 438                      $forum_id = $this->parent_id;
 439                      $parents_list = make_forum_select($this->parent_id, false, false, false, false);
 440  
 441                      // Fill forum data with default values
 442                      if (!$update)
 443                      {
 444                          $forum_data = array(
 445                              'parent_id'                => $this->parent_id,
 446                              'forum_type'            => FORUM_POST,
 447                              'forum_status'            => ITEM_UNLOCKED,
 448                              'forum_name'            => $request->variable('forum_name', '', true),
 449                              'forum_link'            => '',
 450                              'forum_link_track'        => false,
 451                              'forum_desc'            => '',
 452                              'forum_rules'            => '',
 453                              'forum_rules_link'        => '',
 454                              'forum_image'            => '',
 455                              'forum_style'            => 0,
 456                              'display_subforum_list'    => true,
 457                              'display_on_index'        => false,
 458                              'forum_topics_per_page'    => 0,
 459                              'enable_indexing'        => true,
 460                              'enable_icons'            => false,
 461                              'enable_prune'            => false,
 462                              'prune_days'            => 7,
 463                              'prune_viewed'            => 7,
 464                              'prune_freq'            => 1,
 465                              'enable_shadow_prune'        => false,
 466                              'prune_shadow_days'        => 7,
 467                              'prune_shadow_freq'        => 1,
 468                              'forum_flags'            => FORUM_FLAG_POST_REVIEW + FORUM_FLAG_ACTIVE_TOPICS,
 469                              'forum_options'            => 0,
 470                              'forum_password'        => '',
 471                              'forum_password_confirm'=> '',
 472                          );
 473                      }
 474                  }
 475  
 476                  /**
 477                  * Initialise data before we display the add/edit form
 478                  *
 479                  * @event core.acp_manage_forums_initialise_data
 480                  * @var    string    action        Type of the action: add|edit
 481                  * @var    bool    update        Do we display the form only
 482                  *                            or did the user press submit
 483                  * @var    int        forum_id    When editing: the forum id,
 484                  *                            when creating: the parent forum id
 485                  * @var    array    row            Array with current forum data
 486                  *                            empty when creating new forum
 487                  * @var    array    forum_data    Array with new forum data
 488                  * @var    string    parents_list    List of parent options
 489                  * @since 3.1.0-a1
 490                  */
 491                  $vars = array('action', 'update', 'forum_id', 'row', 'forum_data', 'parents_list');
 492                  extract($phpbb_dispatcher->trigger_event('core.acp_manage_forums_initialise_data', compact($vars)));
 493  
 494                  $forum_rules_data = array(
 495                      'text'            => $forum_data['forum_rules'],
 496                      'allow_bbcode'    => true,
 497                      'allow_smilies'    => true,
 498                      'allow_urls'    => true
 499                  );
 500  
 501                  $forum_desc_data = array(
 502                      'text'            => $forum_data['forum_desc'],
 503                      'allow_bbcode'    => true,
 504                      'allow_smilies'    => true,
 505                      'allow_urls'    => true
 506                  );
 507  
 508                  $forum_rules_preview = '';
 509  
 510                  // Parse rules if specified
 511                  if ($forum_data['forum_rules'])
 512                  {
 513                      if (!isset($forum_data['forum_rules_uid']))
 514                      {
 515                          // Before we are able to display the preview and plane text, we need to parse our $request->variable()'d value...
 516                          $forum_data['forum_rules_uid'] = '';
 517                          $forum_data['forum_rules_bitfield'] = '';
 518                          $forum_data['forum_rules_options'] = 0;
 519  
 520                          generate_text_for_storage($forum_data['forum_rules'], $forum_data['forum_rules_uid'], $forum_data['forum_rules_bitfield'], $forum_data['forum_rules_options'], $request->variable('rules_allow_bbcode', false), $request->variable('rules_allow_urls', false), $request->variable('rules_allow_smilies', false));
 521                      }
 522  
 523                      // Generate preview content
 524                      $forum_rules_preview = generate_text_for_display($forum_data['forum_rules'], $forum_data['forum_rules_uid'], $forum_data['forum_rules_bitfield'], $forum_data['forum_rules_options']);
 525  
 526                      // decode...
 527                      $forum_rules_data = generate_text_for_edit($forum_data['forum_rules'], $forum_data['forum_rules_uid'], $forum_data['forum_rules_options']);
 528                  }
 529  
 530                  // Parse desciption if specified
 531                  if ($forum_data['forum_desc'])
 532                  {
 533                      if (!isset($forum_data['forum_desc_uid']))
 534                      {
 535                          // Before we are able to display the preview and plane text, we need to parse our $request->variable()'d value...
 536                          $forum_data['forum_desc_uid'] = '';
 537                          $forum_data['forum_desc_bitfield'] = '';
 538                          $forum_data['forum_desc_options'] = 0;
 539  
 540                          generate_text_for_storage($forum_data['forum_desc'], $forum_data['forum_desc_uid'], $forum_data['forum_desc_bitfield'], $forum_data['forum_desc_options'], $request->variable('desc_allow_bbcode', false), $request->variable('desc_allow_urls', false), $request->variable('desc_allow_smilies', false));
 541                      }
 542  
 543                      // decode...
 544                      $forum_desc_data = generate_text_for_edit($forum_data['forum_desc'], $forum_data['forum_desc_uid'], $forum_data['forum_desc_options']);
 545                  }
 546  
 547                  $forum_type_options = '';
 548                  $forum_type_ary = array(FORUM_CAT => 'CAT', FORUM_POST => 'FORUM', FORUM_LINK => 'LINK');
 549  
 550                  foreach ($forum_type_ary as $value => $lang)
 551                  {
 552                      $forum_type_options .= '<option value="' . $value . '"' . (($value == $forum_data['forum_type']) ? ' selected="selected"' : '') . '>' . $user->lang['TYPE_' . $lang] . '</option>';
 553                  }
 554  
 555                  $styles_list = style_select($forum_data['forum_style'], true);
 556  
 557                  $statuslist = '<option value="' . ITEM_UNLOCKED . '"' . (($forum_data['forum_status'] == ITEM_UNLOCKED) ? ' selected="selected"' : '') . '>' . $user->lang['UNLOCKED'] . '</option><option value="' . ITEM_LOCKED . '"' . (($forum_data['forum_status'] == ITEM_LOCKED) ? ' selected="selected"' : '') . '>' . $user->lang['LOCKED'] . '</option>';
 558  
 559                  $sql = 'SELECT forum_id
 560                      FROM ' . FORUMS_TABLE . '
 561                      WHERE forum_type = ' . FORUM_POST . "
 562                          AND forum_id <> $forum_id";
 563                  $result = $db->sql_query_limit($sql, 1);
 564  
 565                  $postable_forum_exists = false;
 566                  if ($db->sql_fetchrow($result))
 567                  {
 568                      $postable_forum_exists = true;
 569                  }
 570                  $db->sql_freeresult($result);
 571  
 572                  // Subforum move options
 573                  if ($action == 'edit' && $forum_data['forum_type'] == FORUM_CAT)
 574                  {
 575                      $subforums_id = array();
 576                      $subforums = get_forum_branch($forum_id, 'children');
 577  
 578                      foreach ($subforums as $row)
 579                      {
 580                          $subforums_id[] = $row['forum_id'];
 581                      }
 582  
 583                      $forums_list = make_forum_select($forum_data['parent_id'], $subforums_id);
 584  
 585                      if ($postable_forum_exists)
 586                      {
 587                          $template->assign_vars(array(
 588                              'S_MOVE_FORUM_OPTIONS'        => make_forum_select($forum_data['parent_id'], $subforums_id)) // , false, true, false???
 589                          );
 590                      }
 591  
 592                      $template->assign_vars(array(
 593                          'S_HAS_SUBFORUMS'        => ($forum_data['right_id'] - $forum_data['left_id'] > 1) ? true : false,
 594                          'S_FORUMS_LIST'            => $forums_list)
 595                      );
 596                  }
 597                  else if ($postable_forum_exists)
 598                  {
 599                      $template->assign_vars(array(
 600                          'S_MOVE_FORUM_OPTIONS'        => make_forum_select($forum_data['parent_id'], $forum_id, false, true, false))
 601                      );
 602                  }
 603  
 604                  $s_show_display_on_index = false;
 605  
 606                  if ($forum_data['parent_id'] > 0)
 607                  {
 608                      // if this forum is a subforum put the "display on index" checkbox
 609                      if ($parent_info = $this->get_forum_info($forum_data['parent_id']))
 610                      {
 611                          if ($parent_info['parent_id'] > 0 || $parent_info['forum_type'] == FORUM_CAT)
 612                          {
 613                              $s_show_display_on_index = true;
 614                          }
 615                      }
 616                  }
 617  
 618                  if (strlen($forum_data['forum_password']) == 32)
 619                  {
 620                      $errors[] = $user->lang['FORUM_PASSWORD_OLD'];
 621                  }
 622  
 623                  $template_data = array(
 624                      'S_EDIT_FORUM'        => true,
 625                      'S_ERROR'            => (count($errors)) ? true : false,
 626                      'S_PARENT_ID'        => $this->parent_id,
 627                      'S_FORUM_PARENT_ID'    => $forum_data['parent_id'],
 628                      'S_ADD_ACTION'        => ($action == 'add') ? true : false,
 629  
 630                      'U_BACK'        => $this->u_action . '&amp;parent_id=' . $this->parent_id,
 631                      'U_EDIT_ACTION'    => $this->u_action . "&amp;parent_id={$this->parent_id}&amp;action=$action&amp;f=$forum_id",
 632  
 633                      'L_COPY_PERMISSIONS_EXPLAIN'    => $user->lang['COPY_PERMISSIONS_' . strtoupper($action) . '_EXPLAIN'],
 634                      'L_TITLE'                        => $user->lang[$this->page_title],
 635                      'ERROR_MSG'                        => (count($errors)) ? implode('<br />', $errors) : '',
 636  
 637                      'FORUM_NAME'                => $forum_data['forum_name'],
 638                      'FORUM_DATA_LINK'            => $forum_data['forum_link'],
 639                      'FORUM_IMAGE'                => $forum_data['forum_image'],
 640                      'FORUM_IMAGE_SRC'            => ($forum_data['forum_image']) ? $phpbb_root_path . $forum_data['forum_image'] : '',
 641                      'FORUM_POST'                => FORUM_POST,
 642                      'FORUM_LINK'                => FORUM_LINK,
 643                      'FORUM_CAT'                    => FORUM_CAT,
 644                      'PRUNE_FREQ'                => $forum_data['prune_freq'],
 645                      'PRUNE_DAYS'                => $forum_data['prune_days'],
 646                      'PRUNE_VIEWED'                => $forum_data['prune_viewed'],
 647                      'PRUNE_SHADOW_FREQ'            => $forum_data['prune_shadow_freq'],
 648                      'PRUNE_SHADOW_DAYS'            => $forum_data['prune_shadow_days'],
 649                      'TOPICS_PER_PAGE'            => $forum_data['forum_topics_per_page'],
 650                      'FORUM_RULES_LINK'            => $forum_data['forum_rules_link'],
 651                      'FORUM_RULES'                => $forum_data['forum_rules'],
 652                      'FORUM_RULES_PREVIEW'        => $forum_rules_preview,
 653                      'FORUM_RULES_PLAIN'            => $forum_rules_data['text'],
 654                      'S_BBCODE_CHECKED'            => ($forum_rules_data['allow_bbcode']) ? true : false,
 655                      'S_SMILIES_CHECKED'            => ($forum_rules_data['allow_smilies']) ? true : false,
 656                      'S_URLS_CHECKED'            => ($forum_rules_data['allow_urls']) ? true : false,
 657                      'S_FORUM_PASSWORD_SET'        => (empty($forum_data['forum_password'])) ? false : true,
 658  
 659                      'FORUM_DESC'                => $forum_desc_data['text'],
 660                      'S_DESC_BBCODE_CHECKED'        => ($forum_desc_data['allow_bbcode']) ? true : false,
 661                      'S_DESC_SMILIES_CHECKED'    => ($forum_desc_data['allow_smilies']) ? true : false,
 662                      'S_DESC_URLS_CHECKED'        => ($forum_desc_data['allow_urls']) ? true : false,
 663  
 664                      'S_FORUM_TYPE_OPTIONS'        => $forum_type_options,
 665                      'S_STATUS_OPTIONS'            => $statuslist,
 666                      'S_PARENT_OPTIONS'            => $parents_list,
 667                      'S_STYLES_OPTIONS'            => $styles_list,
 668                      'S_FORUM_OPTIONS'            => make_forum_select(($action == 'add') ? $forum_data['parent_id'] : false, ($action == 'edit') ? $forum_data['forum_id'] : false, false, false, false),
 669                      'S_SHOW_DISPLAY_ON_INDEX'    => $s_show_display_on_index,
 670                      'S_FORUM_POST'                => ($forum_data['forum_type'] == FORUM_POST) ? true : false,
 671                      'S_FORUM_ORIG_POST'            => (isset($old_forum_type) && $old_forum_type == FORUM_POST) ? true : false,
 672                      'S_FORUM_ORIG_CAT'            => (isset($old_forum_type) && $old_forum_type == FORUM_CAT) ? true : false,
 673                      'S_FORUM_ORIG_LINK'            => (isset($old_forum_type) && $old_forum_type == FORUM_LINK) ? true : false,
 674                      'S_FORUM_LINK'                => ($forum_data['forum_type'] == FORUM_LINK) ? true : false,
 675                      'S_FORUM_CAT'                => ($forum_data['forum_type'] == FORUM_CAT) ? true : false,
 676                      'S_ENABLE_INDEXING'            => ($forum_data['enable_indexing']) ? true : false,
 677                      'S_TOPIC_ICONS'                => ($forum_data['enable_icons']) ? true : false,
 678                      'S_DISPLAY_SUBFORUM_LIST'    => ($forum_data['display_subforum_list']) ? true : false,
 679                      'S_DISPLAY_ON_INDEX'        => ($forum_data['display_on_index']) ? true : false,
 680                      'S_PRUNE_ENABLE'            => ($forum_data['enable_prune']) ? true : false,
 681                      'S_PRUNE_SHADOW_ENABLE'            => ($forum_data['enable_shadow_prune']) ? true : false,
 682                      'S_FORUM_LINK_TRACK'        => ($forum_data['forum_flags'] & FORUM_FLAG_LINK_TRACK) ? true : false,
 683                      'S_PRUNE_OLD_POLLS'            => ($forum_data['forum_flags'] & FORUM_FLAG_PRUNE_POLL) ? true : false,
 684                      'S_PRUNE_ANNOUNCE'            => ($forum_data['forum_flags'] & FORUM_FLAG_PRUNE_ANNOUNCE) ? true : false,
 685                      'S_PRUNE_STICKY'            => ($forum_data['forum_flags'] & FORUM_FLAG_PRUNE_STICKY) ? true : false,
 686                      'S_DISPLAY_ACTIVE_TOPICS'    => ($forum_data['forum_type'] == FORUM_POST) ? ($forum_data['forum_flags'] & FORUM_FLAG_ACTIVE_TOPICS) : true,
 687                      'S_ENABLE_ACTIVE_TOPICS'    => ($forum_data['forum_type'] == FORUM_CAT) ? ($forum_data['forum_flags'] & FORUM_FLAG_ACTIVE_TOPICS) : false,
 688                      'S_ENABLE_POST_REVIEW'        => ($forum_data['forum_flags'] & FORUM_FLAG_POST_REVIEW) ? true : false,
 689                      'S_ENABLE_QUICK_REPLY'        => ($forum_data['forum_flags'] & FORUM_FLAG_QUICK_REPLY) ? true : false,
 690                      'S_CAN_COPY_PERMISSIONS'    => ($action != 'edit' || empty($forum_id) || ($auth->acl_get('a_fauth') && $auth->acl_get('a_authusers') && $auth->acl_get('a_authgroups') && $auth->acl_get('a_mauth'))) ? true : false,
 691                  );
 692  
 693                  /**
 694                  * Modify forum template data before we display the form
 695                  *
 696                  * @event core.acp_manage_forums_display_form
 697                  * @var    string    action        Type of the action: add|edit
 698                  * @var    bool    update        Do we display the form only
 699                  *                            or did the user press submit
 700                  * @var    int        forum_id    When editing: the forum id,
 701                  *                            when creating: the parent forum id
 702                  * @var    array    row            Array with current forum data
 703                  *                            empty when creating new forum
 704                  * @var    array    forum_data    Array with new forum data
 705                  * @var    string    parents_list    List of parent options
 706                  * @var    array    errors        Array of errors, if you add errors
 707                  *                    ensure to update the template variables
 708                  *                    S_ERROR and ERROR_MSG to display it
 709                  * @var    array    template_data    Array with new forum data
 710                  * @since 3.1.0-a1
 711                  */
 712                  $vars = array(
 713                      'action',
 714                      'update',
 715                      'forum_id',
 716                      'row',
 717                      'forum_data',
 718                      'parents_list',
 719                      'errors',
 720                      'template_data',
 721                  );
 722                  extract($phpbb_dispatcher->trigger_event('core.acp_manage_forums_display_form', compact($vars)));
 723  
 724                  $template->assign_vars($template_data);
 725  
 726                  return;
 727  
 728              break;
 729  
 730              case 'delete':
 731  
 732                  if (!$forum_id)
 733                  {
 734                      trigger_error($user->lang['NO_FORUM'] . adm_back_link($this->u_action . '&amp;parent_id=' . $this->parent_id), E_USER_WARNING);
 735                  }
 736  
 737                  $forum_data = $this->get_forum_info($forum_id);
 738  
 739                  $subforums_id = array();
 740                  $subforums = get_forum_branch($forum_id, 'children');
 741  
 742                  foreach ($subforums as $row)
 743                  {
 744                      $subforums_id[] = $row['forum_id'];
 745                  }
 746  
 747                  $forums_list = make_forum_select($forum_data['parent_id'], $subforums_id);
 748  
 749                  $sql = 'SELECT forum_id
 750                      FROM ' . FORUMS_TABLE . '
 751                      WHERE forum_type = ' . FORUM_POST . "
 752                          AND forum_id <> $forum_id";
 753                  $result = $db->sql_query_limit($sql, 1);
 754  
 755                  if ($db->sql_fetchrow($result))
 756                  {
 757                      $template->assign_vars(array(
 758                          'S_MOVE_FORUM_OPTIONS'        => make_forum_select($forum_data['parent_id'], $subforums_id, false, true)) // , false, true, false???
 759                      );
 760                  }
 761                  $db->sql_freeresult($result);
 762  
 763                  $parent_id = ($this->parent_id == $forum_id) ? 0 : $this->parent_id;
 764  
 765                  $template->assign_vars(array(
 766                      'S_DELETE_FORUM'        => true,
 767                      'U_ACTION'                => $this->u_action . "&amp;parent_id={$parent_id}&amp;action=delete&amp;f=$forum_id",
 768                      'U_BACK'                => $this->u_action . '&amp;parent_id=' . $this->parent_id,
 769  
 770                      'FORUM_NAME'            => $forum_data['forum_name'],
 771                      'S_FORUM_POST'            => ($forum_data['forum_type'] == FORUM_POST) ? true : false,
 772                      'S_FORUM_LINK'            => ($forum_data['forum_type'] == FORUM_LINK) ? true : false,
 773                      'S_HAS_SUBFORUMS'        => ($forum_data['right_id'] - $forum_data['left_id'] > 1) ? true : false,
 774                      'S_FORUMS_LIST'            => $forums_list,
 775                      'S_ERROR'                => (count($errors)) ? true : false,
 776                      'ERROR_MSG'                => (count($errors)) ? implode('<br />', $errors) : '')
 777                  );
 778  
 779                  return;
 780              break;
 781  
 782              case 'copy_perm':
 783                  $forum_perm_from = $request->variable('forum_perm_from', 0);
 784  
 785                  // Copy permissions?
 786                  if (!empty($forum_perm_from) && $forum_perm_from != $forum_id)
 787                  {
 788                      copy_forum_permissions($forum_perm_from, $forum_id, true);
 789                      phpbb_cache_moderators($db, $cache, $auth);
 790                      $auth->acl_clear_prefetch();
 791                      $cache->destroy('sql', FORUMS_TABLE);
 792  
 793                      $acl_url = '&amp;mode=setting_forum_local&amp;forum_id[]=' . $forum_id;
 794  
 795                      $message = $user->lang['FORUM_UPDATED'];
 796  
 797                      // Redirect to permissions
 798                      if ($auth->acl_get('a_fauth'))
 799                      {
 800                          $message .= '<br /><br />' . sprintf($user->lang['REDIRECT_ACL'], '<a href="' . append_sid("{$phpbb_admin_path}index.$phpEx", 'i=permissions' . $acl_url) . '">', '</a>');
 801                      }
 802  
 803                      trigger_error($message . adm_back_link($this->u_action . '&amp;parent_id=' . $this->parent_id));
 804                  }
 805  
 806              break;
 807          }
 808  
 809          // Default management page
 810          if (!$this->parent_id)
 811          {
 812              $navigation = $user->lang['FORUM_INDEX'];
 813          }
 814          else
 815          {
 816              $navigation = '<a href="' . $this->u_action . '">' . $user->lang['FORUM_INDEX'] . '</a>';
 817  
 818              $forums_nav = get_forum_branch($this->parent_id, 'parents', 'descending');
 819              foreach ($forums_nav as $row)
 820              {
 821                  if ($row['forum_id'] == $this->parent_id)
 822                  {
 823                      $navigation .= ' -&gt; ' . $row['forum_name'];
 824                  }
 825                  else
 826                  {
 827                      $navigation .= ' -&gt; <a href="' . $this->u_action . '&amp;parent_id=' . $row['forum_id'] . '">' . $row['forum_name'] . '</a>';
 828                  }
 829              }
 830          }
 831  
 832          // Jumpbox
 833          $forum_box = make_forum_select($this->parent_id, false, false, false, false); //make_forum_select($this->parent_id);
 834  
 835          if ($action == 'sync' || $action == 'sync_forum')
 836          {
 837              $template->assign_var('S_RESYNCED', true);
 838          }
 839  
 840          $sql = 'SELECT *
 841              FROM ' . FORUMS_TABLE . "
 842              WHERE parent_id = $this->parent_id
 843              ORDER BY left_id";
 844          $result = $db->sql_query($sql);
 845  
 846          $rowset = array();
 847          while ($row = $db->sql_fetchrow($result))
 848          {
 849              $rowset[(int) $row['forum_id']] = $row;
 850          }
 851          $db->sql_freeresult($result);
 852  
 853          /**
 854          * Modify the forum list data
 855          *
 856          * @event core.acp_manage_forums_modify_forum_list
 857          * @var    array    rowset    Array with the forums list data
 858          * @since 3.1.10-RC1
 859          */
 860          $vars = array('rowset');
 861          extract($phpbb_dispatcher->trigger_event('core.acp_manage_forums_modify_forum_list', compact($vars)));
 862  
 863          if (!empty($rowset))
 864          {
 865              foreach ($rowset as $row)
 866              {
 867                  $forum_type = $row['forum_type'];
 868  
 869                  if ($row['forum_status'] == ITEM_LOCKED)
 870                  {
 871                      $folder_image = '<img src="images/icon_folder_lock.gif" alt="' . $user->lang['LOCKED'] . '" />';
 872                  }
 873                  else
 874                  {
 875                      switch ($forum_type)
 876                      {
 877                          case FORUM_LINK:
 878                              $folder_image = '<img src="images/icon_folder_link.gif" alt="' . $user->lang['LINK'] . '" />';
 879                          break;
 880  
 881                          default:
 882                              $folder_image = ($row['left_id'] + 1 != $row['right_id']) ? '<img src="images/icon_subfolder.gif" alt="' . $user->lang['SUBFORUM'] . '" />' : '<img src="images/icon_folder.gif" alt="' . $user->lang['FOLDER'] . '" />';
 883                          break;
 884                      }
 885                  }
 886  
 887                  $url = $this->u_action . "&amp;parent_id=$this->parent_id&amp;f={$row['forum_id']}";
 888  
 889                  $template->assign_block_vars('forums', array(
 890                      'FOLDER_IMAGE'        => $folder_image,
 891                      'FORUM_IMAGE'        => ($row['forum_image']) ? '<img src="' . $phpbb_root_path . $row['forum_image'] . '" alt="" />' : '',
 892                      'FORUM_IMAGE_SRC'    => ($row['forum_image']) ? $phpbb_root_path . $row['forum_image'] : '',
 893                      'FORUM_NAME'        => $row['forum_name'],
 894                      'FORUM_DESCRIPTION'    => generate_text_for_display($row['forum_desc'], $row['forum_desc_uid'], $row['forum_desc_bitfield'], $row['forum_desc_options']),
 895                      'FORUM_TOPICS'        => $row['forum_topics_approved'],
 896                      'FORUM_POSTS'        => $row['forum_posts_approved'],
 897  
 898                      'S_FORUM_LINK'        => ($forum_type == FORUM_LINK) ? true : false,
 899                      'S_FORUM_POST'        => ($forum_type == FORUM_POST) ? true : false,
 900  
 901                      'U_FORUM'            => $this->u_action . '&amp;parent_id=' . $row['forum_id'],
 902                      'U_MOVE_UP'            => $url . '&amp;action=move_up',
 903                      'U_MOVE_DOWN'        => $url . '&amp;action=move_down',
 904                      'U_EDIT'            => $url . '&amp;action=edit',
 905                      'U_DELETE'            => $url . '&amp;action=delete',
 906                      'U_SYNC'            => $url . '&amp;action=sync')
 907                  );
 908              }
 909          }
 910          else if ($this->parent_id)
 911          {
 912              $row = $this->get_forum_info($this->parent_id);
 913  
 914              $url = $this->u_action . '&amp;parent_id=' . $this->parent_id . '&amp;f=' . $row['forum_id'];
 915  
 916              $template->assign_vars(array(
 917                  'S_NO_FORUMS'        => true,
 918  
 919                  'U_EDIT'            => $url . '&amp;action=edit',
 920                  'U_DELETE'            => $url . '&amp;action=delete',
 921                  'U_SYNC'            => $url . '&amp;action=sync')
 922              );
 923          }
 924          unset($rowset);
 925  
 926          $template->assign_vars(array(
 927              'ERROR_MSG'        => (count($errors)) ? implode('<br />', $errors) : '',
 928              'NAVIGATION'    => $navigation,
 929              'FORUM_BOX'        => $forum_box,
 930              'U_SEL_ACTION'    => $this->u_action,
 931              'U_ACTION'        => $this->u_action . '&amp;parent_id=' . $this->parent_id,
 932  
 933              'U_PROGRESS_BAR'    => $this->u_action . '&amp;action=progress_bar',
 934              'UA_PROGRESS_BAR'    => addslashes($this->u_action . '&amp;action=progress_bar'),
 935          ));
 936      }
 937  
 938      /**
 939      * Get forum details
 940      */
 941  	function get_forum_info($forum_id)
 942      {
 943          global $db;
 944  
 945          $sql = 'SELECT *
 946              FROM ' . FORUMS_TABLE . "
 947              WHERE forum_id = $forum_id";
 948          $result = $db->sql_query($sql);
 949          $row = $db->sql_fetchrow($result);
 950          $db->sql_freeresult($result);
 951  
 952          if (!$row)
 953          {
 954              trigger_error("Forum #$forum_id does not exist", E_USER_ERROR);
 955          }
 956  
 957          return $row;
 958      }
 959  
 960      /**
 961      * Update forum data
 962      */
 963  	function update_forum_data(&$forum_data_ary)
 964      {
 965          global $db, $user, $cache, $phpbb_root_path, $phpbb_container, $phpbb_dispatcher, $phpbb_log, $request;
 966  
 967          $errors = array();
 968  
 969          $forum_data = $forum_data_ary;
 970          /**
 971          * Validate the forum data before we create/update the forum
 972          *
 973          * @event core.acp_manage_forums_validate_data
 974          * @var    array    forum_data    Array with new forum data
 975          * @var    array    errors        Array of errors, should be strings and not
 976          *                            language key.
 977          * @since 3.1.0-a1
 978          */
 979          $vars = array('forum_data', 'errors');
 980          extract($phpbb_dispatcher->trigger_event('core.acp_manage_forums_validate_data', compact($vars)));
 981          $forum_data_ary = $forum_data;
 982          unset($forum_data);
 983  
 984          if ($forum_data_ary['forum_name'] == '')
 985          {
 986              $errors[] = $user->lang['FORUM_NAME_EMPTY'];
 987          }
 988  
 989          // No Emojis
 990          if (preg_match_all('/[\x{10000}-\x{10FFFF}]/u', $forum_data_ary['forum_name'], $matches))
 991          {
 992              $character_list = implode('<br>', $matches[0]);
 993              $errors[] = $user->lang('FORUM_NAME_EMOJI', $character_list);
 994          }
 995  
 996          if (utf8_strlen($forum_data_ary['forum_desc']) > 4000)
 997          {
 998              $errors[] = $user->lang['FORUM_DESC_TOO_LONG'];
 999          }
1000  
1001          if (utf8_strlen($forum_data_ary['forum_rules']) > 4000)
1002          {
1003              $errors[] = $user->lang['FORUM_RULES_TOO_LONG'];
1004          }
1005  
1006          if ($forum_data_ary['forum_password'] || $forum_data_ary['forum_password_confirm'])
1007          {
1008              if ($forum_data_ary['forum_password'] != $forum_data_ary['forum_password_confirm'])
1009              {
1010                  $forum_data_ary['forum_password'] = $forum_data_ary['forum_password_confirm'] = '';
1011                  $errors[] = $user->lang['FORUM_PASSWORD_MISMATCH'];
1012              }
1013          }
1014  
1015          if ($forum_data_ary['prune_days'] < 0 || $forum_data_ary['prune_viewed'] < 0 || $forum_data_ary['prune_freq'] < 0)
1016          {
1017              $forum_data_ary['prune_days'] = $forum_data_ary['prune_viewed'] = $forum_data_ary['prune_freq'] = 0;
1018              $errors[] = $user->lang['FORUM_DATA_NEGATIVE'];
1019          }
1020  
1021          $range_test_ary = array(
1022              array('lang' => 'FORUM_TOPICS_PAGE', 'value' => $forum_data_ary['forum_topics_per_page'], 'column_type' => 'USINT:0'),
1023          );
1024  
1025          if (!empty($forum_data_ary['forum_image']) && !file_exists($phpbb_root_path . $forum_data_ary['forum_image']))
1026          {
1027              $errors[] = $user->lang['FORUM_IMAGE_NO_EXIST'];
1028          }
1029  
1030          validate_range($range_test_ary, $errors);
1031  
1032          // Set forum flags
1033          // 1 = link tracking
1034          // 2 = prune old polls
1035          // 4 = prune announcements
1036          // 8 = prune stickies
1037          // 16 = show active topics
1038          // 32 = enable post review
1039          $forum_data_ary['forum_flags'] = 0;
1040          $forum_data_ary['forum_flags'] += ($forum_data_ary['forum_link_track']) ? FORUM_FLAG_LINK_TRACK : 0;
1041          $forum_data_ary['forum_flags'] += ($forum_data_ary['prune_old_polls']) ? FORUM_FLAG_PRUNE_POLL : 0;
1042          $forum_data_ary['forum_flags'] += ($forum_data_ary['prune_announce']) ? FORUM_FLAG_PRUNE_ANNOUNCE : 0;
1043          $forum_data_ary['forum_flags'] += ($forum_data_ary['prune_sticky']) ? FORUM_FLAG_PRUNE_STICKY : 0;
1044          $forum_data_ary['forum_flags'] += ($forum_data_ary['show_active']) ? FORUM_FLAG_ACTIVE_TOPICS : 0;
1045          $forum_data_ary['forum_flags'] += ($forum_data_ary['enable_post_review']) ? FORUM_FLAG_POST_REVIEW : 0;
1046          $forum_data_ary['forum_flags'] += ($forum_data_ary['enable_quick_reply']) ? FORUM_FLAG_QUICK_REPLY : 0;
1047  
1048          // Unset data that are not database fields
1049          $forum_data_sql = $forum_data_ary;
1050  
1051          unset($forum_data_sql['forum_link_track']);
1052          unset($forum_data_sql['prune_old_polls']);
1053          unset($forum_data_sql['prune_announce']);
1054          unset($forum_data_sql['prune_sticky']);
1055          unset($forum_data_sql['show_active']);
1056          unset($forum_data_sql['enable_post_review']);
1057          unset($forum_data_sql['enable_quick_reply']);
1058          unset($forum_data_sql['forum_password_confirm']);
1059  
1060          // What are we going to do tonight Brain? The same thing we do everynight,
1061          // try to take over the world ... or decide whether to continue update
1062          // and if so, whether it's a new forum/cat/link or an existing one
1063          if (count($errors))
1064          {
1065              return $errors;
1066          }
1067  
1068          // As we don't know the old password, it's kinda tricky to detect changes
1069          if ($forum_data_sql['forum_password_unset'])
1070          {
1071              $forum_data_sql['forum_password'] = '';
1072          }
1073          else if (empty($forum_data_sql['forum_password']))
1074          {
1075              unset($forum_data_sql['forum_password']);
1076          }
1077          else
1078          {
1079              // Instantiate passwords manager
1080              /* @var $passwords_manager \phpbb\passwords\manager */
1081              $passwords_manager = $phpbb_container->get('passwords.manager');
1082  
1083              $forum_data_sql['forum_password'] = $passwords_manager->hash($forum_data_sql['forum_password']);
1084          }
1085          unset($forum_data_sql['forum_password_unset']);
1086  
1087          $forum_data = $forum_data_ary;
1088          /**
1089          * Remove invalid values from forum_data_sql that should not be updated
1090          *
1091          * @event core.acp_manage_forums_update_data_before
1092          * @var    array    forum_data        Array with forum data
1093          * @var    array    forum_data_sql    Array with data we are going to update
1094          *                        If forum_data_sql[forum_id] is set, we update
1095          *                        that forum, otherwise a new one is created.
1096          * @since 3.1.0-a1
1097          */
1098          $vars = array('forum_data', 'forum_data_sql');
1099          extract($phpbb_dispatcher->trigger_event('core.acp_manage_forums_update_data_before', compact($vars)));
1100          $forum_data_ary = $forum_data;
1101          unset($forum_data);
1102  
1103          $is_new_forum = !isset($forum_data_sql['forum_id']);
1104  
1105          if ($is_new_forum)
1106          {
1107              // no forum_id means we're creating a new forum
1108              unset($forum_data_sql['type_action']);
1109  
1110              if ($forum_data_sql['parent_id'])
1111              {
1112                  $sql = 'SELECT left_id, right_id, forum_type
1113                      FROM ' . FORUMS_TABLE . '
1114                      WHERE forum_id = ' . $forum_data_sql['parent_id'];
1115                  $result = $db->sql_query($sql);
1116                  $row = $db->sql_fetchrow($result);
1117                  $db->sql_freeresult($result);
1118  
1119                  if (!$row)
1120                  {
1121                      trigger_error($user->lang['PARENT_NOT_EXIST'] . adm_back_link($this->u_action . '&amp;parent_id=' . $this->parent_id), E_USER_WARNING);
1122                  }
1123  
1124                  if ($row['forum_type'] == FORUM_LINK)
1125                  {
1126                      $errors[] = $user->lang['PARENT_IS_LINK_FORUM'];
1127                      return $errors;
1128                  }
1129  
1130                  $sql = 'UPDATE ' . FORUMS_TABLE . '
1131                      SET left_id = left_id + 2, right_id = right_id + 2
1132                      WHERE left_id > ' . $row['right_id'];
1133                  $db->sql_query($sql);
1134  
1135                  $sql = 'UPDATE ' . FORUMS_TABLE . '
1136                      SET right_id = right_id + 2
1137                      WHERE ' . $row['left_id'] . ' BETWEEN left_id AND right_id';
1138                  $db->sql_query($sql);
1139  
1140                  $forum_data_sql['left_id'] = $row['right_id'];
1141                  $forum_data_sql['right_id'] = $row['right_id'] + 1;
1142              }
1143              else
1144              {
1145                  $sql = 'SELECT MAX(right_id) AS right_id
1146                      FROM ' . FORUMS_TABLE;
1147                  $result = $db->sql_query($sql);
1148                  $row = $db->sql_fetchrow($result);
1149                  $db->sql_freeresult($result);
1150  
1151                  $forum_data_sql['left_id'] = $row['right_id'] + 1;
1152                  $forum_data_sql['right_id'] = $row['right_id'] + 2;
1153              }
1154  
1155              $sql = 'INSERT INTO ' . FORUMS_TABLE . ' ' . $db->sql_build_array('INSERT', $forum_data_sql);
1156              $db->sql_query($sql);
1157  
1158              $forum_data_ary['forum_id'] = $db->sql_nextid();
1159  
1160              $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_FORUM_ADD', false, array($forum_data_ary['forum_name']));
1161          }
1162          else
1163          {
1164              $row = $this->get_forum_info($forum_data_sql['forum_id']);
1165  
1166              if ($row['forum_type'] == FORUM_POST && $row['forum_type'] != $forum_data_sql['forum_type'])
1167              {
1168                  // Has subforums and want to change into a link?
1169                  if ($row['right_id'] - $row['left_id'] > 1 && $forum_data_sql['forum_type'] == FORUM_LINK)
1170                  {
1171                      $errors[] = $user->lang['FORUM_WITH_SUBFORUMS_NOT_TO_LINK'];
1172                      return $errors;
1173                  }
1174  
1175                  // we're turning a postable forum into a non-postable forum
1176                  if ($forum_data_sql['type_action'] == 'move')
1177                  {
1178                      $to_forum_id = $request->variable('to_forum_id', 0);
1179  
1180                      if ($to_forum_id)
1181                      {
1182                          $errors = $this->move_forum_content($forum_data_sql['forum_id'], $to_forum_id);
1183                      }
1184                      else
1185                      {
1186                          return array($user->lang['NO_DESTINATION_FORUM']);
1187                      }
1188                  }
1189                  else if ($forum_data_sql['type_action'] == 'delete')
1190                  {
1191                      $errors = $this->delete_forum_content($forum_data_sql['forum_id']);
1192                  }
1193                  else
1194                  {
1195                      return array($user->lang['NO_FORUM_ACTION']);
1196                  }
1197  
1198                  $forum_data_sql['forum_posts_approved'] = $forum_data_sql['forum_posts_unapproved'] = $forum_data_sql['forum_posts_softdeleted'] = $forum_data_sql['forum_topics_approved'] = $forum_data_sql['forum_topics_unapproved'] = $forum_data_sql['forum_topics_softdeleted'] = 0;
1199                  $forum_data_sql['forum_last_post_id'] = $forum_data_sql['forum_last_poster_id'] = $forum_data_sql['forum_last_post_time'] = 0;
1200                  $forum_data_sql['forum_last_poster_name'] = $forum_data_sql['forum_last_poster_colour'] = '';
1201              }
1202              else if ($row['forum_type'] == FORUM_CAT && $forum_data_sql['forum_type'] == FORUM_LINK)
1203              {
1204                  // Has subforums?
1205                  if ($row['right_id'] - $row['left_id'] > 1)
1206                  {
1207                      // We are turning a category into a link - but need to decide what to do with the subforums.
1208                      $action_subforums = $request->variable('action_subforums', '');
1209                      $subforums_to_id = $request->variable('subforums_to_id', 0);
1210  
1211                      if ($action_subforums == 'delete')
1212                      {
1213                          $rows = get_forum_branch($row['forum_id'], 'children', 'descending', false);
1214  
1215                          foreach ($rows as $_row)
1216                          {
1217                              // Do not remove the forum id we are about to change. ;)
1218                              if ($_row['forum_id'] == $row['forum_id'])
1219                              {
1220                                  continue;
1221                              }
1222  
1223                              $forum_ids[] = $_row['forum_id'];
1224                              $errors = array_merge($errors, $this->delete_forum_content($_row['forum_id']));
1225                          }
1226  
1227                          if (count($errors))
1228                          {
1229                              return $errors;
1230                          }
1231  
1232                          if (count($forum_ids))
1233                          {
1234                              $sql = 'DELETE FROM ' . FORUMS_TABLE . '
1235                                  WHERE ' . $db->sql_in_set('forum_id', $forum_ids);
1236                              $db->sql_query($sql);
1237  
1238                              $sql = 'DELETE FROM ' . ACL_GROUPS_TABLE . '
1239                                  WHERE ' . $db->sql_in_set('forum_id', $forum_ids);
1240                              $db->sql_query($sql);
1241  
1242                              $sql = 'DELETE FROM ' . ACL_USERS_TABLE . '
1243                                  WHERE ' . $db->sql_in_set('forum_id', $forum_ids);
1244                              $db->sql_query($sql);
1245  
1246                              // Delete forum ids from extension groups table
1247                              $sql = 'SELECT group_id, allowed_forums
1248                                  FROM ' . EXTENSION_GROUPS_TABLE;
1249                              $result = $db->sql_query($sql);
1250  
1251                              while ($_row = $db->sql_fetchrow($result))
1252                              {
1253                                  if (!$_row['allowed_forums'])
1254                                  {
1255                                      continue;
1256                                  }
1257  
1258                                  $allowed_forums = unserialize(trim($_row['allowed_forums']));
1259                                  $allowed_forums = array_diff($allowed_forums, $forum_ids);
1260  
1261                                  $sql = 'UPDATE ' . EXTENSION_GROUPS_TABLE . "
1262                                      SET allowed_forums = '" . ((count($allowed_forums)) ? serialize($allowed_forums) : '') . "'
1263                                      WHERE group_id = {$_row['group_id']}";
1264                                  $db->sql_query($sql);
1265                              }
1266                              $db->sql_freeresult($result);
1267  
1268                              $cache->destroy('_extensions');
1269                          }
1270                      }
1271                      else if ($action_subforums == 'move')
1272                      {
1273                          if (!$subforums_to_id)
1274                          {
1275                              return array($user->lang['NO_DESTINATION_FORUM']);
1276                          }
1277  
1278                          $sql = 'SELECT forum_name
1279                              FROM ' . FORUMS_TABLE . '
1280                              WHERE forum_id = ' . $subforums_to_id;
1281                          $result = $db->sql_query($sql);
1282                          $_row = $db->sql_fetchrow($result);
1283                          $db->sql_freeresult($result);
1284  
1285                          if (!$_row)
1286                          {
1287                              return array($user->lang['NO_FORUM']);
1288                          }
1289  
1290                          $sql = 'SELECT forum_id
1291                              FROM ' . FORUMS_TABLE . "
1292                              WHERE parent_id = {$row['forum_id']}";
1293                          $result = $db->sql_query($sql);
1294  
1295                          while ($_row = $db->sql_fetchrow($result))
1296                          {
1297                              $this->move_forum($_row['forum_id'], $subforums_to_id);
1298                          }
1299                          $db->sql_freeresult($result);
1300  
1301                          $sql = 'UPDATE ' . FORUMS_TABLE . "
1302                              SET parent_id = $subforums_to_id
1303                              WHERE parent_id = {$row['forum_id']}";
1304                          $db->sql_query($sql);
1305                      }
1306  
1307                      // Adjust the left/right id
1308                      $sql = 'UPDATE ' . FORUMS_TABLE . '
1309                          SET right_id = left_id + 1
1310                          WHERE forum_id = ' . $row['forum_id'];
1311                      $db->sql_query($sql);
1312                  }
1313              }
1314              else if ($row['forum_type'] == FORUM_CAT && $forum_data_sql['forum_type'] == FORUM_POST)
1315              {
1316                  // Changing a category to a forum? Reset the data (you can't post directly in a cat, you must use a forum)
1317                  $forum_data_sql['forum_posts_approved'] = 0;
1318                  $forum_data_sql['forum_posts_unapproved'] = 0;
1319                  $forum_data_sql['forum_posts_softdeleted'] = 0;
1320                  $forum_data_sql['forum_topics_approved'] = 0;
1321                  $forum_data_sql['forum_topics_unapproved'] = 0;
1322                  $forum_data_sql['forum_topics_softdeleted'] = 0;
1323                  $forum_data_sql['forum_last_post_id'] = 0;
1324                  $forum_data_sql['forum_last_post_subject'] = '';
1325                  $forum_data_sql['forum_last_post_time'] = 0;
1326                  $forum_data_sql['forum_last_poster_id'] = 0;
1327                  $forum_data_sql['forum_last_poster_name'] = '';
1328                  $forum_data_sql['forum_last_poster_colour'] = '';
1329              }
1330  
1331              if (count($errors))
1332              {
1333                  return $errors;
1334              }
1335  
1336              if ($row['parent_id'] != $forum_data_sql['parent_id'])
1337              {
1338                  if ($row['forum_id'] != $forum_data_sql['parent_id'])
1339                  {
1340                      $errors = $this->move_forum($forum_data_sql['forum_id'], $forum_data_sql['parent_id']);
1341                  }
1342                  else
1343                  {
1344                      $forum_data_sql['parent_id'] = $row['parent_id'];
1345                  }
1346              }
1347  
1348              if (count($errors))
1349              {
1350                  return $errors;
1351              }
1352  
1353              unset($forum_data_sql['type_action']);
1354  
1355              if ($row['forum_name'] != $forum_data_sql['forum_name'])
1356              {
1357                  // the forum name has changed, clear the parents list of all forums (for safety)
1358                  $sql = 'UPDATE ' . FORUMS_TABLE . "
1359                      SET forum_parents = ''";
1360                  $db->sql_query($sql);
1361              }
1362  
1363              // Setting the forum id to the forum id is not really received well by some dbs. ;)
1364              $forum_id = $forum_data_sql['forum_id'];
1365              unset($forum_data_sql['forum_id']);
1366  
1367              $sql = 'UPDATE ' . FORUMS_TABLE . '
1368                  SET ' . $db->sql_build_array('UPDATE', $forum_data_sql) . '
1369                  WHERE forum_id = ' . $forum_id;
1370              $db->sql_query($sql);
1371  
1372              // Add it back
1373              $forum_data_ary['forum_id'] = $forum_id;
1374  
1375              $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_FORUM_EDIT', false, array($forum_data_ary['forum_name']));
1376          }
1377  
1378          $forum_data = $forum_data_ary;
1379          /**
1380          * Event after a forum was updated or created
1381          *
1382          * @event core.acp_manage_forums_update_data_after
1383          * @var    array    forum_data        Array with forum data
1384          * @var    array    forum_data_sql    Array with data we updated
1385          * @var    bool    is_new_forum    Did we create a forum or update one
1386          *                                If you want to overwrite this value,
1387          *                                ensure to set forum_data_sql[forum_id]
1388          * @var    array    errors        Array of errors, should be strings and not
1389          *                            language key.
1390          * @since 3.1.0-a1
1391          */
1392          $vars = array('forum_data', 'forum_data_sql', 'is_new_forum', 'errors');
1393          extract($phpbb_dispatcher->trigger_event('core.acp_manage_forums_update_data_after', compact($vars)));
1394          $forum_data_ary = $forum_data;
1395          unset($forum_data);
1396  
1397          return $errors;
1398      }
1399  
1400      /**
1401      * Move forum
1402      */
1403  	function move_forum($from_id, $to_id)
1404      {
1405          global $db, $user, $phpbb_dispatcher;
1406  
1407          $errors = array();
1408  
1409          // Check if we want to move to a parent with link type
1410          if ($to_id > 0)
1411          {
1412              $to_data = $this->get_forum_info($to_id);
1413  
1414              if ($to_data['forum_type'] == FORUM_LINK)
1415              {
1416                  $errors[] = $user->lang['PARENT_IS_LINK_FORUM'];
1417              }
1418          }
1419  
1420          /**
1421          * Event when we move all children of one forum to another
1422          *
1423          * This event may be triggered, when a forum is deleted
1424          *
1425          * @event core.acp_manage_forums_move_children
1426          * @var    int        from_id        If of the current parent forum
1427          * @var    int        to_id        If of the new parent forum
1428          * @var    array    errors        Array of errors, should be strings and not
1429          *                            language key.
1430          * @since 3.1.0-a1
1431          */
1432          $vars = array('from_id', 'to_id', 'errors');
1433          extract($phpbb_dispatcher->trigger_event('core.acp_manage_forums_move_children', compact($vars)));
1434  
1435          // Return if there were errors
1436          if (!empty($errors))
1437          {
1438              return $errors;
1439          }
1440  
1441          $db->sql_transaction('begin');
1442  
1443          $moved_forums = get_forum_branch($from_id, 'children', 'descending');
1444          $from_data = $moved_forums[0];
1445          $diff = count($moved_forums) * 2;
1446  
1447          $moved_ids = array();
1448          for ($i = 0, $size = count($moved_forums); $i < $size; ++$i)
1449          {
1450              $moved_ids[] = $moved_forums[$i]['forum_id'];
1451          }
1452  
1453          // Resync parents
1454          $sql = 'UPDATE ' . FORUMS_TABLE . "
1455              SET right_id = right_id - $diff, forum_parents = ''
1456              WHERE left_id < " . $from_data['right_id'] . "
1457                  AND right_id > " . $from_data['right_id'];
1458          $db->sql_query($sql);
1459  
1460          // Resync righthand side of tree
1461          $sql = 'UPDATE ' . FORUMS_TABLE . "
1462              SET left_id = left_id - $diff, right_id = right_id - $diff, forum_parents = ''
1463              WHERE left_id > " . $from_data['right_id'];
1464          $db->sql_query($sql);
1465  
1466          if ($to_id > 0)
1467          {
1468              // Retrieve $to_data again, it may have been changed...
1469              $to_data = $this->get_forum_info($to_id);
1470  
1471              // Resync new parents
1472              $sql = 'UPDATE ' . FORUMS_TABLE . "
1473                  SET right_id = right_id + $diff, forum_parents = ''
1474                  WHERE " . $to_data['right_id'] . ' BETWEEN left_id AND right_id
1475                      AND ' . $db->sql_in_set('forum_id', $moved_ids, true);
1476              $db->sql_query($sql);
1477  
1478              // Resync the righthand side of the tree
1479              $sql = 'UPDATE ' . FORUMS_TABLE . "
1480                  SET left_id = left_id + $diff, right_id = right_id + $diff, forum_parents = ''
1481                  WHERE left_id > " . $to_data['right_id'] . '
1482                      AND ' . $db->sql_in_set('forum_id', $moved_ids, true);
1483              $db->sql_query($sql);
1484  
1485              // Resync moved branch
1486              $to_data['right_id'] += $diff;
1487  
1488              if ($to_data['right_id'] > $from_data['right_id'])
1489              {
1490                  $diff = '+ ' . ($to_data['right_id'] - $from_data['right_id'] - 1);
1491              }
1492              else
1493              {
1494                  $diff = '- ' . abs($to_data['right_id'] - $from_data['right_id'] - 1);
1495              }
1496          }
1497          else
1498          {
1499              $sql = 'SELECT MAX(right_id) AS right_id
1500                  FROM ' . FORUMS_TABLE . '
1501                  WHERE ' . $db->sql_in_set('forum_id', $moved_ids, true);
1502              $result = $db->sql_query($sql);
1503              $row = $db->sql_fetchrow($result);
1504              $db->sql_freeresult($result);
1505  
1506              $diff = '+ ' . ($row['right_id'] - $from_data['left_id'] + 1);
1507          }
1508  
1509          $sql = 'UPDATE ' . FORUMS_TABLE . "
1510              SET left_id = left_id $diff, right_id = right_id $diff, forum_parents = ''
1511              WHERE " . $db->sql_in_set('forum_id', $moved_ids);
1512          $db->sql_query($sql);
1513  
1514          $db->sql_transaction('commit');
1515  
1516          return $errors;
1517      }
1518  
1519      /**
1520      * Move forum content from one to another forum
1521      */
1522  	function move_forum_content($from_id, $to_id, $sync = true)
1523      {
1524          global $db, $phpbb_dispatcher;
1525  
1526          $errors = array();
1527  
1528          /**
1529          * Event when we move content from one forum to another
1530          *
1531          * @event core.acp_manage_forums_move_content
1532          * @var    int        from_id        If of the current parent forum
1533          * @var    int        to_id        If of the new parent forum
1534          * @var    bool    sync        Shall we sync the "to"-forum's data
1535          * @var    array    errors        Array of errors, should be strings and not
1536          *                            language key. If this array is not empty,
1537          *                            The content will not be moved.
1538          * @since 3.1.0-a1
1539          */
1540          $vars = array('from_id', 'to_id', 'sync', 'errors');
1541          extract($phpbb_dispatcher->trigger_event('core.acp_manage_forums_move_content', compact($vars)));
1542  
1543          // Return if there were errors
1544          if (!empty($errors))
1545          {
1546              return $errors;
1547          }
1548  
1549          $table_ary = array(LOG_TABLE, POSTS_TABLE, TOPICS_TABLE, DRAFTS_TABLE, TOPICS_TRACK_TABLE);
1550  
1551          /**
1552           * Perform additional actions before move forum content
1553           *
1554           * @event core.acp_manage_forums_move_content_sql_before
1555           * @var    array    table_ary    Array of tables from which forum_id will be updated
1556           * @since 3.2.4-RC1
1557           */
1558          $vars = array('table_ary');
1559          extract($phpbb_dispatcher->trigger_event('core.acp_manage_forums_move_content_sql_before', compact($vars)));
1560  
1561          foreach ($table_ary as $table)
1562          {
1563              $sql = "UPDATE $table
1564                  SET forum_id = $to_id
1565                  WHERE forum_id = $from_id";
1566              $db->sql_query($sql);
1567          }
1568          unset($table_ary);
1569  
1570          $table_ary = array(FORUMS_ACCESS_TABLE, FORUMS_TRACK_TABLE, FORUMS_WATCH_TABLE, MODERATOR_CACHE_TABLE);
1571  
1572          foreach ($table_ary as $table)
1573          {
1574              $sql = "DELETE FROM $table
1575                  WHERE forum_id = $from_id";
1576              $db->sql_query($sql);
1577          }
1578  
1579          if ($sync)
1580          {
1581              // Delete ghost topics that link back to the same forum then resync counters
1582              sync('topic_moved');
1583              sync('forum', 'forum_id', $to_id, false, true);
1584          }
1585  
1586          return array();
1587      }
1588  
1589      /**
1590      * Remove complete forum
1591      */
1592  	function delete_forum($forum_id, $action_posts = 'delete', $action_subforums = 'delete', $posts_to_id = 0, $subforums_to_id = 0)
1593      {
1594          global $db, $user, $cache, $phpbb_log;
1595  
1596          $forum_data = $this->get_forum_info($forum_id);
1597  
1598          $errors = array();
1599          $log_action_posts = $log_action_forums = $posts_to_name = $subforums_to_name = '';
1600          $forum_ids = array($forum_id);
1601  
1602          if ($action_posts == 'delete')
1603          {
1604              $log_action_posts = 'POSTS';
1605              $errors = array_merge($errors, $this->delete_forum_content($forum_id));
1606          }
1607          else if ($action_posts == 'move')
1608          {
1609              if (!$posts_to_id)
1610              {
1611                  $errors[] = $user->lang['NO_DESTINATION_FORUM'];
1612              }
1613              else
1614              {
1615                  $log_action_posts = 'MOVE_POSTS';
1616  
1617                  $sql = 'SELECT forum_name
1618                      FROM ' . FORUMS_TABLE . '
1619                      WHERE forum_id = ' . $posts_to_id;
1620                  $result = $db->sql_query($sql);
1621                  $row = $db->sql_fetchrow($result);
1622                  $db->sql_freeresult($result);
1623  
1624                  if (!$row)
1625                  {
1626                      $errors[] = $user->lang['NO_FORUM'];
1627                  }
1628                  else
1629                  {
1630                      $posts_to_name = $row['forum_name'];
1631                      $errors = array_merge($errors, $this->move_forum_content($forum_id, $posts_to_id));
1632                  }
1633              }
1634          }
1635  
1636          if (count($errors))
1637          {
1638              return $errors;
1639          }
1640  
1641          if ($action_subforums == 'delete')
1642          {
1643              $log_action_forums = 'FORUMS';
1644              $rows = get_forum_branch($forum_id, 'children', 'descending', false);
1645  
1646              foreach ($rows as $row)
1647              {
1648                  $forum_ids[] = $row['forum_id'];
1649                  $errors = array_merge($errors, $this->delete_forum_content($row['forum_id']));
1650              }
1651  
1652              if (count($errors))
1653              {
1654                  return $errors;
1655              }
1656  
1657              $diff = count($forum_ids) * 2;
1658  
1659              $sql = 'DELETE FROM ' . FORUMS_TABLE . '
1660                  WHERE ' . $db->sql_in_set('forum_id', $forum_ids);
1661              $db->sql_query($sql);
1662  
1663              $sql = 'DELETE FROM ' . ACL_GROUPS_TABLE . '
1664                  WHERE ' . $db->sql_in_set('forum_id', $forum_ids);
1665              $db->sql_query($sql);
1666  
1667              $sql = 'DELETE FROM ' . ACL_USERS_TABLE . '
1668                  WHERE ' . $db->sql_in_set('forum_id', $forum_ids);
1669              $db->sql_query($sql);
1670          }
1671          else if ($action_subforums == 'move')
1672          {
1673              if (!$subforums_to_id)
1674              {
1675                  $errors[] = $user->lang['NO_DESTINATION_FORUM'];
1676              }
1677              else
1678              {
1679                  $log_action_forums = 'MOVE_FORUMS';
1680  
1681                  $sql = 'SELECT forum_name
1682                      FROM ' . FORUMS_TABLE . '
1683                      WHERE forum_id = ' . $subforums_to_id;
1684                  $result = $db->sql_query($sql);
1685                  $row = $db->sql_fetchrow($result);
1686                  $db->sql_freeresult($result);
1687  
1688                  if (!$row)
1689                  {
1690                      $errors[] = $user->lang['NO_FORUM'];
1691                  }
1692                  else
1693                  {
1694                      $subforums_to_name = $row['forum_name'];
1695  
1696                      $sql = 'SELECT forum_id
1697                          FROM ' . FORUMS_TABLE . "
1698                          WHERE parent_id = $forum_id";
1699                      $result = $db->sql_query($sql);
1700  
1701                      while ($row = $db->sql_fetchrow($result))
1702                      {
1703                          $this->move_forum($row['forum_id'], $subforums_to_id);
1704                      }
1705                      $db->sql_freeresult($result);
1706  
1707                      // Grab new forum data for correct tree updating later
1708                      $forum_data = $this->get_forum_info($forum_id);
1709  
1710                      $sql = 'UPDATE ' . FORUMS_TABLE . "
1711                          SET parent_id = $subforums_to_id
1712                          WHERE parent_id = $forum_id";
1713                      $db->sql_query($sql);
1714  
1715                      $diff = 2;
1716                      $sql = 'DELETE FROM ' . FORUMS_TABLE . "
1717                          WHERE forum_id = $forum_id";
1718                      $db->sql_query($sql);
1719  
1720                      $sql = 'DELETE FROM ' . ACL_GROUPS_TABLE . "
1721                          WHERE forum_id = $forum_id";
1722                      $db->sql_query($sql);
1723  
1724                      $sql = 'DELETE FROM ' . ACL_USERS_TABLE . "
1725                          WHERE forum_id = $forum_id";
1726                      $db->sql_query($sql);
1727                  }
1728              }
1729  
1730              if (count($errors))
1731              {
1732                  return $errors;
1733              }
1734          }
1735          else
1736          {
1737              $diff = 2;
1738              $sql = 'DELETE FROM ' . FORUMS_TABLE . "
1739                  WHERE forum_id = $forum_id";
1740              $db->sql_query($sql);
1741  
1742              $sql = 'DELETE FROM ' . ACL_GROUPS_TABLE . "
1743                  WHERE forum_id = $forum_id";
1744              $db->sql_query($sql);
1745  
1746              $sql = 'DELETE FROM ' . ACL_USERS_TABLE . "
1747                  WHERE forum_id = $forum_id";
1748              $db->sql_query($sql);
1749          }
1750  
1751          // Resync tree
1752          $sql = 'UPDATE ' . FORUMS_TABLE . "
1753              SET right_id = right_id - $diff
1754              WHERE left_id < {$forum_data['right_id']} AND right_id > {$forum_data['right_id']}";
1755          $db->sql_query($sql);
1756  
1757          $sql = 'UPDATE ' . FORUMS_TABLE . "
1758              SET left_id = left_id - $diff, right_id = right_id - $diff
1759              WHERE left_id > {$forum_data['right_id']}";
1760          $db->sql_query($sql);
1761  
1762          // Delete forum ids from extension groups table
1763          $sql = 'SELECT group_id, allowed_forums
1764              FROM ' . EXTENSION_GROUPS_TABLE;
1765          $result = $db->sql_query($sql);
1766  
1767          while ($row = $db->sql_fetchrow($result))
1768          {
1769              if (!$row['allowed_forums'])
1770              {
1771                  continue;
1772              }
1773  
1774              $allowed_forums = unserialize(trim($row['allowed_forums']));
1775              $allowed_forums = array_diff($allowed_forums, $forum_ids);
1776  
1777              $sql = 'UPDATE ' . EXTENSION_GROUPS_TABLE . "
1778                  SET allowed_forums = '" . ((count($allowed_forums)) ? serialize($allowed_forums) : '') . "'
1779                  WHERE group_id = {$row['group_id']}";
1780              $db->sql_query($sql);
1781          }
1782          $db->sql_freeresult($result);
1783  
1784          $cache->destroy('_extensions');
1785  
1786          $log_action = implode('_', array($log_action_posts, $log_action_forums));
1787  
1788          switch ($log_action)
1789          {
1790              case 'MOVE_POSTS_MOVE_FORUMS':
1791                  $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_FORUM_DEL_MOVE_POSTS_MOVE_FORUMS', false, array($posts_to_name, $subforums_to_name, $forum_data['forum_name']));
1792              break;
1793  
1794              case 'MOVE_POSTS_FORUMS':
1795                  $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_FORUM_DEL_MOVE_POSTS_FORUMS', false, array($posts_to_name, $forum_data['forum_name']));
1796              break;
1797  
1798              case 'POSTS_MOVE_FORUMS':
1799                  $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_FORUM_DEL_POSTS_MOVE_FORUMS', false, array($subforums_to_name, $forum_data['forum_name']));
1800              break;
1801  
1802              case '_MOVE_FORUMS':
1803                  $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_FORUM_DEL_MOVE_FORUMS', false, array($subforums_to_name, $forum_data['forum_name']));
1804              break;
1805  
1806              case 'MOVE_POSTS_':
1807                  $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_FORUM_DEL_MOVE_POSTS', false, array($posts_to_name, $forum_data['forum_name']));
1808              break;
1809  
1810              case 'POSTS_FORUMS':
1811                  $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_FORUM_DEL_POSTS_FORUMS', false, array($forum_data['forum_name']));
1812              break;
1813  
1814              case '_FORUMS':
1815                  $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_FORUM_DEL_FORUMS', false, array($forum_data['forum_name']));
1816              break;
1817  
1818              case 'POSTS_':
1819                  $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_FORUM_DEL_POSTS', false, array($forum_data['forum_name']));
1820              break;
1821  
1822              default:
1823                  $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_FORUM_DEL_FORUM', false, array($forum_data['forum_name']));
1824              break;
1825          }
1826  
1827          return $errors;
1828      }
1829  
1830      /**
1831      * Delete forum content
1832      */
1833  	function delete_forum_content($forum_id)
1834      {
1835          global $db, $config, $phpbb_root_path, $phpEx, $phpbb_container, $phpbb_dispatcher;
1836  
1837          include_once($phpbb_root_path . 'includes/functions_posting.' . $phpEx);
1838  
1839          $db->sql_transaction('begin');
1840  
1841          // Select then delete all attachments
1842          $sql = 'SELECT a.topic_id
1843              FROM ' . POSTS_TABLE . ' p, ' . ATTACHMENTS_TABLE . " a
1844              WHERE p.forum_id = $forum_id
1845                  AND a.in_message = 0
1846                  AND a.topic_id = p.topic_id";
1847          $result = $db->sql_query($sql);
1848  
1849          $topic_ids = array();
1850          while ($row = $db->sql_fetchrow($result))
1851          {
1852              $topic_ids[] = $row['topic_id'];
1853          }
1854          $db->sql_freeresult($result);
1855  
1856          /** @var \phpbb\attachment\manager $attachment_manager */
1857          $attachment_manager = $phpbb_container->get('attachment.manager');
1858          $attachment_manager->delete('topic', $topic_ids, false);
1859          unset($attachment_manager);
1860  
1861          // Delete shadow topics pointing to topics in this forum
1862          delete_topic_shadows($forum_id);
1863  
1864          // Before we remove anything we make sure we are able to adjust the post counts later. ;)
1865          $sql = 'SELECT poster_id
1866              FROM ' . POSTS_TABLE . '
1867              WHERE forum_id = ' . $forum_id . '
1868                  AND post_postcount = 1
1869                  AND post_visibility = ' . ITEM_APPROVED;
1870          $result = $db->sql_query($sql);
1871  
1872          $post_counts = array();
1873          while ($row = $db->sql_fetchrow($result))
1874          {
1875              $post_counts[$row['poster_id']] = (!empty($post_counts[$row['poster_id']])) ? $post_counts[$row['poster_id']] + 1 : 1;
1876          }
1877          $db->sql_freeresult($result);
1878  
1879          switch ($db->get_sql_layer())
1880          {
1881              case 'mysql4':
1882              case 'mysqli':
1883  
1884                  // Delete everything else and thank MySQL for offering multi-table deletion
1885                  $tables_ary = array(
1886                      SEARCH_WORDMATCH_TABLE    => 'post_id',
1887                      REPORTS_TABLE            => 'post_id',
1888                      WARNINGS_TABLE            => 'post_id',
1889                      BOOKMARKS_TABLE            => 'topic_id',
1890                      TOPICS_WATCH_TABLE        => 'topic_id',
1891                      TOPICS_POSTED_TABLE        => 'topic_id',
1892                      POLL_OPTIONS_TABLE        => 'topic_id',
1893                      POLL_VOTES_TABLE        => 'topic_id',
1894                  );
1895  
1896                  $sql = 'DELETE ' . POSTS_TABLE;
1897                  $sql_using = "\nFROM " . POSTS_TABLE;
1898                  $sql_where = "\nWHERE " . POSTS_TABLE . ".forum_id = $forum_id\n";
1899  
1900                  foreach ($tables_ary as $table => $field)
1901                  {
1902                      $sql .= ", $table ";
1903                      $sql_using .= ", $table ";
1904                      $sql_where .= "\nAND $table.$field = " . POSTS_TABLE . ".$field";
1905                  }
1906  
1907                  $db->sql_query($sql . $sql_using . $sql_where);
1908  
1909              break;
1910  
1911              default:
1912  
1913                  // Delete everything else and curse your DB for not offering multi-table deletion
1914                  $tables_ary = array(
1915                      'post_id'    =>    array(
1916                          SEARCH_WORDMATCH_TABLE,
1917                          REPORTS_TABLE,
1918                          WARNINGS_TABLE,
1919                      ),
1920  
1921                      'topic_id'    =>    array(
1922                          BOOKMARKS_TABLE,
1923                          TOPICS_WATCH_TABLE,
1924                          TOPICS_POSTED_TABLE,
1925                          POLL_OPTIONS_TABLE,
1926                          POLL_VOTES_TABLE,
1927                      )
1928                  );
1929  
1930                  // Amount of rows we select and delete in one iteration.
1931                  $batch_size = 500;
1932  
1933                  foreach ($tables_ary as $field => $tables)
1934                  {
1935                      $start = 0;
1936  
1937                      do
1938                      {
1939                          $sql = "SELECT $field
1940                              FROM " . POSTS_TABLE . '
1941                              WHERE forum_id = ' . $forum_id;
1942                          $result = $db->sql_query_limit($sql, $batch_size, $start);
1943  
1944                          $ids = array();
1945                          while ($row = $db->sql_fetchrow($result))
1946                          {
1947                              $ids[] = $row[$field];
1948                          }
1949                          $db->sql_freeresult($result);
1950  
1951                          if (count($ids))
1952                          {
1953                              $start += count($ids);
1954  
1955                              foreach ($tables as $table)
1956                              {
1957                                  $db->sql_query("DELETE FROM $table WHERE " . $db->sql_in_set($field, $ids));
1958                              }
1959                          }
1960                      }
1961                      while (count($ids) == $batch_size);
1962                  }
1963                  unset($ids);
1964  
1965              break;
1966          }
1967  
1968          $table_ary = array(FORUMS_ACCESS_TABLE, FORUMS_TRACK_TABLE, FORUMS_WATCH_TABLE, LOG_TABLE, MODERATOR_CACHE_TABLE, POSTS_TABLE, TOPICS_TABLE, TOPICS_TRACK_TABLE);
1969  
1970          /**
1971           * Perform additional actions before forum content deletion
1972           *
1973           * @event core.delete_forum_content_before_query
1974           * @var    array    table_ary    Array of tables from which all rows will be deleted that hold the forum_id
1975           * @var    int        forum_id    the forum id
1976           * @var    array    topic_ids    Array of the topic ids from the forum to be deleted
1977           * @var    array    post_counts    Array of counts of posts in the forum, by poster_id
1978           * @since 3.1.6-RC1
1979           */
1980          $vars = array(
1981                  'table_ary',
1982                  'forum_id',
1983                  'topic_ids',
1984                  'post_counts',
1985          );
1986          extract($phpbb_dispatcher->trigger_event('core.delete_forum_content_before_query', compact($vars)));
1987  
1988          foreach ($table_ary as $table)
1989          {
1990              $db->sql_query("DELETE FROM $table WHERE forum_id = $forum_id");
1991          }
1992  
1993          // Set forum ids to 0
1994          $table_ary = array(DRAFTS_TABLE);
1995  
1996          foreach ($table_ary as $table)
1997          {
1998              $db->sql_query("UPDATE $table SET forum_id = 0 WHERE forum_id = $forum_id");
1999          }
2000  
2001          // Adjust users post counts
2002          if (count($post_counts))
2003          {
2004              foreach ($post_counts as $poster_id => $substract)
2005              {
2006                  $sql = 'UPDATE ' . USERS_TABLE . '
2007                      SET user_posts = 0
2008                      WHERE user_id = ' . $poster_id . '
2009                      AND user_posts < ' . $substract;
2010                  $db->sql_query($sql);
2011  
2012                  $sql = 'UPDATE ' . USERS_TABLE . '
2013                      SET user_posts = user_posts - ' . $substract . '
2014                      WHERE user_id = ' . $poster_id . '
2015                      AND user_posts >= ' . $substract;
2016                  $db->sql_query($sql);
2017              }
2018          }
2019  
2020          $db->sql_transaction('commit');
2021  
2022          // Make sure the overall post/topic count is correct...
2023          $sql = 'SELECT COUNT(post_id) AS stat
2024              FROM ' . POSTS_TABLE . '
2025              WHERE post_visibility = ' . ITEM_APPROVED;
2026          $result = $db->sql_query($sql);
2027          $row = $db->sql_fetchrow($result);
2028          $db->sql_freeresult($result);
2029  
2030          $config->set('num_posts', (int) $row['stat'], false);
2031  
2032          $sql = 'SELECT COUNT(topic_id) AS stat
2033              FROM ' . TOPICS_TABLE . '
2034              WHERE topic_visibility = ' . ITEM_APPROVED;
2035          $result = $db->sql_query($sql);
2036          $row = $db->sql_fetchrow($result);
2037          $db->sql_freeresult($result);
2038  
2039          $config->set('num_topics', (int) $row['stat'], false);
2040  
2041          $sql = 'SELECT COUNT(attach_id) as stat
2042              FROM ' . ATTACHMENTS_TABLE;
2043          $result = $db->sql_query($sql);
2044          $row = $db->sql_fetchrow($result);
2045          $db->sql_freeresult($result);
2046  
2047          $config->set('num_files', (int) $row['stat'], false);
2048  
2049          $sql = 'SELECT SUM(filesize) as stat
2050              FROM ' . ATTACHMENTS_TABLE;
2051          $result = $db->sql_query($sql);
2052          $row = $db->sql_fetchrow($result);
2053          $db->sql_freeresult($result);
2054  
2055          $config->set('upload_dir_size', (float) $row['stat'], false);
2056  
2057          return array();
2058      }
2059  
2060      /**
2061      * Move forum position by $steps up/down
2062      */
2063  	function move_forum_by($forum_row, $action = 'move_up', $steps = 1)
2064      {
2065          global $db;
2066  
2067          /**
2068          * Fetch all the siblings between the module's current spot
2069          * and where we want to move it to. If there are less than $steps
2070          * siblings between the current spot and the target then the
2071          * module will move as far as possible
2072          */
2073          $sql = 'SELECT forum_id, forum_name, left_id, right_id
2074              FROM ' . FORUMS_TABLE . "
2075              WHERE parent_id = {$forum_row['parent_id']}
2076                  AND " . (($action == 'move_up') ? "right_id < {$forum_row['right_id']} ORDER BY right_id DESC" : "left_id > {$forum_row['left_id']} ORDER BY left_id ASC");
2077          $result = $db->sql_query_limit($sql, $steps);
2078  
2079          $target = array();
2080          while ($row = $db->sql_fetchrow($result))
2081          {
2082              $target = $row;
2083          }
2084          $db->sql_freeresult($result);
2085  
2086          if (!count($target))
2087          {
2088              // The forum is already on top or bottom
2089              return false;
2090          }
2091  
2092          /**
2093          * $left_id and $right_id define the scope of the nodes that are affected by the move.
2094          * $diff_up and $diff_down are the values to substract or add to each node's left_id
2095          * and right_id in order to move them up or down.
2096          * $move_up_left and $move_up_right define the scope of the nodes that are moving
2097          * up. Other nodes in the scope of ($left_id, $right_id) are considered to move down.
2098          */
2099          if ($action == 'move_up')
2100          {
2101              $left_id = $target['left_id'];
2102              $right_id = $forum_row['right_id'];
2103  
2104              $diff_up = $forum_row['left_id'] - $target['left_id'];
2105              $diff_down = $forum_row['right_id'] + 1 - $forum_row['left_id'];
2106  
2107              $move_up_left = $forum_row['left_id'];
2108              $move_up_right = $forum_row['right_id'];
2109          }
2110          else
2111          {
2112              $left_id = $forum_row['left_id'];
2113              $right_id = $target['right_id'];
2114  
2115              $diff_up = $forum_row['right_id'] + 1 - $forum_row['left_id'];
2116              $diff_down = $target['right_id'] - $forum_row['right_id'];
2117  
2118              $move_up_left = $forum_row['right_id'] + 1;
2119              $move_up_right = $target['right_id'];
2120          }
2121  
2122          // Now do the dirty job
2123          $sql = 'UPDATE ' . FORUMS_TABLE . "
2124              SET left_id = left_id + CASE
2125                  WHEN left_id BETWEEN {$move_up_left} AND {$move_up_right} THEN -{$diff_up}
2126                  ELSE {$diff_down}
2127              END,
2128              right_id = right_id + CASE
2129                  WHEN right_id BETWEEN {$move_up_left} AND {$move_up_right} THEN -{$diff_up}
2130                  ELSE {$diff_down}
2131              END,
2132              forum_parents = ''
2133              WHERE
2134                  left_id BETWEEN {$left_id} AND {$right_id}
2135                  AND right_id BETWEEN {$left_id} AND {$right_id}";
2136          $db->sql_query($sql);
2137  
2138          return $target['forum_name'];
2139      }
2140  
2141      /**
2142      * Display progress bar for syncinc forums
2143      */
2144  	function display_progress_bar($start, $total)
2145      {
2146          global $template, $user;
2147  
2148          adm_page_header($user->lang['SYNC_IN_PROGRESS']);
2149  
2150          $template->set_filenames(array(
2151              'body'    => 'progress_bar.html')
2152          );
2153  
2154          $template->assign_vars(array(
2155              'L_PROGRESS'            => $user->lang['SYNC_IN_PROGRESS'],
2156              'L_PROGRESS_EXPLAIN'    => ($start && $total) ? sprintf($user->lang['SYNC_IN_PROGRESS_EXPLAIN'], $start, $total) : $user->lang['SYNC_IN_PROGRESS'])
2157          );
2158  
2159          adm_page_footer();
2160      }
2161  
2162      /**
2163      * Display copy permission page
2164      * Not used at the moment - we will have a look at it for 3.0.7
2165      */
2166  	function copy_permission_page($forum_data)
2167      {
2168          global $phpEx, $phpbb_admin_path, $template, $user;
2169  
2170          $acl_url = '&amp;mode=setting_forum_local&amp;forum_id[]=' . $forum_data['forum_id'];
2171          $action = append_sid($this->u_action . "&amp;parent_id={$this->parent_id}&amp;f={$forum_data['forum_id']}&amp;action=copy_perm");
2172  
2173          $l_acl = sprintf($user->lang['COPY_TO_ACL'], '<a href="' . append_sid("{$phpbb_admin_path}index.$phpEx", 'i=permissions' . $acl_url) . '">', '</a>');
2174  
2175          $this->tpl_name = 'acp_forums_copy_perm';
2176  
2177          $template->assign_vars(array(
2178              'U_ACL'                => append_sid("{$phpbb_admin_path}index.$phpEx", 'i=permissions' . $acl_url),
2179              'L_ACL_LINK'        => $l_acl,
2180              'L_BACK_LINK'        => adm_back_link($this->u_action . '&amp;parent_id=' . $this->parent_id),
2181              'S_COPY_ACTION'        => $action,
2182              'S_FORUM_OPTIONS'    => make_forum_select($forum_data['parent_id'], $forum_data['forum_id'], false, false, false),
2183          ));
2184      }
2185  
2186  }


Generated: Tue Apr 7 19:42:26 2020 Cross-referenced by PHPXref 0.7.1