";
$NEWFORUMPOSTSTYLE_MAIN = "
";
$NEWFORUMPOSTSTYLE_FOOTER = "
";
}
$results = $sql->db_Select_gen("
SELECT t.thread_id, t.thread_name, t.thread_datestamp, t.thread_user, t.thread_views, t.thread_lastpost, t.thread_lastuser, t.thread_total_replies, t.thread_active, t.thread_s, f.forum_id, f.forum_name, f.forum_class, u.user_name, fp.forum_class, lp.user_name AS lp_name
FROM #forum_thread AS t
LEFT JOIN #user AS u ON SUBSTRING_INDEX(t.thread_user,'.',1) = u.user_id
LEFT JOIN #user AS lp ON SUBSTRING_INDEX(t.thread_lastuser,'.',1) = lp.user_id
LEFT JOIN #forum AS f ON f.forum_id = t.thread_forum_id
LEFT JOIN #forum AS fp ON f.forum_parent = fp.forum_id
WHERE f.forum_id = t.thread_forum_id AND t.thread_parent=0 AND f.forum_class IN (".USERCLASS_LIST.")
AND fp.forum_class IN (".USERCLASS_LIST.")
ORDER BY t.$query DESC LIMIT 0, ".$pref['nfp_amount']);
$forumArray = $sql->db_getList();
if(!isset($gen) || !is_object($gen))
{
$gen = new convert;
}
/* // Deprecated method to indicate new forum posts
if(is_readable(THEME."forum/new_small.png"))
{
$ICON = "";
}
else
{
$ICON = "";
}
*/
$TOTAL_TOPICS = $sql->db_Count("forum_thread", "(*)", " WHERE thread_parent='0' ");
$TOTAL_REPLIES = $sql->db_Count("forum_thread", "(*)", " WHERE thread_parent!='0' ");
$sql->db_Select_gen("SELECT sum(thread_views) FROM #forum_thread");
$tmp = $sql->db_Fetch();
$TOTAL_VIEWS = $tmp[0];
$text = preg_replace("/\{(.*?)\}/e", '$\1', $NEWFORUMPOSTSTYLE_HEADER);
foreach ($forumArray as $forumInfo)
{
extract($forumInfo);
$r_datestamp = $gen->convert_date($thread_lastpost, "forum");
if($thread_total_replies)
{
$tmp = explode(".", $thread_lastuser, 2);
if($lp_name)
{
$LASTPOST = "$lp_name";
}
else
{
if($tmp[1])
{
$LASTPOST = $tmp[1];
}
else
{
$LASTPOST = NFPM_L16;
}
}
$LASTPOSTDATE = "$r_datestamp";
}
else
{
$LASTPOST = ' - ';
$LASTPOSTDATE = '';
}
$newflag = FALSE;
if (USER)
{
if ($forumInfo['thread_lastpost'] > USERLV && !preg_match("#\b".$forumInfo['thread_id']."\b#", USERVIEWED))
{
$newflag = TRUE;
}
}
if ($newflag)
{
if ($forumInfo['thread_total_replies'] >= $pref['forum_popular'])
{
$iconfile = 'new_popular.png';
$iconalt = NFPM_L17;
}
else
{
$iconfile = 'new.png';
$iconalt = NFPM_L18;
}
}
else
{
if ($forumInfo['thread_total_replies'] >= $pref['forum_popular'])
{
$iconfile = 'nonew_popular.png';
$iconalt = NFPM_L19;
}
else
{
$iconfile = 'nonew.png';
$iconalt = NFPM_L20;
}
if ($forumInfo['thread_s'] == 1)
{
if ($forumInfo['thread_active'])
{
$iconfile = 'sticky.png';
$iconalt = NFPM_L21;
}
else
{
$iconfile = 'sticky_closed.png';
$iconalt = NFPM_L22;
}
}
elseif($forumInfo['thread_s'] == 2)
{
$iconfile = 'announce.png';
$iconalt = NFPM_L23;
}
elseif(!$forumInfo['thread_active'])
{
$iconfile = 'closed.png';
$iconalt = NFPM_L24;
}
}
$ICON = "";
$x = explode(chr(1), $thread_user);
$tmp = explode(".", $x[0], 2);
if($user_name)
{
$POSTER = "$user_name";
}
else
{
if($tmp[1])
{
$POSTER = $tmp[1];
}
else
{
$POSTER = NFPM_L16;
}
}
$THREAD = "$thread_name";
$FORUM = "$forum_name";
$VIEWS = $thread_views;
$REPLIES = $thread_total_replies;
$text .= preg_replace("/\{(.*?)\}/e", '$\1', $NEWFORUMPOSTSTYLE_MAIN);
}
$text .= preg_replace("/\{(.*?)\}/e", '$\1', $NEWFORUMPOSTSTYLE_FOOTER);
$text = ($pref['nfp_layer'] ? "".$text."
" : $text);
if($results)
{
$ns->tablerender($pref["nfp_caption"], $text, 'nfp');
}