Hm nachdem ich darüber nicht einschlafen konnte, habe ich mich nochmal rangesetzt und das ist dabei raus gekommen:
Das Script kann irgendwo auf den Server gelegt werden.
Z.b. als lastposts.php - man muss lediglich den $phpbb_root_path anpassen.
Es werden die für den User speziell sichtbaren Themen/Posts gezeigt (Für den fall, dass er nicht eingeloggt ist, wird er natürlich nur wie ein Gast behandelt).
Verbesserungsvorschläge: gerne

Beispielaufruf ist unten drunter.
Code: Alles auswählen
<?
/**
* phpBB3 - last active topics
*
* @author: combuster
* @since: 06.01.2008
*/
//***************** BEGIN LAST ACTIVE TOPICS *****************//
function get_last_topics($limit = 10, $path = './')
{
global $phpbb_root_path, $phpEx, $user, $auth, $cache, $db, $config;
$phpbb_root_path = $path;;
define('IN_PHPBB', 1);
$phpEx = substr(strrchr(__FILE__, '.'), 1);
// Include files
require($phpbb_root_path . 'config.' . $phpEx);
require($phpbb_root_path . 'includes/acm/acm_'. $acm_type . '.' . $phpEx);
require($phpbb_root_path . 'includes/cache.' . $phpEx);
require($phpbb_root_path . 'includes/session.' . $phpEx);
require($phpbb_root_path . 'includes/auth.' . $phpEx);
require($phpbb_root_path . 'includes/functions.' . $phpEx);
require($phpbb_root_path . 'includes/constants.' . $phpEx);
require($phpbb_root_path . 'includes/db/' . $dbms . '.' . $phpEx);
require($phpbb_root_path . 'includes/utf/utf_tools.' . $phpEx);
// Instantiate some basic classes
$user = new user();
$auth = new auth();
$cache = new cache();
$db = new $sql_db();
// Connect to DB
$db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false, defined('PHPBB_DB_NEW_LINK') ? PHPBB_DB_NEW_LINK : false);
// We do not need this any longer, unset for safety purposes
unset($dbpasswd);
// Grab global variables, re-cache if necessary
$config = $cache->obtain_config();
// Start session management
$user->session_begin();
$auth->acl($user->data);
// Get forums
$forum_ary = array();
$forum_read_ary = $auth->acl_getf('f_read');
foreach ($forum_read_ary as $forum_id => $allowed)
{
if ($allowed['f_read'])
{
$forum_ary[] = (int) $forum_id;
}
}
// Remove double entries
$forum_ary = array_unique($forum_ary);
// Get sql-source for where-clause
$forum_sql = (sizeof($forum_ary)) ? $db->sql_in_set('t.forum_id', $forum_ary, false) : $db->sql_in_set('t.forum_id', '0', false);
// Select last active topics
$sql = "SELECT *
FROM " . TOPICS_TABLE . " as t
WHERE topic_approved = '1'
AND $forum_sql
ORDER BY topic_last_post_time DESC
LIMIT 0, $limit";
$result = $db->sql_query($sql);
// Generate string with last active topics
$str = "";
while ($row = $db->sql_fetchrow($result)) {
extract($row);
$str .= '<a href="'.$phpbb_root_path."/viewtopic.php?f=$forum_id&t=$topic_id".'" target="_blank">'.utf8_decode($topic_title)."</a><br/><b>views</b>: $topic_views, <b>replies</b>: $topic_replies, <b>first poster</b>: ".utf8_decode($topic_first_poster_name).', <b>last poster</b>: '.utf8_decode($topic_last_poster_name).'<br/>';
}
$db->sql_freeresult($result);
// Return last active topics
return $str;
}
//***************** END LAST ACTIVE TOPICS *****************//
// Example:
// Display the last 5 active topics from the phpBB3 located at "forum/phpBB3/"
echo get_last_topics(5, "forum/phpBB3/");
?>
Man muss ein bischen aufpassen wo man die Funktion benutzt, da die globalen Variablen überschrieben werden. Allerdings muss man sie global machen, damit die phpBB Scripte drauf zugreifen können. Wäre kewl, wenn da jemand ne bessere Lösung hätte!
comb