News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

RSS Feed Poster

Started by SMFHacks.com Team, January 11, 2007, 07:46:04 PM

Previous topic - Next topic

acadiaforum.net

Quote from: markdw on April 05, 2011, 04:06:26 AM
Makes total sense, I'm testing this now. It seems crazy that posting HTML isn't controlled through the permissions system, that way we could create a custom permission set up for the feed poster...

Well, technically it is, but with a cron job set up to create its own posts, you're sort of circumventing the permission system. I think if the author of this mod wanted to include this feature (at least in 1.1.x , not sure about 2.x), he would need to create a random hash mark (or have the user do it) and use that in place of the HTML bbc code. Then he'd need to also modify the Subs_post file as well and add that chunk of code with a check for that hash.

I've been successfully using this for 3 days now. It's perfect for the HTML formatted Ebay rss feeds I'm using.
New GM Crossover Forums: AcadiaForum.net [nofollow] | EnclaveForum.net [nofollow] | SaturnOutlookForum.net [nofollow] | TraverseForum.com [nofollow]

TheCodfather

when i point my browser to my cron php file im getting

Fatal error: Call to undefined function tp_loadtheme() in /home/goseafis/public_html/Sources/Load.php on line 1370

vbgamer45

That's a problem hmm you might have to modify your load.php to check if in SSI or not or if that function exists. Sounds like a bug with tiny portal though that should be reported.
Community Suite for SMF - Grow your forum with SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com - Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

TheCodfather

#2063
well it posted some posts but its not displaying the html properly its posting the code not the pictures etc

example below any way to fix it ?

<table border="0" cellpadding="8"><tr><td width="80px"><img border="0" src="http://thumbs4.ebaystatic.com/m/m5OAwl0sJ0eIs_ZsqDhr6HQ/80.jpg"></td><td><strong>£0.99</strong> (0 Bids)
End Date: Thursday Apr-07-2011 18:32:52 BST
Bid now | Add to watch list</td></tr></table>


and also what would i need to modify and how ?

TheCodfather

stop working at all now.

no posting nothing.

markdw

Quote from: acadiaforum.net on April 06, 2011, 10:48:53 AM
Quote from: markdw on April 05, 2011, 04:06:26 AM
Makes total sense, I'm testing this now. It seems crazy that posting HTML isn't controlled through the permissions system, that way we could create a custom permission set up for the feed poster...

Well, technically it is, but with a cron job set up to create its own posts, you're sort of circumventing the permission system. I think if the author of this mod wanted to include this feature (at least in 1.1.x , not sure about 2.x), he would need to create a random hash mark (or have the user do it) and use that in place of the HTML bbc code. Then he'd need to also modify the Subs_post file as well and add that chunk of code with a check for that hash.

I've been successfully using this for 3 days now. It's perfect for the HTML formatted Ebay rss feeds I'm using.

Yup, has been posting for days now without any problems in that regard. Was just wondering if you have had any issues with this not posting the lastest couple of items on the feed? My site is reading two feeds and it refuses to post the last update for either one until something else is added to the feed above it.

It's also randomly double-posting items from a YouTube feed as if they were new items, but in fairness YouTube isn't great for RSS.

MoreBloodWine

Not sure about the youtube thing but the not posting last feed is one of a few things I pointed out to VB which I'm hoping he can get to at some point.

Edit: Come think of it, the youtube thing could be the feed owner makin a minor change to it which tricks the mod in to think its new.
Quote from: markdw on April 11, 2011, 12:01:45 PM
Quote from: acadiaforum.net on April 06, 2011, 10:48:53 AM
Quote from: markdw on April 05, 2011, 04:06:26 AM
Makes total sense, I'm testing this now. It seems crazy that posting HTML isn't controlled through the permissions system, that way we could create a custom permission set up for the feed poster...

Well, technically it is, but with a cron job set up to create its own posts, you're sort of circumventing the permission system. I think if the author of this mod wanted to include this feature (at least in 1.1.x , not sure about 2.x), he would need to create a random hash mark (or have the user do it) and use that in place of the HTML bbc code. Then he'd need to also modify the Subs_post file as well and add that chunk of code with a check for that hash.

I've been successfully using this for 3 days now. It's perfect for the HTML formatted Ebay rss feeds I'm using.

Yup, has been posting for days now without any problems in that regard. Was just wondering if you have had any issues with this not posting the lastest couple of items on the feed? My site is reading two feeds and it refuses to post the last update for either one until something else is added to the feed above it.

