function get_content($forum, $topic) { global $db, $user, $phpbb_root_path, $config, $template, $phpEx; $search_limit = 1; $bbcode_bitfield = ''; $forum_id = array($forum); $topic_id = array($topic); $forum_id_where = create_where_clauses($forum_id, 'forum'); $topic_id_where = create_where_clauses($topic_id, 'topic'); $posts_ary = array('SELECT' => 'p.*, t.*, u.username, u.user_colour', 'FROM' => array(POSTS_TABLE => 'p'), 'LEFT_JOIN' => array(array('FROM' => array(USERS_TABLE => 'u'), 'ON' => 'u.user_id = p.poster_id'), array('FROM' => array(TOPICS_TABLE => 't'), 'ON' => 'p.topic_id = t.topic_id')), 'WHERE' => str_replace(array('WHERE ', 'topic_id'), array('', 't.topic_id'), $topic_id_where) . ' AND t.topic_status <> ' . ITEM_MOVED . ' AND t.topic_approved = 1', 'ORDER_BY' => 'p.post_id DESC'); $posts = $db->sql_build_query('SELECT', $posts_ary); $posts_result = $db->sql_query_limit($posts, $search_limit); while ($posts_row = $db->sql_fetchrow($posts_result)) { $topic_title = $posts_row['topic_title']; $post_author = get_username_string('full', $posts_row['poster_id'], $posts_row['username'], $posts_row['user_colour']); $post_date = $user->format_date($posts_row['post_time']); $post_link = append_sid("{$phpbb_root_path}viewtopic.{$phpEx}", "p=" . $posts_row['post_id'] . "#p" . $posts_row['post_id']); $post_text = nl2br($posts_row['post_text']); $bbcode = new bbcode(base64_encode($bbcode_bitfield)); $bbcode->bbcode_second_pass($post_text, $posts_row['bbcode_uid'], $posts_row['bbcode_bitfield']); $post_text = smiley_text($post_text); $info = array('TOPIC_TITLE' => '<a href="' . $post_link . '">' . censor_text($topic_title) . '</a>', 'POST_AUTHOR' => $post_author, 'POST_DATE' => $post_date, 'POST_LINK' => '<a href="' . $post_link . '"><img src="./images/extras/link-url.png"></a> ', 'POST_TEXT' => censor_text($post_text)); /* $template->assign_block_vars('web_pages', array( 'TOPIC_TITLE' => censor_text($topic_title), 'POST_AUTHOR' => $post_author, 'POST_DATE' => $post_date, 'POST_LINK' => $post_link, 'POST_TEXT' => censor_text($post_text), )); */ } // we could return an array with all the info ?? //$topic_title = censor_text($topic_title); //return($post_text); return $info; }
} else { define('IN_PHPBB', true); $phpbb_root_path = defined('PHPBB_ROOT_PATH') ? PHPBB_ROOT_PATH : '../forums/'; $phpEx = substr(strrchr(__FILE__, '.'), 1); include $phpbb_root_path . 'common.' . $phpEx; include $phpbb_root_path . 'includes/bbcode.' . $phpEx; include $phpbb_root_path . 'includes/functions_display.' . $phpEx; // Start session management $user->session_begin(); $auth->acl($user->data); $user->setup('viewforum'); $search_limit = 4; $forum_id = array(4, 14, 17, 18, 21, 6, 8, 10, 11, 20, 13); $forum_id_where = create_where_clauses($forum_id, 'forum'); $topic_id = array(); $topic_id_where = create_where_clauses($topic_id, 'topic'); print '<h1>New Forum Topics</h1>'; $topics = 'SELECT * FROM ' . TOPICS_TABLE . ' ' . $forum_id_where . ' AND topic_status <> ' . ITEM_MOVED . ' AND topic_approved = 1 ORDER BY topic_id DESC '; $topics_result = $db->sql_query_limit($topics, $search_limit); while ($topics_row = $db->sql_fetchrow($topics_result)) { $topic_title = $topics_row['topic_title']; $topic_author = get_username_string('full', $topics_row['topic_poster'], $topics_row['topic_first_poster_name'], $topics_row['topic_first_poster_colour']); $topic_date = $user->format_date($topics_row['topic_time']); $topic_last_post = append_sid("{$phpbb_root_path}viewtopic.{$phpEx}", "p=" . $topics_row['topic_last_post_id'] . "#" . $topics_row['topic_last_post_id']); $topic_last_author = get_username_string('full', $topics_row['topic_last_poster_id'], $topics_row['topic_last_poster_name'], $topics_row['topic_last_poster_colour']); $topic_link = append_sid("{$phpbb_root_path}viewtopic.{$phpEx}", "t=" . $topics_row['topic_id']); print '<div class="Entry" id="ForumEntry">'; print '<span class="EntryTitle"><a class="topicTitle" href="' . $topic_link . '">' . $topic_title . '</a></span><br />'; print ' Last post by: ' . $topic_last_author . ' <br />'; print ' ' . $topic_date . '<br />'; print '</div>';