XMB Forum Software
Not logged in [Login - Register]
Go To Bottom

Printable Version  
 Pages:  1  
Author:

RSS Feed Hack

Phil1ooo
Member
***




Posts: 85
Registered: 4-24-2013
Member Is Offline


[*] posted on 5-5-2013 at 10:28 PM
RSS Feed Hack


Hi

Does anyone know of a RSS feed hack? One that allows feeds to be posted on the forum and if possible also provides the forums rss feed links/page etc.

Cheers




View user's profile View All Posts By User
lottos
Administrator
********




Posts: 356
Registered: 6-3-2002
Location: Competitions Australia: https://www.lottos.com.au/
Member Is Offline

Mood: pass me a TimTam

[*] posted on 5-10-2013 at 04:10 AM


Here's a really old one. It looks like it was based on an old version of xmb, so you probably need to alter it:
1. The first select:
$query1 = mysql_query("SELECT lastpost, fid ,tid, subject FROM {$tablepre}threads ORDER BY lastpost DESC");
Alter to add: WHERE fid IN(fid ids)
fid ids being replaced by the actual forum id numbers seperated by commas, eg: WHERE fid IN(1,5,7)

2. Remove the other SELECTS that look and exclude private forums, as the latest version of xmb handles this differently and point 1 should simplify it.


Code:
<?php Header('Content-type: text/xml'); include ('config.php'); $edate=gmdate("D,d M Y H:i:s T"); /* /////////////////////// Installation //////////////////////////////// 1) Change the configuration settings below to match your requirements 2) Upload this file into your forum directory 3) The RSS Feedlink can be located anywhere on your site <a href="http://www.yoursite.com/forumdirectory/xmb-rss.php"> ///////////////////// Installation End ////////////////////////////// */ ///////////////// Configuration settings //////////////////////////// // Required Parameters $title=""; //The title of your newsfeed $description=""; //The description of your newsfeed $linkurl=""; // Link url to your site or forum $webmaster=""; //e-mail address of site webmaster $maxnews=10; //The maximum number of news items to display $copyright=""; // RSS Feed Copyright notice // Optional Parameters $imageurl=""; // URL of News Logo/Forum Logo etc $editor=""; //e-mail address of news editor $feedstatus=1; //Feedstatus 1 for on 0 for off $postorder="ASC"; //ASC show first post in thread DESC show last post in thread $showtopics=0; // Show topics only in feed 1= on 0=off $category=1; //use forum name as newsitem category 1= on 0 = off // Custom Error message Configuration $msgtitle="Forum Feed Is currently Offline";//The title if Newsfeed is offline $msgdesc="The website administrator has temporarily turned off this RSS feed. Please check again later";//Message to display if feed is offline $msgsql="The newsfeeed is currently offline. Please try again later"; //message to display if msyql connection fails ///////////////// Configuration End ///////////////////////////////// echo "<?xml version=\"1.0\"?>\n"; echo "<rss version=\"2.0\">\n"; echo " <channel>\n"; echo " <title>$title</title>\n"; echo " <link>$linkurl</link>\n"; echo " <description>$description</description>\n"; echo " <language>en-us</language>\n"; echo " <copyright>$copyright</copyright>\n"; echo " <generator>XMB Forum RSS Feeder - http://forums.xmbforum2.com</generator>\n"; echo " <webMaster>$webmaster</webMaster>\n"; // Additional options display if ($editor==""){ }else{ echo " <managingEditor>$editor</managingEditor>\n"; } if ($imageurl==""){ }else{ echo " <image>\n"; echo " <title>$title</title>\n"; echo" <url>$imageurl</url>\n"; echo" <link>$linkurl</link>\n"; echo" <description>$description</description>\n"; echo" </image>\n"; } switch($feedstatus){ case 1: // Connect to forum and retreive Last 10 Posts @$dbh = mysql_connect ($dbhost, $dbuser, $dbpw)or die ("<item>\n<title>$msgtitle</title>\n<description>$msgsql</description>\n<pubdate>$edate</pubdate>\n</item>\n</channel>\n</rss>"); @$result = mysql_select_db ($dbname, $dbh) or die ("<item>\n<title>$msgtitle</title>\n<description>$msgsql</description>\n<pubdate>$edate</pubdate>\n</item>\n</channel>\n</rss>"); //Latest 10 posts Not showing Private forums $x=0; $query1 = mysql_query("SELECT lastpost, fid ,tid, subject FROM {$tablepre}threads ORDER BY lastpost DESC"); while($last = mysql_fetch_array($query1)) { $query2 = mysql_query("SELECT name,userlist,private FROM {$tablepre}forums WHERE fid =$last[fid]"); $forum =mysql_fetch_array($query2); //ignore private forums if (($forum[userlist] == "")and($forum[private]==1)){ //retrieve first post for each thread being displayed $query3 = mysql_query("SELECT message,author,dateline FROM {$tablepre}posts WHERE fid=$last[fid] AND tid=$last[tid] ORDER BY pid $postorder LIMIT 1"); $content = mysql_fetch_array($query3); $rawnews= stripslashes($content[message]); $newsbody=htmlentities($rawnews,ENT_COMPAT); $pdate=gmdate("D,d M Y H:i:s T",$content[dateline]); $rawtitle = stripslashes($last[subject]); $newstitle=htmlentities($rawtitle,ENT_COMPAT); $rawcat = stripslashes($forum[name]); $newscat=htmlentities($rawcat,ENT_COMPAT); $author=htmlentities($content[author],ENT_COMPAT); //output each forum topic echo " <item>\n"; if ($category==1){ echo" <category>$newscat</category>\n"; } echo " <title><![CDATA[$newstitle]]></title>\n"; // } echo " <link>$full_url"; echo"viewthread.php?tid=$last[tid]</link>\n"; echo " <pubDate>$pdate</pubDate>\n"; if($showtopic==0){ echo " <description>By: $author\n<![CDATA[$newsbody]]></description>\n"; } echo " </item>\n"; $x++; } if ($x == $maxnews){ break; }} mysql_close(); break; case 0: // Offline output statement echo"<item>\n"; echo" <title>$msgtitle</title>\n"; echo" <pubDate>$edate</pubDate>\n"; echo " <description>$msgdesc</description>\n"; echo"</item>\n"; break; } //Finally, close off your XML/RSS tags: echo " </channel>\n"; echo "</rss> "; /* ////////////////////// Changelog ////////////////////////////////////// 1) included config.php to provide database connection settings 2) added newslogo image support 3) added script configuration settings including no of items to display and ability to turn feed on and off 4) added installation instructions and improved script comments 5)Check and remove all private forums from display 6) Added Copyright info for news 7) Using CDATA and htmlentities to Clean invalid characters from posts (ie & etc) 8) Added show first post or last post in thread option 9) Better sql error message now in rss format 10) Added option to Customize error messages 11) Put timestamp as <pubdate> in error feeds 12) Tidied up code and removed un-necessay items from script used during testing 13) Added option to show forum name in Newstitle 14) Using htmlentities to Clean invalid characters from newstitles (ie & etc) 15) Removed the forum name in Title infavour of the Item Category option 16) Added the display of the post author in the posd 17) Corrected Link display in each item 18) 24-05-05 Fix added to Topic Titles to correct illegal RSS characters 19) 25-05-04 Added option to Show topic titles only in feed ToDo List 1) allow feedstatus and configuration to be altered from forum Admin 2) add option to use specific forum for newsfeeds? 3) Join queries like today.php */ ?>




Largest list of competitions online!
View user's profile Visit user's homepage View All Posts By User
Phil1ooo
Member
***




Posts: 85
Registered: 4-24-2013
Member Is Offline


[*] posted on 5-10-2013 at 04:44 AM


Thank You

I keep getting error on line 43 in my browser which is this
----
Parse error: syntax error, unexpected T_STRING in /home/name/public_html/forum/rss-file-name.php on line 43
----
Which is this below
---
Code:
echo "<?xml version=\"2.0\"?>\n";

---
I've tried changing it to a number of various versions off the top of my head but nothing works, Tried removing it but also no go.

Any idea on what should go there?

Cheers




View user's profile View All Posts By User
lottos
Administrator
********




Posts: 356
Registered: 6-3-2002
Location: Competitions Australia: https://www.lottos.com.au/
Member Is Offline

Mood: pass me a TimTam

[*] posted on 5-10-2013 at 05:09 AM


Change it back to 1

I reckon the issue is elsewhere, especially if you have altered the code.

