Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> General/Other Stuff
Author Message
64bitguy
The Mouse Is Extension Of Arm



Joined: Mar 06, 2004
Posts: 1164

PostPosted: Fri Aug 27, 2004 5:58 pm Reply with quote

Okay

I know I'm doing something wrong with my stripslashes code.

Can someone point me in the right direction?

In my New Syndicated News module, I am using:
Code:
$title = addslashes(stripslashes($title));

$description = addslashes(stripslashes($description));

to replace what CPG-Nuke used to have as:
Code:
$title = Fix_Quotes($title);

$description = Fix_Quotes($description);

but using this meathod, all of my links with a single quote (or ' if you will) come out like "&apos"

Should I be using something like:

Code:
$title = stripslashes(['$title'], "nohtml");

$description = stripslashes(['$description'], "nohtml");


Obviously, I shouldn't have to worry about the nohtml (since I'm taking RSS feeds, but I'm having a brain fart kind of day working on about 20 different things and for the life of me just can't remember how I should be doing this.

Ideas?

Thanks

_________________
Steph Benoit
100% Section 508 and W3C HTML5 and CSS Compliant (Truly) Code, because I love compliance. 
View user's profile Send private message
sixonetonoffun
Spouse Contemplates Divorce



Joined: Jan 02, 2003
Posts: 2496

PostPosted: Fri Aug 27, 2004 6:28 pm Reply with quote

There is a function FixQuotes in phpnuke that prolly does what they are doing with Fix_Quotes.

$var=check_html($var, "nohtml"); works for stripping html out unconditionally.

_________________
[b][size=5]openSUSE 11.4-x86 | Linux 2.6.37.1-1.2desktop i686 | KDE: 4.6.41>=4.7 | XFCE 4.8 | AMD Athlon(tm) XP 3000+ | MSI K7N2 Delta-L | 3GB Black Diamond DDR
| GeForce 6200@433Mhz 512MB | Xorg 1.9.3 | NVIDIA 270.30[/size:2b8 
View user's profile Send private message
sixonetonoffun







PostPosted: Fri Aug 27, 2004 6:41 pm Reply with quote

I still haven't gotten over there to check your module out. But I was checking out a class for RSS called magpie [ Only registered users can see links on this board! Get registered or login! ]
If you have a need for any hints its pretty cool code with a caching file based system.
 
64bitguy







PostPosted: Fri Aug 27, 2004 7:32 pm Reply with quote

Anyway...

I'm looking through my code, and I don't think that this is where my problem is (in the admin configuration for the reader listed above) but rather elsewhere. I first thought in the index.php code, but now I'm thinking it is in the includes file. The odd thing about this is even Nuke's Your_Account reader does the same thing with code coming out as '

Ideas?


Last edited by 64bitguy on Sat Aug 28, 2004 3:34 pm; edited 1 time in total 
64bitguy







PostPosted: Sat Aug 28, 2004 3:15 pm Reply with quote

Okay... Some more research on my part revealed that this is a problem with RSS Types.

As it turns out, everything works great, but only for UTF-8 Formatted RSS Feeds.

For feeds like RavenPHPScripts and NukeScripts Network that use:
Quote:
<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE rss PUBLIC "-//Netscape Communications//DTD RSS 0.91//EN"
"http://my.netscape.com/publish/formats/rss-0.91.dtd">

<rss version="0.91">

Single quotes are simply stripped out completely which is fine I suppose. One thing I did notice with RavenPHPScripts backend.php is that when going to the link directly in a browser, I'm prompted to Open or Save the file and when selecting "open", I get the content in an editor window versus in a browser window.

This does not happen however with the Nukescripts.net backend.php file. With Nukescripts.net backend2.php file, I get an XML page cannot be displayed error saying:
Quote:
Access is denied. Error processing resource 'http://nukescripts.net/backend2.php'

With content formatted as:
Quote:
<?xml version="1.0" encoding="iso-8859-1" ?>
- <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:admin="http://webns.net/mvcb/" xmlns:cc="http://web.resource.org/cc/" xmlns="http://purl.org/rss/1.0/">

single quotes for some reason are not filtered out, but rather come out as &apos while regular " quotes come out fine.

With sites formatted as simply:
Quote:
<?xml version="1.0" ?>
<rss version="2.0">

I have the same &apos problem.

What I must assume is that my includes file needs some more work for formats beyond UTF-8. Additionally, since it looks like it is utilizing the PHP-Nuke reader (which has the &apos; problem in Your_Account as well) I'm wondering if this is something we can fix elsewhere.

Anyone got any ideas?

Thanks!
 
hireamerica
Client



Joined: Sep 30, 2004
Posts: 103
Location: New Jersey

PostPosted: Tue Jul 26, 2005 12:10 pm Reply with quote

maybe an includes function to change &apos; back to '

Otherwise we're not HTML4 compliant:

Quote:
cannot generate system identifier for general entity "apos".


My only issues are RSS feeds with single quotes that nuke changes to &apos which get flagged by MIT's W3C HTML Validator.
 
View user's profile Send private message Visit poster's website Yahoo Messenger
hireamerica







PostPosted: Tue Jul 26, 2005 12:26 pm Reply with quote

In mainfile.php I got down to the function headlines

Quote:
function headlines($bid, $cenbox=0) {


And then found

Quote:
$content = stripslashes($row['content']);


and replaced that with:

Quote:
$content = ereg_replace("&apos;","'",stripslashes($row['content']));


And there went my HTML4 issue with &apos; in RSS feeds. I have 2 feeds and both do have occasional single quotes in their content. So this just makes sure &apos; becomes '
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> General/Other Stuff

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 ©