News:

Wondering if this will always be free?  See why free is better.

Main Menu

RSS Feed Poster

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

Previous topic - Next topic

xMichael2008x

Does anyone have a fix for the  bbc not being added to the RSS feed?

vbgamer45

Community Suite for SMF - Take your forum to the next level built for 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

Quinn

VB, I think he is editing the post after the feedposter posts it to his forum. I read that then tried it an it does work fine. I looked through the .php files and made a few modifications to the before and after post code. I kept getting an errant HTML tag in the wrong spot. So I replaced the original file with the supplied file and all is working fine as far as I can tell. More testing with rc5 seems to be good but need a few rss feeds with some heavy html in them to be sure it is actually working.

My feed poster user account had global moderator permissions and it wouldn't work. I added the administrator permissions to it and now the html works on both test forums.

http://forums.bs-raven.net/ravenwood/index.php/board,3.0.html
http://forums.bs-raven.net/OldWood/index.php/board,6.0.html

Both are rc5 installs but the 1.1.3 still doesn't work...

xMichael2008x

#2023
Quote from: Quinn on March 25, 2011, 09:50:58 PM
VB, I think he is editing the post after the feedposter posts it to his forum. I read that then tried it an it does work fine.

Correct. One RSS feed works for me, but the other does not. It shows the <p>, etc. coding...I have to manually add html at the beginning and  /html at the end just to make it look right.

http://awesomescreenshot.com/0b0a51g9f this is what the rss feed submits, no html tags in the comment.

http://awesomescreenshot.com/049a51k3a this is my other type of feed, which WORKS.

RSS Feed Settings for the one that does work: http://awesomescreenshot.com/043a51s41
RSS Feed Settings for the one that doesn't include HTML tags: http://awesomescreenshot.com/054a51ud3

xMichael2008x


Eudemon

Quote from: xMichael2008x on March 27, 2011, 02:35:06 PM
Am I the only one with this problem  :-X
confirm that i have the same problem

i went to trace vb's codes and i found this in subs-rss2.php
if ($feed['html'])
{
$msg_body =  $smcFunc['htmlspecialchars']($context['feeditems'][$i]['description'], ENT_QUOTES);

$msg_body = trim($msg_body);

$msg_body = '[html]' . $msg_body . '[/html]';

the message body should have [html] [/html] at the beginning and end
i've enabled html codes in the setting and
i'm using admin account for poster so i should have the permission to use html bbc tag
but somehow they are not added to the post...
so far i don't have a solution yet, hoping vb can come up with one

xMichael2008x

Anyone have a fix to this troublesome problem that they would kindly share for free?  ;D

ziycon

I have everything setup and on 2 RC3, there is no errors, when I go to the cronrss.php file it just prints 'Feed Poster Configuration' to the screen, nothing is being imported!??

Quinn

Quote from: ziycon on March 29, 2011, 06:48:08 PM
I have everything setup and on 2 RC3, there is no errors, when I go to the cronrss.php file it just prints 'Feed Poster Configuration' to the screen, nothing is being imported!??

This is all the script does 'Feed Poster Configuration' to confirm or show errors. If nothing is posted to the forum then something else is wrong. The feed poster account should have Administrator permissions and possibly global moderator too. I use those for my forums and it seems to work.

ziycon

Got it sorted, it was related to the PHP function that was set to be used to pull in the feeds.

ziycon

#2030
Ok, maybe it didn't work as expected. I'm using curl and when I first went to the URL http://..../cronrss.php it ran and posted 9 out of the 10 records in the rss feed, for some reason it didn't post the most recent one even though the feed was set to take upto 10 records.

I setup a cronjob after this and pointed it to the cronrss.php and have it running locally and I'm getting successfully run email notifications from the cronjob but nothing is being posted, if I go to the url for the cronrss.php file its show up the 'Feed Poster Configuration' message grand but no new records from the rss feed are being posted?

InstilledBee

Uh-oh, got a "Hacking attempt" error when I enabled fake cron jobs via php.

Oddly, the error went away after it was able to get the latest feeds. I'm using this mod on 1.1.13. Am I doing something wrong?
Kung Pinoy ka, at nababasa mo 'to, kabayan kita! ;)

Links:


markdw

Quote from: Eudemon369 on March 28, 2011, 10:39:08 PM
Quote from: xMichael2008x on March 27, 2011, 02:35:06 PM
Am I the only one with this problem  :-X
confirm that i have the same problem

I'm also having the same problem when running this as a cron job, doesn't seem to be a problem if I run the cron PHP directly from a browser though.

colour

Keep getting this error when I try to set up a bot

XML error: Not well-formed (invalid token) at line 1

I am running 1.1.13
I provide limited support as I am just as clueless as you.

vbgamer45

The feed is not well formed so can't be loaded into the feed poster.
Community Suite for SMF - Take your forum to the next level built for 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

markdw

OK, regarding the HTML tag problem I think I have a solution although it's not pretty.

I've tested it quite a lot and the [ html ] tags are removed by some process between line 288 and line 311 when running as a proper CRON job, if you change it to [test] [/test] it works fine so it I wonder whether preparsecode() is behaving diffently under Unix CRON. Either way, if you use a placeholder like [test][/test] at line 288 and then use str_replace() just before the definition of $msgOptions on line 311 to swap out "test]" for "html]" it fixes the problem.

I did say it wasnt pretty :P

acadiaforum.net

#2036
Thanks markdw, I'm going to give this a try.

Just for some clarification, I had recently come to the same conclusion. If I manually run the cron file in my browser, the HTML bbc code is added correctly, but it's taken out of the post if a real cron job runs the process (which is the point). I made similar changes (adding a [ B ]old tag in place of the html and it worked fine, so my guess is there's some security procedure in place somewhere in SMF that is intercepting that cronned message and removing the HTML bbc tag for security reasons.
New GM Crossover Forums: AcadiaForum.net [nofollow] | EnclaveForum.net [nofollow] | SaturnOutlookForum.net [nofollow] | TraverseForum.com [nofollow]

markdw

Apologies everyone, I need to revoke my previous optimism, I left this running last night and it doesn't work. Putting in a placeholder and then replacing that works but only to the extent that the tags appear in the message with html source within them - you then need to edit/save the message for the tags to be parsed and the message rendered properly.

The problem has got to be with preparsecode() but I can't understand why that would work any differently under CRON, especially in such a specific way as to remove the HTML tags only (URL is fine).

The hunt goes on...

Arantor

preparsecode() looks at the user id of the poster - under cron, this won't be an admin. Only admins can use the html bbcode, for anyone else it removes it.

acadiaforum.net

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.
New GM Crossover Forums: AcadiaForum.net [nofollow] | EnclaveForum.net [nofollow] | SaturnOutlookForum.net [nofollow] | TraverseForum.com [nofollow]

Advertisement: