Exemplo n.º 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']));
     }
 }
Exemplo n.º 2
0
function realdate($date_syntax = 'Ymd', $date = 0)
{
    global $config;
    $unix_time = $date * 86400 + 1;
    // Since we are using create_date, we need to adjust time back by timezone and dst to avoid date change...
    $zone_offset = 3600 * $config['board_timezone'] + get_dst($unix_time, $config['board_timezone']);
    $unix_time = $unix_time - $zone_offset;
    return create_date($date_syntax, $unix_time, $config['board_timezone']);
}
Exemplo n.º 3
0
			LEFT OUTER JOIN " . POSTS_TABLE . " p2 ON (p2.post_id = t.topic_first_post_id)
			LEFT OUTER JOIN " . FORUMS_TABLE . " f ON (f.forum_id = p.forum_id)
			LEFT OUTER JOIN " . USERS_TABLE . " u ON (u.user_id = p.poster_id)
			LEFT OUTER JOIN " . USERS_TABLE . " u2 ON (u2.user_id = t.topic_poster)
		WHERE ";
$sql_where = $where_forums . " AND p.post_id = t.topic_last_post_id AND t.topic_status <> " . TOPIC_MOVED;
$sql_end = "LIMIT $start, $topic_limit";

if (!$user->data['session_logged_in'])
{
	$user->data['user_time_mode'] = $config['default_time_mode'];
	$user->data['user_timezone'] = $config['board_timezone'];
	$user->data['user_dst_time_lag'] = $config['default_dst_time_lag'];
}

$dst_sec = get_dst(time(), $user->data['user_timezone']);
$adj_time = (3600 * $user->data['user_timezone']) + $dst_sec;
$int_day_sec = intval((time() + $adj_time) / 86400) * 86400;

$mode_pagination = '&amp;amount_days=' . $amount_days;
$total_topics = 0;

switch($mode)
{
	case 'today':
		$sql_tmp = " AND (p.post_time + " . $adj_time . ") > " . $int_day_sec;
		$sql = $sql_start . $sql_where . $sql_tmp . $sql_sort . $sql_end;
		$template->assign_vars(array('STATUS' => $lang['Recent_today']));
		$where_count = $where_forums . $sql_tmp;
		$l_mode = $lang['Recent_title_today'];
		break;
Exemplo n.º 4
0
 $new_poster = request_var('username', '', true);
 $new_poster = !empty($new_poster) ? phpbb_clean_username($new_poster) : '';
 $topic_post = request_var('topic_post', '');
 $twelve_hours = request_var('twelve_hours', '');
 $new_day = request_var($topic_post . '_day', 0);
 $month = request_var($topic_post . '_month', 0);
 $year = request_var($topic_post . '_year', 0);
 $hour = request_var($topic_post . '_hour', 0);
 $minute = request_var($topic_post . '_minute', 0);
 $second = request_var($topic_post . '_second', 0);
 $am_pm_s = request_var($topic_post . '_ampm', '');
 if ($am_pm_s == 'pm' && !empty($twelve_hours)) {
     $hour += 12;
 }
 $edit_post_time = gmmktime($hour, $minute, $second, $month, $new_day, $year);
 $dst_sec = get_dst($edit_post_time, $config['board_timezone']);
 $edit_post_time = $edit_post_time - 3600 * $config['board_timezone'] - $dst_sec;
 $time_changed = $class_mcp->post_change_time($post_id, $edit_post_time);
 if (!empty($new_poster)) {
     $poster_changed = $class_mcp->post_change_poster($post_id, $new_poster);
 }
 if (!empty($post_id)) {
     $sql = "SELECT forum_id, topic_id FROM " . POSTS_TABLE . " WHERE post_id = '" . $post_id . "' LIMIT 1";
     $result = $db->sql_query($sql);
     $post_data = $db->sql_fetchrow($result);
     if (!empty($post_data['forum_id']) && !empty($post_data['topic_id'])) {
         $class_mcp->sync_topic_details($post_data['topic_id'], $post_data['forum_id'], false, false);
     }
 }
 $template->assign_block_vars('submit_finished', array());
 $template->assign_vars(array('L_POST_EDIT_TIME' => $lang['Edit_post_time'], 'L_TIME' => $topic_post_time == 'topic' ? $lang['Topic_time_xs'] : $lang['Post_time'], 'CLOSE' => true, 'POST_EDIT_STRING' => $lang['DETAILS_CHANGED'], 'U_VIEWTOPIC' => append_sid(CMS_PAGE_VIEWTOPIC . '?' . POST_POST_URL . '=' . $post_id . '#p' . $post_id)));