Ravens PHP Scripts: Forums


View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Converting/Creating Blocks
Author Message

Joined: Sep 16, 2008
Posts: 62

PostPosted: Wed Sep 15, 2010 8:42 am Reply with quote

Hi there guys.

i maintaine a few cllan sites in my spare time on one of them the bad company 2 clan Razz groovyyyyy game Razz
one of the clans leaders sent me a new forum block to use he said he
got it of a mates guild so i diceded to have a llook see i have found
sites using it and it is realy kewl.

however i carnt get it to work on the RN site ?
i am using the latest version of RN since last week when i updated
and this is the forum block code.

I am leaving the credits intact it is not my work nore do i wish to steel it
but if some one could look at the code and tell me can i get it to run on


/* Advanced Forums block to show latest posts and top posters.                   */
/* ====================================================                          */
/* Latest Posts :Copyright (c) 2003-2004 by Telli (telli@codezwiz.com)           */
/* http://codezwiz.com                                    */
/* Last Edited - 20 Aug 2004                                      */
/*                                                        */
/* This Block shows the last 10 topics where a message was posted,            */
/* along with the username of the last poster and the day and time            */
/* of the post.                                 */
/* It will also show smileys in the topic titles thanks to the               */
/* smileys.php file found in Leo Tan Block Forums version                    */
/* (http://www.cybercomp.d2g.com).                                               */
/*                                                                               */
/* Top Posters block Copyright (c) 2003 by chatserv (chatserv@nukeresources.com  */
/* http://nukeresources.com                                                      */
/* Cosmetic changes by dvsDave at [ Only registered users can see links on this board! Get registered or login! ]                     */
/* http://controlbooth.com                                                       */
/*                                                                               */
/* Advanced Forums Block (c) 2005 by Raveneise (raveneise@clanresources.org)     */
/* (http://www.clanresources.org)                                                */
/* This is combo of the two blocks mentioned above to make one block.            */
/* Credit for the blocks themselves go to their authors.                       */

if (eregi("block-Advanced_Forums.php", $_SERVER['SCRIPT_NAME'])) {
    Header("Location: index.php");
define("_BBFORUM_TOTTOPICS","Topics ");
define("_BBFORUM_TOTPOSTS","Posts ");
define("_BBFORUM_TOTVIEWS","Views ");
define("_BBFORUM_TOTREPLIES","Replies ");

include_once ('blocks/smileys.php');
$cz_theme = get_theme();
global $prefix, $user_prefix, $db, $dbi, $sitename, $user, $cookie, $group_id;
/* 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 = 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;

/* Total Amount of Topic Replies */
$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;

/* Total Amount of Members */
$result = $db->sql_query( "SELECT * FROM ".$user_prefix."_users" );
$Amount_Of_Members = $db->sql_numrows( $result );

$count = 1;
$content = "<table class=\"row1\" cellspacing=\"0\" cellpadding=\"3\" width=\"100%\">
  <td align=\"left\" class=\"row1\" width=\"50%\"><font class=\"tiny\"><b>"._BBFORUM_TOTTOPICS."</b></font></td>
  <td align=\"left\" class=\"row1\" width=\"50%\"><b>$Amount_Of_Topics</b></td>
  <td align=\"left\" class=\"row1\" width=\"50%\"><font class=\"tiny\"><b>"._BBFORUM_TOTPOSTS."</b></font></td>
  <td align=\"left\" class=\"row1\" width=\"50%\"><b>$Amount_Of_Posts</b></td>
  <td align=\"left\" class=\"row1\" width=\"50%\"><font class=\"tiny\"><b>"._BBFORUM_TOTVIEWS."</b></font></td>
  <td align=\"left\" class=\"row1\" width=\"50%\"><b>$Amount_Of_Topic_Views</b></td>
  <td align=\"left\" class=\"row1\" width=\"50%\"><font class=\"tiny\"><b>"._BBFORUM_TOTREPLIES."</b></font></td>
  <td align=\"left\" class=\"row1\" width=\"50%\"><b>$Amount_Of_Topic_Replies</b></td>
  <td align=\"left\" class=\"row1\" width=\"50%\"><font class=\"tiny\"><a href=\"members.html\">"._BBFORUM_TOTMEMBERS."</a></font></td>
  <td align=\"left\" class=\"row1\" width=\"50%\"><b>$Amount_Of_Members</b></td>
$content .= "<table class=\"row1\" cellspacing=\"0\" cellpadding=\"3\" width=\"100%\">
  <td class=\"row1\" width=\"100%\">";
$content  .= "<A name= \"scrollingCode\"></A><MARQUEE behavior=\"scroll\" direction=\"up\" height=\"220\" scrollamount=\"2\" scrolldelay=\"20\" onmouseover='this.stop()' onmouseout='this.start()'>";
$content .="<center><font class=\"content\"><b>Last 20 Forum Messages</b></center>";
$content .= "<br>";
$result1 = $db->sql_query("SELECT
 t.topic_id, t.topic_last_post_id, t.topic_title,
 f.forum_name, f.forum_id,
 u.username, u.user_id,
 p.poster_id, FROM_UNIXTIME(p.post_time,'%b %d, %Y at %T') as post_time
 FROM ".$prefix."_bbtopics t, ".$prefix."_bbforums f
 LEFT JOIN ".$prefix."_bbposts p ON (p.post_id = t.topic_last_post_id)
 LEFT JOIN ".$prefix."_users u ON (u.user_id = p.poster_id)
 WHERE t.forum_id=f.forum_id AND f.auth_view=0
 ORDER BY t.topic_last_post_id DESC
 LIMIT 20");
while(list($topic_id, $topic_last_post_id, $topic_title, $forum_name, $forum_id, $username, $user_id, $poster_id, $post_time) = $db->sql_fetchrow($result1)) {

$content .= "<img src=\"themes/$cz_theme/forums/images/icon_minipost.gif\" border=\"0\" alt=\"\"><a href=\"modules.php?name=Forums&amp;file=viewtopic&amp;p=$topic_last_post_id#$topic_last_post_id\"STYLE=\"text-decoration: none\"><b> $topic_title </b></a><br><font class=\"content\"><i>Last post by <A HREF=\"forum-userprofile-.html$poster_id\"STYLE=\"text-decoration: none\"> $username </a> in <a href=\"modules.php?name=Forums&amp;file=viewforum&amp;f=$forum_id\">$forum_name</a> on $post_time</i></font><br><br>";
$count = $count + 1;
$content .= "</marquee></td></tr></table>";
$content .= "<table class=\"row1\" cellspacing=\"0\" cellpadding=\"3\" width=\"100%\">
  <td align=\"center\" class=\"row1\" width=\"50%\"><a href=\"forums.html\">"._BBFORUM_FORUM."</a></td>
  <td align=\"center\" class=\"row1\" width=\"50%\"><a href=\"modules.php?name=Forums&file=search\">"._BBFORUM_SEARCH."</a></td>

$a = 1;
    global $user, $cookie, $sitename, $prefix, $user_prefix, $dbi, $admin, $module_name;
    $result=sql_query("SELECT user_id, username, user_posts, user_avatar FROM ".$user_prefix."_users ORDER BY user_posts DESC LIMIT 0,5", $dbi);
    while(list($user_id, $username, $user_posts, $user_avatar) = sql_fetch_row($result, $dbi)) {
$content .= "<div align=\"left\"><table class=\"outer\" cellpadding=\"0\" style=\"border-collapse: collapse\" bordercolor=\"#111111\" cellspacing=\"1\" border=\"0\">";
$content .= "<tr class=\"even\" vAlign=\"middle\">";
$content .= "<td align=\"middle\">";
if ($user_avatar=="") {
$content .= "&nbsp;&nbsp;<a href=\"forum-userprofile-.html$user_id\"><img alt src=\"modules/Forums/images/avatars/noimage.gif\" border =\"0\" width=\"32\"></a></td>";
if (eregi("http://", $user_avatar)) {
$content .= "&nbsp;&nbsp;<a href=\"modules.php?name=Forums&amp;file=profile&amp;mode=viewprofile&amp;u=$user_id\"><img alt src=\"$user_avatar\" border =\"0\" width=\"32\"></a></td>";
$content .= "&nbsp;&nbsp;<a href=\"modules.php?name=Forums&amp;file=profile&amp;mode=viewprofile&amp;u=$user_id\"><img alt src=\"modules/Forums/images/avatars/$user_avatar\" border =\"0\" width=\"32\"></a></td>";
$content .= "<td align=\"middle\">&nbsp;<a href=\"modules.php?name=Forums&amp;file=profile&amp;mode=viewprofile&amp;u=$user_id\"><b>$username</b></a>&nbsp;<br>&nbsp;<a href=\"modules.php?name=Forums&amp;file=search&amp;search_author=$username\">Posts:</a>&nbsp;<br>";
$content .= "&nbsp;<a href=\"modules.php?name=Forums&amp;file=search&amp;search_author=$username\">$user_posts</a>&nbsp;</td>";
$content .= "</tr>";
$content .= "</table></div><hr>";

View user's profile Send private message Visit poster's website
RavenNuke(tm) Development Team

Joined: Dec 02, 2006
Posts: 1693
Location: Texas, USA

PostPosted: Wed Sep 15, 2010 9:00 am Reply with quote

I notice it's using the old $dbi [ Only registered users can see links on this board! Get registered or login! ]

it may have other issues as well. It's using marquee (depreciated) which may not work if you have html compliance errors on your site. Also make sure you have blocks/smileys.php because it is included by this block and is not a core file.
View user's profile Send private message Visit poster's website
Site Admin

Joined: Mar 30, 2006
Posts: 2583
Location: Pittsburgh, Pennsylvania

PostPosted: Wed Sep 15, 2010 9:11 am Reply with quote

Change line 126-127 as follows.


    $result=sql_query("SELECT user_id, username, user_posts, user_avatar FROM ".$user_prefix."_users ORDER BY user_posts DESC LIMIT 0,5", $dbi);
    while(list($user_id, $username, $user_posts, $user_avatar) = sql_fetch_row($result, $dbi)) {


    $result = $db->sql_query('SELECT `user_id`, `username`, `user_posts`, `user_avatar` FROM `' . $user_prefix . '_users` ORDER BY `user_posts` DESC LIMIT 0,5');
    while(list($user_id, $username, $user_posts, $user_avatar) = $db->sql_fetchrow($result)) {

"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan. 
View user's profile Send private message

PostPosted: Wed Sep 15, 2010 9:15 am Reply with quote

If you do not have smileys.php you could try commenting out line 113


If you do have smileys.php post the contents here as there may be problems with that.

Joined: Oct 14, 2006
Posts: 60
Location: Norway

PostPosted: Wed Sep 15, 2010 12:18 pm Reply with quote

Seems like this is the Advanced Side Forums Block which can be downloaded from ClanThemes home page: [ Only registered users can see links on this board! Get registered or login! ]
.. smileys.php file included.

View user's profile Send private message

PostPosted: Wed Sep 15, 2010 1:11 pm Reply with quote

dunno where it came from jus liked the look of it when shown it would like it myself you know Smile so would the BC2 clan an thanx guys will make the changes sujested an get bk to you

PostPosted: Wed Sep 15, 2010 1:16 pm Reply with quote

Hey Palbin

thanx dude that code change has it workin like a dream now

many thanx there dude
Hangin' Around

Joined: Nov 18, 2010
Posts: 28

PostPosted: Sat Apr 30, 2011 1:17 am Reply with quote

was wondering if you could make this block just display stats and not forum posts?
View user's profile Send private message

Joined: Sep 28, 2006
Posts: 235

PostPosted: Sun Apr 29, 2012 7:56 am Reply with quote

Here is the smiley.php code in case anyone else needed it.


function parseEmoticons ($text) {

    $emoticons = array();
    $emoticons[] = array(":)", "<img src='modules/Forums/images/smiles/icon_smile.gif' alt='' align='absmiddle' BORDER=0>");
    $emoticons[] = array(":D", "<img src='modules/Forums/images/smiles/icon_biggrin.gif' alt='' align='absmiddle' BORDER=0>");
    $emoticons[] = array(":(", "<img src='modules/Forums/images/smiles/icon_sad.gif' alt='' align='absmiddle' BORDER=0>");
    $emoticons[] = array("Shocked", "<img src='modules/Forums/images/smiles/icon_eek.gif' alt='' align='absmiddle' BORDER=0>");
    $emoticons[] = array(":?", "<img src='modules/Forums/images/smiles/icon_confused.gif' alt='' align='absmiddle' BORDER=0>");
    $emoticons[] = array("8)", "<img src='modules/Forums/images/smiles/icon_cool.gif' alt='' align='absmiddle' BORDER=0>");
    $emoticons[] = array(":lol:", "<img src='modules/Forums/images/smiles/icon_lol.gif' alt='' align='absmiddle' BORDER=0>");
    $emoticons[] = array(":x", "<img src='modules/Forums/images/smiles/icon_mad.gif' alt='' align='absmiddle' BORDER=0>");
    $emoticons[] = array(":P", "<img src='modules/Forums/images/smiles/icon_razz.gif' alt='' align='absmiddle' BORDER=0>");
    $emoticons[] = array(":oops:", "<img src='modules/Forums/images/smiles/icon_redface.gif' alt='' align='absmiddle' BORDER=0>");
    $emoticons[] = array(":cry:", "<img src='modules/Forums/images/smiles/icon_cry.gif' alt='' align='absmiddle' BORDER=0>");
    $emoticons[] = array(":evil:", "<img src='modules/Forums/images/smiles/icon_evil.gif' alt='' align='absmiddle' BORDER=0>");
    $emoticons[] = array(":twisted:", "<img src='modules/Forums/images/smiles/icon_twisted.gif' alt='' align='absmiddle' BORDER=0>");
    $emoticons[] = array(":roll:", "<img src='modules/Forums/images/smiles/icon_twisted.gif' alt='' align='absmiddle' BORDER=0>");
    $emoticons[] = array(":wink:", "<img src='modules/Forums/images/smiles/icon_wink.gif' alt='' align='absmiddle' BORDER=0>");
    $emoticons[] = array(":!", "<img src='modules/Forums/images/smiles/icon_exclaim.gif' alt='' align='absmiddle' BORDER=0>");
    $emoticons[] = array(":?", "<img src='modules/Forums/images/smiles/icon_question.gif' alt='' align='absmiddle' BORDER=0>");
    $emoticons[] = array(":idea:", "<img src='modules/Forums/images/smiles/icon_idea.gif' alt='' align='absmiddle' BORDER=0>");
    $emoticons[] = array(":arrow:", "<img src='modules/Forums/images/smiles/icon_arrow.gif' alt='' align='absmiddle' BORDER=0>");
    $emoticons[] = array(":o", "<img src='modules/Forums/images/smiles/icon_surprised.gif' alt='' align='absmiddle' BORDER=0>");
    foreach ($emoticons as $emoticon) {
       $text = str_replace($emoticon[0],$emoticon[1],$text);
    return $text;


alterednuke.com Your source for Ravennuke themes. 
View user's profile Send private message Send e-mail
Site Admin

Joined: Feb 06, 2006
Posts: 3048
Location: United Kingdom

PostPosted: Tue Jul 17, 2012 6:24 am Reply with quote

Has anyone tried this on RN 2.5?
View user's profile Send private message
The Mouse Is Extension Of Arm

Joined: Aug 13, 2009
Posts: 1084

PostPosted: Tue Jul 17, 2012 8:07 am Reply with quote

This is very old block

if (eregi("block-Advanced_Forums.php", $_SERVER['SCRIPT_NAME'])) {

    Header("Location: index.php");


XHTML 1.0(RavenNuke)
if ( !defined('BLOCK_FILE') ) {

   Header('Location: ../index.php');

If you install it,Let us know if the block is validated. Probably not!

HTML(For phpnuke or other version out there)

if ( !defined('BLOCK_FILE') ) {

   Header("Location: ../index.php");

Search for

global $prefix, $user_prefix, $db, $dbi, $sitename, $user, $cookie, $group_id; 

Replace with
global $prefix, $user_prefix, $db, $sitename, $user, $cookie, $group_id;
View user's profile Send private message
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Converting/Creating Blocks

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum

Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
Forums ©