/**
* Create forum navigation links for given forum, create parent
* list if currently null, assign basic forum info to template
*/
function generate_forum_nav(&$forum_data)
{
    global $db, $user, $template, $auth, $config;
    global $phpEx, $phpbb_root_path;
    if (!$auth->acl_get('f_list', $forum_data['forum_id'])) {
        return;
    }
    // Get forum parents
    $forum_parents = get_forum_parents($forum_data);
    // Build navigation links
    if (!empty($forum_parents)) {
        foreach ($forum_parents as $parent_forum_id => $parent_data) {
            list($parent_name, $parent_type) = array_values($parent_data);
            // Skip this parent if the user does not have the permission to view it
            if (!$auth->acl_get('f_list', $parent_forum_id)) {
                continue;
            }
            $template->assign_block_vars('navlinks', array('S_IS_CAT' => $parent_type == FORUM_CAT ? true : false, 'S_IS_LINK' => $parent_type == FORUM_LINK ? true : false, 'S_IS_POST' => $parent_type == FORUM_POST ? true : false, 'FORUM_NAME' => $parent_name, 'FORUM_ID' => $parent_forum_id, 'U_VIEW_FORUM' => append_sid("{$phpbb_root_path}viewforum.{$phpEx}", 'f=' . $parent_forum_id)));
        }
    }
    $template->assign_block_vars('navlinks', array('S_IS_CAT' => $forum_data['forum_type'] == FORUM_CAT ? true : false, 'S_IS_LINK' => $forum_data['forum_type'] == FORUM_LINK ? true : false, 'S_IS_POST' => $forum_data['forum_type'] == FORUM_POST ? true : false, 'FORUM_NAME' => $forum_data['forum_name'], 'FORUM_ID' => $forum_data['forum_id'], 'U_VIEW_FORUM' => append_sid("{$phpbb_root_path}viewforum.{$phpEx}", 'f=' . $forum_data['forum_id'])));
    $template->assign_vars(array('FORUM_ID' => $forum_data['forum_id'], 'FORUM_NAME' => $forum_data['forum_name'], 'FORUM_DESC' => generate_text_for_display($forum_data['forum_desc'], $forum_data['forum_desc_uid'], $forum_data['forum_desc_bitfield'], $forum_data['forum_desc_options']), 'S_ENABLE_FEEDS_FORUM' => $config['feed_forum'] && !phpbb_optionget(FORUM_OPTION_FEED_EXCLUDE, $forum_data['forum_options']) ? true : false));
    return;
}
Beispiel #2
0
/**
* Create forum navigation links for given forum, create parent
* list if currently null, assign basic forum info to template
*/
function generate_forum_nav(&$forum_data)
{
    global $db, $user, $template, $auth, $config;
    global $phpEx, $phpbb_root_path, $phpbb_dispatcher;
    if (!$auth->acl_get('f_list', $forum_data['forum_id'])) {
        return;
    }
    $navlinks = $navlinks_parents = $forum_template_data = array();
    // Get forum parents
    $forum_parents = get_forum_parents($forum_data);
    $microdata_attr = 'data-forum-id';
    // Build navigation links
    if (!empty($forum_parents)) {
        foreach ($forum_parents as $parent_forum_id => $parent_data) {
            list($parent_name, $parent_type) = array_values($parent_data);
            // Skip this parent if the user does not have the permission to view it
            if (!$auth->acl_get('f_list', $parent_forum_id)) {
                continue;
            }
            $navlinks_parents[] = array('S_IS_CAT' => $parent_type == FORUM_CAT ? true : false, 'S_IS_LINK' => $parent_type == FORUM_LINK ? true : false, 'S_IS_POST' => $parent_type == FORUM_POST ? true : false, 'FORUM_NAME' => $parent_name, 'FORUM_ID' => $parent_forum_id, 'MICRODATA' => $microdata_attr . '="' . $parent_forum_id . '"', 'U_VIEW_FORUM' => append_sid("{$phpbb_root_path}viewforum.{$phpEx}", 'f=' . $parent_forum_id));
        }
    }
    $navlinks = array('S_IS_CAT' => $forum_data['forum_type'] == FORUM_CAT ? true : false, 'S_IS_LINK' => $forum_data['forum_type'] == FORUM_LINK ? true : false, 'S_IS_POST' => $forum_data['forum_type'] == FORUM_POST ? true : false, 'FORUM_NAME' => $forum_data['forum_name'], 'FORUM_ID' => $forum_data['forum_id'], 'MICRODATA' => $microdata_attr . '="' . $forum_data['forum_id'] . '"', 'U_VIEW_FORUM' => append_sid("{$phpbb_root_path}viewforum.{$phpEx}", 'f=' . $forum_data['forum_id']));
    $forum_template_data = array('FORUM_ID' => $forum_data['forum_id'], 'FORUM_NAME' => $forum_data['forum_name'], 'FORUM_DESC' => generate_text_for_display($forum_data['forum_desc'], $forum_data['forum_desc_uid'], $forum_data['forum_desc_bitfield'], $forum_data['forum_desc_options']), 'S_ENABLE_FEEDS_FORUM' => $config['feed_forum'] && $forum_data['forum_type'] == FORUM_POST && !phpbb_optionget(FORUM_OPTION_FEED_EXCLUDE, $forum_data['forum_options']) ? true : false);
    /**
     * Event to modify the navlinks text
     *
     * @event core.generate_forum_nav
     * @var	array	forum_data				Array with the forum data
     * @var	array	forum_template_data		Array with generic forum template data
     * @var	string	microdata_attr			The microdata attribute
     * @var	array	navlinks_parents		Array with the forum parents navlinks data
     * @var	array	navlinks				Array with the forum navlinks data
     * @since 3.1.5-RC1
     */
    $vars = array('forum_data', 'forum_template_data', 'microdata_attr', 'navlinks_parents', 'navlinks');
    extract($phpbb_dispatcher->trigger_event('core.generate_forum_nav', compact($vars)));
    $template->assign_block_vars_array('navlinks', $navlinks_parents);
    $template->assign_block_vars('navlinks', $navlinks);
    $template->assign_vars($forum_template_data);
    return;
}
Beispiel #3
0
    public function display_recent_topics($tpl_loopname = 'recent_topics', $spec_forum_id = 0, $include_subforums = true)
    {
        $this->user->add_lang_ext('paybas/recenttopics', 'recenttopics');
        /**
         * Set some internal needed variables
         */
        $topics_per_page = $this->config['rt_number'];
        $num_pages = $this->config['rt_page_number'];
        $min_topic_level = $this->config['rt_min_topic_level'];
        $excluded_topics = $this->config['rt_anti_topics'];
        $display_parent_forums = $this->config['rt_parents'];
        $unread_only = $this->config['rt_unreadonly'];
        $sort_topics = $this->config['rt_sort_start_time'] ? 'topic_time' : 'topic_last_post_time';
        $persistent_display = $this->config['rt_persistent_display'];
        if ($persistent_display) {
            $this->template->assign_vars(array(strtoupper($tpl_loopname) . '_DISPLAY' => true));
        }
        $start = $this->request->variable($tpl_loopname . '_start', 0);
        $excluded_topic_ids = explode(', ', $excluded_topics);
        $total_limit = $topics_per_page * $num_pages;
        if (!function_exists('display_forums')) {
            include $this->root_path . 'includes/functions_display.' . $this->phpEx;
        }
        /**
         * Get the forums we take our topics from
         */
        // Get the allowed forums
        $forum_ary = array();
        $forum_read_ary = $this->auth->acl_getf('f_read');
        foreach ($forum_read_ary as $forum_id => $allowed) {
            if ($allowed['f_read']) {
                $forum_ary[] = (int) $forum_id;
            }
        }
        $forum_ids = array_unique($forum_ary);
        if (!sizeof($forum_ids)) {
            // No forums with f_read
            return;
        }
        $spec_forum_ary = array();
        if ($spec_forum_id) {
            // Only take a special-forum
            if (!$include_subforums) {
                if (!in_array($spec_forum_id, $forum_ids)) {
                    return;
                }
                $forum_ids = array();
                $sql = 'SELECT 1 as display_forum
					FROM ' . FORUMS_TABLE . '
					WHERE forum_id = ' . intval($spec_forum_id) . '
						AND forum_recent_topics = 1';
                $result = $this->db->sql_query_limit($sql, 1);
                $display_forum = (bool) $this->db->sql_fetchfield('display_forum');
                $this->db->sql_freeresult($result);
                if ($display_forum) {
                    $forum_ids = array($spec_forum_id);
                }
            } else {
                // ... and it's subforums
                $sql = 'SELECT f2.forum_id
					FROM ' . FORUMS_TABLE . ' f1
					LEFT JOIN ' . FORUMS_TABLE . " f2\n\t\t\t\t\t\tON (f2.left_id BETWEEN f1.left_id AND f1.right_id\n\t\t\t\t\t\t\tAND f2.forum_recent_topics = 1)\n\t\t\t\t\tWHERE f1.forum_id = {$spec_forum_id}\n\t\t\t\t\t\tAND f1.forum_recent_topics = 1\n\t\t\t\t\tORDER BY f2.left_id DESC";
                $result = $this->db->sql_query($sql);
                while ($row = $this->db->sql_fetchrow($result)) {
                    $spec_forum_ary[] = $row['forum_id'];
                }
                $this->db->sql_freeresult($result);
                $forum_ids = array_intersect($forum_ids, $spec_forum_ary);
                if (!sizeof($forum_ids)) {
                    return;
                }
            }
        } else {
            $sql = 'SELECT forum_id
				FROM ' . FORUMS_TABLE . '
				WHERE ' . $this->db->sql_in_set('forum_id', $forum_ids) . '
					AND forum_recent_topics = 1';
            $result = $this->db->sql_query($sql);
            $forum_ids = array();
            while ($row = $this->db->sql_fetchrow($result)) {
                $forum_ids[] = $row['forum_id'];
            }
            $this->db->sql_freeresult($result);
        }
        // No forums with f_read or recent topics enabled
        if (!sizeof($forum_ids)) {
            return;
        }
        // Remove duplicated ids
        $forum_ids = array_unique($forum_ids);
        $forums = $topic_list = array();
        $topics_count = 0;
        $obtain_icons = false;
        // Either use the phpBB core function to get unread topics, or the custom function for default behavior
        if ($unread_only && $this->user->data['user_id'] != ANONYMOUS) {
            // Get unread topics
            $sql_extra = ' AND ' . $this->db->sql_in_set('t.topic_id', $excluded_topic_ids, true);
            $sql_extra .= ' AND ' . $this->content_visibility->get_forums_visibility_sql('topic', $forum_ids, $table_alias = 't.');
            $unread_topics = get_unread_topics(false, $sql_extra, '', $total_limit);
            foreach ($unread_topics as $topic_id => $mark_time) {
                $topics_count++;
                if ($topics_count > $start && $topics_count <= $start + $topics_per_page) {
                    $topic_list[] = $topic_id;
                }
            }
        } else {
            // Get the allowed topics
            $sql_array = array('SELECT' => 't.forum_id, t.topic_id, t.topic_type, t.icon_id, tt.mark_time, ft.mark_time as f_mark_time', 'FROM' => array(TOPICS_TABLE => 't'), 'LEFT_JOIN' => array(array('FROM' => array(TOPICS_TRACK_TABLE => 'tt'), 'ON' => 'tt.topic_id = t.topic_id AND tt.user_id = ' . $this->user->data['user_id']), array('FROM' => array(FORUMS_TRACK_TABLE => 'ft'), 'ON' => 'ft.forum_id = t.forum_id AND ft.user_id = ' . $this->user->data['user_id'])), 'WHERE' => $this->db->sql_in_set('t.topic_id', $excluded_topic_ids, true) . '
					AND t.topic_status <> ' . ITEM_MOVED . '
					AND ' . $this->content_visibility->get_forums_visibility_sql('topic', $forum_ids, $table_alias = 't.'), 'ORDER_BY' => 't.' . $sort_topics . ' DESC');
            // Check if we want all topics, or only stickies/announcements/globals
            if ($min_topic_level > 0) {
                $sql_array['WHERE'] .= ' AND t.topic_type >= ' . $min_topic_level;
            }
            /**
             * Event to modify the SQL query before the allowed topics list data is retrieved
             *
             * @event paybas.recenttopics.sql_pull_topics_list
             * @var    array    sql_array        The SQL array
             * @since 2.0.4
             */
            $vars = array('sql_array');
            extract($this->dispatcher->trigger_event('paybas.recenttopics.sql_pull_topics_list', compact($vars)));
            $sql = $this->db->sql_build_query('SELECT', $sql_array);
            $result = $this->db->sql_query_limit($sql, $total_limit);
            while ($row = $this->db->sql_fetchrow($result)) {
                $topics_count++;
                if ($topics_count > $start && $topics_count <= $start + $topics_per_page) {
                    $topic_list[] = $row['topic_id'];
                    $rowset[$row['topic_id']] = $row;
                    if (!isset($forums[$row['forum_id']]) && $this->user->data['is_registered'] && $this->config['load_db_lastread']) {
                        $forums[$row['forum_id']]['mark_time'] = $row['f_mark_time'];
                    }
                    $forums[$row['forum_id']]['topic_list'][] = $row['topic_id'];
                    $forums[$row['forum_id']]['rowset'][$row['topic_id']] =& $rowset[$row['topic_id']];
                    if ($row['icon_id'] && $this->auth->acl_get('f_icons', $row['forum_id'])) {
                        $obtain_icons = true;
                    }
                }
            }
            $this->db->sql_freeresult($result);
        }
        // No topics to display
        if (!sizeof($topic_list)) {
            return;
        }
        // Grab icons
        if ($obtain_icons) {
            $icons = $this->cache->obtain_icons();
        } else {
            $icons = array();
        }
        // Borrowed from search.php
        foreach ($forums as $forum_id => $forum) {
            if ($this->user->data['is_registered'] && $this->config['load_db_lastread']) {
                $topic_tracking_info[$forum_id] = get_topic_tracking($forum_id, $forum['topic_list'], $forum['rowset'], array($forum_id => $forum['mark_time']), $forum_id ? false : $forum['topic_list']);
            } else {
                if ($this->config['load_anon_lastread'] || $this->user->data['is_registered']) {
                    $tracking_topics = $this->request->variable($this->config['cookie_name'] . '_track', '', true, \phpbb\request\request_interface::COOKIE);
                    $tracking_topics = $tracking_topics ? tracking_unserialize($tracking_topics) : array();
                    $topic_tracking_info[$forum_id] = get_complete_topic_tracking($forum_id, $forum['topic_list'], $forum_id ? false : $forum['topic_list']);
                    if (!$this->user->data['is_registered']) {
                        $this->user->data['user_lastmark'] = isset($tracking_topics['l']) ? (int) (base_convert($tracking_topics['l'], 36, 10) + $this->config['board_startdate']) : 0;
                    }
                }
            }
        }
        // Now only pull the data of the requested topics
        $sql_array = array('SELECT' => 't.*, tp.topic_posted, f.forum_name', 'FROM' => array(TOPICS_TABLE => 't'), 'LEFT_JOIN' => array(array('FROM' => array(TOPICS_POSTED_TABLE => 'tp'), 'ON' => 't.topic_id = tp.topic_id AND tp.user_id = ' . $this->user->data['user_id']), array('FROM' => array(FORUMS_TABLE => 'f'), 'ON' => 'f.forum_id = t.forum_id')), 'WHERE' => $this->db->sql_in_set('t.topic_id', $topic_list), 'ORDER_BY' => 't.' . $sort_topics . ' DESC');
        if ($display_parent_forums) {
            $sql_array['SELECT'] .= ', f.parent_id, f.forum_parents, f.left_id, f.right_id';
        }
        /**
         * Event to modify the SQL query before the topics data is retrieved
         *
         * @event paybas.recenttopics.sql_pull_topics_data
         * @var    array    sql_array        The SQL array
         * @since 2.0.0
         */
        $vars = array('sql_array');
        extract($this->dispatcher->trigger_event('paybas.recenttopics.sql_pull_topics_data', compact($vars)));
        $sql = $this->db->sql_build_query('SELECT', $sql_array);
        $result = $this->db->sql_query_limit($sql, $topics_per_page);
        $rowset = $topic_icons = array();
        while ($row = $this->db->sql_fetchrow($result)) {
            $rowset[] = $row;
        }
        $this->db->sql_freeresult($result);
        // No topics returned by the DB
        if (!sizeof($rowset)) {
            return;
        }
        /**
         * Event to modify the topics list data before we start the display loop
         *
         * @event paybas.recenttopics.modify_topics_list
         * @var    array    topic_list        Array of all the topic IDs
         * @var    array    rowset            The full topics list array
         * @since 2.0.1
         */
        $vars = array('topic_list', 'rowset');
        extract($this->dispatcher->trigger_event('paybas.recenttopics.modify_topics_list', compact($vars)));
        foreach ($rowset as $row) {
            $topic_id = $row['topic_id'];
            $forum_id = $row['forum_id'];
            $s_type_switch_test = $row['topic_type'] == POST_ANNOUNCE || $row['topic_type'] == POST_GLOBAL ? 1 : 0;
            //$replies = ($this->auth->acl_get('m_approve', $forum_id)) ? $row['topic_replies_real'] : $row['topic_replies'];
            $replies = $this->content_visibility->get_count('topic_posts', $row, $forum_id) - 1;
            if ($unread_only) {
                topic_status($row, $replies, true, $folder_img, $folder_alt, $topic_type);
                $unread_topic = true;
            } else {
                topic_status($row, $replies, isset($topic_tracking_info[$forum_id][$row['topic_id']]) && $row['topic_last_post_time'] > $topic_tracking_info[$forum_id][$row['topic_id']] ? true : false, $folder_img, $folder_alt, $topic_type);
                $unread_topic = isset($topic_tracking_info[$forum_id][$row['topic_id']]) && $row['topic_last_post_time'] > $topic_tracking_info[$forum_id][$row['topic_id']] ? true : false;
            }
            $view_topic_url = append_sid("{$this->root_path}viewtopic.{$this->phpEx}", 'f=' . $forum_id . '&amp;t=' . $topic_id);
            $view_forum_url = append_sid("{$this->root_path}viewforum.{$this->phpEx}", 'f=' . $forum_id);
            $topic_unapproved = $row['topic_visibility'] == ITEM_UNAPPROVED && $this->auth->acl_get('m_approve', $forum_id);
            $posts_unapproved = $row['topic_visibility'] == ITEM_APPROVED && $row['topic_posts_unapproved'] && $this->auth->acl_get('m_approve', $forum_id);
            $u_mcp_queue = $topic_unapproved || $posts_unapproved ? append_sid("{$this->root_path}mcp.{$this->phpEx}", 'i=queue&amp;mode=' . ($topic_unapproved ? 'approve_details' : 'unapproved_posts') . "&amp;t={$topic_id}", true, $this->user->session_id) : '';
            $s_type_switch = $row['topic_type'] == POST_ANNOUNCE || $row['topic_type'] == POST_GLOBAL ? 1 : 0;
            if (!empty($icons[$row['icon_id']])) {
                $topic_icons[] = $topic_id;
            }
            // Get folder img, topic status/type related information
            $folder_img = $folder_alt = $topic_type = '';
            topic_status($row, $replies, $unread_topic, $folder_img, $folder_alt, $topic_type);
            $tpl_ary = array('FORUM_ID' => $forum_id, 'TOPIC_ID' => $topic_id, 'TOPIC_AUTHOR' => get_username_string('username', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']), 'TOPIC_AUTHOR_COLOUR' => get_username_string('colour', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']), 'TOPIC_AUTHOR_FULL' => get_username_string('full', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']), 'FIRST_POST_TIME' => $this->user->format_date($row['topic_time']), 'LAST_POST_SUBJECT' => censor_text($row['topic_last_post_subject']), 'LAST_POST_TIME' => $this->user->format_date($row['topic_last_post_time']), 'LAST_VIEW_TIME' => $this->user->format_date($row['topic_last_view_time']), 'LAST_POST_AUTHOR' => get_username_string('username', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']), 'LAST_POST_AUTHOR_COLOUR' => get_username_string('colour', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']), 'LAST_POST_AUTHOR_FULL' => get_username_string('full', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']), 'REPLIES' => $replies, 'VIEWS' => $row['topic_views'], 'TOPIC_TITLE' => censor_text($row['topic_title']), 'FORUM_NAME' => $row['forum_name'], 'TOPIC_TYPE' => $topic_type, 'TOPIC_IMG_STYLE' => $folder_img, 'TOPIC_FOLDER_IMG' => $this->user->img($folder_img, $folder_alt), 'TOPIC_FOLDER_IMG_ALT' => $this->user->lang[$folder_alt], 'TOPIC_ICON_IMG' => !empty($icons[$row['icon_id']]) ? $icons[$row['icon_id']]['img'] : '', 'TOPIC_ICON_IMG_WIDTH' => !empty($icons[$row['icon_id']]) ? $icons[$row['icon_id']]['width'] : '', 'TOPIC_ICON_IMG_HEIGHT' => !empty($icons[$row['icon_id']]) ? $icons[$row['icon_id']]['height'] : '', 'ATTACH_ICON_IMG' => $this->auth->acl_get('u_download') && $this->auth->acl_get('f_download', $forum_id) && $row['topic_attachment'] ? $this->user->img('icon_topic_attach', $this->user->lang['TOTAL_ATTACHMENTS']) : '', 'UNAPPROVED_IMG' => $topic_unapproved || $posts_unapproved ? $this->user->img('icon_topic_unapproved', $topic_unapproved ? 'TOPIC_UNAPPROVED' : 'POSTS_UNAPPROVED') : '', 'REPORTED_IMG' => $row['topic_reported'] && $this->auth->acl_get('m_report', $forum_id) ? $this->user->img('icon_topic_reported', 'TOPIC_REPORTED') : '', 'S_HAS_POLL' => $row['poll_start'] ? true : false, 'S_TOPIC_TYPE' => $row['topic_type'], 'S_USER_POSTED' => isset($row['topic_posted']) && $row['topic_posted'] ? true : false, 'S_UNREAD_TOPIC' => $unread_topic, 'S_TOPIC_REPORTED' => $row['topic_reported'] && $this->auth->acl_get('m_report', $forum_id) ? true : false, 'S_TOPIC_UNAPPROVED' => $topic_unapproved, 'S_POSTS_UNAPPROVED' => $posts_unapproved, 'S_POST_ANNOUNCE' => $row['topic_type'] == POST_ANNOUNCE ? true : false, 'S_POST_GLOBAL' => $row['topic_type'] == POST_GLOBAL ? true : false, 'S_POST_STICKY' => $row['topic_type'] == POST_STICKY ? true : false, 'S_TOPIC_LOCKED' => $row['topic_status'] == ITEM_LOCKED ? true : false, 'S_TOPIC_MOVED' => $row['topic_status'] == ITEM_MOVED ? true : false, 'S_TOPIC_TYPE_SWITCH' => $s_type_switch == $s_type_switch_test ? -1 : $s_type_switch_test, 'U_NEWEST_POST' => $view_topic_url . '&amp;view=unread#unread', 'U_LAST_POST' => $view_topic_url . '&amp;p=' . $row['topic_last_post_id'] . '#p' . $row['topic_last_post_id'], 'U_LAST_POST_AUTHOR' => get_username_string('profile', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']), 'U_TOPIC_AUTHOR' => get_username_string('profile', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']), 'U_VIEW_TOPIC' => $view_topic_url, 'U_VIEW_FORUM' => $view_forum_url, 'U_MCP_REPORT' => append_sid("{$this->root_path}mcp.{$this->phpEx}", 'i=reports&amp;mode=reports&amp;f=' . $forum_id . '&amp;t=' . $topic_id, true, $this->user->session_id), 'U_MCP_QUEUE' => $u_mcp_queue);
            /**
             * Modify the topic data before it is assigned to the template
             *
             * @event paybas.recenttopics.modify_tpl_ary
             * @var    array    row            Array with topic data
             * @var    array    tpl_ary        Template block array with topic data
             * @since 2.0.0
             */
            $vars = array('row', 'tpl_ary');
            extract($this->dispatcher->trigger_event('paybas.recenttopics.modify_tpl_ary', compact($vars)));
            $this->template->assign_block_vars($tpl_loopname, $tpl_ary);
            $this->pagination->generate_template_pagination($view_topic_url, $tpl_loopname . '.pagination', 'start', $replies + 1, $this->config['posts_per_page'], 1, true, true);
            if ($display_parent_forums) {
                $forum_parents = get_forum_parents($row);
                foreach ($forum_parents as $parent_id => $data) {
                    $this->template->assign_block_vars($tpl_loopname . '.parent_forums', array('FORUM_ID' => $parent_id, 'FORUM_NAME' => $data[0], 'U_VIEW_FORUM' => append_sid("{$this->root_path}viewforum.{$this->phpEx}", 'f=' . $parent_id)));
                }
            }
        }
        // Get URL-parameters for pagination
        $url_params = explode('&', $this->user->page['query_string']);
        $append_params = false;
        foreach ($url_params as $param) {
            if (!$param) {
                continue;
            }
            if (strpos($param, '=') === false) {
                // Fix MSSTI Advanced BBCode MOD
                $append_params[$param] = '1';
                continue;
            }
            list($name, $value) = explode('=', $param);
            if ($name != $tpl_loopname . '_start') {
                $append_params[$name] = $value;
            }
        }
        $pagination_url = append_sid($this->root_path . $this->user->page['page_name'], $append_params);
        $this->pagination->generate_template_pagination($pagination_url, 'rt_pagination', $tpl_loopname . '_start', $topics_count, $topics_per_page, $start);
        $this->template->assign_vars(array('RT_SORT_START_TIME' => $sort_topics === 'topic_time' ? true : false, 'S_TOPIC_ICONS' => sizeof($topic_icons) ? true : false, 'NEWEST_POST_IMG' => $this->user->img('icon_topic_newest', 'VIEW_NEWEST_POST'), 'LAST_POST_IMG' => $this->user->img('icon_topic_latest', 'VIEW_LATEST_POST'), 'POLL_IMG' => $this->user->img('icon_topic_poll', 'TOPIC_POLL'), strtoupper($tpl_loopname) . '_DISPLAY' => true));
    }
