Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 2.x > vBulletin 2.x Full Releases
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
news2vb - Moreover news headlines to vBulletin discussion thread Details »»
news2vb - Moreover news headlines to vBulletin discussion thread
Version: 1.00, by Cloud-Warrior Cloud-Warrior is offline
Developer Last Online: Apr 2010 Show Printable Version Email this Page

Version: 2.2.x Rating:
Released: 03-14-2002 Last Update: Never Installs: 6
 
No support by the author.

Hope the instructions at the top are clear, if not please post here.

To install this utility, copy the single PHP file to your vB dir. Edit it and change the password to whatever you wish. Change the yourvbdir variable to the URL pointing to your vB directory.

As demo - here are some sample output threads:

http://www.boards.ie/vbulletin/showt...threadid=44475
http://www.boards.ie/vbulletin/showt...threadid=44522

Also, have a look at the menu here:

http://www.boards.ie/vbulletin/news2...ion=picksource

This script will generate messages of the following form in whatever forum you wish, using any of the Moreover newsfeeds.

Changelog

1.1 - "Post News" output now shows BB code parsed message, URL to thread
1.1 - Fixed missing references to $yourvburl

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #32  
Old 02-27-2003, 01:25 PM
fimfimfim fimfimfim is offline
 
Join Date: Jan 2002
Posts: 6
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

First off, very cool mod / hack!

I was wodnering if there was an easy way to make each headline a thread with a link to the story vs putting all the days news into a thread as posts. Any help is appreciated. TIA!
Reply With Quote
  #33  
Old 02-27-2003, 02:27 PM
Cloud-Warrior's Avatar
Cloud-Warrior Cloud-Warrior is offline
 
Join Date: Feb 2002
Location: Galway, Ireland
Posts: 100
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Do you mean, instead of a thread, you'd create a pseudo-thread that would actually link to the news story?

That'd involve some hacking of vB I think, more than just an add-on

Or do you just mean having a new thread for each news item, with the subject = headline and posttext = link to article?

That'd be easy enough to do I'd say, in the loop where it says:

if ($jitemheadline != "") {
...
}

you'd post a new thread and post for each headline instead of one big thread and post with all headlines after the loop.

John.
--
Reply With Quote
  #34  
Old 02-27-2003, 02:36 PM
fimfimfim fimfimfim is offline
 
Join Date: Jan 2002
Posts: 6
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

The latter is what I was looking for. I'll give it a shot. Thanks again!
Reply With Quote
  #35  
Old 02-27-2003, 02:46 PM
fimfimfim fimfimfim is offline
 
Join Date: Jan 2002
Posts: 6
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Got it! Thanks for the input. Had a problem for a while where I wasn't setting $jmessage to null after each insert.. duh Anyway, its working great. Once again thanks for the mod and your help!
Reply With Quote
  #36  
Old 02-28-2003, 07:29 PM
limey's Avatar
limey limey is offline
 
Join Date: Dec 2001
Location: -
Posts: 187
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Can you post how you did the new thread per story listing?

Aside from queries and keywords, can you limit the number of stories pulled?
Reply With Quote
  #37  
Old 02-28-2003, 07:41 PM
fimfimfim fimfimfim is offline
 
Join Date: Jan 2002
Posts: 6
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Sure here's what I did:

In the section that Could-Warrior mentioned:

