View Single Post
  #2  
Old 01-29-2004, 05:21 AM
raxafarian raxafarian is offline
 
Join Date: Apr 2003
Posts: 28
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01248 seconds
  • Memory Usage 1,878KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD_SHOWPOST
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (3)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • reputationlevel
  • showthread
Included Files:
  • ./showpost.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showpost_start
  • bbcode_fetch_tags
  • bbcode_create
  • postbit_factory
  • showpost_post
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • showpost_complete