All pastes #595768 Raw Edit

Miscellany

public php v1 · immutable
#595768 ·published 2007-06-29 17:24 UTC
rendered paste body
<?php/*** @ignore*/define('FORUM_ID', 2);define('POST_LIMIT', 5);define('IN_PHPBB', true);$phpbb_root_path = './forum/';$phpEx = substr(strrchr(__FILE__, '.'), 1);include($phpbb_root_path . 'common.' . $phpEx);include($phpbb_root_path . 'includes/functions_display.' . $phpEx);// Start session management$user->session_begin(false);$auth->acl($user->data);// Grab user preferences$user->setup();$query = "SELECT u.user_id, u.username, t.topic_title, t.topic_poster, t.forum_id, t.topic_id, t.topic_time, t.topic_replies, t.topic_first_post_id, p.poster_id, p.topic_id, p.post_id, p.post_text, p.bbcode_bitfield, p.bbcode_uid FROM ".USERS_TABLE." u, ".TOPICS_TABLE." t, ".POSTS_TABLE." p WHERE u.user_id = t.topic_poster AND u.user_id = p.poster_id AND t.topic_id = p.topic_id AND p.post_id = t.topic_first_post_id AND t.forum_id = ".FORUM_ID." ORDER BY t.topic_time DESC";$result = $db->sql_query_limit($query, POST_LIMIT);$posts = array();$poster_id = 0;while ($r = $db->sql_fetchrow($result)){    $posts[] = array(            'topic_id' => $r['topic_id'],            'topic_time' => $r['topic_time'],             'topic_title' => $r['topic_title'],             );}// Output the postsforeach($posts as $m){	$template->assign_block_vars('news', array(        'topic_id' => $m['topic_id'],        'topic_time' => $user->format_date($m['topic_time']),         'topic_title' => $m['topic_title'],            'forum_id' => FORUM_ID            )    );     unset($message,$poster_id);}page_header('page title');$template->set_filenames(array(    'body' => 'portal.html'));page_footer();?>