Advertisement:

Author Topic: RSS Injector available  (Read 189870 times)

Offline L.G.S

  • SMF Hero
  • ******
  • Posts: 2,658
  • Gender: Male
  • RuthlessIntent.com !
    • GamesandGoals.com
Re: RSS Injector available
« Reply #80 on: March 24, 2006, 10:57:08 AM »
I have tried the code yes, and nothing. Worked once now it's dead.
FREE and LIVE World Cup + Premier League football streams:

www.gamesandgoals.com


Offline TechnoDragon

  • Jr. Member
  • **
  • Posts: 374
  • Gender: Male
  • With great power comes great resposibility...
    • Dragon Talk Forum
Re: RSS Injector available
« Reply #81 on: March 24, 2006, 08:51:47 PM »
it worked once?

Well it may not be working not because it is broken, but because there are no new news coming rom that feed...the php file is designed to test against what has already been posted and skip it if it thinks it is already there...try a different feed and see what happens
Don't tell me to get into shape...I have a shape...It is round!


Offline Xarcell

  • SMF Hero
  • ******
  • Posts: 1,684
  • Gender: Male
  • SMF-DP Supporter
Re: RSS Injector available
« Reply #82 on: March 24, 2006, 09:58:14 PM »
You have to run the new.php to show feeds each time, unless you set up a cron job to run it for you automactically.

Offline TechnoDragon

  • Jr. Member
  • **
  • Posts: 374
  • Gender: Male
  • With great power comes great resposibility...
    • Dragon Talk Forum
Re: RSS Injector available
« Reply #83 on: March 24, 2006, 10:15:07 PM »
You have to run the new.php to show feeds each time, unless you set up a cron job to run it for you automactically.

Did you get your to work?  I hadn't heard from you in awhile.  Just wondering.
Don't tell me to get into shape...I have a shape...It is round!


Offline L.G.S

  • SMF Hero
  • ******
  • Posts: 2,658
  • Gender: Male
  • RuthlessIntent.com !
    • GamesandGoals.com
Re: RSS Injector available
« Reply #84 on: March 25, 2006, 05:30:15 AM »
You have to run the new.php to show feeds each time, unless you set up a cron job to run it for you automactically.

Yes I know that, I did read the posts.

thanks for the help everyone, although I think I will not use this
FREE and LIVE World Cup + Premier League football streams:

www.gamesandgoals.com


Offline L.G.S

  • SMF Hero
  • ******
  • Posts: 2,658
  • Gender: Male
  • RuthlessIntent.com !
    • GamesandGoals.com
Re: RSS Injector available
« Reply #85 on: March 25, 2006, 09:55:54 AM »
Scratch that last comment, I have figured it out.

