PHP Web Host - Quality Web Hosting For All PHP Applications Free RavenNuke(tm) Add Ons
  Login or Register
 • Home • Downloads • Your Account • Forums • 

View next topic
View previous topic


Google
 
Web RavenPHPScripts (This Site)
Post new topic   Reply to topic
Author Message
Dawg
RavenNuke(tm) Development Team


Joined: Nov 07, 2003
Posts: 884

PostPosted: Wed Jun 17, 2009 4:42 pm Reply with quote Back to top

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&amp;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
View user's profile Send private message
Palbin
Site Admin


Joined: Mar 30, 2006
Posts: 2404
Location: Pennsylvania

PostPosted: Wed Jun 17, 2009 5:29 pm Reply with quote Back to top

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&amp;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 to the forums!



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.
View user's profile Send private message Visit poster's website
Dawg
RavenNuke(tm) Development Team


Joined: Nov 07, 2003
Posts: 884

PostPosted: Wed Jun 17, 2009 6:31 pm Reply with quote Back to top

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='forums.html&amp;file=viewtopic&amp;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>";
?>
View user's profile Send private message
Palbin
Site Admin


Joined: Mar 30, 2006
Posts: 2404
Location: Pennsylvania

PostPosted: Wed Jun 17, 2009 7:15 pm Reply with quote Back to top

I'm not 100% sure if it validates, but it looks good to me.
View user's profile Send private message Visit poster's website
Dawg
RavenNuke(tm) Development Team


Joined: Nov 07, 2003
Posts: 884

PostPosted: Wed Jun 17, 2009 7:26 pm Reply with quote Back to top

Other than marquee It checks out fine. It also works as expected in IE7,8 and FF3

Dawg
View user's profile Send private message
sexycoder
Spammer and overall low life


Joined: Feb 02, 2009
Posts: 82

PostPosted: Thu Jun 18, 2009 6:41 am Reply with quote Back to top

I already tested and it is not validated. It has 17 errors. Shocked
View user's profile Send private message
Dawg
RavenNuke(tm) Development Team


Joined: Nov 07, 2003
Posts: 884

PostPosted: Thu Jun 18, 2009 7:53 am Reply with quote Back to top

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
View user's profile Send private message
warren-the-ape
Worker
Worker


Joined: Nov 19, 2007
Posts: 196
Location: Netherlands

PostPosted: Thu Jun 18, 2009 10:18 am Reply with quote Back to top

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 to the forums!
Cool
View user's profile Send private message
Dawg
RavenNuke(tm) Development Team


Joined: Nov 07, 2003
Posts: 884

PostPosted: Thu Jun 18, 2009 10:24 am Reply with quote Back to top

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
View user's profile Send private message
unicornio
Involved
Involved


Joined: Aug 13, 2009
Posts: 410

PostPosted: Thu Nov 12, 2009 7:14 am Reply with quote Back to top

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?
View user's profile Send private message
nuken
RavenNuke(tm) Development Team


Joined: Mar 11, 2007
Posts: 1435
Location: North Carolina

PostPosted: Thu Nov 12, 2009 8:19 am Reply with quote Back to top

it should be
Code:
while(list($topic_id, $topic_last_post_id, $topic_title) = $db->sql_fetchrow($result1)) {
View user's profile Send private message Send e-mail Visit poster's website
unicornio
Involved
Involved


Joined: Aug 13, 2009
Posts: 410

PostPosted: Thu Nov 12, 2009 9:59 am Reply with quote Back to top

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 to the forums!


but why this is new sql_fetchrow
View user's profile Send private message
evaders99
Former Moderator in Good Standing


Joined: Apr 30, 2004
Posts: 3221

PostPosted: Thu Nov 12, 2009 8:24 pm Reply with quote Back to top

Correct, $dbi is the old abstraction layer and should not be used. $db is the new one from phpBB2.
View user's profile Send private message Visit poster's website
unicornio
Involved
Involved


Joined: Aug 13, 2009
Posts: 410

PostPosted: Fri Nov 13, 2009 8:20 am Reply with quote Back to top

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?
View user's profile Send private message
evaders99
Former Moderator in Good Standing


Joined: Apr 30, 2004
Posts: 3221

PostPosted: Fri Nov 13, 2009 7:52 pm Reply with quote Back to top

Should be the same, yes
View user's profile Send private message Visit poster's website
unicornio
Involved
Involved


Joined: Aug 13, 2009
Posts: 410

PostPosted: Fri Nov 13, 2009 8:12 pm Reply with quote Back to top

Thanks for replying.
View user's profile Send private message
Display posts from previous:       
Post new topic   Reply to topic

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
Forums ©
 

All logos and trademarks in this site are property of their respective owner.
The comments are property of their posters, all the rest © 2002-2011 by Raven

You can syndicate our news using the file xml

CSE HTML Validator Helped Clean up This Page! [Valid RSS] valid RSS 2.0 Valid robots.txt Stop Spam Harvesters, Join Project Honey Pot

Website engines core code is © copyright by PHP-Nuke but has been heavily patched and modified by myself and others.
PHP-Nuke is a free software released under the GNU/GPL.


:: fisubice phpbb2 style by Daz :: PHP-Nuke theme by www.nukemods.com ::
:: fisubice Theme Modified by the RavenNuke™ Team ::

:: W3C CSS Compliance Validation :: W3C HTML 4.01 Transitional Compliance Validation ::

zerosum