function cms_block_forum() { global $db, $cache, $config, $template, $images, $lang, $bbcode, $block_id, $cms_config_vars; $template->_tpldata['fetchpost_row.'] = array(); if (!class_exists('class_topics')) { include IP_ROOT_PATH . 'includes/class_topics.' . PHP_EXT; } $class_topics = new class_topics(); $template->assign_vars(array('L_COMMENTS' => $lang['Comments'], 'L_VIEW_COMMENTS' => $lang['View_comments'], 'L_POST_COMMENT' => $lang['Post_your_comment'], 'L_POSTED' => $lang['Posted'], 'L_ANNOUNCEMENT' => $lang['Post_Announcement'], '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'], 'IMG_CLOCK' => $images['news_clock'])); $article = request_var('article', 0); if (!empty($article)) { $cms_config_vars['md_news_length'][$block_id] = 0; } // Mighty Gorgon: edited by JHL, I still need to check the impacts on the auth system //$fetchposts = $class_topics->fetch_posts($cms_config_vars['md_news_forum_id'][$block_id], $cms_config_vars['md_num_news'][$block_id], $cms_config_vars['md_news_length'][$block_id], false, false, false, false); $fetchposts = $class_topics->fetch_posts($cms_config_vars['md_news_forum_id'][$block_id], $cms_config_vars['md_num_news'][$block_id], $cms_config_vars['md_news_length'][$block_id]); for ($i = 0; $i < sizeof($fetchposts); $i++) { $open_bracket = ''; $close_bracket = ''; $read_full = ''; if (empty($article) && $fetchposts[$i]['striped'] == 1) { $open_bracket = '[ '; $close_bracket = ' ]'; $read_full = $lang['Read_Full']; } // Convert and clean special chars! $topic_title = htmlspecialchars_clean($fetchposts[$i]['topic_title']); $template->assign_block_vars('fetchpost_row', array('TOPIC_ID' => $fetchposts[$i]['topic_id'], 'TITLE' => $topic_title, 'POSTER' => $fetchposts[$i]['username'], 'POSTER_CG' => colorize_username($fetchposts[$i]['user_id'], $fetchposts[$i]['username'], $fetchposts[$i]['user_color'], $fetchposts[$i]['user_active']), 'TIME' => $fetchposts[$i]['topic_time'], 'TEXT' => $fetchposts[$i]['post_text'], 'REPLIES' => $fetchposts[$i]['topic_replies'], 'U_VIEW_COMMENTS' => append_sid(CMS_PAGE_VIEWTOPIC . '?' . POST_FORUM_URL . '=' . $fetchposts[$i]['forum_id'] . '&' . POST_TOPIC_URL . '=' . $fetchposts[$i]['topic_id'] . '&' . POST_POST_URL . '=' . $fetchposts[$i]['post_id'] . '#p' . $fetchposts[$i]['post_id'], true), 'U_POST_COMMENT' => append_sid('posting.' . PHP_EXT . '?mode=reply&' . POST_FORUM_URL . '=' . $fetchposts[$i]['forum_id'] . '&' . POST_TOPIC_URL . '=' . $fetchposts[$i]['topic_id']), 'U_PRINT_TOPIC' => append_sid('printview.' . PHP_EXT . '?' . POST_FORUM_URL . '=' . $fetchposts[$i]['forum_id'] . '&' . POST_TOPIC_URL . '=' . $fetchposts[$i]['topic_id'] . '&start=0'), 'U_EMAIL_TOPIC' => append_sid('tellafriend.' . PHP_EXT . '?topic_title=' . urlencode(ip_utf8_decode($fetchposts[$i]['topic_title'])) . '&topic_id=' . $fetchposts[$i]['topic_id']), 'U_READ_FULL' => append_sid($index_file . '?article=' . $i), 'L_READ_FULL' => $read_full, 'OPEN' => $open_bracket, 'CLOSE' => $close_bracket)); } }
function cms_block_recent_topics() { global $db, $cache, $config, $template, $user, $lang, $block_id, $cms_config_vars; $template->_tpldata['recent_topic_row.'] = array(); $except_forums = build_exclusion_forums_list(); $current_time = time(); $extra = "AND t.topic_time <= {$current_time}"; $sql = "SELECT t.topic_id, t.topic_title, t.topic_last_post_id, t.forum_id, p.post_id, p.poster_id, p.post_time, u.user_id, u.username, u.user_active, u.user_color\n\t\t\tFROM " . TOPICS_TABLE . " AS t, " . POSTS_TABLE . " AS p, " . USERS_TABLE . " AS u\n\t\t\tWHERE t.forum_id NOT IN (" . $except_forums . ")\n\t\t\t\tAND t.topic_status <> 2\n\t\t\t\tAND p.post_id = t.topic_last_post_id\n\t\t\t\tAND p.poster_id = u.user_id\n\t\t\t\t{$extra}\n\t\t\tORDER BY p.post_time DESC\n\t\t\tLIMIT " . $cms_config_vars['md_num_recent_topics'][$block_id]; $result = $db->sql_query($sql); $number_recent_topics = $db->sql_numrows($result); $recent_topic_row = array(); while ($row1 = $db->sql_fetchrow($result)) { $recent_topic_row[] = $row1; } $db->sql_freeresult($result); if ($cms_config_vars['md_recent_topics_style'][$block_id]) { $style_row = 'scroll'; } else { $style_row = 'static'; } $template->assign_block_vars($style_row, ''); for ($i = 0; $i < $number_recent_topics; $i++) { $recent_topic_row[$i]['topic_title'] = censor_text($recent_topic_row[$i]['topic_title']); // Convert and clean special chars! $topic_title = htmlspecialchars_clean($recent_topic_row[$i]['topic_title']); $template->assign_block_vars($style_row . '.recent_topic_row', array('U_TITLE' => append_sid(CMS_PAGE_VIEWTOPIC . '?' . POST_FORUM_URL . '=' . $recent_topic_row[$i]['forum_id'] . '&' . POST_TOPIC_URL . '=' . $recent_topic_row[$i]['topic_id'] . '&' . POST_POST_URL . '=' . $recent_topic_row[$i]['post_id']) . '#p' . $recent_topic_row[$i]['post_id'], 'L_TITLE' => $topic_title, 'L_BY' => $lang['By'], 'L_ON' => $lang['POSTED_ON'], 'S_POSTER' => colorize_username($recent_topic_row[$i]['user_id'], $recent_topic_row[$i]['username'], $recent_topic_row[$i]['user_color'], $recent_topic_row[$i]['user_active']), 'S_POSTTIME' => create_date_ip($config['default_dateformat'], $recent_topic_row[$i]['post_time'], $config['board_timezone']))); } }
function cms_block_recent_articles() { // if article approved in the table is equal to 1 the article has been approved, else it is not approved, so don't show it. global $db, $cache, $config, $template, $user, $lang, $table_prefix, $style_row, $block_id, $cms_config_vars; $template->_tpldata['recent_articles.'] = array(); @(include_once IP_ROOT_PATH . 'includes/bbcode.' . PHP_EXT); $sql = "SELECT * FROM " . KB_ARTICLES_TABLE . " ORDER BY article_id DESC LIMIT " . $cms_config_vars['md_total_articles'][$block_id]; $result = $db->sql_query($sql); //now lets get our info if ($row = $db->sql_fetchrow($result)) { $i = 0; do { if ($row['approved'] == 1) { $title = $row['article_title']; $author_id = $row['article_author_id']; $author = colorize_username($author_id); $article_category_id = $row['article_id']; $url = append_sid(IP_ROOT_PATH . 'kb.' . PHP_EXT . '?mode=article&k=' . $article_category_id); if ($cms_config_vars['md_recent_articles_style'][$block_id] == '1') { $style_row = 'articles_scroll'; } else { $style_row = 'articles_static'; } $template->assign_block_vars($style_row, ''); // Convert and clean special chars! $title = htmlspecialchars_clean($title); $template->assign_block_vars($style_row . '.recent_articles', array('TITLE' => $title, 'U_ARTICLE' => $url, 'AUTHOR' => $author, 'DATE' => create_date_ip($config['default_dateformat'], $row['article_date'], $config['board_timezone']))); } $i++; } while ($row = $db->sql_fetchrow($result)); $db->sql_freeresult($result); } }
function cms_block_random_topics_ver() { global $db, $cache, $config, $template, $user, $lang, $block_id, $cms_config_vars; $template->_tpldata['random_topic_ver_row.'] = array(); $allowed_forum_id = build_allowed_forums_list(); if ($allowed_forum_id != '') { $allow_forum_id = $cms_config_vars['md_random_topics_ver_forums'][$block_id]; if ($allow_forum_id == '0') { $allowed_forums_sql = 'AND t.forum_id IN (' . $allowed_forum_id . ')'; } else { $allowed_forums = explode(',', $allow_forum_id); $allowed_forums_tmp = explode(',', $allowed_forum_id); $allowed_forum_id = ''; for ($i = 0; $i < sizeof($allowed_forums); $i++) { for ($j = 0; $j < sizeof($allowed_forums_tmp); $j++) { if ($allowed_forums[$i] == $allowed_forums_tmp[$j]) { $allowed_forum_id .= $allowed_forums[$i] . ','; break; } } } if ($allowed_forum_id != '') { $allowed_forum_id = substr($allowed_forum_id, -1, 1) == ',' ? substr($allowed_forum_id, 0, -1) : $allowed_forum_id; $allowed_forums_sql = 'AND t.forum_id IN (' . $allowed_forum_id . ')'; } else { $no_topics_found = true; } } } else { $allowed_forums_sql = ''; } $sql = "SELECT t.topic_id, t.topic_title, t.topic_last_post_id, t.forum_id, p.post_id, p.poster_id, p.post_time, u.user_id, u.username, u.user_active, u.user_color\n\t\t\tFROM " . TOPICS_TABLE . " AS t, " . POSTS_TABLE . " AS p, " . USERS_TABLE . " AS u, " . FORUMS_TABLE . " AS f\n\t\t\tWHERE t.topic_status <> 2\n\t\t\t\t" . $allowed_forums_sql . "\n\t\t\t\tAND f.forum_id = t.forum_id\n\t\t\t\tAND p.post_id = t.topic_last_post_id\n\t\t\t\tAND p.poster_id = u.user_id\n\t\t\tORDER BY RAND()\n\t\t\tLIMIT " . $cms_config_vars['md_num_random_topics_ver'][$block_id]; $result = $db->sql_query($sql); $number_random_topics = $db->sql_numrows($result); $random_topic_row = array(); while ($row1 = $db->sql_fetchrow($result)) { $random_topic_row[] = $row1; } $db->sql_freeresult($result); if ($number_random_topics == 0 || $no_topics_found == true) { $template->assign_block_vars('no_topics', array('L_NO_TOPICS' => $lang['No_topics_found'])); } else { for ($i = 0; $i < $number_random_topics; $i++) { $random_topic_row[$i]['topic_title'] = censor_text($random_topic_row[$i]['topic_title']); // Convert and clean special chars! $topic_title = htmlspecialchars_clean($random_topic_row[$i]['topic_title']); $template->assign_block_vars('random_topic_ver_row', array('U_TITLE' => append_sid(CMS_PAGE_VIEWTOPIC . '?' . POST_FORUM_URL . '=' . $random_topic_row[$i]['forum_id'] . '&' . POST_TOPIC_URL . '=' . $random_topic_row[$i]['topic_id'] . '&' . POST_POST_URL . '=' . $random_topic_row[$i]['post_id']) . '#p' . $random_topic_row[$i]['post_id'], 'L_TITLE' => $topic_title, 'L_BY' => $lang['By'], 'L_ON' => $lang['POSTED_ON'], 'S_POSTER' => colorize_username($random_topic_row[$i]['user_id'], $random_topic_row[$i]['username'], $random_topic_row[$i]['user_color'], $random_topic_row[$i]['user_active']), 'S_POSTTIME' => create_date_ip($config['default_dateformat'], $random_topic_row[$i]['post_time'], $config['board_timezone']))); } } }
function cms_block_forum_attach() { global $db, $cache, $config, $template, $images, $lang, $bbcode, $block_id, $cms_config_vars; if (!class_exists('class_topics')) { include IP_ROOT_PATH . 'includes/class_topics.' . PHP_EXT; } $class_topics = new class_topics(); @(include_once IP_ROOT_PATH . ATTACH_MOD_PATH . 'displaying.' . PHP_EXT); $template->_tpldata['articles_fp.'] = array(); $index_file = !empty($_SERVER['SCRIPT_NAME']) ? $_SERVER['SCRIPT_NAME'] : getenv('SCRIPT_NAME'); $index_file = htmlspecialchars(urldecode($index_file)); $template->set_filenames(array('forum_attach_block' => 'blocks/forum_attach_block.tpl')); $template->assign_vars(array('L_COMMENTS' => $lang['Comments'], 'L_VIEW_COMMENTS' => $lang['View_comments'], 'L_POST_COMMENT' => $lang['Post_your_comment'], 'L_POSTED' => $lang['Posted'], 'L_ANNOUNCEMENT' => $lang['Post_Announcement'], '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'], 'IMG_CLOCK' => $images['news_clock'])); // $only_auth_view must have the opposite value of $cms_config_vars['md_ignore_auth_view'][$block_id] // Suggested by JHL - To Be Verified! //$only_auth_view = (!empty($cms_config_vars['md_ignore_auth_view'][$block_id]) ? true : false); $only_auth_view = !empty($cms_config_vars['md_ignore_auth_view'][$block_id]) || $cms_config_vars['md_ignore_auth_view'][$block_id] == true ? false : true; if ($cms_config_vars['md_single_post_retrieve'][$block_id]) { $single_post_id = request_var('post_id', 0); if ($cms_config_vars['md_single_post_auto_id'][$block_id]) { $single_post_id = !empty($single_post_id) ? $single_post_id : $cms_config_vars['md_single_post_id'][$block_id]; } else { $single_post_id = $cms_config_vars['md_single_post_id'][$block_id]; } // Mighty Gorgon: edited by JHL, I still need to check the impacts of this amendment //$fetchposts = $class_topics->fetch_posts($single_post_id, 1, $cms_config_vars['md_single_post_length'][$block_id], false, false, true, $only_auth_view); $fetchposts = $class_topics->fetch_posts($single_post_id, 1, $cms_config_vars['md_single_post_length'][$block_id], false, 0, true, $only_auth_view); } else { $fetchposts = $class_topics->fetch_posts($cms_config_vars['md_posts_forum_id'][$block_id], $cms_config_vars['md_num_posts'][$block_id], $cms_config_vars['md_posts_length'][$block_id], $cms_config_vars['md_posts_show_portal'][$block_id], $cms_config_vars['md_posts_random'][$block_id], false, $only_auth_view); } for ($i = 0; $i < sizeof($fetchposts); $i++) { init_display_post_attachments($fetchposts[$i]['topic_attachment'], $fetchposts[$i], true, $block_id); $open_bracket = ''; $close_bracket = ''; $read_full = ''; if ($fetchposts[$i]['striped'] == 1) { $open_bracket = '[ '; $close_bracket = ' ]'; $read_full = $lang['Read_Full']; } // Convert and clean special chars! $topic_title = htmlspecialchars_clean($fetchposts[$i]['topic_title']); $template->assign_block_vars('articles_fp', array('TOPIC_ID' => $fetchposts[$i]['topic_id'], 'FORUM_ID' => $fetchposts[$i]['forum_id'], 'TITLE' => $topic_title, 'POSTER' => $fetchposts[$i]['username'], 'POSTER_CG' => colorize_username($fetchposts[$i]['user_id'], $fetchposts[$i]['username'], $fetchposts[$i]['user_color'], $fetchposts[$i]['user_active']), 'TIME' => $fetchposts[$i]['topic_time'], 'TEXT' => $fetchposts[$i]['post_text'], 'REPLIES' => $fetchposts[$i]['topic_replies'], 'U_VIEW_COMMENTS' => append_sid(CMS_PAGE_VIEWTOPIC . '?' . POST_FORUM_URL . '=' . $fetchposts[$i]['forum_id'] . '&' . POST_TOPIC_URL . '=' . $fetchposts[$i]['topic_id'] . '&' . POST_POST_URL . '=' . $fetchposts[$i]['post_id'] . '#p' . $fetchposts[$i]['post_id'], true), 'U_POST_COMMENT' => append_sid('posting.' . PHP_EXT . '?mode=reply&' . POST_FORUM_URL . '=' . $fetchposts[$i]['forum_id'] . '&' . POST_TOPIC_URL . '=' . $fetchposts[$i]['topic_id']), 'U_PRINT_TOPIC' => append_sid('printview.' . PHP_EXT . '?' . POST_FORUM_URL . '=' . $fetchposts[$i]['forum_id'] . '&' . POST_TOPIC_URL . '=' . $fetchposts[$i]['topic_id'] . '&start=0'), 'U_EMAIL_TOPIC' => append_sid('tellafriend.' . PHP_EXT . '?topic_title=' . urlencode(ip_utf8_decode($fetchposts[$i]['topic_title'])) . '&topic_id=' . $fetchposts[$i]['topic_id']), 'U_READ_FULL' => append_sid($index_file . '?article=' . $i), 'L_READ_FULL' => $read_full, 'OPEN' => $open_bracket, 'CLOSE' => $close_bracket)); display_attachments($fetchposts[$i]['post_id'], 'articles_fp'); } }
function cms_block_top_likes() { global $db, $cache, $config, $template, $lang, $block_id, $cms_config_vars; $template->_tpldata['likes_row.'] = array(); $topic_likes_hours = (int) $cms_config_vars['md_top_likes_hours'][$block_id]; $topic_likes_hours = !empty($topic_likes_hours) ? $topic_likes_hours : 24; $topic_likes_timeframe = $topic_likes_hours * 60 * 60; $topic_likes_topics = (int) $cms_config_vars['md_top_likes_topics'][$block_id]; $topic_likes_topics = !empty($topic_likes_topics) ? $topic_likes_topics : 10; $current_time = time(); $delta_time = $current_time - $topic_likes_timeframe; $cache_expiry = 1 * 1 * 60 * 60; $topics_likes = $cache->get('_topics_likes_' . $cache_expiry); if ($topics_likes === false) { $topics_likes = array(); $sql = "SELECT COUNT(tl.topic_id) AS likes_count, t.topic_id, t.topic_title\n\t\t\t\tFROM " . POSTS_LIKES_TABLE . " AS tl, " . TOPICS_TABLE . " AS t\n\t\t\t\tWHERE tl.like_time > " . (int) $delta_time . "\n\t\t\t\t\tAND t.topic_id = tl.topic_id\n\t\t\t\tGROUP BY tl.topic_id\n\t\t\t\tORDER BY likes_count DESC\n\t\t\t\tLIMIT 0, " . (int) $topic_likes_topics; $result = $db->sql_query($sql); $topics_likes = $db->sql_fetchrowset($result); $db->sql_freeresult($result); $cache->put('_topics_likes_' . $cache_expiry, $topics_likes, $cache_expiry); } $switch_topics_likes = false; if (!empty($topics_likes)) { $switch_topics_likes = true; $row_class = ''; $i = 0; foreach ($topics_likes as $topic) { $topic_title = censor_text($topic['topic_title']); $topic_title = htmlspecialchars_clean($topic_title); $row_class = ip_zebra_rows($row_class); $template->assign_block_vars('likes_row', array('CLASS' => $row_class, 'ROW_NUMBER' => $i + 1, 'TOPIC_TITLE' => $topic_title, 'TOPIC_TITLE_SHORT' => strlen($topic_title) > 24 ? substr($topic_title, 0, 18) . '...' : $topic_title, 'U_TOPIC' => append_sid(CMS_PAGE_VIEWTOPIC . '?' . POST_TOPIC_URL . '=' . $topic['topic_id']), 'LIKES_COUNT' => $topic['likes_count'])); $i++; } } $template->assign_vars(array('L_TOP_LIKES_NO_TOPICS_T' => sprintf($lang['TOP_LIKES_NO_TOPICS'], $topic_likes_hours), 'L_TOP_LIKES_DESC_T' => sprintf($lang['TOP_LIKES_DESC'], $topic_likes_hours), 'S_TOPICS_LIKES' => $switch_topics_likes, 'S_TOPICS_LIKES_COUNTER' => !empty($cms_config_vars['md_top_likes_counter'][$block_id]) ? true : false, 'S_TOPICS_LIKES_BLOCK_ID' => $block_id)); }
function generate_topic_title($topic_id, $topic_data, $max_title_length) { global $config, $bbcode, $lang, $lofi; $max_title_length = (int) $max_title_length > 255 || $max_title_length < 15 ? 255 : $max_title_length; $topic_title = censor_text($topic_data['topic_title']); $topic_title_clean = empty($topic_data['topic_title_clean']) ? substr(ip_clean_string($topic_title, $lang['ENCODING']), 0, 254) : $topic_data['topic_title_clean']; if (empty($topic_data['topic_title_clean'])) { if (!function_exists('update_clean_topic_title')) { @(include_once IP_ROOT_PATH . 'includes/functions_topics.' . PHP_EXT); } update_clean_topic_title($topic_id, $topic_title_clean); } $topic_title_prefix = empty($topic_data['title_compl_infos']) ? '' : trim($topic_data['title_compl_infos']) . ' '; // Convert and clean special chars! $topic_title = htmlspecialchars_clean($topic_title); // SMILEYS IN TITLE - BEGIN if ($config['smilies_topic_title'] == true && !$lofi) { if (!class_exists('bbcode')) { include IP_ROOT_PATH . 'includes/bbcode.' . PHP_EXT; } if (empty($bbcode)) { $bbcode = new bbcode(); } $bbcode->allow_smilies = $config['allow_smilies'] && $topic_data['enable_smilies'] ? true : false; $topic_title = $bbcode->parse_only_smilies($topic_title); } // SMILEYS IN TITLE - END $topic_title = $topic_title_prefix . $topic_title; $topic_title_plain = htmlspecialchars(strip_tags($topic_title)); $topic_title_short = $topic_title; if (strlen($topic_title) > $max_title_length - 3) { // remove tags from the short version, in case a smiley or a quick title prefix is in there $topic_title_short = substr(strip_tags($topic_title), 0, intval($max_title_length)) . '...'; } $topic_title_data = array('title' => $topic_title, 'title_clean' => $topic_title_clean, 'title_plain' => $topic_title_plain, 'title_prefix' => $topic_title_prefix, 'title_short' => $topic_title_short); return $topic_title_data; }
$template->assign_block_vars('allow_drafts', array()); $hidden_form_fields .= '<input type="hidden" name="d" value="' . $draft_id . '" />'; if (($draft == true) && ($draft_confirm == false)) { $template->assign_block_vars('save_draft_confirm', array()); } } // MG Drafts - END // MG Featured Image - BEGIN $post_featured_image = $post_info['post_images']; // MG Featured Image - END // Convert and clean special chars! $subject = (($mode == 'editpost') ? $subject : htmlspecialchars_clean($subject)); $topic_desc = !empty($topic_desc) ? htmlspecialchars_clean($topic_desc) : ''; $topic_title_clean = (empty($topic_title_clean) ? $subject : trim($topic_title_clean)); $topic_title_clean = substr(ip_clean_string($topic_title_clean, $lang['ENCODING']), 0, 254); $topic_tags = (empty($topic_tags) ? '' : trim($topic_tags)); if (!empty($topic_tags)) { $ttags = explode(', ', $topic_tags); foreach ($ttags as $ttag) { if (!empty($ttag)) { $template->assign_block_vars('ttag', array( 'TTAG' => $ttag ) );
$newest_img = '<a href="' . append_sid(CMS_PAGE_VIEWTOPIC . '?' . POST_TOPIC_URL . '=' . $topic_id . '&view=newest') . '"><img src="' . $images['icon_newest_reply'] . '" alt="' . $lang['View_newest_post'] . '" title="' . $lang['View_newest_post'] . '" /></a> '; } } else { $folder_image = $folder; $folder_alt = $similar['topic_status'] == TOPIC_LOCKED ? $lang['Topic_locked'] : $lang['No_new_posts']; $newest_img = ''; } } else { $folder_image = $folder; $folder_alt = $similar['topic_status'] == TOPIC_LOCKED ? $lang['Topic_locked'] : $lang['No_new_posts']; $newest_img = ''; } $similar['topic_title'] = censor_text($similar['topic_title']); $similar_topic_title = strlen($similar['topic_title']) > 45 ? substr($similar['topic_title'], 0, 42) . '...' : $similar['topic_title']; // Convert and clean special chars! $similar_topic_title = htmlspecialchars_clean($similar_topic_title); // SMILEYS IN TITLE - BEGIN if ($config['smilies_topic_title'] == true && !$lofi) { $bbcode->allow_smilies = $config['allow_smilies'] ? true : false; $similar_topic_title = $bbcode->parse_only_smilies($similar_topic_title); } // SMILEYS IN TITLE - END $topic_url = '<a href="' . append_sid(CMS_PAGE_VIEWTOPIC . '?' . POST_TOPIC_URL . '=' . $similar['topic_id']) . '" class="' . $topic_class . '">' . $similar_topic_title . '</a>'; $author = $similar['user_id'] != ANONYMOUS ? colorize_username($similar['user_id'], $similar['username'], $similar['user_color'], $similar['user_active']) : ($similar['post_username'] != '' ? '<span style="font-weight: bold; color: ' . $config['active_users_color'] . '">' . $similar['post_username'] . '</span>' : '<span style="font-weight: bold; color: ' . $config['active_users_color'] . '">' . $lang['Guest'] . '</span>'); $forum_url = append_sid(CMS_PAGE_VIEWFORUM . '?' . POST_FORUM_URL . '=' . $similar['forum_id']); $forum = '<a href="' . $forum_url . '">' . $similar['forum_name'] . '</a>'; $last_post_author = $similar['id2'] != ANONYMOUS ? colorize_username($similar['id2'], $similar['user2'], $similar['user_color2'], $similar['user_active2']) : ($similar['post_username2'] != '' ? '<span style="font-weight: bold; color: ' . $config['active_users_color'] . '">' . $similar['post_username2'] . '</span>' : '<span style="font-weight: bold; color: ' . $config['active_users_color'] . '">' . $lang['Guest'] . '</span>'); $post_url = '<a href="' . append_sid(CMS_PAGE_VIEWTOPIC . '?' . POST_POST_URL . '=' . $similar['topic_last_post_id']) . '#p' . $similar['topic_last_post_id'] . '"><img src="' . $images['icon_latest_reply'] . '" alt="' . $lang['View_latest_post'] . '" title="' . $lang['View_latest_post'] . '" /></a><br />' . $last_post_author; //$post_time = create_date_ip($config['default_dateformat'], $similar['topic_time'], $config['board_timezone']); $post_time = create_date_ip($config['default_dateformat'], $similar['topic_last_post_time'], $config['board_timezone']); $row_class = !($i % 2) ? $theme['td_class1'] : $theme['td_class2'];
$topic_id = $topic_link['topic_id']; $topic_id_append = $topic_link['topic_id_append']; $topic_pagination = generate_topic_pagination($forum_id, $topic_id, $replies); $first_time = create_date_ip($lang['DATE_FORMAT_VF'], $topic['topic_time'], $config['board_timezone'], true); $first_author = ($topic['first_poster_id'] != ANONYMOUS) ? colorize_username($topic['topic_first_poster_id'], $topic['topic_first_poster_name'], $topic['topic_first_poster_color'], 1) : (($topic['topic_first_poster_name'] != '') ? $topic['topic_first_poster_name'] : $lang['Guest']); $last_time = create_date_ip($config['default_dateformat'], $topic['topic_last_post_time'], $config['board_timezone']); $last_author = ($topic['topic_last_poster_id'] != ANONYMOUS) ? colorize_username($topic['topic_last_poster_id'], $topic['topic_last_poster_name'], $topic['topic_last_poster_color'], 1) : (($topic['topic_last_poster_name'] != '') ? $topic['topic_last_poster_name'] : $lang['Guest']); $last_url = '<a href="' . append_sid(CMS_PAGE_VIEWTOPIC . '?' . $forum_id_append . '&' . $topic_id_append . '&' . POST_POST_URL . '=' . $topic['topic_last_post_id']) . '#p' . $topic['topic_last_post_id'] . '"><img src="' . $images['icon_latest_reply'] . '" alt="' . $lang['View_latest_post'] . '" title="' . $lang['View_latest_post'] . '" /></a>'; $topic_tags_links = $class_topics_tags->build_tags_list_single_topic($topic['topic_tags']); // Convert and clean special chars! $topic_title = htmlspecialchars_clean($topic_title); $template->assign_block_vars('row', array( 'CLASS' => $class, 'ROW_NUMBER' => $i + 1, 'TOPIC_ID' => $topic_id, 'TOPIC_FOLDER_IMG' => $topic_link['image'], 'L_TOPIC_FOLDER_ALT' => $topic_link['image_alt'], 'TOPIC_TITLE' => $topic_title, 'TOPIC_TYPE' => $topic_link['type'], 'TOPIC_TYPE_ICON' => $topic_link['icon'], 'TOPIC_CLASS' => (!empty($topic_link['class_new']) ? ('topiclink' . $topic_link['class_new']) : $topic_link['class']), 'CLASS_NEW' => $topic_link['class_new'], 'NEWEST_POST_IMG' => $topic_link['newest_post_img'], 'L_NEWS' => $news_label, 'GOTO_PAGE' => $topic_pagination['base'],
/** * 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'] . '&' . POST_TOPIC_URL . '=' . $article['topic_id']), 'U_COMMENT' => append_sid(CMS_PAGE_VIEWTOPIC . '?' . POST_FORUM_URL . '=' . $article['forum_id'] . '&' . 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&' . POST_FORUM_URL . '=' . $article['forum_id'] . '&' . POST_TOPIC_URL . '=' . $article['topic_id']), 'U_PRINT_TOPIC' => append_sid('printview.' . PHP_EXT . '?' . POST_FORUM_URL . '=' . $article['forum_id'] . '&' . POST_TOPIC_URL . '=' . $article['topic_id'] . '&start=0'), 'U_EMAIL_TOPIC' => append_sid('tellafriend.' . PHP_EXT . '?topic_title=' . urlencode(ip_utf8_decode($article['topic_title'])) . '&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'])); } }
'L_DIV_HEADERS' => $dividers[$i]) ); } // Event Registration - BEGIN if (($topic_rowset[$i]['topic_reg']) && check_reg_active($topic_rowset[$i]['topic_id'])) { $template->assign_block_vars('topicrow.display_reg', array()); } // Event Registration - END if (!empty($topic_rowset[$i]['topic_desc']) && $config['show_topic_description']) { $topic_desc = censor_text($topic_rowset[$i]['topic_desc']); // Convert and clean special chars! $topic_desc = htmlspecialchars_clean($topic_desc); // SMILEYS IN TITLE - BEGIN if (($config['smilies_topic_title'] == true) && !$lofi) { $bbcode->allow_smilies = ($config['allow_smilies'] && $topic_rowset[$i]['enable_smilies'] ? true : false); $topic_desc = $bbcode->parse_only_smilies($topic_desc); } // SMILEYS IN TITLE - END $template->assign_block_vars('topicrow.switch_topic_desc', array( 'TOPIC_DESCRIPTION' => $topic_desc ) ); } if ($i == 0) {
function get_event_topics(&$events, &$number, $start_date, $end_date, $limit = false, $start = 0, $max_limit = -1, $fid = '') { global $tree, $template, $lang, $images, $user, $db, $cache, $config, $bbcode; if (!class_exists('bbcode')) { include IP_ROOT_PATH . 'includes/bbcode.' . PHP_EXT; } if (empty($bbcode)) { $bbcode = new bbcode(); } // get some parameter $topic_title_length = isset($config['calendar_title_length']) ? intval($config['calendar_title_length']) : 30; $topic_text_length = isset($config['calendar_text_length']) ? intval($config['calendar_text_length']) : 200; if ($max_limit < 0) { $max_limit = $config['topics_per_page']; } // get the forums authorized (compliency with categories hierarchy v2 mod) $cat_hierarchy = function_exists(get_auth_keys); $s_forums_ids = ''; if (!$cat_hierarchy) { // standard read $is_auth = array(); $is_auth = auth(AUTH_ALL, AUTH_LIST_ALL, $user->data); // forum or cat asked $is_ask = array(); if ($fid == 'Root' || $fid == POST_CAT_URL . 0) { $fid = ''; } if (!empty($fid)) { $type = substr($fid, 0, 1); $id = intval(substr($fid, 1)); if ($type == POST_CAT_URL) { $sql = "SELECT forum_id FROM " . FORUMS_TABLE . " WHERE parent_id = '" . $id . "'"; $result = $db->sql_query($sql); while ($row = $db->sql_fetchrow($result)) { $is_ask[$row['forum_id']] = true; } $db->sql_freeresult($result); } elseif ($type == POST_FORUM_URL) { $is_ask[$id] = true; } else { return; } } // get the list of authorized forums while (list($forum_id, $forum_auth) = each($is_auth)) { if ($forum_auth['auth_read'] && (empty($fid) || isset($is_ask[$forum_id]))) { $s_forum_ids .= (empty($s_forum_ids) ? '' : ', ') . $forum_id; } } } else { if (empty($fid) || $fid == POST_CAT_URL . 0) { $fid = 'Root'; } // get auth key $keys = array(); $keys = get_auth_keys($fid, true, -1, -1, 'auth_read'); for ($i = 0; $i < sizeof($keys['id']); $i++) { if ($tree['type'][$keys['idx'][$i]] == POST_FORUM_URL && $tree['auth'][$keys['id'][$i]]['auth_read']) { $s_forum_ids .= (empty($s_forum_ids) ? '' : ', ') . $tree['id'][$keys['idx'][$i]]; } } } // no forums authed, return if (empty($s_forum_ids)) { return; } // select topics $sql_forums_field = ''; $sql_forums_file = ''; $sql_forums_match = ''; if (!$cat_hierarchy) { $sql_forums_field = ', f.forum_name'; $sql_forums_file = ', ' . FORUMS_TABLE . ' AS f'; $sql_forums_match = ' AND f.forum_id = t.forum_id'; } $sql = "SELECT\n\t\t\t\t\tt.*,\n\t\t\t\t\tp.poster_id, p.post_username, p.post_text, p.enable_bbcode, p.enable_html, p.enable_smilies,\n\t\t\t\t\tu.username, u.user_active, u.user_color,\n\t\t\t\t\tlp.poster_id AS lp_poster_id,\n\t\t\t\t\tlu.username AS lp_username,\n\t\t\t\t\tlp.post_username AS lp_post_username,\n\t\t\t\t\tlp.post_time AS lp_post_time\n\t\t\t\t\t{$sql_forums_field}\n\t\t\tFROM " . TOPICS_TABLE . " AS t, " . POSTS_TABLE . " AS p, " . USERS_TABLE . " AS u, " . POSTS_TABLE . " AS lp, " . USERS_TABLE . " lu {$sql_forums_file}\n\t\t\tWHERE\n\t\t\t\tt.forum_id IN ({$s_forum_ids})\n\t\t\t\tAND p.post_id = t.topic_first_post_id\n\t\t\t\tAND u.user_id = p.poster_id\n\t\t\t\tAND lp.post_id = t.topic_last_post_id\n\t\t\t\tAND lu.user_id = lp.poster_id\n\t\t\t\tAND t.topic_calendar_time < {$end_date}\n\t\t\t\tAND (t.topic_calendar_time + t.topic_calendar_duration) >= {$start_date}\n\t\t\t\tAND t.topic_status <> " . TOPIC_MOVED . "\n\t\t\t\t{$sql_forums_match}\n\t\t\tORDER BY\n\t\t\t\tt.topic_calendar_time, t.topic_calendar_duration DESC, t.topic_last_post_id DESC"; $result = $db->sql_query($sql); // get the number of occurences $number = $db->sql_numrows($result); // if limit per page asked, limit the number of results if ($limit) { $db->sql_freeresult($result); $sql .= " LIMIT {$start}, {$max_limit}"; $result = $db->sql_query($sql); } $bbcode->allow_html = $user->data['user_allowhtml'] && $config['allow_html'] ? 1 : 0; $bbcode->allow_bbcode = $user->data['user_allowbbcode'] && $config['allow_bbcode'] ? 1 : 0; $bbcode->allow_smilies = $user->data['user_allowsmile'] && $config['allow_smilies'] ? 1 : 0; // read the items while ($row = $db->sql_fetchrow($result)) { // prepare the message $topic_author_id = $row['poster_id']; $topic_author = $row['poster_id'] == ANONYMOUS ? $row['post_username'] : $row['username']; $topic_time = $row['topic_time']; $topic_last_author_id = $row['lp_poster_id']; $topic_last_author = $row['lp_poster_id'] == ANONYMOUS ? $row['lp_post_username'] : $row['lp_username']; $topic_last_time = $row['lp_post_time']; $topic_views = $row['topic_views']; $topic_replies = $row['topic_replies']; $topic_icon = $row['topic_icon']; $topic_title = $row['topic_title']; $message = htmlspecialchars($row['post_text']); $topic_calendar_time = $row['topic_calendar_time']; $topic_calendar_duration = $row['topic_calendar_duration']; $topic_link = append_sid(IP_ROOT_PATH . CMS_PAGE_VIEWTOPIC . '?' . POST_TOPIC_URL . '=' . $row['topic_id']); $topic_title = censor_text($topic_title); $message = censor_text($message); $short_title = strlen($topic_title) > $topic_title_length + 3 ? substr($topic_title, 0, $topic_title_length) . '...' : $topic_title; // Convert and clean special chars! $topic_title = htmlspecialchars_clean($topic_title); $short_title = htmlspecialchars_clean($short_title); // SMILEYS IN TITLE - BEGIN if ($config['smilies_topic_title'] && !$lofi) { $topic_title = $bbcode->parse_only_smilies($topic_title); $short_title = $bbcode->parse_only_smilies($short_title); } // SMILEYS IN TITLE - END $dsp_topic_icon = ''; if (function_exists('get_icon_title')) { $dsp_topic_icon = get_icon_title($topic_icon, 0, POST_CALENDAR); } // parse the message $message = substr($message, 0, $topic_text_length); // remove HTML if not allowed if (!$config['allow_html'] && $row['enable_html']) { $message = preg_replace('#(<)([\\/]?.*?)(>)#is', "<\\2>", $message); } $message = $bbcode->parse($message); // get the date format $fmt = $lang['DATE_FORMAT_CALENDAR']; if (!empty($topic_calendar_duration)) { $fmt = $config['default_dateformat']; } // replace \n with <br /> //$message = preg_replace("/[\n\r]{1,2}/", '<br />', $message); // build the overview $sav_tpl = $template->_tpldata; $det_handler = '_overview_topic_' . $row['topic_id']; $template->set_filenames(array($det_handler => 'calendar_overview_topic.tpl')); $nav_desc = ''; if ($cat_hierarchy) { $nav_desc = make_cat_nav_tree(POST_FORUM_URL . $row['forum_id'], '', '', 'gensmall'); } else { $nav_desc = '<a href="' . append_sid(IP_ROOT_PATH . CMS_PAGE_VIEWFORUM . '?' . POST_FORUM_URL . '=' . $row['forum_id']) . '" class="gensmall">' . $row['forum_name'] . '</a>'; } $template->assign_vars(array('L_CALENDAR_EVENT' => $lang['Calendar_event'], 'L_AUTHOR' => $lang['Author'], 'L_TOPIC_DATE' => $lang['Date'], 'L_FORUM' => $lang['Forum'], 'L_VIEWS' => $lang['Views'], 'L_REPLIES' => $lang['Replies'], 'TOPIC_TITLE' => $dsp_topic_icon . ' ' . $topic_title, 'CALENDAR_EVENT' => get_calendar_title_date($topic_calendar_time, $topic_calendar_duration), 'AUTHOR' => $topic_author, 'TOPIC_DATE' => create_date($user->data['user_dateformat'], $topic_time, $config['board_timezone']), 'NAV_DESC' => $nav_desc, 'CALENDAR_MESSAGE' => $message, 'VIEWS' => $topic_views, 'REPLIES' => $topic_replies)); $template->assign_var_from_handle('_calendar_overview', $det_handler); $message = $template->_tpldata['.'][0]['_calendar_overview']; $template->_tpldata = $sav_tpl; // remove \n remaining from the template $message = preg_replace("/[\n\r]{1,2}/", '', $message); // store only the new values $new_row = array(); $new_row['event_id'] = POST_TOPIC_URL . $row['topic_id']; $new_row['event_author_id'] = $topic_author_id; $new_row['event_author'] = $topic_author; $new_row['event_author_active'] = $row['user_active']; $new_row['event_author_color'] = $row['user_color']; $new_row['event_time'] = $topic_time; $new_row['event_last_author_id'] = $topic_last_author_id; $new_row['event_last_author'] = $topic_last_author; $new_row['event_last_time'] = $topic_last_time; $new_row['event_replies'] = $topic_replies; $new_row['event_views'] = $topic_views; $new_row['event_type'] = $row['topic_type']; $new_row['event_status'] = $row['topic_status']; $new_row['event_moved_id'] = $row['topic_moved_id']; $new_row['event_last_id'] = $row['topic_last_post_id']; $new_row['event_forum_id'] = $row['forum_id']; $new_row['event_forum_name'] = $row['forum_name']; $new_row['event_icon'] = $topic_icon; $new_row['event_title'] = $topic_title; $new_row['event_short_title'] = $short_title; $new_row['event_message'] = $message; $new_row['event_calendar_time'] = $topic_calendar_time; $new_row['event_calendar_duration'] = $topic_calendar_duration; $new_row['event_link'] = $topic_link; $new_row['event_birthday'] = false; $new_row['event_txt_class'] = 'genmed'; $new_row['event_type_icon'] = '<img src="' . $images['icon_tiny_topic'] . '" style="vertical-align: bottom;" alt="" hspace="2" />'; $events[] = $new_row; } $db->sql_freeresult($result); }
function cms_block_forum_articles() { global $db, $cache, $config, $template, $images, $lang, $bbcode, $block_id, $cms_config_vars, $meta_content, $breadcrumbs; if (!class_exists('class_topics')) { include IP_ROOT_PATH . 'includes/class_topics.' . PHP_EXT; } $class_topics = new class_topics(); @(include_once IP_ROOT_PATH . ATTACH_MOD_PATH . 'displaying.' . PHP_EXT); $template->_tpldata['articles_fa.'] = array(); $index_file = !empty($_SERVER['SCRIPT_NAME']) ? $_SERVER['SCRIPT_NAME'] : getenv('SCRIPT_NAME'); $index_file = htmlspecialchars(urldecode($index_file)); while (substr($index_file, 0, 1) == '/') { $index_file = substr($index_file, 1); } if ($index_file == 'index.' . PHP_EXT) { $prefix = '?page=' . request_var('page', 0) . '&'; } else { $prefix = '?'; } $meta_content['page_title_clean'] = empty($meta_content['page_title_clean']) ? strip_tags($meta_content['page_title']) : $meta_content['page_title_clean']; $template->set_filenames(array('forum_articles_block' => 'blocks/forum_articles_block.tpl')); $title = empty($cms_config_vars['md_posts_title'][$block_id]) ? $meta_content['page_title_clean'] : htmlspecialchars_clean($cms_config_vars['md_posts_title'][$block_id]); $template->assign_vars(array('L_TITLE' => $title, 'L_POSTED' => $lang['Posted'], 'L_ANNOUNCEMENT' => $lang['Post_Announcement'], 'L_PRINT_NEWS' => $lang['News_Print'], 'L_EMAIL_NEWS' => $lang['News_Email'], 'NEWS_PRINT_IMG' => $images['news_print'], 'NEWS_EMAIL_IMG' => $images['news_email'])); // $only_auth_view must have the opposite value of $cms_config_vars['md_ignore_auth_view'][$block_id] $only_auth_view = !empty($cms_config_vars['md_ignore_auth_view'][$block_id]) || $cms_config_vars['md_ignore_auth_view'][$block_id] == true ? false : true; $single_post_id = request_var('post_id', 0); if (!empty($single_post_id)) { $fetchposts = $class_topics->fetch_posts($single_post_id, 1, 0, false, 0, true, $only_auth_view); for ($i = 0; $i < sizeof($fetchposts); $i++) { init_display_post_attachments($fetchposts[$i]['topic_attachment'], $fetchposts[$i], true, $block_id); $topic_title = htmlspecialchars_clean($fetchposts[$i]['topic_title']); $topic_link = $index_file . $prefix . 'post_id=' . $single_post_id; $template->assign_block_vars('articles_fa', array('TOPIC_ID' => $fetchposts[$i]['topic_id'], 'FORUM_ID' => $fetchposts[$i]['forum_id'], 'TITLE' => $topic_title, 'POSTER' => $fetchposts[$i]['username'], 'POSTER_CG' => colorize_username($fetchposts[$i]['user_id'], $fetchposts[$i]['username'], $fetchposts[$i]['user_color'], $fetchposts[$i]['user_active']), 'TIME' => $fetchposts[$i]['topic_time'], 'VIEWS' => $fetchposts[$i]['topic_views'], 'TEXT' => $fetchposts[$i]['post_text'], 'U_PRINT_TOPIC' => append_sid('printview.' . PHP_EXT . '?' . POST_FORUM_URL . '=' . $fetchposts[$i]['forum_id'] . '&' . POST_TOPIC_URL . '=' . $fetchposts[$i]['topic_id'] . '&is_article=1'), 'U_EMAIL_TOPIC' => append_sid('tellafriend.' . PHP_EXT . '?topic_title=' . urlencode(ip_utf8_decode($fetchposts[$i]['topic_title'])) . '&topic_url=' . urlencode(ip_utf8_decode($topic_link))))); display_attachments($fetchposts[$i]['post_id'], 'articles'); } if ($cms_config_vars['md_posts_breadcrumbs'][$block_id]) { $meta_content['page_title_clean'] = empty($meta_content['page_title_clean']) ? strip_tags($meta_content['page_title']) : $meta_content['page_title_clean']; $breadcrumbs['address'] = ''; if ($meta_content['page_title_clean'] != $config['sitename']) { $index_url = $index_file; if ($index_file == 'index.' . PHP_EXT) { $index_url .= '?page=' . request_var('page', 0); } $breadcrumbs['address'] .= $lang['Nav_Separator'] . '<a href="' . append_sid($index_url) . '">' . $meta_content['page_title_clean'] . '</a>'; } $breadcrumbs['address'] .= $lang['Nav_Separator'] . '<a href="#" class="nav-current">' . $topic_title . '</a>'; } } else { $fetchposts = $class_topics->fetch_posts($cms_config_vars['md_posts_forum_id'][$block_id], $cms_config_vars['md_num_posts'][$block_id], -1, $cms_config_vars['md_posts_show_portal'][$block_id], $cms_config_vars['md_posts_random'][$block_id], false, $only_auth_view); for ($i = 0; $i < sizeof($fetchposts); $i++) { // Convert and clean special chars! $topic_title = htmlspecialchars_clean($fetchposts[$i]['topic_title']); $template->assign_block_vars('articles_fa', array('TOPIC_ID' => $fetchposts[$i]['topic_id'], 'FORUM_ID' => $fetchposts[$i]['forum_id'], 'TITLE' => $topic_title, 'POSTER' => $fetchposts[$i]['username'], 'POSTER_CG' => colorize_username($fetchposts[$i]['user_id'], $fetchposts[$i]['username'], $fetchposts[$i]['user_color'], $fetchposts[$i]['user_active']), 'TIME' => $fetchposts[$i]['topic_time'], 'VIEWS' => $fetchposts[$i]['topic_views'], 'U_VIEW_TOPIC' => append_sid($index_file . $prefix . 'post_id=' . $fetchposts[$i]['topic_first_post_id']))); } $template->assign_vars(array('IS_LIST' => true, 'L_TOPICS' => $lang['Topics'], 'L_AUTHOR' => $lang['Author'], 'L_VIEWS' => $lang['Views'])); if ($cms_config_vars['md_posts_breadcrumbs'][$block_id]) { $breadcrumbs['address'] = ''; if ($meta_content['page_title_clean'] != $config['sitename']) { $breadcrumbs['address'] .= $lang['Nav_Separator'] . '<a href="#" class="nav-current">' . $meta_content['page_title_clean'] . '</a>'; } } } }
$news_ticker_content .= '<a href="' . $rss_channel['items'][$j]['link'] . '" target="_blank" title="'. $title .'" onmouseover="document.all.' . $news_ticker_id . '.stop();" onmouseout="document.all.' . $news_ticker_id . '.start();">' . $title . '</a>'; if($j != (sizeof($rss_channel['items']) - 1)) { $news_ticker_content .= ' » '; } } } else { $item_count = 1; $news_ticker_content = 'There are no articles in this feed.'; } } $rss_channel_title = (empty($rss_channel['title']) ? 'No Source Info Available' : ('<a href="' . $rss_channel['link'] . '" target="_blank">' . htmlspecialchars_clean(ip_utf8_decode(strip_tags($rss_channel['title']))) . '</a>')); $template->assign_block_vars('switch_news_ticker.news_ticker_row', array( 'XS_NEWS_TICKER_FROM' => $rss_channel_title, 'XS_NEWS_TICKER_ID' => $news_ticker_id, 'XS_NEWS_TICKER_WIDTH' => $xml_width, 'XS_NEWS_TICKER_HEIGHT' => $xml_height, 'XS_NEWS_TICKER_FONTSIZE' => (($xml_font == 0) ? '' : 'style="font-size: ' . intval($xml_font) . 'px;"'), 'XS_NEWS_TICKER_SPEED' => $xml_speed, 'XS_NEWS_TICKER_SCROLL_DIR' => $xml_dir, 'XS_NEWS_TICKER_CONTENTS' => $news_ticker_content, 'XS_NEWS_TICKER_COLSPAN' => '', ) ); $template->assign_block_vars('switch_news_ticker.news_ticker_row.switch_show_feed', array()); }
// Loop through the posts (even though there is only one) for($i = 0; $i < $total_posts; $i++) { $poster_id = $postrow[$i]['user_id']; $poster = $postrow[$i]['username']; $post_date = create_date($config['default_dateformat'], $postrow[$i]['post_time'], $config['board_timezone']); $post_subject = ($postrow[$i]['post_subject'] != '') ? $postrow[$i]['post_subject'] : ''; $message = $postrow[$i]['post_text']; $post_subject = censor_text($post_subject); $message = censor_text($message); // Convert and clean special chars! $post_subject = htmlspecialchars_clean($post_subject); // SMILEYS IN TITLE - BEGIN if (($config['smilies_topic_title'] == true) && !$lofi) { $bbcode->allow_smilies = ($config['allow_smilies'] && $postrow[$i]['enable_smilies'] ? true : false); $post_subject = $bbcode->parse_only_smilies($post_subject); } // SMILEYS IN TITLE - END // Mighty Gorgon - New BBCode Functions - BEGIN $bbcode->allow_html = (($config['allow_html'] && $user->data['user_allowhtml']) || $config['allow_html_only_for_admins']) && $postrow[$i]['enable_html']; $bbcode->allow_bbcode = $config['allow_bbcode'] && $user->data['user_allowbbcode'] && $postrow[$i]['enable_bbcode']; $bbcode->allow_smilies = $config['allow_smilies'] && empty($lofi) && $postrow[$i]['enable_smilies']; if(preg_match('/\[code/i', $message))
function make_cat_nav_tree($cur, $pgm = '', $meta_content = '', $nav_class = 'nav') { global $tree, $config, $user, $db, $nav_separator; global $global_orig_word, $global_replacement_word; $nav_separator = empty($nav_separator) ? empty($lang['Nav_Separator']) ? ' » ' : $lang['Nav_Separator'] : $nav_separator; // Settings this to false will add the topic title to breadcrumbs $skip_topics = true; $kb_mode_append = ''; $kb_mode_var = request_var('kb', ''); if (!empty($kb_mode_var) && !$user->data['is_bot']) { if ($kb_mode_var == 'on') { $kb_mode_append = '&kb=on'; } elseif ($kb_mode_var == 'off') { $kb_mode_append = '&kb=off'; } } // get topic or post level $type = substr($cur, 0, 1); $id = intval(substr($cur, 1)); $topic_title = ''; $fcur = ''; if ($type == POST_TOPIC_URL || $type == POST_POST_URL) { if ($type == POST_TOPIC_URL) { $sql_where = " WHERE t.topic_id = " . $id . " LIMIT 1"; } elseif ($type == POST_POST_URL) { $sql_from = ", " . POSTS_TABLE . " p"; $sql_where = " WHERE t.topic_id = p.topic_id AND p.post_id = " . $id . " LIMIT 1"; } if (empty($meta_content['forum_id']) || empty($meta_content['topic_title'])) { $sql = "SELECT t.forum_id, t.topic_title, t.title_compl_infos\n\t\t\t\t\t\t\tFROM " . TOPICS_TABLE . " t" . $sql_from . $sql_where; $result = $db->sql_query($sql); if ($row = $db->sql_fetchrow($result)) { $meta_content['forum_id'] = $row['forum_id']; $meta_content['topic_title'] = $row['topic_title']; $meta_content['title_compl_infos'] = $row['title_compl_infos']; } $db->sql_freeresult($result); } $fcur = POST_FORUM_URL . $meta_content['forum_id']; $topic_title = (empty($meta_content['title_compl_infos']) ? '' : $meta_content['title_compl_infos'] . ' ') . $meta_content['topic_title']; $topic_title = censor_text($topic_title); } // keep the compliancy with prec versions if (!isset($tree['keys'][$cur])) { $cur = isset($tree['keys'][POST_CAT_URL . $cur]) ? POST_CAT_URL . $cur : $cur; } // find the object $CH_this = isset($tree['keys'][$cur]) ? $tree['keys'][$cur] : -1; $res = ''; $cur_file_path_parts = pathinfo($_SERVER['SCRIPT_NAME']); $cur_filename = substr($cur_file_path_parts['basename'], 0, 5); $filenames_to_exclude = array('posti'); // Convert and clean special chars! $topic_title = htmlspecialchars_clean($topic_title); while ($CH_this >= 0 || $fcur != '') { $type = substr($fcur, 0, 1) != '' ? substr($cur, 0, 1) : $tree['type'][$CH_this]; $is_topic = false; switch ($type) { case POST_CAT_URL: $field_name = get_object_lang($cur, 'name'); $param_type = POST_CAT_URL; $param_value = $tree['id'][$CH_this]; $pgm_name = CMS_PAGE_FORUM; break; case POST_FORUM_URL: $field_name = get_object_lang($cur, 'name'); $param_type = POST_FORUM_URL; $param_value = $tree['id'][$CH_this]; $pgm_name = CMS_PAGE_VIEWFORUM; break; case POST_TOPIC_URL: $is_topic = true; $field_name = $topic_title; $param_type = POST_TOPIC_URL; $param_value = $id; $pgm_name = CMS_PAGE_VIEWTOPIC; break; case POST_POST_URL: $is_topic = true; $field_name = $topic_title; $param_type = POST_POST_URL; $param_value = $id . '#p' . $id; $pgm_name = CMS_PAGE_VIEWTOPIC; break; default: $field_name = ''; $param_type = ''; $param_value = ''; $pgm_name = CMS_PAGE_FORUM; break; } if ($pgm != '') { $pgm_name = $pgm . '.' . PHP_EXT; } //Dynamic Class Assignment - BEGIN $k = empty($k) ? 1 : $k + 1; $process_res = false; if ($k == 1) { $process_res = $skip_topics && $is_topic ? false : true; $res_class = !in_array($cur_filename, $filenames_to_exclude) ? 'nav-current' : 'nav'; } else { if (!empty($field_name) && $fcur == '') { $process_res = true; $res_class = $nav_class; } } //Dynamic Class Assignment - END if ($process_res) { $res = '<a href="' . append_sid($pgm_name . ($field_name != '' ? '?' . $param_type . '=' . $param_value . $kb_mode_append : '')) . '" class="' . $res_class . '">' . $field_name . '</a>' . ($res != '' ? $nav_separator . $res : ''); } // find parent object if ($fcur != '') { $cur = $fcur; $pgm = ''; $fcur = ''; $topic_title = ''; } else { $cur = $tree['main'][$CH_this]; } $CH_this = isset($tree['keys'][$cur]) ? $tree['keys'][$cur] : -1; } return $res; }
function cms_block_rss() { global $db, $cache, $config, $template, $lang, $block_id, $cms_config_vars; global $rss_channel, $currently_writing, $main, $item_counter; include_once IP_ROOT_PATH . 'includes/functions_xs_useless.' . PHP_EXT; $xml_id = 'rss_' . $block_id; // $xml_feed = "http://news.bbc.co.uk/rss/newsonline_uk_edition/front_page/rss091.xml"; $xml_feed = xsm_unprepare_message($cms_config_vars['md_rss_feeder'][$block_id]); $xml_title = $cms_config_vars['md_rss_title'][$block_id]; $xml_style = $cms_config_vars['md_rss_style'][$block_id]; $xml_scroll = $cms_config_vars['md_rss_scroll'][$block_id]; $xml_speed = '3'; if ($xml_style) { $xml_dir = 'left'; } else { $xml_dir = 'up'; } if ($xml_scroll) { $xml_marquee_start = '<marquee name="' . $xml_id . '" id="' . $xml_id . '" behavior="scroll" direction="' . $xml_dir . '" scrollamount="' . $xml_speed . '" loop="true" onmouseover="this.stop()" onmouseout="this.start()">'; $xml_marquee_end = '</marquee>'; $xml_marquee_append = ' onmouseover="document.all.' . $xml_id . '.stop();" onmouseout="document.all.' . $xml_id . '.start();"'; } else { $xml_marquee_start = ''; $xml_marquee_end = ''; $xml_marquee_append = ''; } $rss_channel = array(); $currently_writing = ''; $main = ''; $item_counter = 0; $xml_feed_error = false; $xml_error = false; $xml_error_msg = ''; if (empty($xml_feed)) { $xml_feed_error = true; $xml_error_msg = 'No XML Feed URL'; } $xml_parser = xml_parser_create(); xml_set_element_handler($xml_parser, 'startElement', 'endElement'); xml_set_character_data_handler($xml_parser, 'characterData'); if (!$xml_feed_error) { if ($fp = @fopen($xml_feed, 'r')) { while ($xml_buffer = @fread($fp, 4096)) { if (!xml_parse($xml_parser, $xml_buffer, feof($fp))) { $xml_error = true; $xml_error_msg = sprintf("XML error: %s at line %d", xml_error_string(xml_get_error_code($xml_parser)), xml_get_current_line_number($xml_parser)); } } xml_parser_free($xml_parser); $rss_ticker_content = ''; $item_count = 0; if (isset($rss_channel['items'])) { if (sizeof($rss_channel['items']) > 0) { $item_count = sizeof($rss_channel['items']); for ($j = 0; $j < $item_count; $j++) { $title = htmlspecialchars_clean(ip_utf8_decode(strip_tags($rss_channel['items'][$j]['title']))); $rss_ticker_content .= ' • <a href="' . $rss_channel['items'][$j]['link'] . '" target="_blank" title="' . $title . '"' . $xml_marquee_append . '><b>' . $title . '</b></a>'; if (!$xml_style && !$xml_scroll) { $rss_ticker_content .= '<br />'; } elseif (!$xml_style) { $rss_ticker_content .= '<br /><br />'; } } } else { $item_count = 1; $rss_ticker_content = 'There are no articles in this feed.'; } } $rss_channel_title = empty($rss_channel['title']) ? 'No Source Info Available' : '<a href="' . $rss_channel['link'] . '" target="_blank">' . htmlspecialchars_clean(ip_utf8_decode(strip_tags($rss_channel['title']))) . '</a>'; $xml_title = !empty($xml_title) ? $xml_title : $rss_channel_title; $template->assign_vars(array('RSS_TICKER_ID' => $xml_id, 'RSS_TICKER_FROM' => $xml_title, 'RSS_TICKER_CONTENTS' => $xml_marquee_start . $rss_ticker_content . $xml_marquee_end, 'RSS_TICKER_COLSPAN' => '')); } else { $xml_error = true; $xml_error_msg = 'Unable to open the XML input'; } } if ($xml_error || $xml_feed_error) { $template->assign_block_vars(array('RSS_TICKER_ID' => $xml_id, 'RSS_TICKER_FROM' => $xml_error_msg, 'RSS_TICKER_CONTENTS' => '<b>' . $xml_error_msg . '</b>: ' . $xml_feed, 'RSS_TICKER_COLSPAN' => 'colspan="2"')); } }