vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.0 Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=33)
-   -   RSS News Feed Hack (https://vborg.vbsupport.ru/showthread.php?t=60899)

Xyphen 01-28-2004 10:00 PM

RSS News Feed Hack
 
My friend made this hack, he owns http://www.liquidpro.net. Check him out.
You may contact him at liquidpro@neo.rr.com. Or you can IM him on AIM at LiquidPro10.

An example is shown at http://www.xtreme-forumz.net. Go to the Techno forum under the General category. Then the CNET News sub-forum.

RSS News Feed Hack for vB 3.0.0. As long as vBulletin doesn't change the database structure much, this should be good for the next release also, and those to come.

Allows you to have a live RSS news feed (such as one from Google or CNET) in a forum. The user that posts it will basically be a bot, which *should* only be used for posting the news, but you can even make it for a regular user.

Comments are welcome!

Instructons:
Note: DON'T FORGET TO MAKE A BACKUP OF EACH FILE BEFORE YOU MODIFY IT!

Copy the files to your web server... keep the same directory structure as in the zip file.
Run the rss_install.php file to setup the RSS script.
If you're upgrading run the rss_upgrade.php file to setup the RSS script. Don't forget to remove all previous modifications (you can find them by searching for "LiquidPro")

#### open the /index.php script ####
Find this:

PHP Code:

require_once('./includes/functions_forumlist.php'); 

Add below it:

PHP Code:

require_once('./includes/RSS/rss_update.php'); 

#### open the /forumdisplay.php script ####
Find this:

PHP Code:

require_once('./includes/functions_forumdisplay.php'); 

Add below it:

PHP Code:

require_once('./includes/RSS/rss_update.php'); 

#### open the /admincp/index.php script ####

Find this:

PHP Code:

construct_nav_group("$vbphrase[styles] &amp; $vbphrase[templates]"'<hr />'); 

Add below it:

PHP Code:

// Manage Hacks
// by: Andrew Wickham
// LiquidPro Inc.
//
construct_nav_option('RSS News Feed''rss_admin.php''<br />');
construct_nav_group('Hacks');
//
// End Manage Hacks 

You're done, thanks for installing the hack.

Hack by: Andrew Wickham (http://www.liquidpro.net)
Hack for: Xtreme-Forumz (http://www.xtreme-forumz.net)

raxafarian 01-29-2004 05:21 AM

Quote:

Originally Posted by Xyphen
My friend made this hack, he owns http://www.liquidpro.net. Check him out.
You may contact him at liquidpro@neo.rr.com. Or you can IM him on AIM at LiquidPro10.

An example is shown at http://www.xtreme-forumz.net. Go to the Techno forum under the General category. Then the CNET News sub-forum.

RSS News Feed Hack for vB 3.0.0 - RC2. As long as vBulletin doesn't change the database structure much, this should be good for the next release also, and those to come.

Allows you to have a live RSS news feed (such as one from Google or CNET) in a forum. The user that posts it will basically be a bot, which *should* only be used for posting the news, but you can even make it for a regular user.

Comments are welcome!

Instructons:
Note: DON'T FORGET TO MAKE A BACKUP OF EACH FILE BEFORE YOU MODIFY IT!

The first thing that you have to do is upload the modifyTable.php file into the root directory (the directory that includes the forumdisplay.php) file. The next thing that you need to do is run the rss_modifyTable.php file, which will modify your SQL tables in order to make it complient with the RSS News Bot. Once you have successfully modified your tables, you should now open up the forumdisplay.php file in a regular text editor (such as Notepad).

Find the following in the forumdisplay.php file
Note: On an unmodified forumdisplay.php file this will be at line 416
PHP Code:

// get announcements
$announcebits '';
$announcements $DB_site->query("
SELECT
announcementid, startdate, title, announcement.views,
user.username, user.userid, user.usertitle, user.customtitle
FROM " 
TABLE_PREFIX "announcement AS announcement
LEFT JOIN " 
TABLE_PREFIX "user AS user ON(user.userid = announcement.userid)
WHERE startdate <= " 
TIMENOW "
AND enddate >= " 
TIMENOW "
AND " 
fetch_forum_clause_sql($foruminfo['forumid'], 'forumid') . "
ORDER BY startdate DESC
iif($vboptions['oneannounce'], "LIMIT 1"));
while (
$announcement $DB_site->fetch_array($announcements))
{
if (
$announcement['customtitle'] == 2)
{
$announcement['usertitle'] = htmlspecialchars_uni($announcement['usertitle']);
}
$announcement['postdate'] = vbdate($vboptions['dateformat'], $announcement['startdate']);
if (
$announcement['startdate'] > $lastread)
{
$announcement['statusicon'] = 'new';
}
else
{
$announcement['statusicon'] = 'old';
}
$announcement['views'] = vb_number_format($announcement['views']);
$announcementidlink iif(!$vboptions['oneannounce'] , "&amp;announcementid=$announcement[announcementid]");
eval(
'$announcebits .= "' fetch_template('forumdisplay_announcement') . '";');


Once you have found that, put this immediately following it.

PHP Code:

// RSS News Feed Hack
// ------------------------------
// By: Andrew Wickham of
// LiquidPro Inc.
//
 
// get the rss settings
include("includes/rss_config.php");
 
// get the bot`s username
$rss_user_query $DB_site->query("SELECT * FROM " TABLE_PREFIX "user WHERE userid = '$rss_userid'");
$rss_user_data $DB_site->fetch_array($rss_user_query);
$rss_username $rss_user_data['username'];
$rss_posts $rss_user_data['posts'];
 
// display threads
if($forumid == $rss_forumid) {
$rss_data implode("",file($rss_source));
 
// include the RSS class
include($rss_pathToClass "/class.RSS.php");
$rss = new RSS($rss_data1);
$rss_allItems $rss->getAllItems();
// check and see what items are in the database, and mark the old ones as old
$rss_query $DB_site->query("SELECT * FROM " TABLE_PREFIX "thread WHERE rss_feed = '1'");
 
for(
$i 0$i count($rss_allItems); $i++) {
$rss_allItems[$i]['OLD'] = true;
}
 
// if there's no items in the database
if($DB_site->num_rows($rss_query) == 0) {
for(
$i 0$i count($rss_allItems); $i++) {
    
$rss_allItems[$i]['OLD'] = false;
}
}
 
// filter out the old items
while($rss_thread_data $DB_site->fetch_array($rss_query)) {
for(
$j 0$j count($rss_allItems); $j++) {
    if(
$rss_thread_data['title'] == $rss_allItems[$j]['TITLE'] && 
     
$rss_thread_data['rss_date'] == $rss_allItems[$j]['pubDate']) {
     
$rss_allItems[$j]['OLD'] = true;
    }
}
}
 
// insert the new items into the database
for($j 0$j count($rss_allItems); $j++) {
if(!
$rss_allItems[$j]['OLD']) {
    
// update the user profile
    
$rss_posts++;
 
    
$rss_title $rss_allItems[$j]['TITLE'];
    
$rss_dateline $rss_allItems[$j]['pubDate'];
    
$current_dateline time();
    
$rss_description $rss_allItems[$j]['DESCRIPTION'];
    
$rss_description .= "<br><br>[url="http://.%20$rss_allitems[$j]['link']%20./"]View the Entire Article[/url]\n";
 
    
$rss_title str_replace("&apos;""\'"$rss_title);
    
$rss_description str_replace("&apos;""\'"$rss_description);
 
    
// get the next available threadid
    
$rss_threadid_query $DB_site->query("SELECT * FROM " TABLE_PREFIX "thread ORDER BY threadid DESC");
    
$rss_threadid_data $DB_site->fetch_array($rss_threadid_query);
    
$rss_threadid $rss_threadid_data['threadid'] + 1;
 
    
// get the next available postid
    
$rss_postid_query $DB_site->query("SELECT * FROM " TABLE_PREFIX "post ORDER By postid DESC");
    
$rss_postid_data $DB_site->fetch_array($rss_postid_query);
    
$rss_postid $rss_postid_data['postid'] + 1;
 
    
$DB_site->query("INSERT INTO " TABLE_PREFIX "post (`threadid`, `username`, `userid`, `title`, `dateline`, `pagetext`, `allowsmilie`, `showsignature`, `visible`) VALUES ('$rss_threadid', '$rss_username', '$rss_userid', '$rss_title', '$current_dateline', '$rss_description', '1', '1', '1')");
    
$DB_site->query("INSERT INTO " TABLE_PREFIX "thread (`title`, `forumid`, `firstpostid`, `lastpost`, `open`, `postusername`, `postuserid`, `lastposter`, `dateline`, `visible`, `rss_feed`, `rss_date`) VALUES ('$rss_title', '$rss_forumid', '$rss_postid', '$current_dateline', '1', '$rss_username', '$rss_userid', '$rss_username', '$current_dateline', '1', '1', '$rss_dateline')");     
}
}
// update the posts in the database
$DB_site->query("UPDATE " TABLE_PREFIX "user SET posts = '$rss_posts' WHERE userid = '$rss_userid'"); 
}
 
//
// ------------------------------
// End of RSS News Hack 

Save your forumdisplay.php file

Open the rss_config.php file included with this zip, and edit the settings to your likings. Make sure you create the specified user or you'll have some major problems.

Copy the rss_config.php file to the "includes" directory on your server.

That's it for the hacking! For the thread you put this hack on, I suggest that you have it so that users other than the bot can't post new threads, only post replies. That way they can post comments on the news feed.

Hack by: Andrew Wickham (http://www.liquidpro.net)
Hack for: Xtreme-Forumz (http://www.xtreme-forumz.net)

I get this error on RC3:

PHP Code:

Database error in vBulletin 3.0.0 Release Candidate 3:

Invalid SQLINSERT INTO post (`threadid`, `username`, `userid`, `title`, `dateline`, `pagetext`, `allowsmilie`, `showsignature`, `visible`) VALUES ('155''Scuba NewsHound''16''Raich wins men's slalom in Alpine skiing World Cup', '1075360929', 'English.eastday.com Wed Jan 2804:02 am GMT<br><br>[url=http://english.eastday.com/epublish/gb/paper1/1161/class000100002/hwz179171.htm]View the Entire Article[/url]
', '1', '1', '1')
mysql error: You have an error in your SQL syntax.  Check the manual that corresponds to your MySQL server version for the right syntax to use near '
s slalom in Alpine skiing World Cup', '1075360929', 'English.ea

mysql error number
1064

Date
Thursday 29th of January 2004 01:22:09 AM
Script
: [url]http://www.wildaboutscuba.com/forums/forumdisplay.php?f=102[/url] 

102 is the correct 'news' forum.

ChrisSy 01-29-2004 08:06 AM

any chance of a screenshot? your board requires registration to view forums

surfhog 01-29-2004 08:27 AM

Sounds really kool Xyphenscreenshot would be nice though please, seems a bit silly to me - signing up to a forum, just to view a modification. hehe! we spent all day signing up to boards and waisting everybodies time LOL

:tired:

StarBuG 01-29-2004 09:01 AM

when your forum is closed for guests please provide a login for vB.org users or please make screenshots!

Like me many user wount register only to see the hack in action!

Greetings

Star

colicab-d 01-29-2004 09:04 AM

Well i just added a basic link to the external.php rss feed on my forum, had it vailadted first then just used that.

have a look on www.artorg.co.uk/index.php , i just added it to the portal :p

Xyphen 01-29-2004 09:43 AM

raxafarian thank you for the error update. This is probably because it's RC3. I notice that it's a single quote that's causing the problem. I'll download RC3 and look into it further. Thank you.

Everyone else: I attached a screen shot of it. Enjoy!

sjau 01-29-2004 11:30 AM

Would be nice to have it run on RC3...

One more thing:

what about the files in the /include/RSS folder?

You did not mention anything there.

Xyphen 01-29-2004 12:19 PM

You create a folder called RSS in the includes folder, and then upload those files into it. The files in that are the main RSS class files.

And like I said, I'm going to download RC3 tonight and get it working for it also.

raxafarian 01-29-2004 12:47 PM

Quote:

Originally Posted by Xyphen
You create a folder called RSS in the includes folder, and then upload those files into it. The files in that are the main RSS class files.

And like I said, I'm going to download RC3 tonight and get it working for it also.

the problem is the apostrophe in the headline it was trying to grab....
Quote:

'Raich wins men's slalom in........

Sooner95 01-29-2004 02:37 PM

this is a good idea... nice one. Hope this canbe made to work on the Gold version when its released...

raxafarian 01-29-2004 05:03 PM

Quote:

Originally Posted by raxafarian
the problem is the apostrophe in the headline it was trying to grab....

turning magicquotes on took care of this problem. I got it to work with one feed, but most of what I can use are not ver.91. A few feeds seem to include image tags which makes them not function. Here is one of those:
http://p.moreover.com/cgi-local/page?feed=30770&o=rss

Xyphen 01-29-2004 06:28 PM

Yea that'd fix it, because on my server it's not having a problem with apostrophe's in the titles. That example you posted isn't a very good news feed. Under the description it has the date and such, where my script is made to have the description as a short version of the article. I'd steer away from using that one, not to mention it doesn't have a pubdate field, so that'd cause some errors with the program.

I designed it with CNET News in mind.

Pady 01-29-2004 07:14 PM

an excellent looking hack m8 - would it be possible to expand it so that you can have different feeds posting in different forums?

Xyphen 01-29-2004 07:26 PM

Hm, be a little more complicated and I'd have to convert it over to SQL based instead of file-based configuration. However, it could be done... I will look at that for the next version I put out (which will probably be here in the next couple weeks). Thanks for the input.

mitchjaz 01-29-2004 09:23 PM

Looks great. I am anxious for it to ready for RC3

LLFan 01-29-2004 09:47 PM

Got it working just fine, great hack.

1 question though, as posts have been made by the bot they are not upping the forum post count. I setup a new forum just for the rss feed but people will never be able to see when new news arrives unless they physically go into the forum. Is there a fix?

Xyphen 01-30-2004 01:13 AM

Well, I could, but it'd slow down your load time for the main page. You'd have to be willing to sacrifice that.

raxafarian 01-30-2004 01:18 AM

by the way... I got that feed working. I had to delete the two RSS entries in the thread table, then reinstall them.

Seems to be working well

thanks

LLFan 01-30-2004 01:58 AM

Quote:

Originally Posted by Xyphen
Well, I could, but it'd slow down your load time for the main page. You'd have to be willing to sacrifice that.

Please explain...how would this slow down the load time?

Serge 01-30-2004 03:08 AM

Great idea. I would think maybe a cron script would be better? You could make it so it would check the feed and make a new post everytime something new came?

I don't know about that I was just thinking out loud maybe I will try and see what I can do.

Xyphen 01-30-2004 09:56 AM

LLFan, I mean... that every time someone loaded the main page it would have to access an outside source (the RSS news feed) and check if there's any new updates

mitchjaz 01-30-2004 01:39 PM

I'm running vb3 RC3. I get a mysql error due to the apostrope's in tome headlines. If I turn on magic quotes,that conflicts with other programs on my site. Is there a way to get around this? Maybe with .htaccess?

Xyphen 01-30-2004 06:28 PM

Hm, I'm not entirely sure, I don't do much with .htaccess. Maybe there's some work-around for it. I'll look into that.

Also, do you guys mind posting the URLs that you are using it on? I'd like to see it in action as a user, not the creator.

sjau 01-30-2004 10:00 PM

When does the script now update the RSS feed?

Xyphen 01-30-2004 11:21 PM

It now updates it only when you visit the specified forum. I re-wrote it tonight, and I'm going to release it probably tomorrow evening, v1.1. It has Admin Panel support now too, so it'll be a lot easier.

raxafarian 01-30-2004 11:26 PM

Quote:

Originally Posted by Xyphen
It now updates it only when you visit the specified forum. I re-wrote it tonight, and I'm going to release it probably tomorrow evening, v1.1. It has Admin Panel support now too, so it'll be a lot easier.

I'm pretty sure this is due to the crappy feed I posted above, but mine will not update. If I remove the two 'rss' tables and reinsert them, it pulls new headlines. If not, it doesn't do anything.

Also changing to another feed won't update...I still need to blow those 2 entries away and put them back.... then the new feed works... once.

mitchjaz 01-31-2004 03:05 AM

If anyone knows a workaround so it can operate with magic quotes turned off, that would be great. Also, the ability to receive image tags would be a nice feature for later as well. Here's a feed from the front of my site that I pipe in via RSS through vbindex and a server side include.

http://www.dphoto.us/forum/index.php...al_camera_news

techglitch 01-31-2004 05:35 AM

What about doing multi feeds for multi forms? For those who want to categorize more feeds..

Xyphen 01-31-2004 02:47 PM

Thanks for all the input guys. And the multi-feeds and multi-forms thing is going to be included in v1.1. I like the idea, that was the original plan but I decided not to do it for some reason. About the <img> tag. You'd have to make sure that your forum allows you to post HTML tags, or it won't work, just for future reference.

sjau 01-31-2004 03:41 PM

Quote:

Originally Posted by raxafarian
I'm pretty sure this is due to the crappy feed I posted above, but mine will not update. If I remove the two 'rss' tables and reinsert them, it pulls new headlines. If not, it doesn't do anything.

Also changing to another feed won't update...I still need to blow those 2 entries away and put them back.... then the new feed works... once.


The same happens for me. I installed it yesterday and it got those news:

Bewertung Thema / Autor Letzter Beitrag Antworten Hits
Free-software guru meets Indian president
News-Bot Gestern 20.53
von News-Bot 0 1
Sun urges Eclipse to unify Java world
News-Bot Gestern 20.53
von News-Bot 0 1
Dutch judge blocks Lindows over trademark issue
News-Bot Gestern 20.53
von News-Bot 0 1
Week in review: Virus king
News-Bot Gestern 20.53
von News-Bot 0 1
Lindows offers software for free over P2P
News-Bot Gestern 20.53
von News-Bot 0 1


But nothing since then.


Maybe instead of making it update when the forum is visited that you can set a cron to do the update like every 15 min.
If you write an admin panel it would be great if you could choose like update when the forum is visited OR every xxx min.

Xyphen 01-31-2004 09:57 PM

OK, v1.1's official out! It's updated as of right now, support for v1.0 is no longer.

sjau 01-31-2004 10:02 PM

*download*

Would it be possible to add the RSS-Bot postings also to the posting counts?

wolfstream 02-01-2004 07:36 AM

hmm, no updates?
Seems that I cant get a single update, no matter how often I visit the forum.
I entered one rss feed in, checked the forum and it was fine. After entering the second in though, it didn't do anything at all.. I thinks this is (almost) a decent hack, but it needs some other method of updating things.
Sure, I could delete and recreate it, but that'd make no sense now. SO, what seems to be the problem here?

sjau 02-01-2004 07:40 AM

Wolfstream, download the version 1.1. With that the update works when you visit the forum.

AddOn:

Some Google RSS Feeds can be found here

http://googlenews.74d.com/

Using right now the one from Google Germany:

http://wsjb78.com/forums/forumdisplay.php?f=2

wolfstream 02-01-2004 07:58 AM

Quote:

Originally Posted by sjau
Wolfstream, download the version 1.1. With that the update works when you visit the forum.

AddOn:

Some Google RSS Feeds can be found here

http://googlenews.74d.com/

Using right now the one from Google Germany:

http://wsjb78.com/forums/forumdisplay.php?f=2

Unless there's ANOTHER version of this floating around somewhere, I've already got it downloaded. It just doesn't work, go figure. I downloaded the zip, nothing is updating at all.
It's not the RSS, it's impossible for every feed I try to actually not work, really. The feeds are great, the hack doesn't work from what I've seen.

sjau 02-01-2004 08:16 AM

When did you download it? Xyphen added this night (for me) the version 1.1... something like 12h ago...
If you've downloaded your version before that you're still using the old one. :)

Do you have in your Admin CP a new Nav entry for the RSS Feeds? If not you're using the old version.

wolfstream 02-01-2004 10:18 AM

Again,
I know how to read. The file I'm using IS the latest version but does NOT work, no matter what the author claims. I've yet to see the results from the second feed, and the first just hasn't even left the first day (though it's been less than 6 hours ).

sjau 02-01-2004 10:55 AM

Ups, wolfstream you're right. It's not updating for me either.
I was sure this morning when I got up that there were more entries than when I installed it this night.

Xyphen 02-01-2004 06:20 PM

Guys, make sure you have the bots enabled! If they're not enabled they will not update. It works for me on my forum and on my testing forum. I came up with a fix for the single quotes problem, I will update the main post in a little bit for it.

Also, please note that news updates aren't in the exact order that they are on the news feed, this is due to the XML parsing. Anyways, all news updates that are on the news feed, will be on the forum... just in a different order. If all else fails, disable the rss feed. Then delete all news. Then re-enable it.


All times are GMT. The time now is 04:51 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01832 seconds
  • Memory Usage 1,911KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (9)bbcode_php_printable
  • (8)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete