Verzeichnisstruktur phpBB-3.3.16


Veröffentlicht
27.04.2026

So funktioniert es


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

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

      (Beispiel Datei-Icons)

Auf das Icon klicken um den Quellcode anzuzeigen

ucp_main.php

Zuletzt modifiziert: 01.05.2026, 11:25 - Dateigröße: 38.13 KiB


 0001  <?php
 0002  /**
 0003  *
 0004  * This file is part of the phpBB Forum Software package.
 0005  *
 0006  * @copyright (c) phpBB Limited <https://www.phpbb.com>
 0007  * @license GNU General Public License, version 2 (GPL-2.0)
 0008  *
 0009  * For full copyright and license information, please see
 0010  * the docs/CREDITS.txt file.
 0011  *
 0012  */
 0013   
 0014  /**
 0015  * @ignore
 0016  */
 0017  if (!defined('IN_PHPBB'))
 0018  {
 0019      exit;
 0020  }
 0021   
 0022  /**
 0023  * ucp_main
 0024  * UCP Front Panel
 0025  */
 0026  class ucp_main
 0027  {
 0028      var $p_master;
 0029      var $u_action;
 0030   
 0031      function __construct($p_master)
 0032      {
 0033          $this->p_master = $p_master;
 0034      }
 0035   
 0036      function main($id, $mode)
 0037      {
 0038          global $config, $db, $user, $auth, $template, $phpbb_root_path, $phpEx, $phpbb_dispatcher, $cache;
 0039          global $request, $phpbb_container, $language;
 0040   
 0041          /* @var $pagination \phpbb\pagination */
 0042          $pagination = $phpbb_container->get('pagination');
 0043   
 0044          /* @var $phpbb_content_visibility \phpbb\content_visibility */
 0045          $phpbb_content_visibility = $phpbb_container->get('content.visibility');
 0046   
 0047          switch ($mode)
 0048          {
 0049              case 'front':
 0050   
 0051                  $user->add_lang('memberlist');
 0052   
 0053                  $sql_from = TOPICS_TABLE . ' t LEFT JOIN ' . FORUMS_TABLE . ' f ON (f.forum_id = t.forum_id) ';
 0054                  $sql_select = ', f.enable_icons';
 0055   
 0056                  if ($config['load_db_track'])
 0057                  {
 0058                      $sql_from .= ' LEFT JOIN ' . TOPICS_POSTED_TABLE . ' tp ON (tp.topic_id = t.topic_id
 0059                          AND tp.user_id = ' . $user->data['user_id'] . ')';
 0060                      $sql_select .= ', tp.topic_posted';
 0061                  }
 0062   
 0063                  if ($config['load_db_lastread'])
 0064                  {
 0065                      $sql_from .= ' LEFT JOIN ' . TOPICS_TRACK_TABLE . ' tt ON (tt.topic_id = t.topic_id
 0066                          AND tt.user_id = ' . $user->data['user_id'] . ')';
 0067                      $sql_select .= ', tt.mark_time';
 0068   
 0069                      $sql_from .= ' LEFT JOIN ' . FORUMS_TRACK_TABLE . ' ft ON (ft.forum_id = t.forum_id
 0070                          AND ft.user_id = ' . $user->data['user_id'] . ')';
 0071                      $sql_select .= ', ft.mark_time AS forum_mark_time';
 0072                  }
 0073   
 0074                  $topic_type = $user->lang['VIEW_TOPIC_GLOBAL'];
 0075                  $folder = 'global_read';
 0076                  $folder_new = 'global_unread';
 0077   
 0078                  // Get cleaned up list... return only those forums having the f_read permission
 0079                  $forum_ary = $auth->acl_getf('f_read', true);
 0080                  $forum_ary = array_unique(array_keys($forum_ary));
 0081                  $topic_list = $rowset = array();
 0082   
 0083                  // If the user can't see any forums, he can't read any posts because fid of 0 is invalid
 0084                  if (!empty($forum_ary))
 0085                  {
 0086                      /**
 0087                       * Modify sql variables before query is processed
 0088                       *
 0089                       * @event core.ucp_main_front_modify_sql
 0090                       * @var string    sql_select    SQL select
 0091                       * @var string  sql_from    SQL from
 0092                       * @var array   forum_ary    Forum array
 0093                       * @since 3.2.4-RC1
 0094                       */
 0095                      $vars = array(
 0096                          'sql_select',
 0097                          'sql_from',
 0098                          'forum_ary',
 0099                      );
 0100                      extract($phpbb_dispatcher->trigger_event('core.ucp_main_front_modify_sql', compact($vars)));
 0101   
 0102                      $sql = "SELECT t.* $sql_select
 0103                          FROM $sql_from
 0104                          WHERE t.topic_type = " . POST_GLOBAL . '
 0105                              AND ' . $db->sql_in_set('t.forum_id', $forum_ary) . '
 0106                          ORDER BY t.topic_last_post_time DESC, t.topic_last_post_id DESC';
 0107                      $result = $db->sql_query($sql);
 0108   
 0109                      while ($row = $db->sql_fetchrow($result))
 0110                      {
 0111                          $topic_list[] = $row['topic_id'];
 0112                          $rowset[$row['topic_id']] = $row;
 0113                      }
 0114                      $db->sql_freeresult($result);
 0115                  }
 0116   
 0117                  $topic_forum_list = array();
 0118                  foreach ($rowset as $t_id => $row)
 0119                  {
 0120                      if (isset($forum_tracking_info[$row['forum_id']]))
 0121                      {
 0122                          $row['forum_mark_time'] = $forum_tracking_info[$row['forum_id']];
 0123                      }
 0124   
 0125                      $topic_forum_list[$row['forum_id']]['forum_mark_time'] = ($config['load_db_lastread'] && $user->data['is_registered'] && isset($row['forum_mark_time'])) ? $row['forum_mark_time'] : 0;
 0126                      $topic_forum_list[$row['forum_id']]['topics'][] = (int) $t_id;
 0127                  }
 0128   
 0129                  $topic_tracking_info = $tracking_topics = array();
 0130                  if ($config['load_db_lastread'])
 0131                  {
 0132                      foreach ($topic_forum_list as $f_id => $topic_row)
 0133                      {
 0134                          $topic_tracking_info += get_topic_tracking($f_id, $topic_row['topics'], $rowset, array($f_id => $topic_row['forum_mark_time']));
 0135                      }
 0136                  }
 0137                  else
 0138                  {
 0139                      foreach ($topic_forum_list as $f_id => $topic_row)
 0140                      {
 0141                          $topic_tracking_info += get_complete_topic_tracking($f_id, $topic_row['topics']);
 0142                      }
 0143                  }
 0144                  unset($topic_forum_list);
 0145   
 0146                  // Grab icons
 0147                  $icons = $cache->obtain_icons();
 0148   
 0149                  foreach ($topic_list as $topic_id)
 0150                  {
 0151                      $row = &$rowset[$topic_id];
 0152   
 0153                      $forum_id = $row['forum_id'];
 0154                      $topic_id = $row['topic_id'];
 0155   
 0156                      $unread_topic = (isset($topic_tracking_info[$topic_id]) && $row['topic_last_post_time'] > $topic_tracking_info[$topic_id]) ? true : false;
 0157   
 0158                      $folder_img = ($unread_topic) ? $folder_new : $folder;
 0159                      $folder_alt = ($unread_topic) ? 'UNREAD_POSTS' : (($row['topic_status'] == ITEM_LOCKED) ? 'TOPIC_LOCKED' : 'NO_UNREAD_POSTS');
 0160   
 0161                      // Replies
 0162                      $replies = $phpbb_content_visibility->get_count('topic_posts', $row, $forum_id) - 1;
 0163   
 0164                      if ($row['topic_status'] == ITEM_LOCKED)
 0165                      {
 0166                          $folder_img .= '_locked';
 0167                      }
 0168   
 0169                      // Posted image?
 0170                      if (!empty($row['topic_posted']) && $row['topic_posted'])
 0171                      {
 0172                          $folder_img .= '_mine';
 0173                      }
 0174   
 0175                      $topicrow = array(
 0176                          'FORUM_ID'                    => $forum_id,
 0177                          'TOPIC_ID'                    => $topic_id,
 0178                          'TOPIC_AUTHOR'                => get_username_string('username', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']),
 0179                          'TOPIC_AUTHOR_COLOUR'        => get_username_string('colour', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']),
 0180                          'TOPIC_AUTHOR_FULL'            => get_username_string('full', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']),
 0181                          'FIRST_POST_TIME'            => $user->format_date($row['topic_time']),
 0182                          'LAST_POST_SUBJECT'            => censor_text($row['topic_last_post_subject']),
 0183                          'LAST_POST_TIME'            => $user->format_date($row['topic_last_post_time']),
 0184                          'LAST_VIEW_TIME'            => $user->format_date($row['topic_last_view_time']),
 0185                          'LAST_POST_AUTHOR'            => get_username_string('username', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']),
 0186                          'LAST_POST_AUTHOR_COLOUR'    => get_username_string('colour', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']),
 0187                          'LAST_POST_AUTHOR_FULL'        => get_username_string('full', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']),
 0188                          'TOPIC_TITLE'                => censor_text($row['topic_title']),
 0189                          'TOPIC_TYPE'                => $topic_type,
 0190   
 0191                          'TOPIC_ICON_IMG'        => !empty($icons[$row['icon_id']]) ? $icons[$row['icon_id']]['img'] : '',
 0192                          'TOPIC_ICON_IMG_WIDTH'    => !empty($icons[$row['icon_id']]) ? $icons[$row['icon_id']]['width'] : '',
 0193                          'TOPIC_ICON_IMG_HEIGHT'    => !empty($icons[$row['icon_id']]) ? $icons[$row['icon_id']]['height'] : '',
 0194                          'TOPIC_IMG_STYLE'        => $folder_img,
 0195                          'TOPIC_FOLDER_IMG'        => $user->img($folder_img, $folder_alt),
 0196                          'ATTACH_ICON_IMG'        => ($auth->acl_get('u_download') && $auth->acl_get('f_download', $forum_id) && $row['topic_attachment']) ? $user->img('icon_topic_attach', '') : '',
 0197   
 0198                          'S_TOPIC_ICONS'        => $row['enable_icons'] ? true : false,
 0199                          'S_USER_POSTED'        => (!empty($row['topic_posted']) && $row['topic_posted']) ? true : false,
 0200                          'S_UNREAD'            => $unread_topic,
 0201   
 0202                          'U_TOPIC_AUTHOR'        => get_username_string('profile', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']),
 0203                          'U_LAST_POST'            => append_sid("{$phpbb_root_path}viewtopic.$phpEx", "p=" . $row['topic_last_post_id']) . '#p' . $row['topic_last_post_id'],
 0204                          'U_LAST_POST_AUTHOR'    => get_username_string('profile', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']),
 0205                          'U_NEWEST_POST'            => append_sid("{$phpbb_root_path}viewtopic.$phpEx", "t=$topic_id&amp;view=unread") . '#unread',
 0206                          'U_VIEW_TOPIC'            => append_sid("{$phpbb_root_path}viewtopic.$phpEx", "t=$topic_id"),
 0207                      );
 0208   
 0209                      /**
 0210                       * Add template variables to a front topics row.
 0211                       *
 0212                       * @event core.ucp_main_front_modify_template_vars
 0213                       * @var array    topicrow        Array containing the template variables for the row
 0214                       * @var array   row                Array containing the subscribed forum row data
 0215                       * @var int     forum_id        Forum ID
 0216                       * @var string  folder_img        Folder image
 0217                       * @var string  folder_alt      Alt text for the folder image
 0218                       * @since 3.2.4-RC1
 0219                       */
 0220                      $vars = array(
 0221                          'topicrow',
 0222                          'row',
 0223                          'forum_id',
 0224                          'folder_img',
 0225                          'folder_alt',
 0226                      );
 0227                      extract($phpbb_dispatcher->trigger_event('core.ucp_main_front_modify_template_vars', compact($vars)));
 0228   
 0229                      $template->assign_block_vars('topicrow', $topicrow);
 0230   
 0231                      $pagination->generate_template_pagination(append_sid("{$phpbb_root_path}viewtopic.$phpEx", "t=$topic_id"), 'topicrow.pagination', 'start', $replies + 1, $config['posts_per_page'], 1, true, true);
 0232                  }
 0233   
 0234                  if ($config['load_user_activity'])
 0235                  {
 0236                      if (!function_exists('display_user_activity'))
 0237                      {
 0238                          include_once($phpbb_root_path . 'includes/functions_display.' . $phpEx);
 0239                      }
 0240                      display_user_activity($user->data);
 0241                  }
 0242   
 0243                  // Do the relevant calculations
 0244                  $memberdays = max(1, round((time() - $user->data['user_regdate']) / 86400));
 0245                  $posts_per_day = $user->data['user_posts'] / $memberdays;
 0246                  $percentage = ($config['num_posts']) ? min(100, ($user->data['user_posts'] / $config['num_posts']) * 100) : 0;
 0247   
 0248                  $template->assign_vars(array(
 0249                      'USER_COLOR'        => (!empty($user->data['user_colour'])) ? $user->data['user_colour'] : '',
 0250                      'JOINED'            => $user->format_date($user->data['user_regdate']),
 0251                      'LAST_ACTIVE'            => (empty($last_active)) ? ' - ' : $user->format_date($last_active),
 0252                      'WARNINGS'            => ($user->data['user_warnings']) ? $user->data['user_warnings'] : 0,
 0253                      'POSTS'                => ($user->data['user_posts']) ? $user->data['user_posts'] : 0,
 0254                      'POSTS_DAY'            => $user->lang('POST_DAY', $posts_per_day),
 0255                      'POSTS_PCT'            => $user->lang('POST_PCT', $percentage),
 0256   
 0257  //                    'S_GROUP_OPTIONS'    => $group_options,
 0258   
 0259                      'U_SEARCH_USER'        => ($auth->acl_get('u_search')) ? append_sid("{$phpbb_root_path}search.$phpEx", 'author_id=' . $user->data['user_id'] . '&amp;sr=posts') : '',
 0260                  ));
 0261   
 0262              break;
 0263   
 0264              case 'subscribed':
 0265   
 0266                  if (!function_exists('topic_status'))
 0267                  {
 0268                      include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
 0269                  }
 0270   
 0271                  $user->add_lang('viewforum');
 0272   
 0273                  add_form_key('ucp_front_subscribed');
 0274   
 0275                  $unwatch = (isset($_POST['unwatch'])) ? true : false;
 0276   
 0277                  /**
 0278                   * Read and potentially modify the post data used to remove subscriptions to forums/topics
 0279                   *
 0280                   * @event core.ucp_main_subscribed_post_data
 0281                   * @since 3.1.10-RC1
 0282                   */
 0283                  $phpbb_dispatcher->dispatch('core.ucp_main_subscribed_post_data');
 0284   
 0285                  if ($unwatch)
 0286                  {
 0287                      if (check_form_key('ucp_front_subscribed'))
 0288                      {
 0289                          $forums = array_keys($request->variable('f', array(0 => 0)));
 0290                          $topics = array_keys($request->variable('t', array(0 => 0)));
 0291   
 0292                          if (count($forums) || count($topics))
 0293                          {
 0294                              $l_unwatch = '';
 0295                              if (count($forums))
 0296                              {
 0297                                  $sql = 'DELETE FROM ' . FORUMS_WATCH_TABLE . '
 0298                                      WHERE ' . $db->sql_in_set('forum_id', $forums) . '
 0299                                          AND user_id = ' . $user->data['user_id'];
 0300                                  $db->sql_query($sql);
 0301   
 0302                                  $l_unwatch .= '_FORUMS';
 0303                              }
 0304   
 0305                              if (count($topics))
 0306                              {
 0307                                  $sql = 'DELETE FROM ' . TOPICS_WATCH_TABLE . '
 0308                                      WHERE ' . $db->sql_in_set('topic_id', $topics) . '
 0309                                          AND user_id = ' . $user->data['user_id'];
 0310                                  $db->sql_query($sql);
 0311   
 0312                                  $l_unwatch .= '_TOPICS';
 0313                              }
 0314                              $msg = $user->lang['UNWATCHED' . $l_unwatch];
 0315                          }
 0316                          else
 0317                          {
 0318                              $msg = $user->lang['NO_WATCHED_SELECTED'];
 0319                          }
 0320                      }
 0321                      else
 0322                      {
 0323                          $msg = $user->lang['FORM_INVALID'];
 0324                      }
 0325                      $message = $msg . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], '<a href="' . append_sid("{$phpbb_root_path}ucp.$phpEx", "i=$id&amp;mode=subscribed") . '">', '</a>');
 0326                      meta_refresh(3, append_sid("{$phpbb_root_path}ucp.$phpEx", "i=$id&amp;mode=subscribed"));
 0327                      trigger_error($message);
 0328                  }
 0329   
 0330                  $forbidden_forums = array();
 0331   
 0332                  if ($config['allow_forum_notify'])
 0333                  {
 0334                      $forbidden_forums = $auth->acl_getf('!f_read', true);
 0335                      $forbidden_forums = array_unique(array_keys($forbidden_forums));
 0336   
 0337                      $sql_array = array(
 0338                          'SELECT'    => 'f.*',
 0339   
 0340                          'FROM'        => array(
 0341                              FORUMS_WATCH_TABLE    => 'fw',
 0342                              FORUMS_TABLE        => 'f'
 0343                          ),
 0344   
 0345                          'WHERE'        => 'fw.user_id = ' . $user->data['user_id'] . '
 0346                              AND f.forum_id = fw.forum_id
 0347                              AND ' . $db->sql_in_set('f.forum_id', $forbidden_forums, true, true),
 0348   
 0349                          'ORDER_BY'    => 'left_id'
 0350                      );
 0351   
 0352                      if ($config['load_db_lastread'])
 0353                      {
 0354                          $sql_array['LEFT_JOIN'] = array(
 0355                              array(
 0356                                  'FROM'    => array(FORUMS_TRACK_TABLE => 'ft'),
 0357                                  'ON'    => 'ft.user_id = ' . $user->data['user_id'] . ' AND ft.forum_id = f.forum_id'
 0358                              )
 0359                          );
 0360   
 0361                          $sql_array['SELECT'] .= ', ft.mark_time ';
 0362                      }
 0363                      else
 0364                      {
 0365                          $tracking_topics = $request->variable($config['cookie_name'] . '_track', '', true, \phpbb\request\request_interface::COOKIE);
 0366                          $tracking_topics = ($tracking_topics) ? tracking_unserialize($tracking_topics) : array();
 0367                      }
 0368   
 0369                      /**
 0370                       * Modify the query used to retrieve a list of subscribed forums
 0371                       *
 0372                       * @event core.ucp_main_subscribed_forums_modify_query
 0373                       * @var array    sql_array           The subscribed forums query
 0374                       * @var array   forbidden_forums   The list of forbidden forums
 0375                       * @since 3.1.10-RC1
 0376                       */
 0377                      $vars = array(
 0378                          'sql_array',
 0379                          'forbidden_forums',
 0380                      );
 0381                      extract($phpbb_dispatcher->trigger_event('core.ucp_main_subscribed_forums_modify_query', compact($vars)));
 0382   
 0383                      $sql = $db->sql_build_query('SELECT', $sql_array);
 0384                      $result = $db->sql_query($sql);
 0385   
 0386                      while ($row = $db->sql_fetchrow($result))
 0387                      {
 0388                          $forum_id = $row['forum_id'];
 0389   
 0390                          if ($config['load_db_lastread'])
 0391                          {
 0392                              $forum_check = (!empty($row['mark_time'])) ? $row['mark_time'] : $user->data['user_lastmark'];
 0393                          }
 0394                          else
 0395                          {
 0396                              $forum_check = (isset($tracking_topics['f'][$forum_id])) ? (int) (base_convert($tracking_topics['f'][$forum_id], 36, 10) + $config['board_startdate']) : $user->data['user_lastmark'];
 0397                          }
 0398   
 0399                          $unread_forum = ($row['forum_last_post_time'] > $forum_check) ? true : false;
 0400   
 0401                          // Which folder should we display?
 0402                          if ($row['forum_status'] == ITEM_LOCKED)
 0403                          {
 0404                              $folder_image = ($unread_forum) ? 'forum_unread_locked' : 'forum_read_locked';
 0405                              $folder_alt = 'FORUM_LOCKED';
 0406                          }
 0407                          else
 0408                          {
 0409                              $folder_image = ($unread_forum) ? 'forum_unread' : 'forum_read';
 0410                              $folder_alt = ($unread_forum) ? 'UNREAD_POSTS' : 'NO_UNREAD_POSTS';
 0411                          }
 0412   
 0413                          // Create last post link information, if appropriate
 0414                          if ($row['forum_last_post_id'])
 0415                          {
 0416                              $last_post_time = $user->format_date($row['forum_last_post_time']);
 0417                              $last_post_time_rfc3339 = gmdate(DATE_RFC3339, $row['forum_last_post_time']);
 0418                              $last_post_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "p=" . $row['forum_last_post_id']) . '#p' . $row['forum_last_post_id'];
 0419                          }
 0420                          else
 0421                          {
 0422                              $last_post_time = $last_post_time_rfc3339 = $last_post_url = '';
 0423                          }
 0424   
 0425                          $template_vars = array(
 0426                              'FORUM_ID'                    => $forum_id,
 0427                              'FORUM_IMG_STYLE'            => $folder_image,
 0428                              'FORUM_FOLDER_IMG'            => $user->img($folder_image, $folder_alt),
 0429                              'FORUM_IMAGE'                => ($row['forum_image']) ? '<img src="' . $phpbb_root_path . $row['forum_image'] . '" alt="' . $user->lang[$folder_alt] . '" />' : '',
 0430                              'FORUM_IMAGE_SRC'            => ($row['forum_image']) ? $phpbb_root_path . $row['forum_image'] : '',
 0431                              'FORUM_NAME'                => $row['forum_name'],
 0432                              'FORUM_DESC'                => generate_text_for_display($row['forum_desc'], $row['forum_desc_uid'], $row['forum_desc_bitfield'], $row['forum_desc_options']),
 0433                              'LAST_POST_SUBJECT'            => $row['forum_last_post_subject'],
 0434                              'LAST_POST_TIME'            => $last_post_time,
 0435                              'LAST_POST_TIME_RFC3339'    => $last_post_time_rfc3339,
 0436   
 0437                              'LAST_POST_AUTHOR'            => get_username_string('username', $row['forum_last_poster_id'], $row['forum_last_poster_name'], $row['forum_last_poster_colour']),
 0438                              'LAST_POST_AUTHOR_COLOUR'    => get_username_string('colour', $row['forum_last_poster_id'], $row['forum_last_poster_name'], $row['forum_last_poster_colour']),
 0439                              'LAST_POST_AUTHOR_FULL'        => get_username_string('full', $row['forum_last_poster_id'], $row['forum_last_poster_name'], $row['forum_last_poster_colour']),
 0440                              'U_LAST_POST_AUTHOR'        => get_username_string('profile', $row['forum_last_poster_id'], $row['forum_last_poster_name'], $row['forum_last_poster_colour']),
 0441   
 0442                              'S_UNREAD_FORUM'        => $unread_forum,
 0443   
 0444                              'U_LAST_POST'            => $last_post_url,
 0445                              'U_VIEWFORUM'            => append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $row['forum_id'])
 0446                          );
 0447   
 0448                          /**
 0449                           * Add template variables to a subscribed forum row.
 0450                           *
 0451                           * @event core.ucp_main_subscribed_forum_modify_template_vars
 0452                           * @var array    template_vars    Array containing the template variables for the row
 0453                           * @var array   row                Array containing the subscribed forum row data
 0454                           * @var int     forum_id        Forum ID
 0455                           * @var string  folder_image    Folder image
 0456                           * @var string  folder_alt      Alt text for the folder image
 0457                           * @var bool    unread_forum    Whether the forum has unread content or not
 0458                           * @var string  last_post_time  The time of the most recent post, expressed as a formatted date string
 0459                           * @var string  last_post_url   The URL of the most recent post in the forum
 0460                           * @since 3.1.10-RC1
 0461                           */
 0462                          $vars = array(
 0463                              'template_vars',
 0464                              'row',
 0465                              'forum_id',
 0466                              'folder_image',
 0467                              'folder_alt',
 0468                              'unread_forum',
 0469                              'last_post_time',
 0470                              'last_post_url',
 0471                          );
 0472                          extract($phpbb_dispatcher->trigger_event('core.ucp_main_subscribed_forum_modify_template_vars', compact($vars)));
 0473   
 0474                          $template->assign_block_vars('forumrow', $template_vars);
 0475                      }
 0476                      $db->sql_freeresult($result);
 0477                  }
 0478   
 0479                  // Subscribed Topics
 0480                  if ($config['allow_topic_notify'])
 0481                  {
 0482                      if (empty($forbidden_forums))
 0483                      {
 0484                          $forbidden_forums = $auth->acl_getf('!f_read', true);
 0485                          $forbidden_forums = array_unique(array_keys($forbidden_forums));
 0486                      }
 0487                      $this->assign_topiclist('subscribed', $forbidden_forums);
 0488                  }
 0489   
 0490                  $template->assign_vars(array(
 0491                      'S_TOPIC_NOTIFY'        => $config['allow_topic_notify'],
 0492                      'S_FORUM_NOTIFY'        => $config['allow_forum_notify'],
 0493                  ));
 0494   
 0495              break;
 0496   
 0497              case 'bookmarks':
 0498   
 0499                  if (!$config['allow_bookmarks'])
 0500                  {
 0501                      $template->assign_vars(array(
 0502                          'S_NO_DISPLAY_BOOKMARKS'    => true)
 0503                      );
 0504                      break;
 0505                  }
 0506   
 0507                  if (!function_exists('topic_status'))
 0508                  {
 0509                      include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
 0510                  }
 0511   
 0512                  $user->add_lang('viewforum');
 0513   
 0514                  if (isset($_POST['unbookmark']))
 0515                  {
 0516                      $s_hidden_fields = array('unbookmark' => 1);
 0517                      $topics = (isset($_POST['t'])) ? array_keys($request->variable('t', array(0 => 0))) : array();
 0518                      $url = $this->u_action;
 0519   
 0520                      if (!count($topics))
 0521                      {
 0522                          trigger_error('NO_BOOKMARKS_SELECTED');
 0523                      }
 0524   
 0525                      foreach ($topics as $topic_id)
 0526                      {
 0527                          $s_hidden_fields['t'][$topic_id] = 1;
 0528                      }
 0529   
 0530                      if (confirm_box(true))
 0531                      {
 0532                          $sql = 'DELETE FROM ' . BOOKMARKS_TABLE . '
 0533                              WHERE user_id = ' . $user->data['user_id'] . '
 0534                                  AND ' . $db->sql_in_set('topic_id', $topics);
 0535                          $db->sql_query($sql);
 0536   
 0537                          meta_refresh(3, $url);
 0538                          $message = $user->lang['BOOKMARKS_REMOVED'] . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], '<a href="' . $url . '">', '</a>');
 0539                          trigger_error($message);
 0540                      }
 0541                      else
 0542                      {
 0543                          confirm_box(false, 'REMOVE_SELECTED_BOOKMARKS', build_hidden_fields($s_hidden_fields));
 0544                      }
 0545                  }
 0546                  $forbidden_forums = $auth->acl_getf('!f_read', true);
 0547                  $forbidden_forums = array_unique(array_keys($forbidden_forums));
 0548   
 0549                  $this->assign_topiclist('bookmarks', $forbidden_forums);
 0550   
 0551              break;
 0552   
 0553              case 'drafts':
 0554   
 0555                  $pm_drafts = ($this->p_master->p_name == 'pm') ? true : false;
 0556                  $template->assign_var('S_SHOW_DRAFTS', true);
 0557   
 0558                  $user->add_lang('posting');
 0559   
 0560                  $edit        = (isset($_REQUEST['edit'])) ? true : false;
 0561                  $submit        = (isset($_POST['submit'])) ? true : false;
 0562                  $draft_id    = $request->variable('edit', 0);
 0563                  $delete        = (isset($_POST['delete'])) ? true : false;
 0564   
 0565                  $s_hidden_fields = ($edit) ? '<input type="hidden" name="edit" value="' . $draft_id . '" />' : '';
 0566                  $draft_subject = $draft_message = '';
 0567                  add_form_key('ucp_draft');
 0568   
 0569                  include_once($phpbb_root_path . 'includes/message_parser.' . $phpEx);
 0570                  $message_parser = new parse_message();
 0571   
 0572                  if ($delete)
 0573                  {
 0574                      if (check_form_key('ucp_draft'))
 0575                      {
 0576                          $drafts = array_keys($request->variable('d', array(0 => 0)));
 0577   
 0578                          if (count($drafts))
 0579                          {
 0580                              $sql = 'DELETE FROM ' . DRAFTS_TABLE . '
 0581                                  WHERE ' . $db->sql_in_set('draft_id', $drafts) . '
 0582                                      AND user_id = ' . $user->data['user_id'];
 0583                              $db->sql_query($sql);
 0584                          }
 0585                          $msg = $user->lang['DRAFTS_DELETED'];
 0586                          unset($drafts);
 0587                      }
 0588                      else
 0589                      {
 0590                          $msg = $user->lang['FORM_INVALID'];
 0591                      }
 0592                      $message = $msg . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], '<a href="' . $this->u_action . '">', '</a>');
 0593                      meta_refresh(3, $this->u_action);
 0594                      trigger_error($message);
 0595                  }
 0596   
 0597                  if ($submit && $edit)
 0598                  {
 0599                      $draft_subject = $request->variable('subject', '', true);
 0600                      $draft_message = $request->variable('message', '', true);
 0601                      if (check_form_key('ucp_draft'))
 0602                      {
 0603                          if ($draft_message && $draft_subject)
 0604                          {
 0605                              // $auth->acl_gets can't be used here because it will check for global forum permissions in this case
 0606                              // In general we don't need too harsh checking here for permissions, as this will be handled later when submitting
 0607                              $bbcode_status = $auth->acl_get('u_pm_bbcode') || $auth->acl_getf_global('f_bbcode');
 0608                              $smilies_status = $auth->acl_get('u_pm_smilies') || $auth->acl_getf_global('f_smilies');
 0609                              $img_status = $auth->acl_get('u_pm_img') || $auth->acl_getf_global('f_img');
 0610                              $flash_status = $auth->acl_get('u_pm_flash') || $auth->acl_getf_global('f_flash');
 0611   
 0612                              $message_parser->message = $draft_message;
 0613                              $message_parser->parse($bbcode_status, $config['allow_post_links'], $smilies_status, $img_status, $flash_status, true, $config['allow_post_links']);
 0614   
 0615                              $draft_row = array(
 0616                                  'draft_subject' => $draft_subject,
 0617                                  'draft_message' => $message_parser->message,
 0618                              );
 0619   
 0620                              $sql = 'UPDATE ' . DRAFTS_TABLE . '
 0621                                  SET ' . $db->sql_build_array('UPDATE', $draft_row) . "
 0622                                  WHERE draft_id = $draft_id
 0623                                      AND user_id = " . $user->data['user_id'];
 0624                              $db->sql_query($sql);
 0625   
 0626                              $message = $user->lang['DRAFT_UPDATED'] . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], '<a href="' . $this->u_action . '">', '</a>');
 0627   
 0628                              meta_refresh(3, $this->u_action);
 0629                              trigger_error($message);
 0630                          }
 0631                          else
 0632                          {
 0633                              $template->assign_var('ERROR', ($draft_message == '') ? $user->lang['EMPTY_DRAFT'] : (($draft_subject == '') ? $user->lang['EMPTY_DRAFT_TITLE'] : ''));
 0634                          }
 0635                      }
 0636                      else
 0637                      {
 0638                          $template->assign_var('ERROR', $user->lang['FORM_INVALID']);
 0639                      }
 0640                  }
 0641   
 0642                  if (!$pm_drafts)
 0643                  {
 0644                      $sql = 'SELECT d.*, f.forum_name
 0645                          FROM ' . DRAFTS_TABLE . ' d, ' . FORUMS_TABLE . ' f
 0646                          WHERE d.user_id = ' . $user->data['user_id'] . ' ' .
 0647                              (($edit) ? "AND d.draft_id = $draft_id" : '') . '
 0648                              AND f.forum_id = d.forum_id
 0649                          ORDER BY d.save_time DESC';
 0650                  }
 0651                  else
 0652                  {
 0653                      $sql = 'SELECT * FROM ' . DRAFTS_TABLE . '
 0654                          WHERE user_id = ' . $user->data['user_id'] . ' ' .
 0655                              (($edit) ? "AND draft_id = $draft_id" : '') . '
 0656                              AND forum_id = 0
 0657                              AND topic_id = 0
 0658                          ORDER BY save_time DESC';
 0659                  }
 0660                  $result = $db->sql_query($sql);
 0661   
 0662                  $draftrows = $topic_ids = array();
 0663   
 0664                  while ($row = $db->sql_fetchrow($result))
 0665                  {
 0666                      if ($row['topic_id'])
 0667                      {
 0668                          $topic_ids[] = (int) $row['topic_id'];
 0669                      }
 0670                      $draftrows[] = $row;
 0671                  }
 0672                  $db->sql_freeresult($result);
 0673   
 0674                  if (count($topic_ids))
 0675                  {
 0676                      $sql = 'SELECT topic_id, forum_id, topic_title
 0677                          FROM ' . TOPICS_TABLE . '
 0678                          WHERE ' . $db->sql_in_set('topic_id', array_unique($topic_ids));
 0679                      $result = $db->sql_query($sql);
 0680   
 0681                      while ($row = $db->sql_fetchrow($result))
 0682                      {
 0683                          $topic_rows[$row['topic_id']] = $row;
 0684                      }
 0685                      $db->sql_freeresult($result);
 0686                  }
 0687                  unset($topic_ids);
 0688   
 0689                  $template->assign_var('S_EDIT_DRAFT', $edit);
 0690   
 0691                  $row_count = 0;
 0692                  foreach ($draftrows as $draft)
 0693                  {
 0694                      $link_topic = $link_forum = $link_pm = false;
 0695                      $insert_url = $view_url = $title = '';
 0696   
 0697                      if (isset($topic_rows[$draft['topic_id']]) && $auth->acl_get('f_read', $topic_rows[$draft['topic_id']]['forum_id']))
 0698                      {
 0699                          $link_topic = true;
 0700                          $view_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", 't=' . $draft['topic_id']);
 0701                          $title = $topic_rows[$draft['topic_id']]['topic_title'];
 0702   
 0703                          $insert_url = append_sid("{$phpbb_root_path}posting.$phpEx", 't=' . $draft['topic_id'] . '&amp;mode=reply&amp;d=' . $draft['draft_id']);
 0704                      }
 0705                      else if ($auth->acl_get('f_read', $draft['forum_id']))
 0706                      {
 0707                          $link_forum = true;
 0708                          $view_url = append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $draft['forum_id']);
 0709                          $title = $draft['forum_name'];
 0710   
 0711                          $insert_url = append_sid("{$phpbb_root_path}posting.$phpEx", 'f=' . $draft['forum_id'] . '&amp;mode=post&amp;d=' . $draft['draft_id']);
 0712                      }
 0713                      else if ($pm_drafts)
 0714                      {
 0715                          $link_pm = true;
 0716                          $insert_url = append_sid("{$phpbb_root_path}ucp.$phpEx", "i=$id&amp;mode=compose&amp;d=" . $draft['draft_id']);
 0717                      }
 0718   
 0719                      if (!$submit)
 0720                      {
 0721                          $message_parser->message = $draft['draft_message'];
 0722                          $message_parser->decode_message();
 0723                          $draft_message = $message_parser->message;
 0724                      }
 0725   
 0726                      $template_row = array(
 0727                          'DATE'            => $user->format_date($draft['save_time']),
 0728                          'DRAFT_MESSAGE'    => $draft_message,
 0729                          'DRAFT_SUBJECT'    => ($submit) ? $draft_subject : $draft['draft_subject'],
 0730                          'TITLE'            => $title,
 0731   
 0732                          'DRAFT_ID'    => $draft['draft_id'],
 0733                          'FORUM_ID'    => $draft['forum_id'],
 0734                          'TOPIC_ID'    => $draft['topic_id'],
 0735   
 0736                          'U_VIEW'        => $view_url,
 0737                          'U_VIEW_EDIT'    => $this->u_action . '&amp;edit=' . $draft['draft_id'],
 0738                          'U_INSERT'        => $insert_url,
 0739   
 0740                          'S_LINK_TOPIC'        => $link_topic,
 0741                          'S_LINK_FORUM'        => $link_forum,
 0742                          'S_LINK_PM'            => $link_pm,
 0743                          'S_HIDDEN_FIELDS'    => $s_hidden_fields
 0744                      );
 0745                      $row_count++;
 0746   
 0747                      ($edit) ? $template->assign_vars($template_row) : $template->assign_block_vars('draftrow', $template_row);
 0748                  }
 0749   
 0750                  if (!$edit)
 0751                  {
 0752                      $template->assign_var('S_DRAFT_ROWS', $row_count);
 0753                  }
 0754   
 0755              break;
 0756          }
 0757   
 0758          $template->assign_vars(array(
 0759              'L_TITLE'            => $user->lang['UCP_MAIN_' . strtoupper($mode)],
 0760   
 0761              'S_DISPLAY_MARK_ALL'    => ($mode == 'watched' || ($mode == 'drafts' && !isset($_GET['edit']))) ? true : false,
 0762              'S_HIDDEN_FIELDS'        => (isset($s_hidden_fields)) ? $s_hidden_fields : '',
 0763              'S_UCP_ACTION'            => $this->u_action,
 0764   
 0765              'LAST_POST_IMG'            => $user->img('icon_topic_latest', 'VIEW_LATEST_POST'),
 0766              'NEWEST_POST_IMG'        => $user->img('icon_topic_newest', 'VIEW_NEWEST_POST'),
 0767          ));
 0768   
 0769          // Set desired template
 0770          $this->tpl_name = 'ucp_main_' . $mode;
 0771          $this->page_title = 'UCP_MAIN_' . strtoupper($mode);
 0772      }
 0773   
 0774      /**
 0775      * Build and assign topiclist for bookmarks/subscribed topics
 0776      */
 0777      function assign_topiclist($mode = 'subscribed', $forbidden_forum_ary = array())
 0778      {
 0779          global $user, $db, $template, $config, $cache, $auth, $phpbb_root_path, $phpEx, $phpbb_container, $request, $phpbb_dispatcher;
 0780   
 0781          /* @var $pagination \phpbb\pagination */
 0782          $pagination = $phpbb_container->get('pagination');
 0783          $table = ($mode == 'subscribed') ? TOPICS_WATCH_TABLE : BOOKMARKS_TABLE;
 0784          $start = $request->variable('start', 0);
 0785   
 0786          // Grab icons
 0787          $icons = $cache->obtain_icons();
 0788   
 0789          $sql_array = array(
 0790              'SELECT'    => 'COUNT(t.topic_id) as topics_count',
 0791   
 0792              'FROM'        => array(
 0793                  $table            => 'i',
 0794                  TOPICS_TABLE    => 't'
 0795              ),
 0796   
 0797              'WHERE'        =>    'i.topic_id = t.topic_id
 0798                  AND i.user_id = ' . $user->data['user_id'] . '
 0799                  AND ' . $db->sql_in_set('t.forum_id', $forbidden_forum_ary, true, true),
 0800          );
 0801   
 0802          /**
 0803           * Modify the query used to retrieve the count of subscribed/bookmarked topics
 0804           *
 0805           * @event core.ucp_main_topiclist_count_modify_query
 0806           * @var array    sql_array              The subscribed/bookmarked topics query
 0807           * @var array   forbidden_forum_ary   The list of forbidden forums
 0808           * @var string  mode                  The type of topic list ('subscribed' or 'bookmarks')
 0809           * @since 3.1.10-RC1
 0810           */
 0811          $vars = array(
 0812              'sql_array',
 0813              'forbidden_forum_ary',
 0814              'mode',
 0815          );
 0816          extract($phpbb_dispatcher->trigger_event('core.ucp_main_topiclist_count_modify_query', compact($vars)));
 0817   
 0818          $sql = $db->sql_build_query('SELECT', $sql_array);
 0819          $result = $db->sql_query($sql);
 0820          $topics_count = (int) $db->sql_fetchfield('topics_count');
 0821          $db->sql_freeresult($result);
 0822   
 0823          if ($topics_count)
 0824          {
 0825              $start = $pagination->validate_start($start, $config['topics_per_page'], $topics_count);
 0826              $pagination->generate_template_pagination($this->u_action, 'pagination', 'start', $topics_count, $config['topics_per_page'], $start);
 0827   
 0828              $template->assign_vars(array(
 0829                  'TOTAL_TOPICS'    => $user->lang('VIEW_FORUM_TOPICS', (int) $topics_count),
 0830              ));
 0831          }
 0832   
 0833          if ($mode == 'subscribed')
 0834          {
 0835              $sql_array = array(
 0836                  'SELECT'    => 't.*, f.forum_name',
 0837   
 0838                  'FROM'        => array(
 0839                      TOPICS_WATCH_TABLE    => 'tw',
 0840                      TOPICS_TABLE        => 't'
 0841                  ),
 0842   
 0843                  'WHERE'        => 'tw.user_id = ' . $user->data['user_id'] . '
 0844                      AND t.topic_id = tw.topic_id
 0845                      AND ' . $db->sql_in_set('t.forum_id', $forbidden_forum_ary, true, true),
 0846   
 0847                  'ORDER_BY'    => 't.topic_last_post_time DESC, t.topic_last_post_id DESC'
 0848              );
 0849   
 0850              $sql_array['LEFT_JOIN'] = array();
 0851          }
 0852          else
 0853          {
 0854              $sql_array = array(
 0855                  'SELECT'    => 't.*, f.forum_name, b.topic_id as b_topic_id',
 0856   
 0857                  'FROM'        => array(
 0858                      BOOKMARKS_TABLE        => 'b',
 0859                  ),
 0860   
 0861                  'WHERE'        => 'b.user_id = ' . $user->data['user_id'] . '
 0862                      AND ' . $db->sql_in_set('f.forum_id', $forbidden_forum_ary, true, true),
 0863   
 0864                  'ORDER_BY'    => 't.topic_last_post_time DESC, t.topic_last_post_id DESC'
 0865              );
 0866   
 0867              $sql_array['LEFT_JOIN'] = array();
 0868              $sql_array['LEFT_JOIN'][] = array('FROM' => array(TOPICS_TABLE => 't'), 'ON' => 'b.topic_id = t.topic_id');
 0869          }
 0870   
 0871          $sql_array['LEFT_JOIN'][] = array('FROM' => array(FORUMS_TABLE => 'f'), 'ON' => 't.forum_id = f.forum_id');
 0872   
 0873          if ($config['load_db_lastread'])
 0874          {
 0875              $sql_array['LEFT_JOIN'][] = array('FROM' => array(FORUMS_TRACK_TABLE => 'ft'), 'ON' => 'ft.forum_id = t.forum_id AND ft.user_id = ' . $user->data['user_id']);
 0876              $sql_array['LEFT_JOIN'][] = array('FROM' => array(TOPICS_TRACK_TABLE => 'tt'), 'ON' => 'tt.topic_id = t.topic_id AND tt.user_id = ' . $user->data['user_id']);
 0877              $sql_array['SELECT'] .= ', tt.mark_time, ft.mark_time AS forum_mark_time';
 0878          }
 0879   
 0880          if ($config['load_db_track'])
 0881          {
 0882              $sql_array['LEFT_JOIN'][] = array('FROM' => array(TOPICS_POSTED_TABLE => 'tp'), 'ON' => 'tp.topic_id = t.topic_id AND tp.user_id = ' . $user->data['user_id']);
 0883              $sql_array['SELECT'] .= ', tp.topic_posted';
 0884          }
 0885   
 0886          /**
 0887           * Modify the query used to retrieve the list of subscribed/bookmarked topics
 0888           *
 0889           * @event core.ucp_main_topiclist_modify_query
 0890           * @var array    sql_array              The subscribed/bookmarked topics query
 0891           * @var array   forbidden_forum_ary   The list of forbidden forums
 0892           * @var string  mode                  The type of topic list ('subscribed' or 'bookmarks')
 0893           * @since 3.1.10-RC1
 0894           */
 0895          $vars = array(
 0896              'sql_array',
 0897              'forbidden_forum_ary',
 0898              'mode',
 0899          );
 0900          extract($phpbb_dispatcher->trigger_event('core.ucp_main_topiclist_modify_query', compact($vars)));
 0901   
 0902          $sql = $db->sql_build_query('SELECT', $sql_array);
 0903          $result = $db->sql_query_limit($sql, $config['topics_per_page'], $start);
 0904   
 0905          $topic_list = $topic_forum_list = $global_announce_list = $rowset = array();
 0906          while ($row = $db->sql_fetchrow($result))
 0907          {
 0908              $topic_id = (isset($row['b_topic_id'])) ? $row['b_topic_id'] : $row['topic_id'];
 0909   
 0910              $topic_list[] = $topic_id;
 0911              $rowset[$topic_id] = $row;
 0912   
 0913              $topic_forum_list[$row['forum_id']]['forum_mark_time'] = ($config['load_db_lastread']) ? $row['forum_mark_time'] : 0;
 0914              $topic_forum_list[$row['forum_id']]['topics'][] = $topic_id;
 0915   
 0916              if ($row['topic_type'] == POST_GLOBAL)
 0917              {
 0918                  $global_announce_list[] = $topic_id;
 0919              }
 0920          }
 0921          $db->sql_freeresult($result);
 0922   
 0923          $topic_tracking_info = array();
 0924          if ($config['load_db_lastread'])
 0925          {
 0926              foreach ($topic_forum_list as $f_id => $topic_row)
 0927              {
 0928                  $topic_tracking_info += get_topic_tracking($f_id, $topic_row['topics'], $rowset, array($f_id => $topic_row['forum_mark_time']));
 0929              }
 0930          }
 0931          else
 0932          {
 0933              foreach ($topic_forum_list as $f_id => $topic_row)
 0934              {
 0935                  $topic_tracking_info += get_complete_topic_tracking($f_id, $topic_row['topics']);
 0936              }
 0937          }
 0938   
 0939          /* @var $phpbb_content_visibility \phpbb\content_visibility */
 0940          $phpbb_content_visibility = $phpbb_container->get('content.visibility');
 0941   
 0942          foreach ($topic_list as $topic_id)
 0943          {
 0944              $row = &$rowset[$topic_id];
 0945   
 0946              $forum_id = $row['forum_id'];
 0947              $topic_id = (isset($row['b_topic_id'])) ? $row['b_topic_id'] : $row['topic_id'];
 0948   
 0949              $unread_topic = (isset($topic_tracking_info[$topic_id]) && $row['topic_last_post_time'] > $topic_tracking_info[$topic_id]) ? true : false;
 0950   
 0951              // Replies
 0952              $replies = $phpbb_content_visibility->get_count('topic_posts', $row, $forum_id) - 1;
 0953   
 0954              if ($row['topic_status'] == ITEM_MOVED && !empty($row['topic_moved_id']))
 0955              {
 0956                  $topic_id = $row['topic_moved_id'];
 0957              }
 0958   
 0959              // Get folder img, topic status/type related information
 0960              $folder_img = $folder_alt = $topic_type = '';
 0961              topic_status($row, $replies, $unread_topic, $folder_img, $folder_alt, $topic_type);
 0962   
 0963              $view_topic_url_params = "t=$topic_id";
 0964              $view_topic_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", $view_topic_url_params);
 0965   
 0966              // Send vars to template
 0967              $template_vars = array(
 0968                  'FORUM_ID'                    => $forum_id,
 0969                  'TOPIC_ID'                    => $topic_id,
 0970                  'FIRST_POST_TIME'            => $user->format_date($row['topic_time']),
 0971                  'LAST_POST_SUBJECT'            => $row['topic_last_post_subject'],
 0972                  'LAST_POST_TIME'            => $user->format_date($row['topic_last_post_time']),
 0973                  'LAST_VIEW_TIME'            => $user->format_date($row['topic_last_view_time']),
 0974   
 0975                  'TOPIC_AUTHOR'                => get_username_string('username', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']),
 0976                  'TOPIC_AUTHOR_COLOUR'        => get_username_string('colour', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']),
 0977                  'TOPIC_AUTHOR_FULL'            => get_username_string('full', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']),
 0978                  'U_TOPIC_AUTHOR'            => get_username_string('profile', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']),
 0979   
 0980                  'LAST_POST_AUTHOR'            => get_username_string('username', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']),
 0981                  'LAST_POST_AUTHOR_COLOUR'    => get_username_string('colour', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']),
 0982                  'LAST_POST_AUTHOR_FULL'        => get_username_string('full', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']),
 0983                  'U_LAST_POST_AUTHOR'        => get_username_string('profile', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']),
 0984   
 0985                  'S_DELETED_TOPIC'    => (!$row['topic_id']) ? true : false,
 0986   
 0987                  'REPLIES'            => $replies,
 0988                  'VIEWS'                => $row['topic_views'],
 0989                  'TOPIC_TITLE'        => censor_text($row['topic_title']),
 0990                  'TOPIC_TYPE'        => $topic_type,
 0991                  'FORUM_NAME'        => $row['forum_name'],
 0992   
 0993                  'TOPIC_IMG_STYLE'        => $folder_img,
 0994                  'TOPIC_FOLDER_IMG'        => $user->img($folder_img, $folder_alt),
 0995                  'TOPIC_FOLDER_IMG_ALT'    => $user->lang[$folder_alt],
 0996                  'TOPIC_ICON_IMG'        => (!empty($icons[$row['icon_id']])) ? $icons[$row['icon_id']]['img'] : '',
 0997                  'TOPIC_ICON_IMG_WIDTH'    => (!empty($icons[$row['icon_id']])) ? $icons[$row['icon_id']]['width'] : '',
 0998                  'TOPIC_ICON_IMG_HEIGHT'    => (!empty($icons[$row['icon_id']])) ? $icons[$row['icon_id']]['height'] : '',
 0999                  'ATTACH_ICON_IMG'        => ($auth->acl_get('u_download') && $auth->acl_get('f_download', $forum_id) && $row['topic_attachment']) ? $user->img('icon_topic_attach', $user->lang['TOTAL_ATTACHMENTS']) : '',
 1000   
 1001                  'S_TOPIC_TYPE'            => $row['topic_type'],
 1002                  'S_USER_POSTED'            => (!empty($row['topic_posted'])) ? true : false,
 1003                  'S_UNREAD_TOPIC'        => $unread_topic,
 1004   
 1005                  'U_NEWEST_POST'            => append_sid("{$phpbb_root_path}viewtopic.$phpEx", $view_topic_url_params . '&amp;view=unread') . '#unread',
 1006                  'U_LAST_POST'            => append_sid("{$phpbb_root_path}viewtopic.$phpEx", $view_topic_url_params . '&amp;p=' . $row['topic_last_post_id']) . '#p' . $row['topic_last_post_id'],
 1007                  'U_VIEW_TOPIC'            => $view_topic_url,
 1008                  'U_VIEW_FORUM'            => append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $forum_id),
 1009              );
 1010   
 1011              /**
 1012               * Add template variables to a subscribed/bookmarked topic row.
 1013               *
 1014               * @event core.ucp_main_topiclist_topic_modify_template_vars
 1015               * @var array    template_vars    Array containing the template variables for the row
 1016               * @var array   row                Array containing the subscribed/bookmarked topic row data
 1017               * @var int     forum_id        ID of the forum containing the topic
 1018               * @var int     topic_id        Topic ID
 1019               * @var int     replies         Number of replies in the topic
 1020               * @var string  topic_type      Topic type
 1021               * @var string  folder_img      Folder image
 1022               * @var string  folder_alt      Alt text for the folder image
 1023               * @var array   icons           Array containing topic icons
 1024               * @var bool    unread_topic    Whether the topic has unread content or not
 1025               * @var string  view_topic_url  The URL of the topic
 1026               * @since 3.1.10-RC1
 1027               */
 1028              $vars = array(
 1029                  'template_vars',
 1030                  'row',
 1031                  'forum_id',
 1032                  'topic_id',
 1033                  'replies',
 1034                  'topic_type',
 1035                  'folder_img',
 1036                  'folder_alt',
 1037                  'icons',
 1038                  'unread_topic',
 1039                  'view_topic_url',
 1040              );
 1041              extract($phpbb_dispatcher->trigger_event('core.ucp_main_topiclist_topic_modify_template_vars', compact($vars)));
 1042   
 1043              $template->assign_block_vars('topicrow', $template_vars);
 1044   
 1045              $pagination->generate_template_pagination(append_sid("{$phpbb_root_path}viewtopic.$phpEx", "t=$topic_id"), 'topicrow.pagination', 'start', $replies + 1, $config['posts_per_page'], 1, true, true);
 1046          }
 1047      }
 1048  }
 1049