Code:<?php
/************************************************************************************/
/* */
/* CENTER BLOCK: block-phpBB_Forums.php */
/* For PHP-Nuke 6.5 */
/* v1.5 06-04-2003 */
/* */
/* by: Maty Scripts (webmaster@matyscripts.com) */
/* http://www.matyscripts.com */
/* */
/* 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( eregi( "block-phpBB_Forums.php", $_SERVER['PHP_SELF'])) {
Header("Location: index.php");
die();
}
// include the Cache-Lite package
require_once("includes/Cache_Lite/Lite.php");
// set some variables
$options = array(
"cacheDir" => "C:/Cache/",
"lifeTime" => 10
);
// create a Cache_Lite object
$objCache = new Cache_Lite($options);
// test if there exists a valid cache,
// the ID will be the basename of the block
$fileid = basename($blockfile,".php");
if ($content = $objCache->get($fileid)) {
}
else
{
// do the block's work here...
global $prefix, $user_prefix, $db, $sitename, $bgcolor1, $bgcolor2;
/**********************************/
/* */
/* Configuration parameters */
/* */
/**********************************/
// When set to 1 then Forums permissions which View and/or Read are NOT set to 'ALL' will NOT be displayed in the center block
$HideViewReadOnly = 0;
// Show only 5 last new topics
$Last_New_Topics = 75;
// Icon that is displayed in Center Block in front of Topic
$IconPath = "modules/Forums/templates/subSilver/images/icon_mini_message.gif";
/**********************************/
/* */
/* Don't Edit Below ! */
/* */
/**********************************/
$border = 0;
$cellspacing = 0;
$cellstyle = "style=\"border-left-width: 1; border-right-width: 1; border-top-width: 1; border-bottom-style: solid; border-bottom-width: 1\"";
/* Total Amount of Topics */
$result = $db->sql_query( "SELECT * FROM ".$prefix."_bbtopics" );
$Amount_Of_Topics = $db->sql_numrows( $result );
/* Total Amount of Posts */
$result = $db->sql_query( "SELECT * FROM ".$prefix."_bbposts" );
$Amount_Of_Posts = $db->sql_numrows( $result );
/* Total Amount of Topic Views */
$Amount_Of_Topic_Views = 1;
$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;
}
/* Total Amount of Topic Replies */
$Amount_Of_Topic_Replies = 1;
$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;
}
/* Total Amount of Members */
$result = $db->sql_query( "SELECT * FROM ".$user_prefix."_users" );
$Amount_Of_Members = $db->sql_numrows( $result ) - 1;
/* Last X New Topics */
$Count_Topics = 0;
$Topic_Buffer="";
$content = "<center><a href=\"/modules.php?name=Forums\"><img src=\"images/boards.gif\" border=\"0\"></a></center>";
$content .= "<center><b>Below is just a snap shot of our popular Message Boards:</b> <br><br>To view all topics, please click the icon above to enter the full<br> message board. Once inside, you can see all topics that have been recently<br> posted. The list below is generated automatically by the most recent posts.</center>";
$content .= "<br>";
$content .= "<br>";
$content .= "<center><font color=006699><b><big><big>Over 42,195+ Posts!</big></big></center></font>";
$content .= "<br>";
$content .= "<center><font color=gray><b>Some Topics Can Only Be Viewed By Members Logged In.</center></font>";
$content .= "<table><table><tr><td><table width=\"550\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td bgcolor=\"#CAC8C8\"><table width=\"100%\" border=\"0\" cellpadding=\"1\" cellspacing=\"1\" ><tr> ";
$content .= "<th height=\"20\" colspan=\"2\" align=\"center\" nowrap background=\"images/cellpic69.gif\" class=\"thcornerl\"><font color=\"#FFFFFF\"><strong>Topics</strong></font></th>";
$content .= " <th width=\"50\" align=\"center\" nowrap background=\"images/cellpic69.gif\" class=\"thtop\"><font color=\"#FFFFFF\"><strong> Replies </strong></font></th>";
$content .= " <th width=\"75\" align=\"center\" nowrap background=\"images/cellpic69.gif\" class=\"thtop\"><font color=\"#FFFFFF\"><strong> Author </strong></font></th>";
$content .= " <th width=\"50\" align=\"center\" nowrap background=\"images/cellpic69.gif\" class=\"thtop\"><font color=\"#FFFFFF\"><strong> Views </strong></font></th>";
$content .= " <th align=\"center\" nowrap background=\"/images/cellpic69.gif\" class=\"thcornerr\"><font color=\"#FFFFFF\"><strong> Last Post </strong></font></th>";
$content .= " </tr> ";
$result1 = $db->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" );
while( list( $topic_id, $forum_id, $topic_last_post_id, $topic_title, $topic_poster, $topic_views, $topic_replies, $topic_moved_id ) = sql_fetch_row( $result1, $dbi ) )
{
$skip_display = 0;
if( $HideViewReadOnly == 1 )
{
$result5 = $db->sql_query( "SELECT auth_view, auth_read FROM ".$prefix."_bbforums where forum_id = '$forum_id'" );
list( $auth_view, $auth_read ) = $db->sql_fetchrow( $result5 );
if( ( $auth_view != 0 ) or ( $auth_read != 0 ) ) { $skip_display = 1; }
}
if( $topic_moved_id != 0 )
{
// Shadow Topic !!
$skip_display = 0;
}
if( $skip_display ==0 )
{
$Count_Topics += 1;
$result2 = $db->sql_query( "SELECT topic_id, poster_id, FROM_UNIXTIME( post_time,'%b %d, %Y at %T') as post_time FROM ".$prefix."_bbposts where post_id = '$topic_last_post_id'" );
list( $topic_id, $poster_id, $post_time ) = $db->sql_fetchrow( $result2 );
$result3 = $db->sql_query( "SELECT username, user_id FROM ".$user_prefix."_users where user_id='$poster_id'" );
list( $uname, $uid ) = $db->sql_fetchrow( $result3 );
$LastPoster = "<A HREF=\"profile-.html$uid\"STYLE=\"text-decoration: none\"> $uname </a>";
$result4 = $db->sql_query( "SELECT username, user_id FROM ".$user_prefix."_users where user_id='$topic_poster'" );
list( $uname, $uid ) = $db->sql_fetchrow( $result4 );
$OrigPoster = "<A HREF=\"profile-.html$uid\"STYLE=\"text-decoration: none\"> $uname </a>";
$TopicImage = "<img src=\"$IconPath\" border=\"0\" alt=\"\">";
$TopicTitleShow = "<a href=\"forums.html?amp;file=viewtopic&p=$topic_last_post_id#$topic_last_post_id\"STYLE=\"text-decoration: none\">$topic_title</a>";
$content .= "<tr><td align=\"center\" height=\"30\" width=\"30\" nowrap bgcolor=\"#F4F6FB\" class=\"row1\"><img src=\"images/envelope691.gif\" border=\"0\" /></td>";
$content .= "<td width=\"100%\" bgcolor=\"#F4F6FB\" class=\"row1\"> $TopicTitleShow</td>";
$content .= "<td align=\"center\" bgcolor=\"#F4F6FB\" class=\"row2\">$topic_replies</td>";
$content .= "<td align=\"center\" bgcolor=\"#F4F6FB\" class=\"row3\">$OrigPoster</td>";
$content .= "<td align=\"center\" bgcolor=\"#F4F6FB\" class=\"row2\">$topic_views</td>";
$content .= "<td width=\"100%\" align=\"center\" nowrap bgcolor=\"#F4F6FB\" class=\"row3\"><font size=\"-2\"><i>$post_time</i></font><BR>$LastPoster <a href=\"forums.html?amp;file=viewtopic&p=$topic_last_post_id#$topic_last_post_id\"STYLE=\"text-decoration: none\"><img src=\"modules/Forums/templates/subSilver/images/icon_newest_reply.gif\" border=\"0\" alt=\"Latest Post\"></a></td></tr> ";
}
if( $Last_New_Topics == $Count_Topics ) { break 1; }
}
$content .= " <tr> <td bgcolor=\"#F4F6FB\" height=\"15\" colspan=\"6\" align=\"center\" class=\"cat\" background=\"images/cellpic3.gif\"> </td>";
$content .= " </tr>";
$content .= "</table>";
$content .=" </td> </tr></table></table>";
$content .= "<br>";
$content .= "<center><a href=\"/modules.php?name=Forums\"><img src=\"images/enter.png\" border=\"0\"></a></center>";
$content .= "<br>";
$content .= "<center><b><font color=gray><u>Please Note</u>: The message boards are not moderated, or controlled by the staff!</font></center></b>";
$content .= "<br>";
$content .= "<br>";
// ...and save it in the cache for future use
$objCache->save($content, $fileid);
}
?>
|