<?php
/* by: Mat Verdonschot(mverdonschot@lycos.nl) */
/* http://members.lycos.nl/mverdonschot */
if( eregi( "block-phpBB_Forums.php",$PHP_SELF ) )
{
Header("Location: index.php");
die();
}
global $prefix, $dbi, $sitename;
$Last_5_New_Topics = 5; // Show only 5 last new topics
$border = 1;
$bordercolor = "#E6E6FA"; //#cacaca
$cellspacing = 0;
$bgcolor = "#EAEDF4"; // #F0F8FF #B0C4DE
$bgcolor2 = "#FFFFFF"; //#D6DFF7 #B0C4DE #6495ED
// Languages
define("_BBFORUM_NEWTOPICS","Topic");
define("_BBFORUM_POSTER", "Poster");
define("_BBFORUM_VIEWS", "Views");
define("_BBFORUM_REPLIES", "Replies");
define("_BBFORUM_LASTPOSTER", "Last Poster");
define("_BBFORUM_TOTTOPICS", "Topics ");
define("_BBFORUM_TOTPOSTS", "Posts ");
define("_BBFORUM_TOTVIEWS", "Views ");
define("_BBFORUM_TOTREPLIES", "Replies ");
define("_BBFORUM_TOTMEMBERS", "Members ");
define("_BBFORUM_FORUM", "Go To Forums");
/* Total Amount of Topics */
$result = sql_query( "SELECT * FROM ".$prefix."_topicsbb", $dbi );
$Amount_Of_Topics = sql_num_rows( $result, $dbi );
/* Total Amount of Posts */
$result = sql_query( "SELECT * FROM ".$prefix."_posts", $dbi );
$Amount_Of_Posts = sql_num_rows( $result, $dbi );
/* Total Amount of Topic Views */
$Amount_Of_Topic_Views = 0;
$result = sql_query( "SELECT topic_views FROM ".$prefix."_topicsbb", $dbi );
while( list( $topic_views ) = sql_fetch_row( $result, $dbi ) )
{
$Amount_Of_Topic_Views = $Amount_Of_Topic_Views + $topic_views;
}
/* Total Amount of Topic Replies */
$Amount_Of_Topic_Replies = 0;
$result = sql_query( "SELECT topic_replies FROM ".$prefix."_topicsbb", $dbi );
while( list( $topic_replies ) = sql_fetch_row( $result, $dbi ) )
{
$Amount_Of_Topic_Replies = $Amount_Of_Topic_Replies + $topic_replies;
}
/* Total Amount of Members */
$result = sql_query( "SELECT * FROM ".$prefix."_users", $dbi );
$Amount_Of_Members = sql_num_rows( $result, $dbi );
/* Last 5 New Topics */
$Topic_Buffer = "";
$result1 = sql_query( "SELECT topic_id, topic_last_post_id, topic_title, topic_poster, topic_views, topic_replies FROM ".$prefix."_topicsbb ORDER BY topic_last_post_id DESC LIMIT $Last_5_New_Topics", $dbi );
while( list( $topic_id, $topic_last_post_id, $topic_title, $topic_poster, $topic_views, $topic_replies ) = sql_fetch_row( $result1, $dbi ) )
{
$result2 = sql_query( "SELECT topic_id, poster_id, FROM_UNIXTIME(post_time,'%b %d, %Y at %T') as post_time FROM ".$prefix."_posts where post_id = '$topic_last_post_id'", $dbi );
list( $topic_id, $poster_id, $post_time ) = sql_fetch_row( $result2, $dbi );
$result3 = sql_query( "SELECT uname, uid FROM ".$prefix."_users where uid='$poster_id'", $dbi );
list( $uname, $uid ) = sql_fetch_row( $result3, $dbi );
$LastPoster = "<A HREF=\"modules.php?name=Forums&file=profile&mode=viewprofile&u=$uid\"STYLE=\"text-decoration: none\"> $uname </a>";
$result4 = sql_query( "SELECT uname, uid FROM ".$prefix."_users where uid='$topic_poster'", $dbi );
list( $uname, $uid ) = sql_fetch_row( $result4, $dbi );
$OrigPoster = "<A HREF=\"modules.php?name=Forums&file=profile&mode=viewprofile&u=$uid\"STYLE=\"text-decoration: none\"> $uname </a>";
$TopicImage = "<img src=\"images/blocks/folder.gif\" border=\"0\" alt=\"\">";
$TopicTitleShow = "<a href=\"modules.php?name=Forums&file=viewtopic&p=$topic_last_post_id#$topic_last_post_id\"STYLE=\"text-decoration: none\">$topic_title</a>";
$Topic_Buffer .= "<tr><td>$TopicImage$TopicTitleShow</td><td><div align=\"center\">$OrigPoster</div></td><td><div align=\"center\">$topic_views</div></td><td><div align=\"center\">$topic_replies</div></td><td align=\"center\">$LastPoster
<font size=\"-2\">".substr($post_time,0,strpos($post_time,"at"))."</font></td></tr>";
}
/*
*/
/* Write Table to Screen */
$content .= "<table bgcolor=\"$bgcolor\" width=\"100%\" border=\"$border\" cellspacing=\"$cellspacing\" bordercolor=\"$bordercolor\" >"; // bgcolor=\"$bgcolor\"
$content .= "<tr><td align=\"center\">"._BBFORUM_NEWTOPICS."</td><td align=\"center\">"._BBFORUM_POSTER."</td><td align=\"center\">"._BBFORUM_VIEWS."</td><td align=\"center\">"._BBFORUM_REPLIES."</td><td align=\"center\">"._BBFORUM_LASTPOSTER."</td></tr>";
$content .= "$Topic_Buffer";
$content .= "<tr><td align=\"center\" colspan=\"5\">"._BBFORUM_TOTTOPICS."$Amount_Of_Topics|"._BBFORUM_TOTPOSTS."$Amount_Of_Posts|"._BBFORUM_TOTVIEWS."$Amount_Of_Topic_Views|"._BBFORUM_TOTREPLIES."$Amount_Of_Topic_Replies|<a href=\"modules.php?name=Members_List\">"._BBFORUM_TOTMEMBERS."</a>$Amount_Of_Members</center></td></tr>";
$content .= "<tr><td align=\"center\" colspan=\"5\">[ <a href=\"modules.php?name=Forums\">"._BBFORUM_FORUM."</a> ]</center></td></tr>";
$content .= "</table>";
?> |