Code: Selecteer alles
<?php
// Aantal topics om te tonen
define("TOPIC_COUNT", 10);
// Pad naar directory
define("PHPBB_PATH", "../forum/");
// URL naar phpBB 2 dir
define("PHPBB_LOCATION", "http://www.treinenplace.nl/forum/");
// Tijdformaat in PHP date()
define("TIME_FORMAT", "H:i");
// includeer de meuk
$phpbb_root_path = PHPBB_PATH;
if ( !defined('IN_PHPBB') )
{
define('IN_PHPBB', true);
include(PHPBB_PATH . 'extension.inc');
include(PHPBB_PATH . 'config.'.$phpEx);
include(PHPBB_PATH . 'includes/constants.'.$phpEx);
include(PHPBB_PATH . 'includes/db.'.$phpEx);
}
// sql statement to fetch active topics van public forums
$sql = "SELECT DISTINCT t.topic_title, t.topic_last_post_id, p.post_time, f.forum_name
FROM " . TOPICS_TABLE . " AS t, " . POSTS_TABLE . " AS p, " . FORUMS_TABLE . " AS f
WHERE
t.forum_id = f.forum_id
AND f.auth_view = " . AUTH_ALL . "
AND p.topic_id = t.topic_id
AND p.post_id = t.topic_last_post_id
ORDER BY p.post_time DESC LIMIT " . TOPIC_COUNT;
$nt_result = $db->sql_query($sql);
if(!$nt_result)
{
die("Failed obtaining list of active topics".mysql_error());
}
else
{
$nt_data = $db->sql_fetchrowset($af_result);
}
if ( count($nt_data) == 0 )
{
die("No topics found");
}
else
{
/// functie om strings op te kappen ////
function breekaf($variabele) {
if(strlen($variabele) > 24) {
$variabele = substr($variabele,0,24) ."..";
}
else {
}
return $variabele;
}
////// functie einde! /////////
// $nt_data contains all interesting data
for ($i = 0; $i < count($nt_data); $i++)
{
$title = $nt_data[$i]['topic_title'];
$url = PHPBB_LOCATION . 'viewtopic.' . $phpEx . "?" . POST_POST_URL . "=" . $nt_data[$i]['topic_last_post_id'] . "#" . $nt_data[$i]['topic_last_post_id'];
$on_forum = '- ' . $nt_data[$i]['forum_name'] . ' forum';
$post_time = date(TIME_FORMAT, $nt_data[$i]['post_time']);
?>
<li><?php echo $post_time; ?> -
<a href="<?php echo $url; ?>" title="<?php echo "$title $on_forum"; ?>"><?php echo(breekaf("$title")); ?></a></li>
<?php
}
}
?>

Wie kan dit inhacken
