<?
include("newposts.php");
?>
In a separate file called 'newposts.php' I have the below code. You will need to replace 'fedforum' to your own forum path
Code: Select all
<?php
/**
* newest_posts - raw dump of newest posts from forum
*
* @copyright (c) 2008 ameeck / Vojtech Vondra - phpBB.cz
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*/
define('IN_PHPBB', true);
$phpbb_root_path = 'fedforum/';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
// Start session management
//$user->session_begin();
//$auth->acl($user->data);
//$user->setup();
// Number of posts and grabbing permissions
// Pocet prspevku pro zobrazen a oprvnen
$topic_limit = request_var('topic_limit', 5);
$forums = array_unique(array_keys($auth->acl_getf('f_read', true))); //ignored in sql statement to include all topics despite permissions
// Select the last topics based on user permissions
/* $sql = 'SELECT p.post_id, p.topic_id, p.forum_id, p.post_subject, p.post_time, u.username
FROM ' . POSTS_TABLE . ' p , ' . USERS_TABLE . ' u
WHERE post_approved = 1
AND ' . $db->sql_in_set('forum_id', $forums) . '
AND u.user_id = p.poster_id
ORDER BY post_time DESC
LIMIT 0,' . $topic_limit;
$result = $db->sql_query($sql); */
// Select the last topics ignoring permissions
// Vybrat posledn tmata ke kterm mme oprvnen
$sql = 'SELECT p.post_id, p.topic_id, p.forum_id, p.post_subject, p.post_time, u.username
FROM ' . POSTS_TABLE . ' p , ' . USERS_TABLE . ' u
WHERE post_approved = 1
AND u.user_id = p.poster_id
ORDER BY post_time DESC
LIMIT 0,' . $topic_limit;
$result = $db->sql_query($sql);
// Proper header since output not buffered
// Poslat hlavicky pro sprvn kdovn, protoe vpis obsahu je postupn
// header('Content-Type: text/html; charset=utf-8');
// Now let's output the content
// A ted vypsat obsah
// echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Last Topics</title></head><body><div id="post_content"><strong>Last Topics:</strong><br/><ul>';
while ($row = $db->sql_fetchrow($result))
{
$url = generate_board_url() . "/viewtopic.{$phpEx}?f={$row['forum_id']}&t={$row['topic_id']}&p={$row['post_id']}#p{$row['post_id']}"; //added fedforum to url
//old line $url = generate_board_url() . "viewtopic.{$phpEx}?f={$row['forum_id']}&t={$row['topic_id']}&p={$row['post_id']}#p{$row['post_id']}";
echo '<tr><td colspan=\"2\"><a target="_blank" href="' . $url . '">' . $row['post_subject'] . '</a>, ' . ucwords($row['username']) . ', ' . date("d/m Hi",$row['post_time']).'hrs</td></tr>';
}
echo '</div></body></html>';
?>
Hope that helps.
Paul