Although I have one problem, when I click MARK READ in recent posts they never go away :(
FREE and LIVE World Cup + Premier League football streams:

www.gamesandgoals.com


Offline TechnoDragon

  • Jr. Member
  • **
  • Posts: 374
  • Gender: Male
  • With great power comes great resposibility...
    • Dragon Talk Forum
Re: RSS Injector available
« Reply #86 on: March 25, 2006, 10:13:40 AM »
ok, that is a very fixable problem.  Go into your admin panel, click forum maitenence, click recount forum statistics.  Once that it complete, click fixes all errors and click yes...voila...problems go away!

It is a bug that I cannot figure out how to fix.  (not that familiar with coding)
Don't tell me to get into shape...I have a shape...It is round!


Offline L.G.S

  • SMF Hero
  • ******
  • Posts: 2,658
  • Gender: Male
  • RuthlessIntent.com !
    • GamesandGoals.com
Re: RSS Injector available
« Reply #87 on: March 25, 2006, 11:57:06 AM »
Nope, they are all still there lol.

Also how do I make them appear on the forum index as new posts? in the 'last post' are it always says NA
FREE and LIVE World Cup + Premier League football streams:

www.gamesandgoals.com


Offline TechnoDragon

  • Jr. Member
  • **
  • Posts: 374
  • Gender: Male
  • With great power comes great resposibility...
    • Dragon Talk Forum
Re: RSS Injector available
« Reply #88 on: March 25, 2006, 02:01:02 PM »
Nope, they are all still there lol.

Also how do I make them appear on the forum index as new posts? in the 'last post' are it always says NA

That is another problem i have been trying to get fixed....I did not write the original coding for this...jsut figured out how to get it to work.  Anyone that can answer that question of how to make them show up as "new" would be greatly appreciated...as far as NA...it is because the injector uses the member ID rather than the name...I could not figure out how to get it to do that either.
Don't tell me to get into shape...I have a shape...It is round!


Offline L.G.S

  • SMF Hero
  • ******
  • Posts: 2,658
  • Gender: Male
  • RuthlessIntent.com !
    • GamesandGoals.com
Re: RSS Injector available
« Reply #89 on: March 25, 2006, 02:23:21 PM »
ok thanks,

I guess I will have to wait until someone picks up on this.
FREE and LIVE World Cup + Premier League football streams:

www.gamesandgoals.com


Offline TechnoDragon

  • Jr. Member
  • **
  • Posts: 374
  • Gender: Male
  • With great power comes great resposibility...
    • Dragon Talk Forum
Re: RSS Injector available
« Reply #90 on: March 25, 2006, 03:56:55 PM »
ok thanks,

I guess I will have to wait until someone picks up on this.

You can see how it works at my site...I have three different boards right now using it:

http://forum.technodragon.net/index.php?board=56.0
http://forum.technodragon.net/index.php?board=57.0
http://forum.technodragon.net/index.php?board=58.0

(Actually I have more, but I figure these are enough to see what works)
Don't tell me to get into shape...I have a shape...It is round!


Offline L.G.S

  • SMF Hero
  • ******
  • Posts: 2,658
  • Gender: Male
  • RuthlessIntent.com !
    • GamesandGoals.com
Re: RSS Injector available
« Reply #91 on: March 25, 2006, 07:10:07 PM »
I do not know what you are trying to show me but mine are here:

http://www.tactical-illusion.com/board/index.php?board=167.0
FREE and LIVE World Cup + Premier League football streams:

www.gamesandgoals.com


Offline Xarcell

  • SMF Hero
  • ******
  • Posts: 1,684
  • Gender: Male
  • SMF-DP Supporter
Re: RSS Injector available
« Reply #92 on: March 25, 2006, 08:50:47 PM »
Damnit, wish mine would work...

Offline TechnoDragon

  • Jr. Member
  • **
  • Posts: 374
  • Gender: Male
  • With great power comes great resposibility...
    • Dragon Talk Forum
Re: RSS Injector available
« Reply #93 on: March 26, 2006, 12:44:57 AM »
I do not know what you are trying to show me but mine are here:

http://www.tactical-illusion.com/board/index.php?board=167.0

So basically you got yours working?  Except for the "new" issue?
Damnit, wish mine would work...

Yours is still not working at all?
Don't tell me to get into shape...I have a shape...It is round!


Offline L.G.S

  • SMF Hero
  • ******
  • Posts: 2,658
  • Gender: Male
  • RuthlessIntent.com !
    • GamesandGoals.com
Re: RSS Injector available
« Reply #94 on: March 26, 2006, 05:32:01 AM »
Yes they are working except for the part where they dont show as new.

I'm not too good with code, where would I increase the post characters?
FREE and LIVE World Cup + Premier League football streams:

www.gamesandgoals.com


Offline TechnoDragon

  • Jr. Member
  • **
  • Posts: 374
  • Gender: Male
  • With great power comes great resposibility...
    • Dragon Talk Forum
Re: RSS Injector available
« Reply #95 on: March 26, 2006, 10:10:06 AM »
Yes they are working except for the part where they dont show as new.

I'm not too good with code, where would I increase the post characters?

The post is entirely dependant on what the news feed provides...it doesn't pull any more info than the fedd gives...so if it only gives a link and title...that is all you get, but if it gives more (as some do) like an image, brief summary, and link then you get that instead.
Don't tell me to get into shape...I have a shape...It is round!


Offline L.G.S

  • SMF Hero
  • ******
  • Posts: 2,658
  • Gender: Male
  • RuthlessIntent.com !
    • GamesandGoals.com
Re: RSS Injector available
« Reply #96 on: March 26, 2006, 01:39:22 PM »
ok, thanks.
FREE and LIVE World Cup + Premier League football streams:

www.gamesandgoals.com


Offline Xarcell

  • SMF Hero
  • ******
  • Posts: 1,684
  • Gender: Male
  • SMF-DP Supporter
Re: RSS Injector available
« Reply #97 on: March 26, 2006, 01:59:11 PM »
@ L.G.S

At first you where having the same problem I was. Now yours is work. What did you do to get it to work?

Can I please get a copy of the news.php you used? Just remove your password and such.

Thanks,

-Xarcell


Offline L.G.S

  • SMF Hero
  • ******
  • Posts: 2,658
  • Gender: Male
  • RuthlessIntent.com !
    • GamesandGoals.com
Re: RSS Injector available
« Reply #98 on: March 26, 2006, 03:36:10 PM »
I now have a file for each news type, so here is my world news file:

Code: [Select]
<?php
//
// SMF RSS Injector by Jerry Bell - jerry@cyvin.org
// Based on the Joomla RSS import script by Max Soukhomlinov, maxs@intellectit.com.au
// 
// This script requires XML_RSS and PHP Pear Libraries
// 
//
// This script is quick and dirty. Please remember to abide by the RSS content providers&#39; terms of use.  

/** the PEAR XML_RSS object/class is required */
require &#39;RSS.php&#39;;

/** DATABASE Configuration */
define("DB_HOSTNAME","localhost"); //Insert your DB server name here
define("DB_USERNAME",""); //DB username here
define("DB_PASSWD",""); // DB password here
define("DB_DATABASE",""); //DB name here
$userid 475//Set this to the SMF userid you want the messages posted from
$boardid 170.0;//Set this to the id of the board you want to post the messages in

/** pull list of remote RSS feeds, via a remote RSS feed. */
$rss_feed = & new XML_RSS(&#39;http://news.google.co.uk/nwshp?tab=wn&ned=uk&topic=w&output=rss&#39;); //Insert your URL here
//$rss_feed = & new XML_RSS(&#39;&#39;); //Used this for testing with local file, a bit quicker
// Function for shortening articles based on maximum length
function str_stop($string$max_length){
   if (
strlen($string) > $max_length){
       
$string substr($string0$max_length);
       
$pos strrpos($string" ");
       if(
$pos === false) {return substr($string0$max_length)."...";}
       return 
substr($string0$pos)."...";
   }else{return 
$string;}
}
/** create the database connection object */
$obj_db = @mysql_connect(DB_HOSTNAME,DB_USERNAME,DB_PASSWD) or die (mysql_error());

/** select the intended database */
@mysql_select_db(DB_DATABASE,$obj_db) or die (mysql_error());

$rss_feed->parse();

$num_articles=0//Variable used to count number of new articles, displayed in an email below

    // Here we make sure that feed articles do not already exist in DB
    // this uses title names, make sure to use the same title formatting here as you will use further down
    // state = 1 not trashed
    
foreach ($rss_feed->getItems() as $item) {
        
$obj_query = @mysql_query("
            SELECT
                COUNT(ID_MSG) AS link_match
            FROM
                smf2_messages
            WHERE
                subject = &#39;"
str_stop(addslashes($item[&#39;title&#39;]),100) ."&#39;
        
",$obj_db) or die(mysql_error());

        
$int_count = @mysql_fetch_assoc($obj_query) or die(mysql_error());

        mysql_free_result(
$obj_query);

        if (
$int_count[&#39;link_match&#39;] == 0) {

    
$num_articles = $num_articles +1;
/**
 * REFORMATTING CODE
 **/
// In my experience you have to play with the definitions from different RSS feeds - some rss feeds call fields different things.  
$titletext = str_stop(addslashes($item[&#39;title&#39;]),100);
// This adds an html link at to the original article at the very bottom of the post.
$maintext = addslashes($item[&#39;description&#39;]) . "<p><a href=\"" $item[&#39;link&#39;] . "\">" . $item[&#39;link&#39;] . "</a>";
    
@mysql_query("
INSERT INTO smf2_topics(
ID_BOARD,
ID_MEMBER_STARTED,
ID_MEMBER_UPDATED
) VALUES (
&#39;
$boardid&#39;,
&#39;
$userid&#39;,
&#39;
$userid&#39;
)
"
,$obj_db) or die(mysql_error());
$topic mysql_insert_id();
$postertime date(&#39;U&#39;);
//Insert the actual message
    
@mysql_query("
INSERT INTO smf2_messages(
subject,
body,
  ID_MEMBER,
ID_BOARD,
ID_TOPIC,
posterTime
) VALUES (
&#39;"
$titletext ."&#39;,
&#39;"
$maintext ."&#39;,
&#39;
$userid&#39;,
&#39;
$boardid&#39;,
&#39;
$topic&#39;,
&#39;
$postertime&#39;
)
"
,$obj_db) or die(mysql_error());
$messageid mysql_insert_id();
//Go back and set ID_FIRST_MSG and ID_LAST_MSG in the topics table
    
@mysql_query("
UPDATE smf2_topics
SET ID_FIRST_MSG = &#39;
$messageid&#39;, 
ID_LAST_MSG = &#39;
$messageid&#39;
WHERE ID_TOPIC = &#39;
$topic&#39;
"
,$obj_db) or die(mysql_error());
//Increment total posts for board
    
@mysql_query("
UPDATE smf2_boards
SET numPosts = numPosts + 1, 
numTopics = numTopics + 1
WHERE ID_BOARD = &#39;
$boardid&#39;
"
,$obj_db) or die(mysql_error());
//Increment Total Messages
    
@mysql_query("
UPDATE smf2_settings
SET value = value + 1
WHERE variable = &#39;totalMessages&#39;
"
,$obj_db) or die(mysql_error());
//Increment Total Topics
    
@mysql_query("
UPDATE smf2_settings
SET value = value + 1
WHERE variable = &#39;totalTopics&#39;
"
,$obj_db) or die(mysql_error());
// Increment post count for user record
    
@mysql_query("
                        UPDATE smf2_members
                        SET posts = posts + 1
                                WHERE ID_MEMBER = &#39;
$userid&#39;
                "
,$obj_db) or die(mysql_error());
        } 
    }

if (
$obj_db) {
    @
mysql_close($obj_db);
}
?>
FREE and LIVE World Cup + Premier League football streams:

www.gamesandgoals.com


Offline TechnoDragon

  • Jr. Member
  • **
  • Posts: 374
  • Gender: Male
  • With great power comes great resposibility...
    • Dragon Talk Forum
Re: RSS Injector available
« Reply #99 on: March 26, 2006, 04:24:35 PM »
I did exactly the same thing...every feed has a different file...now if I had enough CRON jobs to run them all!  LOL
Don't tell me to get into shape...I have a shape...It is round!