Beispiel #4
0
        $template->assign_block_vars('topicrow', array('FORUM_ID' => $topic_forum_id, 'TOPIC_ID' => $topic_id, 'TOPIC_AUTHOR' => get_username_string('username', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']), 'TOPIC_AUTHOR_COLOUR' => get_username_string('colour', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']), 'TOPIC_AUTHOR_FULL' => get_username_string('full', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']), 'FIRST_POST_TIME' => $user->format_date($row['topic_time']), 'LAST_POST_SUBJECT' => censor_text($row['topic_last_post_subject']), 'LAST_POST_TIME' => $user->format_date($row['topic_last_post_time']), 'LAST_VIEW_TIME' => $user->format_date($row['topic_last_view_time']), 'LAST_POST_AUTHOR' => get_username_string('username', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']), 'LAST_POST_AUTHOR_COLOUR' => get_username_string('colour', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']), 'LAST_POST_AUTHOR_FULL' => get_username_string('full', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']), 'PAGINATION' => topic_generate_pagination($replies, $view_topic_url), 'REPLIES' => $replies, 'VIEWS' => $row['topic_views'], 'TOPIC_TITLE' => censor_text($row['topic_title']), 'TOPIC_TYPE' => $topic_type, 'TOPIC_FOLDER_IMG' => $user->img($folder_img, $folder_alt), 'TOPIC_FOLDER_IMG_SRC' => $user->img($folder_img, $folder_alt, false, '', 'src'), 'TOPIC_FOLDER_IMG_ALT' => $user->lang[$folder_alt], 'TOPIC_FOLDER_IMG_WIDTH' => $user->img($folder_img, '', false, '', 'width'), 'TOPIC_FOLDER_IMG_HEIGHT' => $user->img($folder_img, '', false, '', 'height'), 'TOPIC_ICON_IMG' => !empty($icons[$row['icon_id']]) ? $icons[$row['icon_id']]['img'] : '', 'TOPIC_ICON_IMG_WIDTH' => !empty($icons[$row['icon_id']]) ? $icons[$row['icon_id']]['width'] : '', 'TOPIC_ICON_IMG_HEIGHT' => !empty($icons[$row['icon_id']]) ? $icons[$row['icon_id']]['height'] : '', 'ATTACH_ICON_IMG' => $auth->acl_get('u_download') && $auth->acl_get('f_download', $topic_forum_id) && $row['topic_attachment'] ? $user->img('icon_topic_attach', $user->lang['TOTAL_ATTACHMENTS']) : '', 'UNAPPROVED_IMG' => $topic_unapproved || $posts_unapproved ? $user->img('icon_topic_unapproved', $topic_unapproved ? 'TOPIC_UNAPPROVED' : 'POSTS_UNAPPROVED') : '', 'S_TOPIC_TYPE' => $row['topic_type'], 'S_USER_POSTED' => isset($row['topic_posted']) && $row['topic_posted'] ? true : false, 'S_UNREAD_TOPIC' => $unread_topic, 'S_TOPIC_REPORTED' => !empty($row['topic_reported']) && $auth->acl_get('m_report', $topic_forum_id) ? true : false, 'S_TOPIC_UNAPPROVED' => $topic_unapproved, 'S_POSTS_UNAPPROVED' => $posts_unapproved, 'S_HAS_POLL' => $row['poll_start'] ? true : false, 'S_POST_ANNOUNCE' => $row['topic_type'] == POST_ANNOUNCE ? true : false, 'S_POST_GLOBAL' => $row['topic_type'] == POST_GLOBAL ? true : false, 'S_POST_STICKY' => $row['topic_type'] == POST_STICKY ? true : false, 'S_TOPIC_LOCKED' => $row['topic_status'] == ITEM_LOCKED ? true : false, 'S_TOPIC_MOVED' => $row['topic_status'] == ITEM_MOVED ? true : false, 'U_NEWEST_POST' => append_sid("{$phpbb_root_path}viewtopic.{$phpEx}", $view_topic_url_params . '&amp;view=unread') . '#unread', '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'], 'U_LAST_POST_AUTHOR' => get_username_string('profile', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']), 'U_TOPIC_AUTHOR' => get_username_string('profile', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']), 'U_VIEW_TOPIC' => $view_topic_url, 'U_MCP_REPORT' => append_sid("{$phpbb_root_path}mcp.{$phpEx}", 'i=reports&amp;mode=reports&amp;f=' . $topic_forum_id . '&amp;t=' . $topic_id, true, $user->session_id), 'U_MCP_QUEUE' => $u_mcp_queue, 'S_TOPIC_TYPE_SWITCH' => $s_type_switch == $s_type_switch_test ? -1 : $s_type_switch_test));
        $s_type_switch = $row['topic_type'] == POST_ANNOUNCE || $row['topic_type'] == POST_GLOBAL ? 1 : 0;
        if ($unread_topic) {
            $mark_forum_read = false;
        }
        unset($rowset[$topic_id]);
    }
}
// This is rather a fudge but it's the best I can think of without requiring information
// on all topics (as we do in 2.0.x). It looks for unread or new topics, if it doesn't find
// any it updates the forum last read cookie. This requires that the user visit the forum
// after reading a topic
if ($forum_data['forum_type'] == FORUM_POST && sizeof($topic_list) && $mark_forum_read) {
    update_forum_tracking_info($forum_id, $forum_data['forum_last_post_time'], false, $mark_time_forum);
}
$parents = get_forum_parents($forum_data);
$array = array();
foreach ($parents as $key => $value) {
    $array[] = $key;
}
$category_id = $array[0];
$region_id = $array[1];
/**
 * Selecting the banners
 */