If you've made the changes I recommended, upload it here and I'll see if I can see anything obvious.




Largest list of competitions online!
View user's profile Visit user's homepage View All Posts By User
Phil1ooo
Member
***




Posts: 85
Registered: 4-24-2013
Member Is Offline


[*] posted on 5-10-2013 at 07:26 AM


Quote: Originally posted by lottos  
Change it back to 1

I reckon the issue is elsewhere, especially if you have altered the code.

If you've made the changes I recommended, upload it here and I'll see if I can see anything obvious.


Doesn't matter what I try nothing changes the error message.
Here's the file.

Am I just supposed to add a RSS link into one of the posts for this to work?


Attachment: ozy_rss.php (5kB)
This file has been downloaded 109 times




View user's profile View All Posts By User
lottos
Administrator
********




Posts: 356
Registered: 6-3-2002
Location: Competitions Australia: https://www.lottos.com.au/
Member Is Offline

Mood: pass me a TimTam

[*] posted on 5-10-2013 at 07:48 AM


Replace
$query1 = mysql_query("SELECT lastpost, fid, tid, WHERE fid IN[1,3] threads ORDER BY lastpost DESC");

with
$query1 = mysql_query("SELECT lastpost, fid, tid, WHERE fid IN(1,3) threads ORDER BY lastpost DESC");




Largest list of competitions online!
View user's profile Visit user's homepage View All Posts By User
Phil1ooo
Member
***




Posts: 85
Registered: 4-24-2013
Member Is Offline


[*] posted on 5-10-2013 at 08:25 AM


Quote: Originally posted by lottos  
Replace
$query1 = mysql_query("SELECT lastpost, fid, tid, WHERE fid IN[1,3] threads ORDER BY lastpost DESC");

with
$query1 = mysql_query("SELECT lastpost, fid, tid, WHERE fid IN(1,3) threads ORDER BY lastpost DESC");


I already tried that before and just changed it back to (). No Difference.

Maybe it is me testing it wrong. How should I be testing this?




View user's profile View All Posts By User
lottos
Administrator
********




Posts: 356
Registered: 6-3-2002
Location: Competitions Australia: https://www.lottos.com.au/
Member Is Offline

Mood: pass me a TimTam

[*] posted on 5-10-2013 at 08:44 AM


You need to get the code correct before it will run.

You have one too many closing } somewhere - when you removed some of the code you missed removing it.




Largest list of competitions online!
View user's profile Visit user's homepage View All Posts By User
lottos
Administrator
********




Posts: 356
Registered: 6-3-2002
Location: Competitions Australia: https://www.lottos.com.au/
Member Is Offline

Mood: pass me a TimTam

[*] posted on 5-10-2013 at 10:57 AM


A newer one, which is the one used on this very forum (preview either via the link along the header to the right of the search, or via http://forums.xmbforum2.com/feed.xml.php ):

Code:
<?php /** * eXtreme Message Board * XMB 1.9.11 * * RSS Feed Add-On * Version 0.1 BETA by Robert Chapin (miqrogroove) * http://www.miqrogroove.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, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * **/ define('X_SCRIPT', 'feed.xml.php'); // Configurable, edit as you like! define('MAX_RSS_ITEMS', 10); require 'header.php'; $fid = getInt('fid'); $fids = loadFIDs(); if ($fid > 0) { if (!in_array($fid, $fids)) { header('HTTP/1.0 404 Not Found'); error('404 Not Found'); } else { $fids = array($fid); $forum = getForum($fid); $link = "{$full_url}forumdisplay.php?fid=$fid"; $title = rss_cdata(fnameOut($forum['name'])); $desc = rss_cdata(html_entity_decode($forum['description'])); } } else { $link = $full_url; $title = $SETTINGS['bbname']; $desc = $lang['alttodayposts']; } if (count($fids) == 0) { header('HTTP/1.0 403 Forbidden'); error('The forums have not been configured for guest access yet.'); } $fids = implode(',', $fids); $query = $db->query( "SELECT t.*, MIN(p.dateline) AS firstpost FROM ".X_PREFIX."threads AS t LEFT JOIN ".X_PREFIX."posts AS p USING (tid) WHERE t.fid IN ($fids) AND t.closed NOT LIKE 'moved%' GROUP BY t.tid ORDER BY tid DESC LIMIT ".MAX_RSS_ITEMS ); if ($row = $db->fetch_array($query)) { $lastpost = explode('|', $row['lastpost']); $build = '<lastBuildDate>'.date('r', $lastpost[0]).'</lastBuildDate>'; $db->data_seek($query, 0); } else { $build = ''; } echo "<?xml version='1.0' encoding='{$lang['charset']}' ?>\n"; ?> <rss version="2.0"> <channel> <title><?php echo $title; ?></title> <link><?php echo $link; ?></link> <description><?php echo $desc; ?></description> <language><?php echo $lang['iso639']; ?></language> <generator><?php echo $versionlong; ?></generator> <?php echo "$build\n"; ?> <?php while ($thread = $db->fetch_array($query)) { ?> <item> <title><?php echo rawHTMLsubject(stripslashes($thread['subject'])); ?></title> <link><?php echo "{$full_url}viewthread.php?tid={$thread['tid']}"; ?></link> <guid><?php echo "{$full_url}viewthread.php?tid={$thread['tid']}"; ?></guid> <pubDate><?php echo date('r', $thread['firstpost']); ?></pubDate> </item> <?php } // wend ?> </channel> </rss> <?php //loadFIDs returns an array of forum and subforum IDs accessible by Guests. function loadFIDs() { $forums = permittedForums(forumCache(), 'thread', 'array', TRUE, 'Guest'); $fids = array(); foreach($forums as $forum) { if ($forum['type'] != 'group') { $fids[] = $forum['fid']; } } return $fids; } function rss_cdata($input) { return "<![CDATA[$input]]>"; } ?>




Largest list of competitions online!
View user's profile Visit user's homepage View All Posts By User
Phil1ooo
Member
***




Posts: 85
Registered: 4-24-2013
Member Is Offline


[*] posted on 5-10-2013 at 09:35 PM


Thank You But I am still getting an error message
------------------

Internet Explorer cannot display this feed




This feed contains code errors.



Go back to the previous page.



More information


Invalid at the top level of the document.
Line: 71 Character: 7

</rss>

----------------

But looking at the file line 71 has this on it

Code:
$db->data_seek($query, 0);

and </rss> is on line 99 with nothing as character 7 as there only 6 characters in this.




View user's profile View All Posts By User
Phil1ooo
Member
***




Posts: 85
Registered: 4-24-2013
Member Is Offline


[*] posted on 5-10-2013 at 09:48 PM


Quote: Originally posted by lottos  
You need to get the code correct before it will run.

You have one too many closing } somewhere - when you removed some of the code you missed removing it.


That wouldn't surprise me as php although I am trying it has never been my strong suit.

