Author |
Message |
Dawg
RavenNuke(tm) Development Team
Joined: Nov 07, 2003
Posts: 928
|
Posted:
Wed Jun 17, 2009 4:42 pm |
|
Greetings All,
I altered the Old Forums Scroll block to get rid of $dbi and a bunch of " ' "
What else did I miss?
Code:<?php
/************************************************************************/
/* Forums Block for phpBB 2.0.0 port to PHP Nuke 5.5 */
/* ================================================= */
/* */
/* Copyright (c) 2002 by Francisco Burzi (fbc@mandrakesoft.com) */
/* http://phpnuke.org */
/* */
/* Version 1, modified by Sébastien Vaast */
/* http://membres.lycos.fr/projectpluto/ */
/* */
/* */
/* Last Edited - 09 May 2002 */
/* */
/* 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). */
/* */
/* 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. */
/************************************************************************/
/************************************************************************/
/* Modified by Gaylen Fraley http://ravenphpscripts.com */
/* Modified by Dawg for new $db */
/************************************************************************/
if (eregi("block-ForumsScroll.php", $_SERVER['PHP_SELF'])) {
Header("Location: index.php");
die();
}
global $prefix, $db, $sitename, $user, $cookie, $group_id;
$count = 1;
$amount = 30;
$content = "<a name= 'scrollingCode'></a>";
$content .="<marquee behavior= 'scroll' align= 'center' direction= 'up' height='300' scrollamount= '2' scrolldelay= '25' onmouseover='this.stop()' onmouseout='this.start()'>";
$content .="<center> <style='text-decoration: none'><font color='#666666'><b>Last $amount Forum Messages</b></center>";
$result1 = $db->sql_query("SELECT topic_id, topic_last_post_id, topic_title FROM ".$prefix."_bbtopics ORDER BY topic_last_post_id DESC LIMIT $amount");
$content .= "<br \/>";
while(list($topic_id, $topic_last_post_id, $topic_title) = $db->sql_fetchrow($result1)) {
$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 ".$prefix."_users where user_id='$poster_id'");
list($username, $user_id)=$db->sql_fetchrow($result3);
$topic_title = substr("$topic_title", 0,100);
$content .= "<img src='modules/Forums/templates/subSilver/images/icon_mini_message.gif' border='0'alt='' \/><a href='forums.html?amp;file=viewtopic&p=$topic_last_post_id#$topic_last_post_id'style='text-decoration: none'><b> $topic_title </b></a><br /><font color='#666666'><i>Last post by <A HREF='profile-.html$user_id'STYLE='text-decoration: none'> $username </a> on $post_time</i></font><br \/><br />";
$count = $count + 1;
}
$content .= "<br \/><center>[ <a href='forums.html'STYLE='text-decoration: none'>$sitename";
$content .= "</a>]</center>";
?>
|
Thank You for your time!
Dawg |
Last edited by Dawg on Wed Jun 17, 2009 6:19 pm; edited 1 time in total |
|
|
|
Palbin
Site Admin
Joined: Mar 30, 2006
Posts: 2583
Location: Pittsburgh, Pennsylvania
|
Posted:
Wed Jun 17, 2009 5:29 pm |
|
Code:
if (eregi("block-ForumsScroll.php", $_SERVER['PHP_SELF'])) {
Header("Location: index.php");
die();
}
|
Should be:
Code:
if ( !defined('BLOCK_FILE') ) {
Header('Location: ../index.php');
die();
}
|
Code:
global $prefix, $db, $sitename, $user, $cookie, $group_id;
|
I don't think $group_id, $$cookie, or $user_id are needed.
Code:
global $db, $prefix, $sitename;
|
Code:
$content .= "<img src='modules/Forums/templates/subSilver/images/icon_mini_message.gif' border='0'alt='' \/><a href='forums.html?amp;file=viewtopic&p=$topic_last_post_id#$topic_last_post_id'style='text-decoration: none'><b> $topic_title </b></a><br /><font color='#666666'><i>Last post by <A HREF='profile-.html$user_id'STYLE='text-decoration: none'> $username </a> on $post_time</i></font><br \/><br />";
|
A lot of your closing tags in this string have something like this <br \/> instead of this <br />.
You also need to remove the capital HREF= and STYLE=.
You should validate the block with [ Only registered users can see links on this board! Get registered or login! ]
The only other thing that I would would be to tackle the whole " vs ' quotes thing. If you don't know what I am talking about or don't feel comfortable doing it I wouldn't worry about it. |
_________________ "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. |
|
|
|
Dawg
|
Posted:
Wed Jun 17, 2009 6:31 pm |
|
Thank You for your help...
I know "Some" of the ' vs " but not enough to feel comfortable with the sql part of it so I am going to leave it.
Code:<?php
/************************************************************************/
/* Forums Block for phpBB 2.0.0 port to PHP Nuke 5.5 */
/* ================================================= */
/* */
/* Copyright (c) 2002 by Francisco Burzi (fbc@mandrakesoft.com) */
/* http://phpnuke.org */
/* */
/* Version 1, modified by Sébastien Vaast */
/* http://membres.lycos.fr/projectpluto/ */
/* */
/* */
/* Last Edited - 09 May 2002 */
/* */
/* 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). */
/* */
/* 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. */
/************************************************************************/
/************************************************************************/
/* Modified by Gaylen Fraley http://ravenphpscripts.com */
/* Modified by Dawg for new $db */
/* with help from Palbin */
/************************************************************************/
if ( !defined('BLOCK_FILE') ) {
Header('Location: ../index.php');
die();
}
global $db, $prefix, $sitename;
$count = 1;
$amount = 30;
$content = "<a name= 'scrollingCode'></a>";
$content .="<marquee behavior= 'scroll' align= 'center' direction= 'up' height='300' scrollamount= '2' scrolldelay= '25' onmouseover='this.stop()' onmouseout='this.start()'>";
$content .="<center><b>Last $amount Forum Messages</b></center>";
$result1 = $db->sql_query("SELECT topic_id, topic_last_post_id, topic_title FROM ".$prefix."_bbtopics ORDER BY topic_last_post_id DESC LIMIT $amount");
$content .= "<br />";
while(list($topic_id, $topic_last_post_id, $topic_title) = $db->sql_fetchrow($result1)) {
$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 ".$prefix."_users where user_id='$poster_id'");
list($username, $user_id)=$db->sql_fetchrow($result3);
$topic_title = substr("$topic_title", 0,100);
$content .= "<img src='modules/Forums/templates/subSilver/images/icon_mini_message.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 color='#666666'><i>Last post by <a href='forum-userprofile-.html$user_id'style='text-decoration: none'> $username </a> on $post_time</i></font><br /><br />";
$count = $count + 1;
}
$content .= "<br /><center>[ <a href='forums.html'style='text-decoration: none'>$sitename";
$content .= "</a>]</center>";
?>
|
|
|
|
|
|
Palbin
|
Posted:
Wed Jun 17, 2009 7:15 pm |
|
I'm not 100% sure if it validates, but it looks good to me. |
|
|
|
|
Dawg
|
Posted:
Wed Jun 17, 2009 7:26 pm |
|
Other than marquee It checks out fine. It also works as expected in IE7,8 and FF3
Dawg |
|
|
|
|
sexycoder
Spammer and overall low life
Joined: Feb 02, 2009
Posts: 82
|
Posted:
Thu Jun 18, 2009 6:41 am |
|
I already tested and it is not validated. It has 17 errors. |
|
|
|
|
Dawg
|
Posted:
Thu Jun 18, 2009 7:53 am |
|
and if you look through those errors....they are all about the use of the marquee tag and the code that runs it. Anything with Marquee in it is not going to test valid.
I have tested it againest IE7 and 8, FF3 and it works as expected.
Dawg |
|
|
|
|
warren-the-ape
Worker
Joined: Nov 19, 2007
Posts: 196
Location: Netherlands
|
Posted:
Thu Jun 18, 2009 10:18 am |
|
Or you just use the block from Nukecoder.com that doesn't use the deprecated marquee tag at all;
[ Only registered users can see links on this board! Get registered or login! ] |
|
|
|
|
Dawg
|
Posted:
Thu Jun 18, 2009 10:24 am |
|
Warren,
I have used it on several sites but it tends to act jerky and it slow to load. That was what sent me back to the Old marquee one.
Dawg |
|
|
|
|
hicuxunicorniobestbuildpc
The Mouse Is Extension Of Arm
Joined: Aug 13, 2009
Posts: 1123
|
Posted:
Thu Nov 12, 2009 7:14 am |
|
When I run this block I get this error
Code:Fatal error: Call to undefined method sql_db::sql_fetch_row()
|
from this line
Code:while(list($topic_id, $topic_last_post_id, $topic_title) = $db->sql_fetch_row($result1)) {
|
Anyone knows why? |
|
|
|
|
nuken
RavenNuke(tm) Development Team
Joined: Mar 11, 2007
Posts: 2024
Location: North Carolina
|
Posted:
Thu Nov 12, 2009 8:19 am |
|
it should be Code:while(list($topic_id, $topic_last_post_id, $topic_title) = $db->sql_fetchrow($result1)) {
|
|
_________________ Tricked Out News |
|
|
|
hicuxunicorniobestbuildpc
|
Posted:
Thu Nov 12, 2009 9:59 am |
|
Wow, I guess I didnt sleep well today.
What is the different between this
sql_fetch_row (means this old from $dbi)?
and
sql_fetchrow(means this new from $db)?
Thanks for your answer. I trying to clean all old blocks I have with $dbi
This helps me a lot
[ Only registered users can see links on this board! Get registered or login! ]
but why this is new sql_fetchrow |
|
|
|
|
evaders99
Former Moderator in Good Standing
Joined: Apr 30, 2004
Posts: 3221
|
Posted:
Thu Nov 12, 2009 8:24 pm |
|
|
|
|
hicuxunicorniobestbuildpc
|
Posted:
Fri Nov 13, 2009 8:20 am |
|
Thanks evaders99. I've been reading about the old abstraction and Im taking the time to renew all my blocks and modules.
So
mysql_query
but
sql_query
so
mysql_numrows
but
sql_numrows
Are they the same? |
|
|
|
|
evaders99
|
Posted:
Fri Nov 13, 2009 7:52 pm |
|
|
|
|
hicuxunicorniobestbuildpc
|
Posted:
Fri Nov 13, 2009 8:12 pm |
|
|
|
|
|