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 posts foreach($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(); ?>