It's also randomly double-posting items from a YouTube feed as if they were new items, but in fairness YouTube isn't great for RSS.
Want a sig like mine for your BTCGuild stats ? Then check this out: Spend-ur-Bits


markdw

Nope, the youtube channel isnt being edited at all - but like I said YouTube's RSS format has caused me headaches in the past so I will get that parsed through yahoo pipes.

So is there idea of what is causing the "wont post last item" error?

w3bm4st3r

RSS Feed Poster create new topics without content??

alimrb

is there any complete sql syntax for converting html tags to smf bbcode?

Swifty550

Quote from: markdw on April 11, 2011, 12:01:45 PM

Yup, has been posting for days now without any problems in that regard. Was just wondering if you have had any issues with this not posting the lastest couple of items on the feed? My site is reading two feeds and it refuses to post the last update for either one until something else is added to the feed above it.


Any news on this problem?

Thanks.

PLAYBOY

I have seen many other posts in this title but nobody really gave an answer to Turkish encoding problem.

How do we change the character encoding of this?
It shows scrambled Turkish characters.

Here are more details about the problem:

When i change ISO-8859-1 to ISO-8859-9 in subs-rss.php ,
cronrss.php gives me these error... and it doesnt post anything anymore.

Warning: xml_parser_create() [function.xml-parser-create]: unsupported source encoding "ISO-8859-9" in /home/site/public_html/forum/Sources/Subs-RSS.php on line 210

Warning: xml_set_element_handler(): supplied argument is not a valid XML Parser resource in /home/site/public_html/forum/Sources/Subs-RSS.php on line 225

Warning: xml_set_character_data_handler(): supplied argument is not a valid XML Parser resource in /home/site/public_html/forum/Sources/Subs-RSS.php on line 226

Warning: xml_parse(): supplied argument is not a valid XML Parser resource in /home/site/public_html/orum/Sources/Subs-RSS.php on line 228

Warning: xml_parser_free(): supplied argument is not a valid XML Parser resource in /home/site/public_html/forum/Sources/Subs-RSS.php on line 232




Also If somebody gives me all the texts, i can just translate it to Turkish.

Another excellent mod from VBGAMER! Thank You!

PLAYBOY

#2072
Quote from: ghostm on August 18, 2008, 10:36:05 AM
FOR TURKISH NON-UTF8 SITES

Install package from admin area and than open the file in package "Subs-RSS.PHP" or get it from "Sources" folder.

find this:
// Globals
$feedcount = 0;
$maxitemcount = 0;
$tag = '';
$insideitem = false;


after that copy and paste this:

# GLOBAL VARIABLES
$url = "http://www.unicode.org/Public/MAPPINGS/ISO8859/8859-9.TXT";
//$url = "8859-9.txt";
$iso2utf = array();
$utf2iso = array();

# UNICODE MAPPING TABLE PARSING
function create_map($url){
    global $iso2utf, $utf2iso;
    $fl = @(file($url)) OR (die("cannot open file : $url\n"));
    for ($i=0; $i<count($fl); $i++){
        if($fl[$i][0] != '#' && trim($fl[$i])){
            list($iso, $uni, $s, $desc) = split("\t",$fl[$i]);
            $iso2utf[$iso] = $uni;
            $utf2iso[$uni] = $iso;
        }
    }
}

# FINDING UNICODE LETTER'S DECIMAL ASCII VALUE
function uniord($c){
    $ud = 0;
    if (ord($c{0})>=0 && ord($c{0})<=127)   $ud = $c{0};
    if (ord($c{0})>=192 && ord($c{0})<=223) $ud = (ord($c{0})-192)*64 + (ord($c{1})-128);
    if (ord($c{0})>=224 && ord($c{0})<=239) $ud = (ord($c{0})-224)*4096 + (ord($c{1})-128)*64 + (ord($c{2})-128);
    if (ord($c{0})>=240 && ord($c{0})<=247) $ud = (ord($c{0})-240)*262144 + (ord($c{1})-128)*4096 + (ord($c{2})-128)*64 + (ord($c{3})-128);
    if (ord($c{0})>=248 && ord($c{0})<=251) $ud = (ord($c{0})-248)*16777216 + (ord($c{1})-128)*262144 + (ord($c{2})-128)*4096 + (ord($c{3})-128)*64 + (ord($c{4})-128);
    if (ord($c{0})>=252 && ord($c{0})<=253) $ud = (ord($c{0})-252)*1073741824 + (ord($c{1})-128)*16777216 + (ord($c{2})-128)*262144 + (ord($c{3})-128)*4096 + (ord($c{4})-128)*64 + (ord($c{5})-128);
    if (ord($c{0})>=254 && ord($c{0})<=255) $ud = false; //error
    return $ud;
}

