<?php
/* Forum Article Block */
/* Written By: gotcha - http://nukecoder.com */
/* Reworked By: warren the ape */
/* Released August 2007, updated May 2008 */
/* 2008 (c) NukeCoder.com */
if ( !defined('BLOCK_FILE') ) {
Header("Location: ../index.php");
die();
}
//CONFIGURATION//
$selectForum = '1'; //Insert the forum ID. Get it from the forum link
$forumMaxLength = '20'; //Max character length for topic links
$nameMaxLength = '10'; //Max character length for username
$post_image = "images/page_white.gif"; //Article icon link
$more_image = "images/page_white_more.gif"; //View more icon link
//NO NEED TO EDIT BELOW THIS LINE//
//-------------------------------//
define("_BBFORUM_TOTTOPICS","Topics ");
define("_BBFORUM_TOTPOSTS","Posts ");
define("_BBFORUM_TOTVIEWS","Views ");
define("_BBFORUM_TOTREPLIES","Replies ");
define("_BBFORUM_TOTMEMBERS","Members");
define("_BBFORUM_FORUM","Forums");
define("_BBFORUM_SEARCH","Search");
global $prefix, $user_prefix, $db, $user, $cookie, $group_id;
$content .= '
<div>
';
$sql = "SELECT
t.topic_id, t.topic_first_post_id, t.topic_title, f.forum_name,
f.forum_id, u.username, u.user_id, p.poster_id, p.post_time FROM
".$prefix."_bbtopics t, ".$prefix."_bbforums f,
".$prefix."_bbposts p, ".$user_prefix."_users u WHERE
p.post_id = t.topic_first_post_id AND u.user_id = p.poster_id
AND t.forum_id=f.forum_id AND f.auth_view=0 AND f.forum_id= $selectForum
ORDER BY t.topic_first_post_id DESC
LIMIT 5";
$result1 = $db->sql_query($sql);
while(list($topic_id, $topic_first_post_id, $topic_title, $forum_name, $forum_id, $username, $user_id, $poster_id, $post_time) = $db->sql_fetchrow($result1))
{
$topicTitleModified = strlen($topic_title)<$forumMaxLength?$topic_title:substr($topic_title,0,$forumMaxLength).'...';
$userNameModified = strlen($username)<$nameMaxLength?$username:substr($username,0,$nameMaxLength).'..';
$content .= '
<div style="padding-top: 12px;">
<img src="'.$post_image.'" alt="" align="top" />
<a href="modules.php?name=Forums&file=viewtopic&t='.$topic_id.'" title="'.$topic_title.'"><strong>'.$topicTitleModified.'</strong></a><br />
<span style="display:block;padding-top:2px;">'.date("d-m-Y", $post_time).', by
<a href="modules.php?name=Forums&file=profile&mode=viewprofile&u='.$user_id.'" title="View Profile: '.$username.'">'.$userNameModified.'</a></span>
</div>
';
}
$content .= '
</div>
<div style="float:right;padding:8px 4px 8px 0px;">
<a href="modules.php?name=Forums&file=viewforum&f='.$selectForum.'"><strong>View More</strong></a> <img src="'.$more_image.'" alt="" align="top" /></div>
';
?> |