You know I'll tell ya something, I'm a fully Qualified PastryChef, chef, baker, account, and done Law for 10yrs, a 4x4 fanatic, I relocate houses (that's a whole house), I've created and managed multi million dollar businesses, been around Australia 3 times just to name a few (the point is I am no idiot) BUT I just for some reason can't get my head around this PHP stuff. HTML is fine but php just has me beat at the moment.

But I am working at it everyday as I'm semi-retired now and have the time.




View user's profile View All Posts By User
lottos
Administrator
********




Posts: 356
Registered: 6-3-2002
Location: Competitions Australia: https://www.lottos.com.au/
Member Is Offline

Mood: pass me a TimTam

[*] posted on 5-10-2013 at 11:42 PM


Everyone has to learn somehow!

Not sure why that newer script is erroring. I assume you've made no changes to it? Have you tried with another browser like FireFox?




Largest list of competitions online!
View user's profile Visit user's homepage View All Posts By User
Phil1ooo
Member
***




Posts: 85
Registered: 4-24-2013
Member Is Offline


[*] posted on 5-11-2013 at 12:06 AM


Quote: Originally posted by lottos  
Everyone has to learn somehow!

Not sure why that newer script is erroring. I assume you've made no changes to it? Have you tried with another browser like FireFox?

Correct no changes made.
Just tried in Firefox and it does work.

I mostly IE-10 in win8




View user's profile View All Posts By User
Phil1ooo
Member
***




Posts: 85
Registered: 4-24-2013
Member Is Offline


[*] posted on 5-11-2013 at 12:11 AM


Now is it possible to get feeds displayed say on a topic board.
I remember years ago when I was using smf I had a rss hack that when I placed a RSS link in the description panel it displayed feeds say 10 new feeds everyday into that board each in there own posts under that rss feed heading.

Brings new content to the forum automatically on a daily bases or weekly depending on the admin settings.

Nothing like that is there?




View user's profile View All Posts By User
Phil1ooo
Member
***




Posts: 85
Registered: 4-24-2013
Member Is Offline


thumbup.gif posted on 5-11-2013 at 12:32 AM


Quote: Originally posted by lottos  
Everyone has to learn somehow!

Not sure why that newer script is erroring. I assume you've made no changes to it? Have you tried with another browser like FireFox?


I have fixed the IE issue by removing these lines at the bottom

----------------------
Largest list of competitions online!


View user's profile Visit user's homepage View All Posts By User U2U Member
---------------------

It now works in IE

Cheers




View user's profile View All Posts By User
lottos
Administrator
********




Posts: 356
Registered: 6-3-2002
Location: Competitions Australia: https://www.lottos.com.au/
Member Is Offline

Mood: pass me a TimTam

[*] posted on 5-11-2013 at 02:21 AM


Quote: Originally posted by Phil1ooo  
Quote: Originally posted by lottos  
Everyone has to learn somehow!

Not sure why that newer script is erroring. I assume you've made no changes to it? Have you tried with another browser like FireFox?


I have fixed the IE issue by removing these lines at the bottom

----------------------
Largest list of competitions online!


View user's profile Visit user's homepage View All Posts By User U2U Member
---------------------

It now works in IE

Cheers



That made me smile.... you copied more than what was in the code box!

I'm curious as to why you would want the RSS feed on your own website? Doesn't 'Todays Posts' already provide the most up to date topics?

In any case, you need to convert the RSS back - there are plenty of examples on the web for this, one example see post 7 on this site:
https://forums.digitalpoint.com/threads/how-to-display-rss-f...




Largest list of competitions online!
View user's profile Visit user's homepage View All Posts By User
Phil1ooo
Member
***




Posts: 85
Registered: 4-24-2013
Member Is Offline


[*] posted on 5-11-2013 at 02:43 AM


Not sure how it got there then but anyway it's fixed now.

As for wanting the rss feed, I originally didn't want it for my own website but wanted to be able to display other rss feeds ON my website in certain posts.

For forums with little content rss feeds put in content automatically.
I'll look into what you provided.

Thanks heaps for all your help on this.

Cheers




View user's profile View All Posts By User
Phil1ooo
Member
***




Posts: 85
Registered: 4-24-2013
Member Is Offline


[*] posted on 5-11-2013 at 05:41 AM


Here have a look at this and if I am correct this should update every hour
http://www.ozyforums.com.au/viewthread.php?tid=403

What do you think?

I am working on getting the details to be displayed as well.




View user's profile View All Posts By User
lottos
Administrator
********




Posts: 356
Registered: 6-3-2002
Location: Competitions Australia: https://www.lottos.com.au/
Member Is Offline

Mood: pass me a TimTam

[*] posted on 5-11-2013 at 06:00 AM


Looks great!


I see:

posted on 11-5-2013 at 04:37 PM
Latest news From XMB Forums


XMB Forum
Today's Posts

[New] Theme preview thumbnail is "error.png"
php programmer looking for love
xmb seo
New Icon Image for each forum id Suggestion
[New] Members List
[New] Need to know where a line of code is!
[New] Move text BELOW header in seperate tables.
RSS Feed Hack
xmb future
[New] Trying to upgrade. Need xmb 1.8 first. Help?




Largest list of competitions online!
View user's profile Visit user's homepage View All Posts By User
Phil1ooo
Member
***




Posts: 85
Registered: 4-24-2013
Member Is Offline


[*] posted on 5-11-2013 at 06:07 AM


Thank You

Like I said this should update with new/updated content every hour.

I hope that part works. (cross fingers) LOL

When I know it's working I can offer this to users so they can generate their own feed links from any website and install the code to access feeds.





View user's profile View All Posts By User
 Pages:  1  

  Go To Top

Powered by XMB 1.9.11 (Debug Mode)
Forum Script Software by XMB © 2001-2017 The XMB Group
[Queries: 16] [PHP: 11.6% - SQL: 88.4%]
Funded with thanks to competitions website.