# PARSING UNICODE STRING
function utf2iso($source) {
    global $utf2iso;
    $pos = 0;
    $len = strlen ($source);
    $encodedString = '';
   
    while ($pos < $len) {
        $is_ascii = false;
        $asciiPos = ord (substr ($source, $pos, 1));
        if(($asciiPos >= 240) && ($asciiPos <= 255)) {
            // 4 chars representing one unicode character
            $thisLetter = substr ($source, $pos, 4);
            $thisLetterOrd = uniord($thisLetter);
            $pos += 4;
        }
        else if(($asciiPos >= 224) && ($asciiPos <= 239)) {
            // 3 chars representing one unicode character
            $thisLetter = substr ($source, $pos, 3);
            $thisLetterOrd = uniord($thisLetter);
            $pos += 3;
        }
        else if(($asciiPos >= 192) && ($asciiPos <= 223)) {
            // 2 chars representing one unicode character
            $thisLetter = substr ($source, $pos, 2);
            $thisLetterOrd = uniord($thisLetter);
            $pos += 2;
        }
        else{
            // 1 char (lower ascii)
            $thisLetter = substr ($source, $pos, 1);
            $thisLetterOrd = uniord($thisLetter);
            $pos += 1;
            $encodedString .= $thisLetterOrd;
            $is_ascii = true;
        }
        if(!$is_ascii){
            $hex = sprintf("%X", $thisLetterOrd);
            if(strlen($hex)<4) for($t=strlen($hex);$t<4;$t++)$hex = "0".$hex;
            $hex = "0x".$hex;
            $hex = $utf2iso[$hex];
            $hex = str_replace('0x','',$hex);
            $dec = hexdec($hex);
            $encodedString .= sprintf("%c", $dec);
        }
    }
    return $encodedString;
}

# CREATING ISO2UTF & UTF2ISO MAPS
create_map($url);


find this:
/*
if ($feed['html'])
{
$msg_body = '[html]' . $msg_body . '[/html]';
preparsecode($msg_body);
}
*/


before add:
$msg_body = utf2iso($msg_body);
$msg_title = utf2iso($msg_title);


let's upload this file. that's all. don't forget to run cronrss.php

i think you should get the the file "http://www.unicode.org/Public/MAPPINGS/ISO8859/8859-9.TXT" to your root and remove the slash at Subs-RSS.php to get it from local.

Regards

Mr Selim

Is there an easier way to encode this to Turkish?
This post is from 2008. I dont even know if it works now.

or is there a way to encode wp rss in ISO-8859-9 instead of UTF?

Klauser

Quote from: Klauser on March 03, 2011, 12:27:45 PM
Is it possible to do another way of calling the /cronrss.php ? I have a SMF board which does not allow guests, if I am logged in and put the url into the browser, the RSS-Feeds are getting updated, if I do it over a Cron Job than the job is not working, because it does not have access to the forum and see the login page.  ???

I am now on an other pc, I put the Url into the browser and hit enter and I will be redirected to the login page of the SMF Board, after I am logged in, than I see that the FeedPoster is working. So that is why the External Cronjob Call is not working. My forum is totaly restricted, no public Areas, so there is the problem.

walker

Quote from: acadiaforum.net on April 04, 2011, 01:55:22 PM
Well, it sounded like a good idea, but that didn't work either. The HTML bbc tag is being stripped out after the script executes and before it gets posted, so SMF itself is removing it within preparsecode(). When mark's suggestion didn't work, I dug into the subs_post file and found the error (and a subsequent, even more convoluted, solution).

Here's what I had to do to get HTML tags to parse correctly in the rss feeds.

In Subs_RSS.php, find this line (mine was line 294)
     $msg_body = '[ HTML ]' . $msg_body . '[ /HTML ] ';

and replace it with this:
     $msg_body = '[HIDDENTAG]' . $msg_body . ' [/HIDDENTAG]';

