Code:
<?php
########################################################################
# PHP-Nuke Block: Center Forum Posts Block v.1 #
# Re-coded for PHP-Nuke 6.5 #
# #
# Originally made by coldblooded http://www.hellhole.org #
# Edited by William Wickings http://www.amateur-online.net #
# Modified by Gary Tomkinson http://www.tomkinson.org #
########################################################################
# This program is free software. You can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation; either version 2 of the License. #
# If you modify this, let me know for fun. =) #
########################################################################
if (!eregi("modules.php", $_SERVER['SCRIPT_NAME'])) {
die ("You can't access this file directly...");
}
require_once("mainfile.php");
$module_name = basename(dirname(__FILE__));
//get_lang($module_name);
$pagetitle = "- $module_name";
include("header.php");
global $prefix, $dbi, $sitename, $admin;
$HideViewReadOnly = 1;
$ThemeSel = get_theme();
$Last_New_Topics = 40;
$show .= "<tr>
<td height=\"25\" colspan=\"6\" align=\"center\" class=\"catbottom\" background=\"\"> </td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table>";
$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 )
{
// Shadow Topic !!
$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 at %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);
$viewlast .="<tr>
<td height=\"30\" nowrap bgcolor=\"#FFFFFF\" class=\"row1\"><b> · </b></td>
<td width=\"100%\" bgcolor=\"#FFFFFF\" class=\"row1\"> <a href=\"forums.html?file=viewtopic&t=$topic_id#$topic_last_post_id\">$topic_title</a></td>
<td align=\"center\" bgcolor=\"#FFFFFF\" class=\"row2\"><b>$topic_replies</b></td>
<td align=\"center\" bgcolor=\"#FFFFFF\" class=\"row3\"><a href=\"forums.html?file=profile&mode=viewprofile&u=$sifra\">$avtor</a></td>
<td align=\"center\" bgcolor=\"#FFFFFF\" class=\"row2\">$topic_views</td>
<td align=\"center\" nowrap bgcolor=\"#FFFFFF\" class=\"row3\"><font size=\"-2\"><i> $post_time </i></font><br>
<a href=\"forums.html?file=profile&mode=viewprofile&u=$user_id\">$username</a> <a href=\"forums.html?file=viewtopic&p=$topic_last_post_id#$topic_last_post_id\"></a></td>
</tr>";
}
if( $Last_New_Topics == $Count_Topics ) { break 1; }
}
$mycontent .= "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"1\">
<tr>
<td><table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">
<tr>
<td bgcolor=\"$bgcolor1\"><table width=\"100%\" border=\"0\" cellpadding=\"1\" cellspacing=\"1\">
<tr>
<th height=\"25\" colspan=\"2\" align=\"center\" nowrap background=\"\" class=\"thcornerl\"><font color=\"#006699\"><strong>Latest Discussion Topics</strong></font></th>
<th width=\"50\" align=\"center\" nowrap background=\"\" class=\"thtop\"><font color=\"#006699\"><strong> Replies </strong></font></th>
<th width=\"100\" align=\"center\" nowrap background=\"\" class=\"thtop\"><font color=\"#006699\"><strong> Author </strong></font></th>
<th width=\"50\" align=\"center\" nowrap background=\"\" class=\"thtop\"><font color=\"#006699\"><strong> Views </strong></font></th>
<th align=\"center\" nowrap background=\"\" class=\"thcornerr\"><font color=\"#006699\"><strong> Last Post </strong></font></th>
</tr>";
echo "$mycontent";
echo "$viewlast";
echo "$show";
include("footer.php");
?>
|