PHP Web Host - Quality Web Hosting For All PHP Applications Just Great Software
  Login or Register
 • Home • Downloads • Your Account • Forums • 

View next topic
View previous topic


Google
 
Web RavenPHPScripts (This Site)
Post new topic   This topic is locked: you cannot edit posts or make replies.
Author Message
BobMarion
Former Admin in Good Standing


Joined: Oct 30, 2002
Posts: 1043
Location: RedNeck Land (known as Kentucky)

PostPosted: Wed Aug 25, 2004 9:23 pm Reply with quote Back to top

Any site running NukeSentinel(tm) that allows other sites to add their backend.php news feed needs to do the following:

Open backend.php in a text editor and find:
Code:
include("mainfile.php");
header("Content-Type: text/xml");


Replace it with:
Code:
//include("mainfile.php");
require_once("config.php");
require_once("db/db.php");
$row = $db->sql_fetchrow($db->sql_query("SELECT * FROM ".$prefix."_config"));
$sitename = $row[sitename];
$nukeurl = $row[nukeurl];
$backend_title = $row[backend_title];
$backend_language = $row[backend_language];

header("Content-Type: application/rss+xml");


NukeSentinel(tm) is blocking outside sites from adding your backend.php into a block on their sites and the above corrects it.

UPDATED: This post has been updated to include those items found below.


Last edited by BobMarion on Thu Aug 26, 2004 10:15 am; edited 2 times in total
View user's profile Send private message Send e-mail Visit poster's website
64bitguy
The Mouse Is Extension Of Arm


Joined: Mar 06, 2004
Posts: 1156
Location: Sanbornton, NH USA

PostPosted: Thu Aug 26, 2004 2:37 am Reply with quote Back to top

Excellent Development Support = Going to lookup a solution to a problem that you just found, only to find that an annoucement was posted 4 hours earlier.

I'm getting the feeling that Bob:
A) Is A Voodoo Priest.
B) Is spending non-coding time developing ESP skills.
C) Has one hell of a crystal ball.
D) Got an email from someone that is syndicating RSS feeds wondering why they won't load anymore.

In any event, its all good to me! Thanks!
View user's profile Send private message Visit poster's website
BobMarion
Former Admin in Good Standing


Joined: Oct 30, 2002
Posts: 1043
Location: RedNeck Land (known as Kentucky)

PostPosted: Thu Aug 26, 2004 2:39 am Reply with quote Back to top

To confess, it came from a bug report on my site Smile
View user's profile Send private message Send e-mail Visit poster's website
Muffin
Client


Joined: Apr 10, 2004
Posts: 649
Location: UK

PostPosted: Thu Aug 26, 2004 5:48 am Reply with quote Back to top

Thanks Bob.

I had a newsfeed on my site, but in a block. It worked fine with Sentinel.

The only thing that went wonky was when the newsfeed site was down and it screwed up the display on the page.
View user's profile Send private message
mesa
New Member
New Member


Joined: Jul 30, 2004
Posts: 1

PostPosted: Thu Aug 26, 2004 6:34 am Reply with quote Back to top

Here are the results after reediting with the code on the backend.php

Only registered users can see links on this board!
Get registered or login to the forums!

--------------------------------------------------------
Sorry
This feed does not validate.

Your feed appears to be encoded as "ISO-8859-1", but your server is reporting "US-ASCII" [help]


line 9, column 26: title contains bad characters (2 occurrences) [help]

<title>Ravens PHP Scripts ™</title> ^
line 10, column 6: link must be a full and valid URL [help]

<link></link> ^
line 15, column 19: title contains bad characters (4 occurrences) [help]

<title>NukeSentinel™ and RSS feeds</title> ^
line 16, column 57: link must be a full and valid URL (10 occurrences) [help]

<link>/modules.php?name=News&amp;file=article&amp;sid=471</link> ^
Source:
Only registered users can see links on this board!
Get registered or login to the forums!




Rssults are pull from
Only registered users can see links on this board!
Get registered or login to the forums!


to reconfirm
Only registered users can see links on this board!
Get registered or login to the forums!
View user's profile Send private message Visit poster's website
sixonetonoffun
Spouse Contemplates Divorce


Joined: Jan 02, 2003
Posts: 2499

PostPosted: Thu Aug 26, 2004 6:44 am Reply with quote Back to top

Doesn't really say if that validater supports out of date rss 0.91 I'd guess it is for 2.0 but anyway if you hunt around there are some efforts to create updated backend.php out there.
View user's profile Send private message
molten2
New Member
New Member