Then in Subs_Post.php, find the HTML parsing 'if' loop (line 210-220) and add this code after it:

if (!$previewing && strpos($parts[$i], '[HIDDENTAG]') !== false)
{
$parts[$i] = preg_replace('~\[HIDDENTAG\](.+?)\[/HIDDENTAG\]~ise', '\'[html]\' . strtr(un_htmlspecialchars(\'$1\'), array("\n" => \'\', \'  \' => \'  \')) . \'[/html]\'', $parts[$i]);
}


As arantor pointed out, the cron process does not pass the necessary credentials back to SMF to allow it to have the authority to use the HTML bbc code, regardless of what user you tell it to post under. So what I've done here is taken the chunk of code that normally runs if you DO have that permission for the HTML code and run it again if it finds an arbitrary tag (hiddentag in this example). The benefit here is that it finally allows the RSS poster to use html tags. The downside is that you're allowing anyone who happens to know that new tag to circumvent the security that SMF puts in place on the HTML tag. If you want to use it, copy the code from above, but replace "HIDDENTAG" with some obscure tag name of your choosing that won't be easily guessable and at least you add a measure of security through obscurity.



That is excellent! worked really great - using - 1.1.13   

IchBin™

Playboy, from a quick look at your errors it would appear that "ISO-8859-9" is not a supported encoding. Looking at the function on the PHP doc site it would appear that is the case as well.

http://www.php.net/xml_parser_create
QuoteIn PHP 5.0.0 and 5.0.1, the default output charset is ISO-8859-1, while in PHP 5.0.2 and upper is UTF-8. The supported encodings are ISO-8859-1, UTF-8 and US-ASCII.
IchBin™        TinyPortal

PLAYBOY

Quote from: IchBin™ on April 18, 2011, 10:46:42 AM
Playboy, from a quick look at your errors it would appear that "ISO-8859-9" is not a supported encoding. Looking at the function on the PHP doc site it would appear that is the case as well.

http://www.php.net/xml_parser_create
QuoteIn PHP 5.0.0 and 5.0.1, the default output charset is ISO-8859-1, while in PHP 5.0.2 and upper is UTF-8. The supported encodings are ISO-8859-1, UTF-8 and US-ASCII.

So what should i do?
Is there a way to fix or edit it? Can anybody help me about this?

MrMorph

I've been using an old version of this mod for a long time, works great, cept for HTML entitities.  EG:

QuoteRobotShop
a robotics distribution company,
headquartered in Qu&eacute;bec, Canada,
and
representing over 200 manufacturers,

Does anyone know if the new version corrects this and decodes the entities please ?

NanoSector

My Mods / Mod Builder - A tool to easily create mods / Blog
"I've heard from a reliable source that the Answer is 42. But, still no word on what the question is."

oridyne

Started using this mod and the feed has been working ok for the first few messages then I got a "Hacking Attempt" screen with this posted in the error log:


Hacking attempt...

INSERT INTO `xxxx_smf1`.smf_messages
(ID_BOARD, ID_TOPIC, ID_MEMBER, subject, body, posterName, posterEmail, posterTime,
posterIP, smileysEnabled, modifiedName, icon)
VALUES (61, 0, 122, SUBSTRING('ZZ9:First Episode of Hitchhiker's', 1, 255), SUBSTRING('[b]First Episode of Hitchhiker's[/b]

[html]<div class="field field-type-datetime field-field-date"> <div class="field-label">Date: </div> <div class="field-items"> <div class="field-item odd"> <span class="date-display-single">Tuesday, March 8, 2011 - <span class="date-display-start">22:30</span><span class="date-display-separator"> - </span><span class="date-display-end">23:00</span></span> </div> </div> </div> <p>The thirty-third anniversary of the first broadcast of the first episode of the first radio series, the first incarnation of Hitchhiker's.</p>[/html]

Source: [url=http://www.zz9.org/node/86]First Episode of Hitchhiker's[/url]', 1, 65534), SUBSTRING('RSSFeeder', 1, 255), SUBSTRING('[email protected]', 1, 255), 1304156252,
SUBSTRING('127.0.0.1', 1, 255), 1, '', SUBSTRING('hitchhike', 1, 16))
File: Subs-Post.php
Line: 1542


Any ideas on what is wrong or how I can fix it..

Thanks..
<*> I'm dangerous when I know what I'm doing <*>

Big Bang Burger Bar

Advertisement: