Code:/***************************
This adds x Forum entries *
***************************/
if ($T3 > 0) {
global $prefix, $sitename, $user_prefix, $db, $admin, $dbi;
$HideViewReadOnly = 1;
$result = $db->sql_query( "SELECT * FROM ".$prefix."_bbtopics" );
$Amount_Of_Topics = $db->sql_numrows( $result );
$result = $db->sql_query( "SELECT * FROM ".$prefix."_bbposts" );
$Amount_Of_Posts = $db->sql_numrows( $result );
$Amount_Of_Topic_Views = 0;
$result = $db->sql_query( "SELECT topic_views FROM ".$prefix."_bbtopics" );
while( list( $topic_views ) = $db->sql_fetchrow( $result ) )
{$Amount_Of_Topic_Views = $Amount_Of_Topic_Views + $topic_views;}
$Amount_Of_Topic_Replies = 0;
$result = $db->sql_query( "SELECT topic_replies FROM ".$prefix."_bbtopics" );
while( list( $topic_replies ) = $db->sql_fetchrow( $result ) )
{$Amount_Of_Topic_Replies = $Amount_Of_Topic_Replies + $topic_replies;}
$Count_Topics = 0;
$Topic_Buffer = "";
$result = sql_query( "SELECT topic_id, forum_id, topic_last_post_id, topic_title, topic_poster, topic_views, topic_replies, topic_moved_id FROM ".$prefix."_bbtopics ORDER BY topic_last_post_id DESC", $dbi );
while( list( $topic_id, $forum_id, $topic_last_post_id, $topic_title, $topic_poster, $topic_views, $topic_replies, $topic_moved_id ) = sql_fetch_row( $result, $dbi ) )
{$skip_display = 0;
if( $HideViewReadOnly == 1 ){
$result1 = sql_query( "SELECT auth_view, auth_read FROM ".$prefix."_bbforums where forum_id = '$forum_id'", $dbi );
list( $auth_view, $auth_read ) = sql_fetch_row( $result1, $dbi );
if( ( $auth_view != 0 ) or ( $auth_read != 0 ) ) { $skip_display = 1; }}
if( $topic_moved_id != 0 ){
$skip_display = 1;}
if( $skip_display == 0 ){
$Count_Topics += 1;
$result2 = sql_query("SELECT username, user_id FROM ".$prefix."_users where user_id='$topic_poster'", $dbi);
list($username, $user_id)=sql_fetch_row($result2, $dbi);
$avtor=$username;
$sifra=$user_id;
$result3 = sql_query("SELECT poster_id, FROM_UNIXTIME(post_time,'%d/%m/%Y om %H:%i') as post_time FROM ".$prefix."_bbposts where post_id='$topic_last_post_id'", $dbi);
list($poster_id, $post_time)=sql_fetch_row($result3, $dbi);
$result4 = sql_query("SELECT username, user_id FROM ".$prefix."_users where user_id='$poster_id'", $dbi);
list($username, $user_id)=sql_fetch_row($result4, $dbi);
global $ThemeSel;
$viewlast .="<tr>
<td height=\"10\" nowrap bgcolor=\"#DDDDDD\"><IMG src='$nukeurl/modules/Newsletter/images/forum.gif' border=0 align='absmiddle'></td>
<td width=\"100%\" bgcolor=\"#EEEEEE\"><a href=\"".$nukeurl."/modules.php?name=Forums&file=viewtopic&t=$topic_id#$topic_last_post_id\"><font size=1 color=#000000>$topic_title</font></a></td>
<td height=\"10\" align=\"center\" bgcolor=\"#DDDDDD\"><font size=1 color=#000000>$topic_replies</font></td>
<td align=\"center\" bgcolor=\"#EEEEEE\"><a href=\"".$nukeurl."/modules.php?name=Forums&file=profile&mode=viewprofile&u=$sifra\"><font size=1 color=#000000>$avtor</font></a></td>
<td height=\"10\" align=\"center\" bgcolor=\"#DDDDDD\"><font size=1 color=#000000>$topic_views</font></td>
<td align=\"right\" nowrap bgcolor=\"#EEEEEE\"><font size=1 color=#000000><i> $post_time </i></font><br>
<a href=\"".$nukeurl."/modules.php?name=Forums&file=profile&mode=viewprofile&u=$user_id\"><font size=1 color=#000000>$username</font></a> <a href=\"".$nukeurl."/modules.php?name=Forums&file=viewtopic&p=$topic_last_post_id#$topic_last_post_id\"><img src=\"$nukeurl/modules/Newsletter/images/filr.gif\" border=\"0\"></a> </td>
</tr>";}
if( $T4 == $Count_Topics ) { break 1; }}
$forumbody .= "<hr noshade size=1><br><table width=\"95%\" border=\"0\" cellspacing=\"2\" cellpadding=\"2\" align=\"center\"><tr><td colspan=\"6\" width=\"100%\" height=\"20\" bgcolor=\"#808080\"><IMG src='$nukeurl/modules/Newsletter/images/forums.gif' border=0 align='absmiddle'> <a href=\"".$nukeurl."/modules.php?op=modload&name=Forums\" title=\"Our latest forum posts\"><b><font size='3' color='#FFFFFF'>Last $T4 Forum Posts. Click here for more.</font></b></a></td></tr>";
$forumbody .= "<tr bgcolor=\"#ABABAB\">
<td width=\"10\"></td>
<td width=\"100%\"><font size='2' color='#ffffff'><b>Subject</b></font></td>
<td width=\"10\" align='center' nowrap><font size='2' color='#FFFFFF'><b>Replies</b></font></td>
<td align='center' nowrap><font size='2' color='#FFFFFF'><b>Author</b></font></td>
<td width=\"10\" align='center' nowrap><font size='2' color='#FFFFFF'><b>Viewed</b></font></td>
<td align='center' nowrap><font size='2' color='#FFFFFF'><b>Last Reply</b></font></td>
</tr>";
$forumbody .= "$viewlast";
$forumbody .= "</table><br>";
}
// End x Forum entries
|