Joined: Jun 27, 2004
Posts: 16

PostPosted: Thu Aug 26, 2004 6:54 am Reply with quote Back to top

Eliminate bad char and try to add this line to Bob's code.

Code:

$nukeurl = $row[nukeurl];


This solution work for me and validate correctly
Only registered users can see links on this board!
Get registered or login to the forums!


bye


Last edited by molten2 on Thu Aug 26, 2004 7:22 am; edited 1 time in total
View user's profile Send private message Send e-mail Visit poster's website
GeekyGuy
Client


Joined: Jun 03, 2004
Posts: 302
Location: Huber Heights Ohio

PostPosted: Thu Aug 26, 2004 7:11 am Reply with quote Back to top

I'll get this info added to the next update to the NukeSentinel(tm) User Guide FAQ.
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger MSN Messenger ICQ Number
sixonetonoffun
Spouse Contemplates Divorce


Joined: Jan 02, 2003
Posts: 2499

PostPosted: Thu Aug 26, 2004 7:16 am Reply with quote Back to top

I have to ask what setting has to be anabled to create this issue Bob? Because I just tested a feed and it seems to function ok without the additional code? So I assume ther are specific circumstances under which there is an issue??
View user's profile Send private message
molten2
New Member
New Member


Joined: Jun 27, 2004
Posts: 16

PostPosted: Thu Aug 26, 2004 7:27 am Reply with quote Back to top

in my experience the news feeds don't work only for sentinel protected sites...
View user's profile Send private message Send e-mail Visit poster's website
sixonetonoffun
Spouse Contemplates Divorce


Joined: Jan 02, 2003
Posts: 2499

PostPosted: Thu Aug 26, 2004 7:46 am Reply with quote Back to top

Yes the feed comes from a Sentinel protected site but its shown on a PostNuke site in a core RSS block. Thats why I was wondering what circumstances created an issue with backend.php The one I use is slightly modified but not a lot. Validates fine runs on the mentioned block fine without the updates above? The only blocker not active on the site is the proxy blocker. I surrender! If it's not borke I'm not fixing it lol!
View user's profile Send private message
molten2
New Member
New Member


Joined: Jun 27, 2004
Posts: 16

PostPosted: Thu Aug 26, 2004 8:55 am Reply with quote Back to top

try to use the rss reader coming from your_account module in a sentinel (2.0.1) protected site...
instead of reading it with a block.
View user's profile Send private message Send e-mail Visit poster's website
chatserv
The Mouse Is Extension Of Arm


Joined: May 02, 2003
Posts: 1396
Location: Puerto Rico

PostPosted: Thu Aug 26, 2004 9:17 am Reply with quote Back to top

If it works used on a block but doesn't on the YA module try editing its index, find:
Code:
   if ($fp) {
           fputs($fp, "GET " . $rdf['path'] . "?" . $rdf['query'] . " HTTP/1.0\r\n");

change to:
Code:
   if ($fp) {
       if ($rdf['query'] != '')
           $rdf['query'] = "?" . $rdf['query'];

       fputs($fp, "GET " . $rdf['path'] . $rdf['query'] . " HTTP/1.0\r\n");

That is the only variant i could find between the two.
View user's profile Send private message Visit poster's website
sixonetonoffun
Spouse Contemplates Divorce


Joined: Jan 02, 2003
Posts: 2499

PostPosted: Thu Aug 26, 2004 9:51 am Reply with quote Back to top

Thanks molten2
I'd have never thought of using the reader in Your Account its not a feature I really think of often.

Though Ravens site will read in the reader mine won't pre or post changes guess I'll have to dig a little more. Works in the blocks fine both before and after but the reader it doesn't and also it validated fine before the changes and now it gives a couple xml parse errors Grr!

Guess I'll keep playing with it and read up on the topic a little.
View user's profile Send private message
Raven
Site Admin/Owner


Joined: Aug 27, 2002
Posts: 16987
Location: Kansas

PostPosted: Thu Aug 26, 2004 9:51 am Reply with quote Back to top

molten2 wrote:
Eliminate bad char and try to add this line to Bob's code.

Code:

$nukeurl = $row[nukeurl];


This solution work for me and validate correctly
Only registered users can see links on this board!
Get registered or login to the forums!


bye
I added your url code. Does the feed from here work now?
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger
BobMarion
Former Admin in Good Standing


Joined: Oct 30, 2002
Posts: 1043
Location: RedNeck Land (known as Kentucky)

PostPosted: Thu Aug 26, 2004 9:58 am Reply with quote Back to top

Glad I posted this, used the validator and discovered one other thing.

You also need to change the:
Code:
header("Content-Type: text/xml");


To:
Code:
header("Content-Type: application/rss+xml");
View user's profile Send private message Send e-mail Visit poster's website
molten2
New Member
New Member


Joined: Jun 27, 2004
Posts: 16

PostPosted: Thu Aug 26, 2004 10:01 am Reply with quote Back to top

Yes, It works well now Smile
Thank-you all.
View user's profile Send private message Send e-mail Visit poster's website
BobMarion
Former Admin in Good Standing


Joined: Oct 30, 2002
Posts: 1043
Location: RedNeck Land (known as Kentucky)

PostPosted: Thu Aug 26, 2004 10:03 am Reply with quote Back to top

One thing about title contains bad characters. Since Raven and I both use the (tm) by way of &trade; it is getting that error. Until I figure out how to strip out the htmlentities I'll continue to get that error on my feed.

I've updated my backend.php to have this:
Code:
//include("mainfile.php");
require_once("config.php");
require_once("db/db.php");
$row = $db->sql_fetchrow($db->sql_query("SELECT * FROM ".$prefix."_config"));
$sitename = $row[sitename];
$nukeurl = $row[nukeurl];
$backend_title = $row[backend_title];
$backend_language = $row[backend_language];

header("Content-Type: application/rss+xml");


Which got rid of all but the htmlentities error reported.
Only registered users can see links on this board!
Get registered or login to the forums!
View user's profile Send private message Send e-mail Visit poster's website
Raven
Site Admin/Owner


Joined: Aug 27, 2002
Posts: 16987
Location: Kansas

PostPosted: Thu Aug 26, 2004 10:06 am Reply with quote Back to top

So you aren't using the updated header?
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger
BobMarion
Former Admin in Good Standing


Joined: Oct 30, 2002
Posts: 1043
Location: RedNeck Land (known as Kentucky)

PostPosted: Thu Aug 26, 2004 10:11 am Reply with quote Back to top

Yes I am Smile, had to edit the post above. Had two different copies of backend.php open at the same time and copied from the wrong one Bang Head
View user's profile Send private message Send e-mail Visit poster's website
sixonetonoffun
Spouse Contemplates Divorce


Joined: Jan 02, 2003
Posts: 2499

PostPosted: Thu Aug 26, 2004 10:20 am Reply with quote Back to top

Feed works from here on the Your Account from my site ok. I didnt' try it in a block.

I figured out why it was in part working ok on my PostNuke site in the block its because the PostNuke block adds a referer and user-agent to the fput request.

I haven't figured out why the rest was as it was yet so for the time being I have backend.php for nuke and backend1.php for myself. backend1.php has the image and copyright links though the copyright doesn't get parsed in the block as far as I can tell (From
Only registered users can see links on this board!
Get registered or login to the forums!
syndycation mod which I use if I move news out of the home page to run off a center block on the same site neat trick)

But anyway I can live with this cause no one gives a chit about my feeds but me lol!
View user's profile Send private message
Raven
Site Admin/Owner


Joined: Aug 27, 2002
Posts: 16987
Location: Kansas

PostPosted: Thu Aug 26, 2004 10:51 am Reply with quote Back to top

This fixes the $sitename variable, but not the $backend_title as there is no allowance for the non-space character before the entity. I'm sure it can be tweaked. I hacked some code I found on the net
Code:
//include("mainfile.php");
require_once("config.php");
require_once("db/db.php");
$row = $db->sql_fetchrow($db->sql_query("SELECT * FROM ".$prefix."_config"));
$sitename = $row[sitename];
$backend_title = $row[backend_title];
$backend_language = $row[backend_language];
$nukeurl = $row[nukeurl];
$sitename = stripEntities($sitename);
$backend_title = stripEntities($backend_title);

function stripEntities($s) {
   $s = preg_replace('!&[^;\s]+;!','',$s);         ## remove HTML entities.
   $s = preg_replace('![^\w\s]!','',$s);           ## remove non-word/space chars.
   return $s;
}

header("Content-Type: application/rss+xml");
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger
Raven
Site Admin/Owner


Joined: Aug 27, 2002
Posts: 16987
Location: Kansas

PostPosted: Thu Aug 26, 2004 11:56 am Reply with quote Back to top

Here's the final piece of the puzzle! Find this line
Code:
    echo "<title>".htmlspecialchars($row[title])."</title>\n";
and modify it to
Code:
   $title = $row[title];
   $title = stripEntities($title);
    echo "<title>".htmlspecialchars($title)."</title>\n";

This gives a clean report!
Only registered users can see links on this board!
Get registered or login to the forums!
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger
Raven
Site Admin/Owner


Joined: Aug 27, 2002
Posts: 16987
Location: Kansas

PostPosted: Thu Aug 26, 2004 12:00 pm Reply with quote Back to top

To clarify, I now have this code for backend.php (this is from v6.9)
Code:
<?php

/************************************************************************/
/* PHP-NUKE: Advanced Content Management System                         */
/* ============================================                         */
/*                                                                      */
/* Copyright (c) 2002 by Francisco Burzi                                */
/* http://phpnuke.org                                                   */
/*                                                                      */
/* 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.       */
/************************************************************************/

//include("mainfile.php");
require_once("config.php");
require_once("db/db.php");
$row = $db->sql_fetchrow($db->sql_query("SELECT * FROM ".$prefix."_config"));
$sitename = $row[sitename];
$backend_title = $row[backend_title];
$backend_language = $row[backend_language];
$nukeurl = $row[nukeurl];
$sitename = stripEntities($sitename);
$backend_title = stripEntities($backend_title);

function stripEntities($s) {
   $s = preg_replace('!&[^;\s]+;!','',$s);         ## remove HTML entities.
   $s = preg_replace('![^\w\s]!','',$s);           ## remove non-word/space chars.
   return $s;
}

header("Content-Type: application/rss+xml");
if ($cat != "") {
    $sql = "SELECT catid FROM ".$prefix."_stories_cat WHERE title LIKE '%$cat%' LIMIT 1";
    $result = $db->sql_query($sql);
    $catid = $db->sql_fetchrow($result);
    if ($catid == "") {
   $sql = "SELECT sid, title FROM ".$prefix."_stories ORDER BY sid DESC LIMIT 10";
   $result = $db->sql_query($sql);
    } else {
   $sql = "SELECT sid, title FROM ".$prefix."_stories WHERE catid='$catid' ORDER BY sid DESC LIMIT 10";
   $result = $db->sql_query($sql);
    }
} else {
    $sql = "SELECT sid, title FROM ".$prefix."_stories ORDER BY sid DESC LIMIT 10";
    $result = $db->sql_query($sql);
}

echo "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n\n";
echo "<!DOCTYPE rss PUBLIC \"-//Netscape Communications//DTD RSS 0.91//EN\"\n";
echo " \"http://my.netscape.com/publish/formats/rss-0.91.dtd\">\n\n";
echo "<rss version=\"0.91\">\n\n";
echo "<channel>\n";
echo "<title>".htmlspecialchars($sitename)."</title>\n";
echo "<link>$nukeurl</link>\n";
echo "<description>".htmlspecialchars($backend_title)."</description>\n";
echo "<language>$backend_language</language>\n\n";

while ($row = $db->sql_fetchrow($result)) {
    echo "<item>\n";
   $title = $row[title];
   $title = stripEntities($title);
    echo "<title>".htmlspecialchars($title)."</title>\n";
    echo "<link>$nukeurl/modules.php?name=News&amp;file=article&amp;sid=$row[sid]</link>\n";
    echo "</item>\n\n";
}
echo "</channel>\n";
echo "</rss>";

?>


Last edited by Raven on Thu Aug 26, 2004 12:59 pm; edited 2 times in total
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger
BobMarion
Former Admin in Good Standing


Joined: Oct 30, 2002
Posts: 1043
Location: RedNeck Land (known as Kentucky)

PostPosted: Thu Aug 26, 2004 12:55 pm Reply with quote Back to top

hehehehe, backend.php hasn't changed since 6.5 thru 7.4 with the exception of Chat's fixes Wink

Anyway, the reason for commenting out the mainfile.php include line is this.

1) Your site is running NukeSentinel
2) I try to add your backend.php to my site thru Blocks Admin
3) With the mainfile pulled into backend.php my sites admin returns an error on adding yoru backend.php:
There is a problem with the RSS file URL

Please check the URL and RSS file name, then try again.
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:       
Post new topic   This topic is locked: you cannot edit posts or make replies.

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