Author |
Message |
ominae
Regular
![Regular Regular](modules/Forums/images/ranks/2stars.gif)
![](modules/Forums/images/avatars/gallery/blank.gif)
Joined: Sep 16, 2008
Posts: 62
|
Posted:
Wed Sep 15, 2010 8:42 am |
|
Hi there guys.
i maintaine a few cllan sites in my spare time on one of them the bad company 2 clan groovyyyyy game
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
RN
Code:<?php
/*********************************************************************************/
/* 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 webmaster@controlbooth.com */
/* 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");
die();
}
define("_BBFORUM_TOTTOPICS","Topics ");
define("_BBFORUM_TOTPOSTS","Posts ");
define("_BBFORUM_TOTVIEWS","Views ");
define("_BBFORUM_TOTREPLIES","Replies ");
define("_BBFORUM_TOTMEMBERS","Members");
define("_BBFORUM_FORUM","Forums");
define("_BBFORUM_SEARCH","Search");
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%\">
<tr>
<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>
</tr>
<tr>
<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>
</tr>
<tr>
<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>
</tr>
<tr>
<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>
</tr>
<tr>
<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>
</tr>
</table>";
$content .= "<table class=\"row1\" cellspacing=\"0\" cellpadding=\"3\" width=\"100%\">
<tr>
<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)) {
$topic_title=parseEmoticons($topic_title);
$content .= "<img src=\"themes/$cz_theme/forums/images/icon_minipost.gif\" border=\"0\" alt=\"\"><a href=\"modules.php?name=Forums&file=viewtopic&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&file=viewforum&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%\">
<tr>
<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>
</tr></table>";
$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 .= " <a href=\"forum-userprofile-.html$user_id\"><img alt src=\"modules/Forums/images/avatars/noimage.gif\" border =\"0\" width=\"32\"></a></td>";
}
else
if (eregi("http://", $user_avatar)) {
$content .= " <a href=\"modules.php?name=Forums&file=profile&mode=viewprofile&u=$user_id\"><img alt src=\"$user_avatar\" border =\"0\" width=\"32\"></a></td>";
}
else
$content .= " <a href=\"modules.php?name=Forums&file=profile&mode=viewprofile&u=$user_id\"><img alt src=\"modules/Forums/images/avatars/$user_avatar\" border =\"0\" width=\"32\"></a></td>";
$content .= "<td align=\"middle\"> <a href=\"modules.php?name=Forums&file=profile&mode=viewprofile&u=$user_id\"><b>$username</b></a> <br> <a href=\"modules.php?name=Forums&file=search&search_author=$username\">Posts:</a> <br>";
$content .= " <a href=\"modules.php?name=Forums&file=search&search_author=$username\">$user_posts</a> </td>";
$content .= "</tr>";
$content .= "</table></div><hr>";
}
?>
|
|
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
spasticdonkey
RavenNuke(tm) Development Team
![](modules/Forums/images/avatars/48fb116845dfecf66294c.gif)
Joined: Dec 02, 2006
Posts: 1693
Location: Texas, USA
|
Posted:
Wed Sep 15, 2010 9:00 am |
|
I notice it's using the old $dbi
http://www.ravenphpscripts.com/postt16627.html
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. |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
Palbin
Site Admin
![](modules/Forums/images/avatars/Dilbert/Dilbert_-_Dogbert_King.gif)
Joined: Mar 30, 2006
Posts: 2583
Location: Pittsburgh, Pennsylvania
|
Posted:
Wed Sep 15, 2010 9:11 am |
|
Change line 126-127 as follows.
From:
Code:
$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)) {
|
To:
Code:
$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. |
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
Palbin
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Wed Sep 15, 2010 9:15 am |
|
If you do not have smileys.php you could try commenting out line 113
Code:
//$topic_title=parseEmoticons($topic_title);
|
If you do have smileys.php post the contents here as there may be problems with that. |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
catweazle
Regular
![Regular Regular](modules/Forums/images/ranks/2stars.gif)
![](modules/Forums/images/avatars/536c1ceb4795e098b71c9.jpg)
Joined: Oct 14, 2006
Posts: 60
Location: Norway
|
Posted:
Wed Sep 15, 2010 12:18 pm |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
ominae
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Wed Sep 15, 2010 1:11 pm |
|
dunno where it came from jus liked the look of it when shown it would like it myself you know so would the BC2 clan an thanx guys will make the changes sujested an get bk to you |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
ominae
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Wed Sep 15, 2010 1:16 pm |
|
Hey Palbin
thanx dude that code change has it workin like a dream now
many thanx there dude |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
snyper
Hangin' Around
![](modules/Forums/images/avatars/gallery/blank.gif)
Joined: Nov 18, 2010
Posts: 28
|
Posted:
Sat Apr 30, 2011 1:17 am |
|
was wondering if you could make this block just display stats and not forum posts? |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
nextgen
Worker
![Worker Worker](modules/Forums/images/ranks/3stars.gif)
![](modules/Forums/images/avatars/Risque/fhf212.jpg)
Joined: Sep 28, 2006
Posts: 241
|
Posted:
Sun Apr 29, 2012 7:56 am |
|
Here is the smiley.php code in case anyone else needed it.
Code:<?php
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(" ", "<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. |
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
jakec
Site Admin
![](modules/Forums/images/avatars/502a2d1345d88a86ddb4a.png)
Joined: Feb 06, 2006
Posts: 3048
Location: United Kingdom
|
Posted:
Tue Jul 17, 2012 6:24 am |
|
Has anyone tried this on RN 2.5? |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
hicuxunicorniobestbuildpc
The Mouse Is Extension Of Arm
![](modules/Forums/images/avatars/5ed231554a8492e2e09da.gif)
Joined: Aug 13, 2009
Posts: 1123
|
Posted:
Tue Jul 17, 2012 8:07 am |
|
This is very old block
Old
Code:if (eregi("block-Advanced_Forums.php", $_SERVER['SCRIPT_NAME'])) {
Header("Location: index.php");
die();
}
|
New
XHTML 1.0(RavenNuke)
Code:if ( !defined('BLOCK_FILE') ) {
Header('Location: ../index.php');
die();
}
|
If you install it,Let us know if the block is validated. Probably not!
HTML(For phpnuke or other version out there)
Code:if ( !defined('BLOCK_FILE') ) {
Header("Location: ../index.php");
die();
}
|
Search for
Code:global $prefix, $user_prefix, $db, $dbi, $sitename, $user, $cookie, $group_id;
|
Replace with
Code:global $prefix, $user_prefix, $db, $sitename, $user, $cookie, $group_id;
|
|
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
|