Код:
<?php
if (!defined('BLOCK_FILE')) {
Header("Location: ../index.php");
exit;
}
global $prefix, $db;
$forum_url = "forum"; //название папки в которой лежит форум
$forum_id = ""; // здесь вы можите указать id форума которого вы не хотите показывать в этом блоке.
$limit = "8"; //сколько отображать тем в блоке
$txtlimit = "30"; // сколько симвоолов будет показазано из названия тем
$tableprefix ="vb_"; // prefix вашей базы vb
@include_once("$forum_url/includes/config.php");
if ($forum_id) {
$forumid = "AND forumid=$forum_id";
}
if(_SNSS_LANG == "ru") {
define("_FB_TOPIC","<b>Последние темы форума</b>");
define("_FB_AUTHOR","<b>АвТоР</b>");
define("_FB_VIEW","<b>Пр.</b>");
define("_FB_REPLY","<b>От.</b>");
define("_FB_LAST","<b>Ответил</b>");
define("_FB_INFORM","Информация пользователя");
} else {
define("_FB_TOPIC","<b>Последние темы форума</b>");
define("_FB_AUTHOR","<b>АвТоР</b>");
define("_FB_VIEW","<b>Пр.</b>");
define("_FB_REPLY","<b>От.</b>");
define("_FB_LAST","<b>Ответил</b>");
define("_FB_INFORM","Информация пользователя");
}
if ($limit) {
$limited = "LIMIT $limit";
}
$content .="<table border=\"0\" width=\"100%\" cellspacing=\"1\" cellpadding=\"0\"><tr>";
$content .="<td width=\"60%\" class=\"block-title\" align=\"center\">"._FB_TOPIC."</th><td width=\"15%\" class=\"block-title\" align=\"center\">"._FB_AUTHOR."</th>\n";
$content .="<td width=\"5%\" class=\"block-title\" align=\"center\">"._FB_VIEW."</th><td width=\"5%\" class=\"block-title\" align=\"center\">"._FB_REPLY."</th>\n";
$content .="<td width=\"15%\" class=\"block-title\" align=\"center\">"._FB_LAST."</td></tr></table>\n";
$thread_sql = $db->sql_query("SELECT threadid,title,lastpost,lastposter,postusername,po stuserid,forumid,replycount,views FROM ".$tableprefix."thread WHERE visible=1 AND open=1 $forumid ORDER BY lastpost DESC $limited");
while($thread_get=$db->sql_fetchrow($thread_sql))
{
$lastpost = $thread_get['lastpost'];
$poster = $thread_get['lastposter'];
$firstposter = $thread_get['postusername'];
$tid = $thread_get['threadid'];
$for = $thread_get['forumid'];
$replycount = $thread_get['replycount'];
$views = $thread_get['views'];
$psql = $db->sql_query("SELECT postid FROM ".$tableprefix."post WHERE threadid=$tid ORDER BY postid DESC");
$getp=$db->sql_fetchrow($psql);
$pid = $getp['postid'];
$date2 = date ("d/m/y G:i" ,$lastpost);
$title = $thread_get['title'];
$title = substr($title,0,$txtlimit);
$content .="<table width=\"100%\"><tr><td width=\"60%\"><a href=\"$forum_url/showthread.php?p=$pid#post$pid\">$title</a></td>\n";
$content .="<td width=\"15%\" align=\"center\"><a href=\"$forum_url/member.php?u=$thread_get[postuserid]\" title=\""._FB_INFORM."\">$firstposter</a></td>\n";
$content .="<td width=\"5%\" align=\"center\">$views</td>\n";
$content .="<td width=\"5%\" align=\"center\">$replycount</td>\n";
$content .="<td width=\"15%\" align=\"center\">$poster</td></tr>\n";
}
$content .= "</table>";
?>