<?php
/************************************************************************************/
/* PHP-NUKE: Web Portal System */
/* =========================== */
/* */
/* Copyright (c) 2001-2003 by Francisco Burzi (fburzi@ncc.org.ve) */
/* http://phpnuke.org */
/* */
/* CENTER BLOCK: block-bbforum.php for PHPNuke 6.5 */
/* v1.0 03-16-2003 */
/* */
/* by: Frank Wallacher (frank@saarport.dyndns.org) */
/* http://www.saarport.net */
/* */
/* based on block-phpBB_Forums v1.0 */
/* originally written by: Mat Verdonschot (mverdonschot@lycos.nl) */
/* */
/* 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-bbforum.php",$PHP_SELF ) )
{
Header("Location: index.php");
die();
}
if(file_exists("language/bbforum-block/lang-".$GLOBALS[currentlang].".php")) {
include("language/bbforum-block/lang-".$GLOBALS[currentlang].".php");
}
else {
include("language/bbforum-block/lang-$GLOBALS[language].php");
}
$last_topics = 5; // Shows the last new topics
$bbtopics = $GLOBALS['prefix'] . '_bbtopics';
$bbposts = $GLOBALS['prefix'] . '_bbposts';
$users = $GLOBALS['prefix'] . '_users';
/* Total Amount of Topics */
$sql = "SELECT * FROM $bbtopics";
$result = $GLOBALS['db']->sql_query($sql);
$topics_num = $GLOBALS['db']->sql_numrows($result);
/* Total Amount of Posts */
$sql = "SELECT * FROM $bbposts";
$result = $GLOBALS['db']->sql_query($sql);
$posts_num = $GLOBALS['db']->sql_numrows($result);
/* Total Amount of Topic Views and Replies */
$topic_views_num = 0;
$topic_replies_num = 0;
$sql = "SELECT topic_views,topic_replies FROM $bbtopics";
$result = $GLOBALS['db']->sql_query($sql);
while(list($topic_views,$topic_replies) = $GLOBALS['db']->sql_fetchrow($result)) {
$topic_views_num = $topic_views_num + $topic_views;
$topic_replies_num = $topic_replies_num + $topic_replies;
}
/* Total Amount of Members */
$sql = "SELECT * FROM $users";
$result = $GLOBALS['db']->sql_query($sql);
$users_num = $GLOBALS['db']->sql_numrows($result);
/* Last New Topics to get displayed */
$topic_buffer = "";
$sql = "SELECT topic_id,
topic_title,
topic_poster,
topic_views,
topic_replies,
topic_last_post_id
FROM $bbtopics
ORDER BY topic_last_post_id
DESC LIMIT $last_topics
";
$result = $GLOBALS['db']->sql_query($sql);
while(list($topic_id,$topic_title,$topic_poster,$topic_views,$topic_replies,$topic_last_post_id) = $GLOBALS['db']->sql_fetchrow($result)) {
$timeformat = _TIMEFORMAT;
$sql = "SELECT topic_id,poster_id,
FROM_UNIXTIME(post_time,'$timeformat')
as post_time
FROM $bbposts
WHERE post_id = $topic_last_post_id
";
$result2 = $GLOBALS['db']->sql_query($sql);
list($topic_id,$poster_id,$post_time) = $GLOBALS['db']->sql_fetchrow($result2);
// Format time
$sql = "SELECT user_id,username
FROM $users
WHERE user_id = $poster_id
";
$result3 = $GLOBALS['db']->sql_query($sql);
list($user_id,$username) = $GLOBALS['db']->sql_fetchrow($result3);
$last_poster = ''.$username.'';
$sql = "SELECT user_id,username
FROM $users
WHERE user_id = $topic_poster
";
$result4 = $GLOBALS['db']->sql_query($sql);
list($user_id,$username) = $GLOBALS['db']->sql_fetchrow($result4);
$orig_poster = ''.$username.'';
$topic_image = '[img]modules/Forums/templates/subSilver/images/icon_mini_message.gif[/img]';
$topic_show_title = ''.$topic_title.'';
$topic_buffer .= '<tr bgcolor="'.$GLOBALS[bgcolor3].'"><td class="bbfcolone" bgcolor="'.$GLOBALS[bgcolor1].'">&'.$topic_image.'&'.$topic_show_title.'</td><td class="bbfcoltwo" bgcolor="'.$GLOBALS[bgcolor1].'"><div align="center">'.$orig_poster.'</div></td><td class="bbfcolone" bgcolor="'.$GLOBALS[bgcolor1].'"><div align="center">'.$topic_views.'</div></td><td class="bbfcoltwo" bgcolor="'.$GLOBALS[bgcolor1].'"><div align="center">'.$topic_replies.'</div></td><td align="center" class="bbflastcol" bgcolor="'.$GLOBALS[bgcolor1].'">'.$last_poster.'&[img]modules/Forums/templates/subSilver/images/icon_latest_reply.gif[/img]
<font size="-2">[i]'.$post_time.'[i]</font></td></tr>';
}
/* Table Output */
$content .= '<table cellpadding="1" cellspacing="0" bgcolor="'.$GLOBALS[bgcolor2].'" width="100%" align="center" class="bbftbl">';
$content .= '<tr bgcolor="'.$GLOBALS[bgcolor2].'"><td width="100%" height="21" colspan="5" align="center" class="bbftns">'.$GLOBALS[sitename].'</td></tr>';
$content .= '<tr bgcolor="'.$GLOBALS[bgcolor3].'"><td align="center" width="40%" class="bbfcolonetitle">'._BBFORUM_NEWTOPICS.'</td><td align="center" class="bbfcoltwotitle">'._BBFORUM_POSTER.'</td><td align="center" class="bbfcolonetitle">'._BBFORUM_VIEWS.'</td><td align="center" class="bbfcoltwotitle">'._BBFORUM_REPLIES.'</td><td align="center" class="bbflastcoltitle">'._BBFORUM_LASTPOSTER.'</td></tr>';
$content .= $topic_buffer;
$content .= '<tr bgcolor="'.$GLOBALS[bgcolor3].'"><td align="center" colspan="5" class="bbftotals">'._BBFORUM_TOTTOPICS.' '.$topics_num.'&|&'._BBFORUM_TOTPOSTS.''.$posts_num.'&|&'._BBFORUM_TOTVIEWS.''.$topic_views_num.'&|&'._BBFORUM_TOTREPLIES.''.$topic_replies_num.'&|&'._BBFORUM_TOTMEMBERS.'&'.$users_num.'</center></td></tr>';
$content .= '<tr bgcolor="'.$GLOBALS[bgcolor2].'"><td width="100%" height="21" colspan="5" align="center" class="bbftns">'.$GLOBALS[slogan].'</td></tr>';
$content .= '</table>';
$content .= '<tr bgcolor="'.$GLOBALS[bgcolor2].'"><td align="center" colspan="5" class="content">[ '._BBFORUM_FORUM.' ]&&&[ '._BBFORUM_SEARCH.' ]</center></td></tr>';
?> |