示例#1
0
 /**
  * prepares a list of articles.
  *
  * @param integer (optional) the article id to the article to be displayed.
  *
  * @return void
  *
  * @access private
  */
 function prepareArticles($articles, $show_abstract = false, $show_attachments = true)
 {
     global $lang, $config, $images, $is_auth, $theme, $user, $block_id, $cms_config_var;
     if (isset($cms_config_var['md_news_length'])) {
         $news_trim = $cms_config_var['md_news_length'];
     } else {
         $news_trim = $this->config['news_item_trim'];
     }
     if (is_array($articles)) {
         if ($config['display_tags_box']) {
             @(include_once IP_ROOT_PATH . 'includes/class_topics_tags.' . PHP_EXT);
             $class_topics_tags = new class_topics_tags();
         }
         foreach ($articles as $article) {
             $trimmed = false;
             // Trim the post body if needed.
             if ($show_abstract && $news_trim > 0) {
                 $article['post_abstract'] = $this->trimText($article['post_text'], $news_trim, $trimmed);
                 $article['post_abstract'] = $this->parseMessage($article['post_abstract'] . ' ... ', $article['enable_bbcode'], $article['enable_html'], $article['enable_smilies'], $article['enable_autolinks_acronyms']);
             }
             $article['post_text'] = $this->parseMessage($article['post_text'], $article['enable_bbcode'], $article['enable_html'], $article['enable_smilies'], $article['enable_autolinks_acronyms']);
             if ($show_attachments == true) {
                 init_display_post_attachments($article['topic_attachment'], $article, false, $block_id);
             }
             $sql = '';
             $dateformat = $user->data['user_id'] == ANONYMOUS ? $config['default_dateformat'] : $user->data['user_dateformat'];
             $timezone = $user->data['user_id'] == ANONYMOUS ? $config['board_timezone'] : $user->data['user_timezone'];
             $this->setVariables(array('L_REPLIES' => $lang['Replies'], 'L_REPLY_NEWS' => $lang['News_Reply'], 'L_PRINT_NEWS' => $lang['News_Print'], 'L_EMAIL_NEWS' => $lang['News_Email'], 'MINIPOST_IMG' => $images['icon_minipost'], 'NEWS_REPLY_IMG' => $images['news_reply'], 'NEWS_PRINT_IMG' => $images['news_print'], 'NEWS_EMAIL_IMG' => $images['news_email']));
             //$index_file = CMS_PAGE_HOME;
             $index_file = !empty($_SERVER['SCRIPT_NAME']) ? $_SERVER['SCRIPT_NAME'] : getenv('SCRIPT_NAME');
             //$page_query = $_SERVER['QUERY_STRING'];
             //$page_query = (!empty($_SERVER['QUERY_STRING'])) ? explode('&', $_SERVER['QUERY_STRING']) : explode('&', getenv('QUERY_STRING'));
             if ($this->config['news_base_url'] != '') {
                 $index_file = $this->config['news_base_url'] . $index_file;
             }
             $index_file = htmlspecialchars(urldecode($index_file));
             $portal_page_id = request_var('page', 0);
             $portal_page_id = !empty($portal_page_id) ? 'page=' . $portal_page_id . '&' : '';
             $ubid_link = request_var('ubid', 0);
             $ubid_link = !empty($ubid_link) ? 'ubid=' . $ubid_link . '&' : '';
             $format = 'r';
             $gmepoch = $article['post_time'];
             $tz = $timezone;
             $news_dst_sec = get_dst($gmepoch, $tz);
             $news_date = @gmdate($format, $gmepoch + 3600 * $tz + $news_dst_sec);
             $topic_tags_links = '';
             $topic_tags_display = false;
             if ($config['display_tags_box']) {
                 $topic_id = $article['topic_id'];
                 $topic_tags_links = $class_topics_tags->build_tags_list(array($topic_id));
                 $topic_tags_display = !empty($topic_tags_links) ? true : false;
             }
             // Convert and clean special chars!
             $topic_title = htmlspecialchars_clean($article['topic_title']);
             $this->setBlockVariables('articles', array('L_TITLE' => $topic_title, 'ID' => $article['topic_id'], 'KEY' => !empty($article['article_key']) ? $article['article_key'] : '', 'DAY' => $this->getDay($article['topic_time']), 'MONTH' => $this->getMonth($article['topic_time']), 'YEAR' => $this->getYear($article['topic_time']), 'CATEGORY' => $article['news_category'], 'CAT_ID' => $article['news_id'], 'COUNT_VIEWS' => $article['topic_views'], 'CAT_IMG' => $article['news_image'] ? $this->root_path . $config['news_path'] . '/' . $article['news_image'] : '', 'POST_DATE' => create_date_ip($dateformat, $article['post_time'], $timezone, true), 'RFC_POST_DATE' => $news_date, 'L_POSTER' => colorize_username($article['user_id'], $article['username'], $article['user_color'], $article['user_active']), 'L_COMMENTS' => $article['topic_replies'], 'S_TOPIC_TAGS' => $topic_tags_display, 'TOPIC_TAGS' => $topic_tags_links, 'U_COMMENTS' => append_sid(CMS_PAGE_VIEWTOPIC . '?' . POST_FORUM_URL . '=' . $article['forum_id'] . '&amp;' . POST_TOPIC_URL . '=' . $article['topic_id']), 'U_COMMENT' => append_sid(CMS_PAGE_VIEWTOPIC . '?' . POST_FORUM_URL . '=' . $article['forum_id'] . '&amp;' . POST_TOPIC_URL . '=' . $article['topic_id']), 'U_VIEWS' => append_sid('topic_view_users.' . PHP_EXT . '?' . POST_TOPIC_URL . '=' . $article['topic_id']), 'U_POST_COMMENT' => append_sid('posting.' . PHP_EXT . '?mode=reply&amp;' . POST_FORUM_URL . '=' . $article['forum_id'] . '&amp;' . POST_TOPIC_URL . '=' . $article['topic_id']), 'U_PRINT_TOPIC' => append_sid('printview.' . PHP_EXT . '?' . POST_FORUM_URL . '=' . $article['forum_id'] . '&amp;' . POST_TOPIC_URL . '=' . $article['topic_id'] . '&amp;start=0'), 'U_EMAIL_TOPIC' => append_sid('tellafriend.' . PHP_EXT . '?topic_title=' . urlencode(ip_utf8_decode($article['topic_title'])) . '&amp;topic_id=' . $article['topic_id']), 'L_TITLE_HTML' => urlencode(ip_utf8_decode($article['topic_title'])), 'COUNT_COMMENTS' => $article['topic_replies'], 'BODY' => $show_abstract && $trimmed ? $article['post_abstract'] : $article['post_text'], 'READ_MORE_LINK' => $show_abstract && $trimmed ? '<a href="' . $index_file . '?' . $portal_page_id . $ubid_link . 'topic_id=' . $article['topic_id'] . '">' . $lang['Read_More'] . '</a>' : ''));
             if ($show_attachments) {
                 display_attachments($article['post_id'], 'articles');
             }
             $post_id = $article['post_id'];
         }
     }
     if (sizeof($articles) == 0) {
         $this->setBlockVariables('no_articles', array('L_NO_NEWS' => $lang['No_articles']));
     }
 }
示例#2
0
$topic_viewed_link = '';
if (empty($config['disable_topic_view']) && ($forum_topic_data['forum_topic_views'] == 1) && ($user->data['user_level'] == ADMIN))
{
	$topic_viewed_link = append_sid('topic_view_users.' . PHP_EXT . '?' . $forum_id_append . '&amp;' . $topic_id_append);
}

if ($config['show_social_bookmarks'])
{
	$template->assign_block_vars('social_bookmarks', array());
}

if ($config['display_tags_box'])
{
	@include_once(IP_ROOT_PATH . 'includes/class_topics_tags.' . PHP_EXT);
	$class_topics_tags = new class_topics_tags();
	$topic_tags_links = $class_topics_tags->build_tags_list(array($topic_id));
	$template->assign_vars(array(
		'S_TOPIC_TAGS' => true,
		'TOPIC_TAGS' => $topic_tags_links,
		)
	);
}

if ($config['enable_featured_image'])
{
	$template->assign_var('S_FEATURED_IMAGE', true);
}

$topic_title_enc = urlencode(ip_utf8_decode($topic_title));
$topic_title_enc_utf8 = urlencode($topic_title);