$sql = "\n\tSELECT *\n\tFROM acp_banners\n\tWHERE forum_id  = '{$region_id}' \n\tAND category_id = '{$category_id}'\n";
$result = $db->sql_query($sql);
$banners = $db->sql_fetchrow($result);
if ($banners) {
    $newBanners = array();
    foreach ($banners as $key => $value) {
function display_recent_topics($topics_per_page, $num_pages, $excluded_topics, $tpl_loopname = 'recenttopicrow', $spec_forum_id = 0, $include_subforums = true, $display_parent_forums = true)
{
    global $auth, $cache, $config, $db, $template, $user;
    global $phpbb_root_path, $phpEx;
    $user->add_lang('mods/info_acp_recenttopics');
    /**
     * Set some internal needed variables
     */
    $start = request_var($tpl_loopname . '_start', 0);
    $excluded_topic_ids = explode(', ', $excluded_topics);
    $total_limit = $topics_per_page * $num_pages;
    $ga_forum_id = 0;
    // Forum id we use for global announcements
    /**
     * Get the forums we take our topics from
     */
    // Get the allowed forums
    $forum_ary = array();
    $forum_read_ary = $auth->acl_getf('f_read');
    foreach ($forum_read_ary as $forum_id => $allowed) {
        if ($allowed['f_read']) {
            $forum_ary[] = (int) $forum_id;
        }
    }
    $forum_ids = array_unique($forum_ary);
    if (!sizeof($forum_ids)) {
        // No forums with f_read
        return;
    }
    $spec_forum_ary = array();
    if ($spec_forum_id) {
        // Only take a special-forum
        if (!$include_subforums) {
            if (!in_array($spec_forum_id, $forum_ids)) {
                return;
            }
            $forum_ids = array();
            $sql = 'SELECT 1 as display_forum
				FROM ' . FORUMS_TABLE . '
				WHERE forum_id = ' . $spec_forum_id . '
					AND forum_recent_topics = 1';
            $result = $db->sql_query_limit($sql, 1);
            $display_forum = (bool) $db->sql_fetchfield('display_forum');
            $db->sql_freeresult($result);
            if ($display_forum) {
                $forum_ids = array($spec_forum_id);
            }
        } else {
            // ... and it's subforums
            $sql = 'SELECT f2.forum_id
				FROM ' . FORUMS_TABLE . ' f1
				LEFT JOIN ' . FORUMS_TABLE . " f2\n\t\t\t\t\tON (f2.left_id BETWEEN f1.left_id AND f1.right_id\n\t\t\t\t\t\tAND f2.forum_recent_topics = 1)\n\t\t\t\tWHERE f1.forum_id = {$spec_forum_id}\n\t\t\t\t\tAND f1.forum_recent_topics = 1\n\t\t\t\tORDER BY f2.left_id DESC";
            $result = $db->sql_query($sql);
            while ($row = $db->sql_fetchrow($result)) {
                $spec_forum_ary[] = $row['forum_id'];
            }
            $db->sql_freeresult($result);
            $forum_ids = array_intersect($forum_ids, $spec_forum_ary);
            if (!sizeof($forum_ids)) {
                return;
            }
        }
    } else {
        $sql = 'SELECT forum_id
			FROM ' . FORUMS_TABLE . '
			WHERE ' . $db->sql_in_set('forum_id', $forum_ids) . '
				AND forum_recent_topics = 1';
        $result = $db->sql_query($sql);
        $forum_ids = array();
        while ($row = $db->sql_fetchrow($result)) {
            $forum_ids[] = $row['forum_id'];
        }
        $db->sql_freeresult($result);
    }
    // No forums with f_read
    if (!sizeof($forum_ids)) {
        return;
    }
    // Moderator forums
    $m_approve_ids = array();
    $m_approve_ary = $auth->acl_getf('m_approve');
    foreach ($m_approve_ary as $forum_id => $allowed) {
        if ($allowed['m_approve'] && in_array($forum_id, $forum_ids)) {
            $m_approve_ids[] = (int) $forum_id;
        }
    }
    // Get the allowed topics
    $sql_query_array = array('SELECT' => 't.forum_id, t.topic_id, t.topic_type, t.icon_id, tt.mark_time, ft.mark_time as f_mark_time', 'FROM' => array(TOPICS_TABLE => 't'), 'LEFT_JOIN' => array(array('FROM' => array(TOPICS_TRACK_TABLE => 'tt'), 'ON' => 'tt.topic_id = t.topic_id AND tt.user_id = ' . $user->data['user_id']), array('FROM' => array(FORUMS_TRACK_TABLE => 'ft'), 'ON' => 'ft.forum_id = t.forum_id AND ft.user_id = ' . $user->data['user_id'])), 'WHERE' => '
			(
				(' . $db->sql_in_set('t.topic_id', $excluded_topic_ids, true) . '
					AND ' . $db->sql_in_set('t.forum_id', $forum_ids) . '
				)
				OR t.topic_type = ' . POST_GLOBAL . '
			)
			AND t.topic_status <> ' . ITEM_MOVED . '
			AND (' . $db->sql_in_set('t.forum_id', $m_approve_ids, false, true) . '
				OR t.topic_approved = 1)', 'ORDER_BY' => 't.topic_last_post_time DESC');
    // Is a soft delete MOD installed?
    if (file_exists("{$phpbb_root_path}includes/mods/soft_delete.{$phpEx}")) {
        $sql_query_array['WHERE'] .= ' AND topic_deleted = 0';
    }
    $sql = $db->sql_build_query('SELECT', $sql_query_array);
    $result = $db->sql_query_limit($sql, $total_limit);
    $forums = $ga_topic_ids = $topic_ids = array();
    $num_topics = 0;
    $obtain_icons = false;
    while ($row = $db->sql_fetchrow($result)) {
        $num_topics++;
        if ($num_topics > $start && $num_topics <= $start + $topics_per_page) {
            $topic_ids[] = $row['topic_id'];
            $rowset[$row['topic_id']] = $row;
            if (!isset($forums[$row['forum_id']]) && $user->data['is_registered'] && $config['load_db_lastread']) {
                $forums[$row['forum_id']]['mark_time'] = $row['f_mark_time'];
            }
            $forums[$row['forum_id']]['topic_list'][] = $row['topic_id'];
            $forums[$row['forum_id']]['rowset'][$row['topic_id']] =& $rowset[$row['topic_id']];
            if ($row['icon_id'] && $auth->acl_get('f_icons', $row['forum_id'])) {
                $obtain_icons = true;
            }
        }
    }
    $db->sql_freeresult($result);
    // No topics to display
    if (!sizeof($topic_ids)) {
        return;
    }
    // Grab icons
    if ($obtain_icons) {
        $icons = $cache->obtain_icons();
    } else {
        $icons = array();
    }
    // Borrowed from search.php
    foreach ($forums as $forum_id => $forum) {
        if ($user->data['is_registered'] && $config['load_db_lastread']) {
            $topic_tracking_info[$forum_id] = get_topic_tracking($forum_id, $forum['topic_list'], $forum['rowset'], array($forum_id => $forum['mark_time']), $forum_id ? false : $forum['topic_list']);
        } else {
            if ($config['load_anon_lastread'] || $user->data['is_registered']) {
                $tracking_topics = isset($_COOKIE[$config['cookie_name'] . '_track']) ? STRIP ? stripslashes($_COOKIE[$config['cookie_name'] . '_track']) : $_COOKIE[$config['cookie_name'] . '_track'] : '';
                $tracking_topics = $tracking_topics ? tracking_unserialize($tracking_topics) : array();
                $topic_tracking_info[$forum_id] = get_complete_topic_tracking($forum_id, $forum['topic_list'], $forum_id ? false : $forum['topic_list']);
                if (!$user->data['is_registered']) {
                    $user->data['user_lastmark'] = isset($tracking_topics['l']) ? (int) (base_convert($tracking_topics['l'], 36, 10) + $config['board_startdate']) : 0;
                }
            }
        }
    }
    // Now only pull the data of the requested topics
    $sql_query_array = array('SELECT' => 't.*, tp.topic_posted, f.forum_name', 'FROM' => array(TOPICS_TABLE => 't'), 'LEFT_JOIN' => array(array('FROM' => array(TOPICS_POSTED_TABLE => 'tp'), 'ON' => 't.topic_id = tp.topic_id AND tp.user_id = ' . $user->data['user_id']), array('FROM' => array(FORUMS_TABLE => 'f'), 'ON' => 'f.forum_id = t.forum_id')), 'WHERE' => $db->sql_in_set('t.topic_id', $topic_ids), 'ORDER_BY' => 't.topic_last_post_time DESC');
    if ($display_parent_forums) {
        $sql_query_array['SELECT'] .= ', f.parent_id, f.forum_parents, f.left_id, f.right_id';
    }
    $sql = $db->sql_build_query('SELECT', $sql_query_array);
    $result = $db->sql_query_limit($sql, $topics_per_page);
    $topic_icons = array();
    while ($row = $db->sql_fetchrow($result)) {
        $topic_id = $row['topic_id'];
        $forum_id = $row['forum_id'];
        // Cheat for Global Announcements on the unread-link: copied from search.php
        if (!$forum_id && !$ga_forum_id) {
            $sql2 = 'SELECT forum_id
				FROM ' . FORUMS_TABLE . '
				WHERE forum_type = ' . FORUM_POST . '
					AND ' . $db->sql_in_set('forum_id', $forum_ary, false, true);
            $result2 = $db->sql_query_limit($sql2, 1);
            $ga_forum_id = (int) $db->sql_fetchfield('forum_id');
            $db->sql_freeresult($result2);
            $forum_id = $ga_forum_id;
        } else {
            if (!$forum_id && $ga_forum_id) {
                $forum_id = $ga_forum_id;
            }
        }
        $s_type_switch_test = $row['topic_type'] == POST_ANNOUNCE || $row['topic_type'] == POST_GLOBAL ? 1 : 0;
        $replies = $auth->acl_get('m_approve', $forum_id) ? $row['topic_replies_real'] : $row['topic_replies'];
        topic_status($row, $replies, isset($topic_tracking_info[$forum_id][$row['topic_id']]) && $row['topic_last_post_time'] > $topic_tracking_info[$forum_id][$row['topic_id']] ? true : false, $folder_img, $folder_alt, $topic_type);
        $unread_topic = isset($topic_tracking_info[$forum_id][$row['topic_id']]) && $row['topic_last_post_time'] > $topic_tracking_info[$forum_id][$row['topic_id']] ? true : false;
        $view_topic_url = append_sid("{$phpbb_root_path}viewtopic.{$phpEx}", 'f=' . $forum_id . '&amp;t=' . $topic_id);
        $view_forum_url = append_sid("{$phpbb_root_path}viewforum.{$phpEx}", 'f=' . $forum_id);
        $topic_unapproved = !$row['topic_approved'] && $auth->acl_get('m_approve', $forum_id) ? true : false;
        $posts_unapproved = $row['topic_approved'] && $row['topic_replies'] < $row['topic_replies_real'] && $auth->acl_get('m_approve', $forum_id) ? true : false;
        $u_mcp_queue = $topic_unapproved || $posts_unapproved ? append_sid("{$phpbb_root_path}mcp.{$phpEx}", 'i=queue&amp;mode=' . ($topic_unapproved ? 'approve_details' : 'unapproved_posts') . "&amp;t={$topic_id}", true, $user->session_id) : '';
        $s_type_switch = $row['topic_type'] == POST_ANNOUNCE || $row['topic_type'] == POST_GLOBAL ? 1 : 0;
        if (!empty($icons[$row['icon_id']])) {
            $topic_icons[] = $topic_id;
        }
        $template->assign_block_vars($tpl_loopname, array('FORUM_ID' => $forum_id, 'TOPIC_ID' => $topic_id, 'TOPIC_AUTHOR_FULL' => get_username_string('full', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']), 'FIRST_POST_TIME' => $user->format_date($row['topic_time']), 'LAST_POST_SUBJECT' => censor_text($row['topic_last_post_subject']), 'LAST_POST_TIME' => $user->format_date($row['topic_last_post_time']), 'LAST_VIEW_TIME' => $user->format_date($row['topic_last_view_time']), 'LAST_POST_AUTHOR' => get_username_string('username', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']), 'LAST_POST_AUTHOR_COLOUR' => get_username_string('colour', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']), 'LAST_POST_AUTHOR_FULL' => get_username_string('full', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']), 'PAGINATION' => topic_generate_pagination($replies, $view_topic_url), 'REPLIES' => $replies, 'VIEWS' => $row['topic_views'], 'TOPIC_TITLE' => censor_text($row['topic_title']), 'FORUM_NAME' => $row['forum_name'], 'TOPIC_TYPE' => $topic_type, 'TOPIC_FOLDER_IMG' => $user->img($folder_img, $folder_alt), 'TOPIC_FOLDER_IMG_SRC' => $user->img($folder_img, $folder_alt, false, '', 'src'), 'TOPIC_FOLDER_IMG_ALT' => $user->lang[$folder_alt], 'NEWEST_POST_IMG' => $user->img('icon_topic_newest', 'VIEW_NEWEST_POST'), 'TOPIC_ICON_IMG' => !empty($icons[$row['icon_id']]) ? $icons[$row['icon_id']]['img'] : '', 'TOPIC_ICON_IMG_WIDTH' => !empty($icons[$row['icon_id']]) ? $icons[$row['icon_id']]['width'] : '', 'TOPIC_ICON_IMG_HEIGHT' => !empty($icons[$row['icon_id']]) ? $icons[$row['icon_id']]['height'] : '', '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']) : '', 'UNAPPROVED_IMG' => $topic_unapproved || $posts_unapproved ? $user->img('icon_topic_unapproved', $topic_unapproved ? 'TOPIC_UNAPPROVED' : 'POSTS_UNAPPROVED') : '', 'REPORTED_IMG' => $row['topic_reported'] && $auth->acl_get('m_report', $forum_id) ? $user->img('icon_topic_reported', 'TOPIC_REPORTED') : '', 'S_TOPIC_TYPE' => $row['topic_type'], 'S_USER_POSTED' => isset($row['topic_posted']) && $row['topic_posted'] ? true : false, 'S_UNREAD_TOPIC' => $unread_topic, 'S_TOPIC_REPORTED' => $row['topic_reported'] && $auth->acl_get('m_report', $forum_id) ? true : false, 'S_TOPIC_UNAPPROVED' => $topic_unapproved, 'S_POSTS_UNAPPROVED' => $posts_unapproved, 'S_HAS_POLL' => $row['poll_start'] ? true : false, 'S_POST_ANNOUNCE' => $row['topic_type'] == POST_ANNOUNCE ? true : false, 'S_POST_GLOBAL' => $row['topic_type'] == POST_GLOBAL ? true : false, 'S_POST_STICKY' => $row['topic_type'] == POST_STICKY ? true : false, 'S_TOPIC_LOCKED' => $row['topic_status'] == ITEM_LOCKED ? true : false, 'S_TOPIC_MOVED' => $row['topic_status'] == ITEM_MOVED ? true : false, 'S_TOPIC_TYPE_SWITCH' => $s_type_switch == $s_type_switch_test ? -1 : $s_type_switch_test, 'U_NEWEST_POST' => $view_topic_url . '&amp;view=unread#unread', 'U_LAST_POST' => $view_topic_url . '&amp;p=' . $row['topic_last_post_id'] . '#p' . $row['topic_last_post_id'], 'U_LAST_POST_AUTHOR' => get_username_string('profile', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']), 'U_TOPIC_AUTHOR' => get_username_string('profile', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']), 'U_VIEW_TOPIC' => $view_topic_url, 'U_VIEW_FORUM' => $view_forum_url, 'U_MCP_REPORT' => append_sid("{$phpbb_root_path}mcp.{$phpEx}", 'i=reports&amp;mode=reports&amp;f=' . $forum_id . '&amp;t=' . $topic_id, true, $user->session_id), 'U_MCP_QUEUE' => $u_mcp_queue));
        if ($display_parent_forums) {
            $forum_parents = get_forum_parents($row);
            foreach ($forum_parents as $parent_id => $data) {
                $template->assign_block_vars($tpl_loopname . '.parent_forums', array('FORUM_ID' => $parent_id, 'FORUM_NAME' => $data[0], 'U_VIEW_FORUM' => append_sid("{$phpbb_root_path}viewforum.{$phpEx}", 'f=' . $parent_id)));
            }
        }
    }
    $db->sql_freeresult($result);
    // Get URL-parameters for pagination
    $url_params = explode('&', $user->page['query_string']);
    $append_params = false;
    foreach ($url_params as $param) {
        if (!$param) {
            continue;
        }
        if (strpos($param, '=') === false) {
            // Fix MSSTI Advanced BBCode MOD
            $append_params[$param] = '1';
            continue;
        }
        list($name, $value) = explode('=', $param);
        if ($name != $tpl_loopname . '_start') {
            $append_params[$name] = $value;
        }
    }
    $template->assign_vars(array('S_TOPIC_ICONS' => sizeof($topic_icons) ? true : false, 'NEWEST_POST_IMG' => $user->img('icon_topic_newest', 'VIEW_NEWEST_POST'), 'LAST_POST_IMG' => $user->img('icon_topic_latest', 'VIEW_LATEST_POST'), strtoupper($tpl_loopname) . '_DISPLAY' => true, strtoupper($tpl_loopname) . '_PAGE_NUMBER' => on_page($num_topics, $topics_per_page, $start), strtoupper($tpl_loopname) . '_PAGINATION' => recent_topics_generate_pagination(append_sid($phpbb_root_path . $user->page['page_name'], $append_params), $num_topics, $topics_per_page, $start, false, strtoupper($tpl_loopname), $tpl_loopname . '_start', $tpl_loopname)));
}
function generate_forum_nav(&$forum_data)
{
    global $_CLASS;
    // Get forum parents
    $forum_parents = get_forum_parents($forum_data);
    // Build navigation links
    foreach ($forum_parents as $parent_forum_id => $parent_data) {
        list($parent_name, $parent_type) = array_values($parent_data);
        $_CLASS['core_template']->assign_vars_array('navlinks', array('S_IS_CAT' => $parent_type == FORUM_CAT ? true : false, 'S_IS_LINK' => $parent_type == FORUM_LINK ? true : false, 'S_IS_POST' => $parent_type == FORUM_POST ? true : false, 'FORUM_NAME' => $parent_name, 'FORUM_ID' => $parent_forum_id, 'U_VIEW_FORUM' => generate_link('Forums&amp;file=viewforum&amp;f=' . $parent_forum_id)));
    }
    $_CLASS['core_template']->assign_vars_array('navlinks', array('S_IS_CAT' => $forum_data['forum_type'] == FORUM_CAT ? true : false, 'S_IS_LINK' => $forum_data['forum_type'] == FORUM_LINK ? true : false, 'S_IS_POST' => $forum_data['forum_type'] == FORUM_POST ? true : false, 'FORUM_NAME' => $forum_data['forum_name'], 'FORUM_ID' => $forum_data['forum_id'], 'U_VIEW_FORUM' => generate_link('Forums&amp;file=viewforum&amp;f=' . $forum_data['forum_id'])));
    $_CLASS['core_template']->assign_array(array('FORUM_ID' => $forum_data['forum_id'], 'FORUM_NAME' => $forum_data['forum_name'], 'FORUM_DESC' => strip_tags($forum_data['forum_desc'])));
    return;
}
Beispiel #7
0
/**
 * Retrieve a set of topics and trim the names if necessary
 *
 * @param array $forum_id_ary
 * @param int $num_topics
 * @param int $num_chars
 * @return multitype:
 */
function fetch_topics($forum_id_ary, $num_topics, $num_chars)
{
    global $db, $cache, $user, $config, $auth, $template, $phpbb_root_path, $phpEx;
    //No authed forums, or desired number of topics is zero or less
    if (!sizeof($forum_id_ary) || $num_topics < 1) {
        return array();
    }
    $sql_arr = array('SELECT' => 't.*, tp.topic_posted, f.forum_name, f.parent_id, f.forum_parents, f.left_id, f.right_id ', 'FROM' => array(TOPICS_TABLE => 't'), 'LEFT_JOIN' => array(array('FROM' => array(TOPICS_POSTED_TABLE => 'tp'), 'ON' => 't.topic_id = tp.topic_id AND tp.user_id = ' . $user->data['user_id']), array('FROM' => array(FORUMS_TABLE => 'f'), 'ON' => 'f.forum_id = t.forum_id')), 'WHERE' => ' topic_type <> ' . POST_GLOBAL . ' AND ' . $db->sql_in_set('t.forum_id', $forum_id_ary), 'ORDER_BY' => 't.topic_last_post_time DESC');
    $sql = $db->sql_build_query('SELECT', $sql_arr);
    $result = $db->sql_query_limit($sql, $num_topics);
    $row = $db->sql_fetchrowset($result);
    $db->sql_freeresult($result);
    /**
     * Get list of unread topics
     * @return array[int][int]		Topic ids as keys, mark_time of topic as value
     */
    $unreadlist = \get_unread_topics($user_id = false, $sql_extra = '', $sql_sort = '', $sql_limit = 1001, $sql_limit_offset = 0);
    $topics = array();
    $i = 0;
    foreach ($row as $topic) {
        // FORUM LINK
        $view_forum_url = append_sid("{$phpbb_root_path}viewforum.{$phpEx}", 'f=' . $topic['forum_id']);
        $topic_moderation = false;
        $posts_moderation = false;
        $u_mcp_queue = '';
        //is this topic not approved and does poster have moderation permission ?
        if (!$topic['topic_approved']) {
            if ($auth->acl_get('m_approve', $topic['forum_id'])) {
                $topic_moderation = true;
            }
        } else {
            //if this topic is approved, are there replies yet unapproved ?
            if ($topic['topic_replies'] < $topic['topic_replies_real']) {
                if ($auth->acl_get('m_approve', $topic['forum_id'])) {
                    $posts_moderation = true;
                }
            }
        }
        // build the moderation queue url
        $u_mcp_queue = $topic_moderation || $posts_moderation ? append_sid("{$phpbb_root_path}mcp.{$phpEx}", 'i=queue&amp;mode=' . ($topic_moderation ? 'approve_details' : 'unapproved_posts') . '&amp;t=' . $topic['topic_id'], true, $user->session_id) : '';
        //count the number of replies to the topic
        $replies = $auth->acl_get('m_approve', $topic['forum_id']) ? $topic['topic_replies_real'] : $topic['topic_replies'];
        //build the folder names
        $folder = $folder_new = '';
        if ($topic['topic_status'] == ITEM_MOVED) {
            $topic_type = $user->lang['VIEW_TOPIC_MOVED'];
            $folder_img = 'topic_moved';
            $folder_alt = 'TOPIC_MOVED';
        } else {
            switch ($topic['topic_type']) {
                case POST_GLOBAL:
                    $topic_type = $user->lang['VIEW_TOPIC_GLOBAL'];
                    $folder = 'global_read';
                    $folder_new = 'global_unread';
                    break;
                case POST_ANNOUNCE:
                    $topic_type = $user->lang['VIEW_TOPIC_ANNOUNCEMENT'];
                    $folder = 'announce_read';
                    $folder_new = 'announce_unread';
                    break;
                case POST_STICKY:
                    $topic_type = $user->lang['VIEW_TOPIC_STICKY'];
                    $folder = 'sticky_read';
                    $folder_new = 'sticky_unread';
                    break;
                default:
                    $topic_type = '';
                    $folder = 'topic_read';
                    $folder_new = 'topic_unread';
                    // Hot topic threshold is for posts in a topic, which is replies + the first post. ;)
                    if ($config['hot_threshold'] && $replies + 1 >= $config['hot_threshold'] && $topic['topic_status'] != ITEM_LOCKED) {
                        $folder .= '_hot';
                        $folder_new .= '_hot';
                    }
                    break;
            }
            if ($topic['topic_status'] == ITEM_LOCKED) {
                $topic_type = $user->lang['VIEW_TOPIC_LOCKED'];
                $folder .= '_locked';
                $folder_new .= '_locked';
            }
            if (array_key_exists($topic['topic_id'], $unreadlist)) {
                $folder_img = $folder_new;
                $folder_alt = 'UNREAD_POSTS';
                $topic['unread'] = true;
            } else {
                $topic['unread'] = false;
                $folder_img = $folder;
                $folder_alt = $topic['topic_status'] == ITEM_LOCKED ? 'TOPIC_LOCKED' : 'NO_UNREAD_POSTS';
            }
            // Posted image?
            if (!empty($topic['topic_posted']) && $topic['topic_posted']) {
                $folder_img .= '_mine';
            }
        }
        if ($topic['poll_start'] && $topic['topic_status'] != ITEM_MOVED) {
            $topic_type = $user->lang['VIEW_TOPIC_POLL'];
        }
        // Trim the topic title and add ellipse
        if ($num_chars != 0 and strlen($topic['topic_title']) > $num_chars) {
            $topic['topic_title'] = substr($topic['topic_title'], 0, $num_chars) . '...';
        }
        $icons = array();
        if ($topic['icon_id'] && $auth->acl_get('f_icons', $topic['forum_id'])) {
            $icons = $cache->obtain_icons();
        }
        $attachmenticon = '';
        //can user download ?
        if ($auth->acl_get('u_download') && $auth->acl_get('f_download', $topic['forum_id'])) {
            //does post have attachments ?
            if ($topic['topic_attachment']) {
                $attachmenticon = $user->img('icon_topic_attach', $user->lang['TOTAL_ATTACHMENTS']);
            }
        }
        $topics[$i]['topic_first_poster_colour'] = $topic['topic_first_poster_colour'];
        $topics[$i]['topic_first_poster_name'] = $topic['topic_first_poster_name'];
        $topics[$i]['topic_poster'] = $topic['topic_poster'];
        $topics[$i]['forum_id'] = $topic['forum_id'];
        $topics[$i]['post_id'] = $topic['topic_last_post_id'];
        $topics[$i]['post_unread'] = $topic['unread'];
        $topics[$i]['topic_id'] = $topic['topic_id'];
        $topics[$i]['topic_folder_img'] = $user->img($folder_img, $folder_alt);
        $topics[$i]['topic_folder_img_src'] = $user->img($folder_img, $folder_alt, false, '', 'src');
        $topics[$i]['topic_folder_img_alt'] = $user->lang[$folder_alt];
        $topics[$i]['topic_img'] = !empty($icons[$topic['icon_id']]) ? $icons[$topic['icon_id']]['img'] : '';
        $topics[$i]['topic_img_width'] = !empty($icons[$topic['icon_id']]) ? $icons[$topic['icon_id']]['width'] : '';
        $topics[$i]['topic_img_heigth'] = !empty($icons[$topic['icon_id']]) ? $icons[$topic['icon_id']]['height'] : '';
        $topics[$i]['topic_title'] = $topic['topic_title'];
        $topics[$i]['topic_last_post_id'] = $topic['topic_last_post_id'];
        $topics[$i]['topic_last_post_time'] = $user->format_date($topic['topic_last_post_time']);
        $topics[$i]['user_link'] = get_username_string('full', $topic['topic_last_poster_id'], $topic['topic_last_poster_name'], $topic['topic_last_poster_colour']);
        $topics[$i]['topic_unapproved'] = $topic_moderation;
        $topics[$i]['posts_unapproved'] = $posts_moderation;
        $topics[$i]['topic_reported'] = $topic['topic_reported'] && $auth->acl_get('m_report', $topic['forum_id']) ? true : false;
        $topics[$i]['unapproved_img'] = $topic_moderation || $posts_moderation ? $user->img('icon_topic_unapproved', $topic_moderation ? 'TOPIC_UNAPPROVED' : 'POSTS_UNAPPROVED') : '';
        $topics[$i]['u_mcp_report'] = append_sid("{$phpbb_root_path}mcp.{$phpEx}", 'i=reports&amp;mode=reports&amp;f=' . $topic['forum_id'] . '&amp;t=' . $topic['topic_id'], true, $user->session_id);
        $topics[$i]['u_mcp_queue'] = $u_mcp_queue;
        $topics[$i]['reported_img'] = $topic['topic_reported'] && $auth->acl_get('m_report', $topic['forum_id']) ? $user->img('icon_topic_reported', 'TOPIC_REPORTED') : '';
        $topics[$i]['view_forum_url'] = $view_forum_url;
        $topics[$i]['forum_name'] = $topic['forum_name'];
        $topics[$i]['attach_icon'] = $attachmenticon;
        $topics[$i]['forum_parents'] = \get_forum_parents($topic);
        $i++;
    }
    if (!empty($icons[$topic['icon_id']])) {
        $template->assign_vars(array('S_TOPIC_ICONS' => true));
    }
    return $topics;
}
function generate_forum_nav(&$forum_data)
{
    global $db, $user, $template, $phpEx, $phpbb_root_path;
    // Get forum parents
    $forum_parents = get_forum_parents($forum_data);
    // Build navigation links
    foreach ($forum_parents as $parent_forum_id => $parent_data) {
        list($parent_name, $parent_type) = array_values($parent_data);
        $template->assign_block_vars('navlinks', array('S_IS_CAT' => $parent_type == FORUM_CAT ? true : false, 'S_IS_LINK' => $parent_type == FORUM_LINK ? true : false, 'S_IS_POST' => $parent_type == FORUM_POST ? true : false, 'FORUM_NAME' => $parent_name, 'FORUM_ID' => $parent_forum_id, 'U_VIEW_FORUM' => append_sid("{$phpbb_root_path}viewforum.{$phpEx}?f={$parent_forum_id}")));
    }
    $template->assign_block_vars('navlinks', array('S_IS_CAT' => $forum_data['forum_type'] == FORUM_CAT ? true : false, 'S_IS_LINK' => $forum_data['forum_type'] == FORUM_LINK ? true : false, 'S_IS_POST' => $forum_data['forum_type'] == FORUM_POST ? true : false, 'FORUM_NAME' => $forum_data['forum_name'], 'FORUM_ID' => $forum_data['forum_id'], 'U_VIEW_FORUM' => append_sid("{$phpbb_root_path}viewforum.{$phpEx}?f=" . $forum_data['forum_id'])));
    $template->assign_vars(array('FORUM_ID' => $forum_data['forum_id'], 'FORUM_NAME' => $forum_data['forum_name'], 'FORUM_DESC' => strip_tags($forum_data['forum_desc'])));
    return;
}
Beispiel #9
0
function newpost2mail($data)
{
    global $config, $mode, $user, $post_data, $phpEx, $phpbb_root_path, $db;
    $version = "beta 21";
    // variables that can be used in newpost2mail.config.php to build an individial subject line
    $post_SITENAME = $config['sitename'];
    $post_FORUMNAME = $data['forum_name'];
    $post_MODE = $mode;
    $post_TOPICTITLE = $data['topic_title'];
    $post_SUBJECT = $post_data['post_subject'];
    $post_USERNAME = $user->data['username'];
    $post_IP = $data['poster_ip'];
    $post_HOST = @gethostbyaddr($post_IP);
    // 3rd party edit?
    if ($mode == "edit" and $post_data[username] != $user->data['username']) {
        $post_EDITOR = $user->data['username'];
        $post_USERNAME = $post_data[username];
    }
    // get forum parents
    foreach (get_forum_parents($post_data) as $temp) {
        $post_FORUMPARENTS .= $temp["0"] . " / ";
        $post_FORUMPARENTS_laquo .= $temp["0"] . " « ";
    }
    // read configuration
    include $phpbb_root_path . 'newpost2mail.config.php';
    // check if the actual mode is set for sending mails
    if ($n2m_MAIL_ON[$mode]) {
        // if there is a language set in newpost2mail.config.php then use that setting.
        // Otherwise read default language from board config and use that.
        $n2m_LANG ? $lang = $n2m_LANG : ($lang = $config['default_lang']);
        // get (translated) phrases and convert them to UTF8
        foreach ($n2m_TEXT[en] as $key => $value) {
            if ($n2m_TEXT[$lang][$key]) {
                $phrase[$key] = utf8_encode($n2m_TEXT[$lang][$key]);
            } else {
                $phrase[$key] = utf8_encode($n2m_TEXT[en][$key]);
            }
        }
        // set variables for later use
        $board_url = generate_board_url();
        if (substr($board_url, -1) != "/") {
            $board_url .= "/";
        }
        $forum_url = $board_url . "viewforum.php?f={$data['forum_id']}";
        $thread_url = $board_url . "viewtopic.php?f={$data['forum_id']}&t={$data['topic_id']}";
        $post_url = $board_url . "viewtopic.php?f={$data['forum_id']}&t={$data['topic_id']}&p={$data['post_id']}#p{$data['post_id']}";
        $u_profile_url = $board_url . "memberlist.php?mode=viewprofile&u={$post_data['poster_id']}";
        $e_profile_url = $board_url . "memberlist.php?mode=viewprofile&u={$post_data['post_edit_user']}";
        $reply_url = $board_url . "posting.php?mode=reply&f={$data['forum_id']}&t={$data['topic_id']}";
        $edit_url = $board_url . "posting.php?mode=edit&f={$data['forum_id']}&p={$data['post_id']}";
        $quote_url = $board_url . "posting.php?mode=quote&f={$data['forum_id']}&p={$data['post_id']}";
        $delete_url = $board_url . "posting.php?mode=delete&f={$data['forum_id']}&p={$data['post_id']}";
        $info_url = $board_url . "mcp.php?i=main&mode=post_details&f={$data['forum_id']}&p={$data['post_id']}";
        $pm_url = $board_url . "ucp.php?i=pm&mode=compose&action=quotepost&p={$data['post_id']}";
        $email_url = $board_url . "memberlist.php?mode=email&u={$post_data['poster_id']}";
        // build the email header
        include_once $phpbb_root_path . 'includes/functions_messenger.' . $phpEx;
        $headers .= "Date: " . date("D, j M Y H:i:s O") . "\n";
        $from = html_entity_decode($user->data['username']) . " <" . (($user->data['user_allow_viewemail'] or $n2m_ALWAYS_SHOW_EMAIL) ? $user->data['user_email'] : $user->data['username'] . "@aegee.org") . ">";
        $headers .= "From: " . Mail_mimePart::encodeHeader("from", $from, "UTF-8") . "\n";
        $headers .= "X-Mailer: newpost2mail {$version} for phpBB3\n";
        $headers .= "MIME-Version: 1.0\n";
        $headers .= "Content-type: text/plain; charset=UTF-8; format=flowed\n";
        // build the email body
        $message = html_entity_decode(str_replace("<br />", "<br />\n", generate_text_for_edit($data[message], $data[bbcode_uid], $post_data[forum_desc_options])["text"]) . "\n\n");
        //convert BBCode to text/plain; format=flowed
        require_once 'JBBCode/Parser.php';
        class QuoteWithOption extends JBBCode\CodeDefinition
        {
            public function __construct()
            {
                parent::__construct();
                $this->setTagName("quote");
                $this->useOption = true;
            }
            public function asHtml(JBBCode\ElementNode $el)
            {
                $result = "\nQuote from " . $el->getAttribute()["quote"] . ":\n";
                foreach (preg_split("/\\R/", $this->getContent($el)) as $line) {
                    $result .= "> " . $line . "\n";
                }
                return $result . "\n";
            }
        }
        class QuoteWithoutOption extends JBBCode\CodeDefinition
        {
            public function __construct()
            {
                parent::__construct();
                $this->setTagName("quote");
            }
            public function asHtml(JBBCode\ElementNode $el)
            {
                $result = "\n";
                foreach (preg_split("/\\R/", $this->getContent($el)) as $line) {
                    $result .= "> " . $line . "\n";
                }
                return $result . "\n";
            }
        }
        $parser = new JBBCode\Parser();
        $builder = new JBBCode\CodeDefinitionBuilder('i', '/{param}/');
        $parser->addCodeDefinition($builder->build());
        $builder = new JBBCode\CodeDefinitionBuilder('u', '_{param}_');
        $parser->addCodeDefinition($builder->build());
        $builder = new JBBCode\CodeDefinitionBuilder('b', '*{param}*');
        $parser->addCodeDefinition($builder->build());
        $parser->addCodeDefinition(new QuoteWithOption());
        $parser->addCodeDefinition(new QuoteWithoutOption());
        $builder = new JBBCode\CodeDefinitionBuilder('code', '{param}');
        $parser->addCodeDefinition($builder->build());
        $builder = (new JBBCode\CodeDefinitionBuilder('color', '{param}'))->setUseOption(true);
        $parser->addCodeDefinition($builder->build());
        $builder = (new JBBCode\CodeDefinitionBuilder('size', '{param}'))->setUseOption(true);
        $parser->addCodeDefinition($builder->build());
        $parser->parse($message);
        $message = $parser->getAsHtml();
        // build the informational table
        $message .= "{$phrase['subject']}: {$post_SUBJECT}\n";
        $message .= "{$phrase['thread']}: {$post_TOPICTITLE} {$thread_url}\n";
        $message .= "{$phrase['forum']} : {$post_FORUMPARENTS_laquo}{$post_FORUMNAME} {$forum_url}\n";
        $message .= "{$phrase['actions']}:\n";
        $message .= "  Reply address in the AEGEE Forum: " . $reply_url . "\n";
        $message .= "  Post URL: " . $post_url . "\n";
        $message .= "  Info URL: " . $info_url . "\n\n";
        $message .= "--\nThis message is generated upon adding a new posting in the AEGEE Forum, https://www.aegee.org/forum . You can answer directly to the sender by clicking the reply button, if the sender has activated its @aegee.org address, and does not want to hide his/her identity, otherwise the sending address of this email does not exist.  Sending emails from the AEGEE forum is experimental.  Direct your feedback at forum@aegee.org .";
        if ($post_HOST == $post_IP) {
            $post_HOST = $phrase[host_na];
        }
        // build the post text table
        // search for inline attachments to show them in the post text
        if (!empty($data[attachment_data])) {
            parse_attachments($data[forum_id], $data[message], $data[attachment_data], $dummy, true);
        }
        // generate post text
        // show attachments if not already shown in the post text
        if (!empty($data[attachment_data])) {
            $message .= "{$phrase['attachments']}:\n";
            foreach ($data[attachment_data] as $filename) {
                $message .= "  " . print_r($filename, 1) . "\n";
            }
            $message .= "\n";
        }
        // add signature
        if ($n2m_SHOW_SIG) {
            if ($mode != "edit") {
                if ($user->data[user_sig] and $data[enable_sig]) {
                    $message .= "\nSignature:\n  ";
                    $message .= generate_text_for_edit($user->data[user_sig], $user->data[user_sig_bbcode_uid], $post_data[forum_desc_options])["text"] . "\n\n";
                }
            }
        }
        // encode subject
        $subject = mail_encode(html_entity_decode($n2m_SUBJECT));
        // convert all addresses to lowercase and delete any empty addresses
        foreach ($n2m_MAILTO as $key => $value) {
            if (is_null($value) or $value == "") {
                unset($n2m_MAILTO[$key]);
            } else {
                $n2m_MAILTO[$key] = strtolower($n2m_MAILTO[$key]);
            }
        }
        // insure that every address is only used once
        $n2m_MAILTO = array_unique($n2m_MAILTO);
        // Testversion, Mails an Author des Artikels verhindern
        // unset($n2m_MAILTO[array_search($user->data['user_email'], $n2m_MAILTO)]);
        // die($message); // for debugging purposes, mail will be shown in browser and not sent out if we uncomment this line
        // make text "flow" in plain/text
        $temp = $message;
        $message = '';
        foreach (preg_split("/\\R/", $temp) as $line) {
            $message .= wordwrap($line, 75, $line[0] == ">" ? " \r\n>" : " \r\n") . "\r\n";
        }
        // and finally send the mails
        foreach ($n2m_MAILTO as $mailto) {
            if ($config['smtp_delivery']) {
                // SMTP?
                $tempto[to][email] = $mailto;
                $to[to] = $tempto;
                $result = smtpmail($to, $subject, str_replace("\n.", "\n..", $message), $err_msg, $headers);
                reset($to);
                reset($tempto);
            } else {
                // or PHP mail?
                $result = $config['email_function_name']($mailto, $subject, $message, $headers);
            }
        }
    }
}
/**
* Create forum navigation links for given forum, create parent
* list if currently null, assign basic forum info to template
*/
function generate_forum_nav(&$forum_data)
{
    global $_CLASS;
    if (!$_CLASS['forums_auth']->acl_get('f_list', $forum_data['forum_id'])) {
        return;
    }
    // Get forum parents
    $forum_parents = get_forum_parents($forum_data);
    // Build navigation links
    foreach ($forum_parents as $parent_forum_id => $parent_data) {
        list($parent_name, $parent_type) = array_values($parent_data);
        // Skip this parent if the user does not have the permission to view it
        if (!$_CLASS['forums_auth']->acl_get('f_list', $parent_forum_id)) {
            continue;
        }
        $_CLASS['core_template']->assign_vars_array('navlinks', array('S_IS_CAT' => $parent_type == FORUM_CAT ? true : false, 'S_IS_LINK' => $parent_type == FORUM_LINK ? true : false, 'S_IS_POST' => $parent_type == FORUM_POST ? true : false, 'FORUM_NAME' => $parent_name, 'FORUM_ID' => $parent_forum_id, 'U_VIEW_FORUM' => generate_link('forums&amp;file=viewforum&amp;f=' . $parent_forum_id)));
    }
    $_CLASS['core_template']->assign_vars_array('navlinks', array('S_IS_CAT' => $forum_data['forum_type'] == FORUM_CAT ? true : false, 'S_IS_LINK' => $forum_data['forum_type'] == FORUM_LINK ? true : false, 'S_IS_POST' => $forum_data['forum_type'] == FORUM_POST ? true : false, 'FORUM_NAME' => $forum_data['forum_name'], 'FORUM_ID' => $forum_data['forum_id'], 'U_VIEW_FORUM' => generate_link('forums&amp;file=viewforum&amp;f=' . $forum_data['forum_id'])));
    $_CLASS['core_template']->assign_array(array('FORUM_ID' => $forum_data['forum_id'], 'FORUM_NAME' => $forum_data['forum_name'], 'FORUM_DESC' => generate_text_for_display($forum_data['forum_desc'], $forum_data['forum_desc_uid'], $forum_data['forum_desc_bitfield'], $forum_data['forum_desc_options'])));
    return;
}