if ($jitemheadline != "") {

I added this to limit the headlines to within one hour of the script executing:

$currenttime=time();
$articletime=strtotime($jitemextractiontime);
if ($articletime < ($currenttime - 3600))
continue;


I added this to limit the duplicate headlines:

$result=$DB_site->query("SELECT threadid FROM thread WHERE title LIKE '".addslashes($jitemheadline)."' ");
if ($DB_site->num_rows($result) > 0)
continue;


Lastly, I moved all of this: (which is all Cloud-Warrior's original code with a small change to the VALUES list to make the title of the article appear as the thread subject)

else {
$jmessage .= "[*] ".$jitemheadline."\n";
$jmessage .= "($jitemsource, $jitemextractiontime) \n";
$jsubject = urlencode($jitemheadline);
$jmessage = ereg_replace("INSERTTITLE", "$jsubject", $jmessage);
$DB_site->query("INSERT INTO thread (threadid,title,lastpost,forumid,open,replycount,p ostusername,postuserid,lastposter,dateline,iconid, visible,attach) VALUES (NULL,'".addslashes($jitemheadline)."','".time()." ','$jforum','1','0','".addslashes($jfromwho)."','0 ','".addslashes($jfromwho)."','".time()."','$jicon id','1','0')");
$jthreadid=$DB_site->insert_id();
$jmessage = ereg_replace("INSERTTHREADID", "$jthreadid", $jmessage);
$DB_site->query("INSERT INTO post (postid,threadid,title,username,userid,dateline,at tachmentid,pagetext,allowsmilie,showsignature,ipad dress,iconid,visible) VALUES (NULL,'$jthreadid','".addslashes(htmlspecialchars( "$jusername"))."','".addslashes($jfromwho)."','0', '".time()."','0','".addslashes($jmessage)."','0',' ','','0','1')");
$jmessage = NULL;
$jforuminfo=getforuminfo($jforum);
$DB_site->query("UPDATE forum SET replycount=replycount+1,threadcount=threadcount+1, lastpost='".time()."',lastposter='".addslashes($jf romwho)."' WHERE forumid IN ($jforuminfo[parentlist])");
}
}

Changes Summary:

Bascially added "$jmessage=NULL;" to force only one link per thread.

I commented out all the code right below the "foreach" loop since I've moved it into the loop.

Added the $jitemheadline as the threadtitle vs the one that is created by Cloud-Warriors original.

Well, that's what I did. It should be pretty easy to limit headlines to a set number. Just add a counter and increment each time the loop goes and check for a conditon where it has reached your number of headlines and break ouyt of the loop.

I hope this makes sense. I haven't coded since my college days. The good old days of double pointers, malloc, etc. :laugh:
Reply With Quote
  #38  
Old 03-01-2003, 03:11 AM
limey's Avatar
limey limey is offline
 
Join Date: Dec 2001
Location: -
Posts: 187
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

fimfimfim:

Would it be possible to post your code in entirety? I lost you at
Quote:
Lastly, I moved all of this:
and down.

thanks.
Reply With Quote
  #39  
Old 03-01-2003, 02:00 PM
redd redd is offline
 
Join Date: Sep 2002
Posts: 24
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Just an FYI before you all get too used to this hack... Moreover stopped offering free newsfeeds last August. They contacted me last week and told me that I had to stop using Moreover unless I was willing to sign up for their paid service.

Quote:
We would like to bring to your attention that due to a change in our Terms and Conditions, your website may be in breach of our terms of service. Our Terms and Conditions were updated in August 2002 to restrict use of our public feeds to charitable organizations only, subject to approval by Moreover. (Our terms and conditions can be viewed at http://c.moreover.com/click/here.pl?q51885055).

If you wish to continue receiving these news feeds and you are not a charitable organization, then for a limited period, we can offer you a discount on the standard pricing. If you are interested in receiving product information and pricing from us please complete the form at http://gm14.com/r.html?c=177529&r=17...4982.&g=0&f=-1 Alternatively, phone our US sales department on +1 415 989 0600 or our UK sales department on +44 253 5003.

If, having reviewed our Terms & Conditions, you believe you qualify for continued use of this free service, then please complete the form at this link http://gm14.com/r.html?c=177529&r=17...84117&g=0&f=-1 giving as much detail as possible.

If we do not hear from you within two weeks, headline functionality will be disabled and access to the service will be denied.
Reply With Quote
  #40  
Old 03-03-2003, 12:55 PM
fimfimfim fimfimfim is offline
 
Join Date: Jan 2002
Posts: 6
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Considering the current economic situation, not many things are free these days anymore... :cry:

In any case, here's what it looks like. You can just replace everything from the starting point.


FROM THE TOP:


// news2vb.php, post Moreover news headlines to your vBulletin forum
// Cloud Internet, www.cloud.ie, Version 1.1, 19 March 2002
// Please read the Moreover Terms and Conditions before using this script:
// http://w.moreover.com/site/about/ter...onditions.html
// More information on Moreover at http://w.moreover.com/dev/
// 1.1 - "Post News" output now shows BB code parsed message, URL to thread
// 1.1 - Fixed missing references to $yourvburl
// 1.0 - First version of script

...
CHANGES START HERE

foreach ($jrebrokennewsfeed as $array_id => $jnewsfeedline) {
list($jitemarticleurl, $jitemheadline, $jitemsource, $jitemmediatype, $jitemcategory, $jitemtagline, $jitemcategoryurl, $jitemextractiontime, $jitemaccessstatus, $jitemregistrationurl) = split ("\t", $jnewsfeedline);
if ($jitemheadline != "") {
$currenttime=time();
$articletime=strtotime($jitemextractiontime);
if (if ($jitemheadline != "") {$articletime < ($currenttime - 3600))
continue;
$result=$DB_site->query("SELECT threadid FROM thread WHERE title LIKE '".addslashes($jitemheadline)."' ");
if ($DB_site->num_rows($result) > 0)
continue;
else {
$jmessage .= "[*] ".$jitemheadline."\n";
$jmessage .= "($jitemsource, $jitemextractiontime) \n";
$jsubject = urlencode($jitemheadline);
$jmessage = ereg_replace("INSERTTITLE", "$jsubject", $jmessage);
$DB_site->query("INSERT INTO thread (threadid,title,lastpost,forumid,open,replycount,p ostusername,postuserid,lastposter,dateline,iconid, visible,attach) VALUES (NULL,'".addslashes($jitemheadline)."','".time()." ','$jforum','1','0','".addslashes($jfromwho)."','0 ','".addslashes($jfromwho)."','".time()."','$jicon id','1','0')");
$jthreadid=$DB_site->insert_id();
$jmessage = ereg_replace("INSERTTHREADID", "$jthreadid", $jmessage);
$DB_site->query("INSERT_INTO_post_(postid,threadid,title,us ername,userid,dateline,attachmentid,pagetext,allow smilie,showsignature,ipaddress,iconid,visible)_VAL UES_(NULL,'$jthreadid','".addslashes(htmlspecialch ars("$jusername"))."','".addslashes($jfromwho)."', '0','".time()."','0','".addslashes($jmessage)."',' 0','','','0','1')");
$jmessage = NULL;
$jforuminfo=getforuminfo($jforum);
$DB_site->query("UPDATE forum SET replycount=replycount+1,threadcount=threadcount+1, lastpost='".time()."',lastposter='".addslashes($jf romwho)."'_WHERE_forumid_IN_($jforuminfo[parentlist])");
}
}

}

$jmessage .= "[/list]\n";
$jthreadurl = "$yourvburl/showthread.php?s=&threadid=$jthreadid";

$jbbcodeparsed = bbcodeparse2($jmessage, 1, 1, 1, 1);

$jcheckhtml = "<html>
<head>
<title>news2vb - Post News</title>
</head>
<body>
<h1>news2vb - Post News</h1>
<h5>Thread created - <a href=\"$jthreadurl\">$jthreadurl</a></h5>
<h5>Moreover query - <a href=\"$jnewsfeedurl\">$jnewsfeedurl</a></h5>
<h5>Autocreate URL - $jgenerateurl</h5>
<h3>$jtitle</h3>
$jbbcodeparsed
</body>
</html>";
print $jcheckhtml;
}

function infile($infile) {
$in = fopen($infile, "r");
if(!$in) {
echo "error: could not open the url: $requesturl<br>\n";
} else {
$contents = "";
while(!feof($in)) {
$contents .= fgets($in,256);
}
}
fclose($in);
return $contents;
}
Reply With Quote
  #41  
Old 03-04-2003, 03:33 AM
limey's Avatar
limey limey is offline
 
Join Date: Dec 2001
Location: -
Posts: 187
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

fimfimfim: thanks for posting the code. However, where does this code go between? What does this code replace?

The standard practice here@ vb.org seems to be:
Quote:
find this code "xxxx" and replace with this code "xxxx"
Can you do it like this?

thanks again.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 01:19 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.07446 seconds
  • Memory Usage 2,322KB
  • Queries Executed 25 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (3)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)pagenav_pagelink
  • (11)post_thanks_box
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (11)postbit_onlinestatus
  • (11)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • 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
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete