SimplePortal

Development => Bugs => Topic started by: ataru on February 17, 2015, 10:57:39 AM

Title: Shoutbox can't refresh on non utf-8 languages
Post by: ataru on February 17, 2015, 10:57:39 AM
referring to:
http://simpleportal.net/index.php?topic=10356.0
and
http://simpleportal.net/index.php?topic=13840.0

i found that in Portalshoutbox.template.php the use of htmlspecialchars for non utf-8 languages, due to php 5.4, generates empty values in xml, so that shoutboxes can't refresh when xml is compiled with special chars:
Code: [Select]
function template_shoutbox_xml()
{
global $context, $txt, $smcFunc;

echo '<', '?xml version="1.0" encoding="', $context['character_set'], '"?', '>
<smf>
<shoutbox>', $context['SPortal']['shoutbox']['id'], '</shoutbox>';

if ($context['SPortal']['updated'])
{
echo '
<updated>1</updated>
<error>', empty($context['SPortal']['shouts']) ? $txt['sp_shoutbox_no_shout'] : 0, '</error>
<warning>', !empty($context['SPortal']['shoutbox']['warning']) ? $smcFunc['htmlspecialchars']($context['SPortal']['shoutbox']['warning']) : 0, '</warning>
<reverse>', !empty($context['SPortal']['shoutbox']['reverse']) ? 1 : 0, '</reverse>';

foreach ($context['SPortal']['shouts'] as $shout)
echo '
<shout>
<id>', $shout['id'], '</id>
<author>', htmlspecialchars($shout['author']['link']), '</author>
<time>', htmlspecialchars($shout['time']), '</time>
<timeclean>', htmlspecialchars(strip_tags($shout['time'])), '</timeclean>
<delete>', !empty($shout['delete_link_js']) ? htmlspecialchars($shout['delete_link_js']) : 0, '</delete>
<content>', htmlspecialchars($shout['text']), '</content>
<is_me>', $shout['is_me'] ? 1 : 0, '</is_me>
</shout>';
}
else
echo '
<updated>0</updated>';

echo '
</smf>';
using $smcFunc['htmlspecialchars'] will fix it. can you consider it in next releases?

Code: [Select]
function template_shoutbox_xml()
{
global $context, $txt, $smcFunc;

echo '<', '?xml version="1.0" encoding="', $context['character_set'], '"?', '>
<smf>
<shoutbox>', $context['SPortal']['shoutbox']['id'], '</shoutbox>';

if ($context['SPortal']['updated'])
{
echo '
<updated>1</updated>
<error>', empty($context['SPortal']['shouts']) ? $txt['sp_shoutbox_no_shout'] : 0, '</error>
<warning>', !empty($context['SPortal']['shoutbox']['warning']) ? $smcFunc['htmlspecialchars']($context['SPortal']['shoutbox']['warning']) : 0, '</warning>
<reverse>', !empty($context['SPortal']['shoutbox']['reverse']) ? 1 : 0, '</reverse>';

foreach ($context['SPortal']['shouts'] as $shout)
echo '
<shout>
<id>', $shout['id'], '</id>
<author>', $smcFunc['htmlspecialchars']($shout['author']['link']), '</author>
<time>', $smcFunc['htmlspecialchars']($shout['time']), '</time>
<timeclean>', $smcFunc['htmlspecialchars'](strip_tags($shout['time'])), '</timeclean>
<delete>', !empty($shout['delete_link_js']) ? $smcFunc['htmlspecialchars']($shout['delete_link_js']) : 0, '</delete>
<content>', $smcFunc['htmlspecialchars']($shout['text']), '</content>
<is_me>', $shout['is_me'] ? 1 : 0, '</is_me>
</shout>';
}
else
echo '
<updated>0</updated>';

echo '
</smf>';

thanks
Title: Re: Shoutbox can't refresh on non utf-8 languages
Post by: Raji on July 04, 2015, 11:13:29 AM
where is this file?
Portalshoutbox.template.php
Title: Re: Shoutbox can't refresh on non utf-8 languages
Post by: ♦ Ninja ZX-10RR ♦ on July 04, 2015, 11:16:52 AM
A little search would have told you, but it's usually in Themes/default directory ;)
Title: Re: Shoutbox can't refresh on non utf-8 languages
Post by: [SiNaN] on August 01, 2015, 06:23:19 AM
Thank you for the report and suggested fix. I can confirm that that's how it should have been done. This should be fixed in the next version. Until then, those who are having problems may use the suggested fix in the first post.
Title: Re: Shoutbox can't refresh on non utf-8 languages
Post by: [SiNaN] on August 08, 2015, 10:07:32 AM
The fix for this has been committed.
Title: Re: Shoutbox can't refresh on non utf-8 languages
Post by: Delete Me on December 25, 2015, 08:46:39 PM
I've got smf 2.0.11, SP 2.3.6, php 5.5, and the shoutbox has the same issue with not refreshing.  Further, randomly upon page refresh, doesn't show the last message entered, refreshing the page repeatedly eventually yields all messages.. very random.

I've used the correct file found in one of these posts but it hasn't solved either of these issues at all.  This shoutbox is hugely bugged, can anyone help me out or point me to what I should do?
Title: Re: Shoutbox can't refresh on non utf-8 languages
Post by: Delete Me on December 26, 2015, 12:00:43 PM
Bump :/   Uninstall then reinstall, using the corrected shoutbox file linked on one of those two threads, clearing forum cache, even using a brand new forum from fresh install.... This shoutbox does not auto-refresh and still does not always load all messages.  I am using english -utf8.

Has anyone found a real working solution to this?
Title: Re: Shoutbox can't refresh on non utf-8 languages
Post by: emanuele on December 26, 2015, 05:47:29 PM
Link to your forum?
Title: Re: Shoutbox can't refresh on non utf-8 languages
Post by: ♦ Ninja ZX-10RR ♦ on December 26, 2015, 05:53:07 PM
Also, not to be mean, but if it works for everyone who tried that fix other than you, please don't claim it's bugged, everytime it's something else messed up by either the host or some template conflict, not the shoutbox itself.
And yes, a link to your forum could help, with a visible shoutbox of course ;)

Regards
Title: Re: Shoutbox can't refresh on non utf-8 languages
Post by: FLHS on June 27, 2016, 03:53:49 PM
Hello,

the solution described doesn't works for me.
What have I done?

I transfered my server from an old hardware to a new Hardware.
I restored the whole site on the new machine in the same way:
By this way, I moved from Debian 6 and PHP 5.3.3-7+squeeze28 to Debian 8.5 and PHP 7.0.7-5.
Other things haven't changed.

Everythings runs fine - exept the shoutbox! :(

After every shout I've to refresh the site to make the shout visible.

Of course, I tried the solution described in this thread. But it doesn't work.
After changing the source, nothing changes on the shoutbox but in the error.log I found the following entry:

Quote
PHP Fatal error:  Function name must be a string in <path_to>/Sources/Load.php(2213) : eval()'d code on line 271, referer: http://www.hdb-board.de/index.php?PHPSESSID=xxxxxxxxxxxxxxxxxxxxxxxxxx;wwwRedirect

Does anyone know to solve this?

Thanks
Jens


Edit:
With the template downloaded by here (http://simpleportal.net/index.php?topic=10356.msg69824#msg69824), it runs fine!
Title: Re: Shoutbox can't refresh on non utf-8 languages
Post by: ♦ Ninja ZX-10RR ♦ on June 27, 2016, 04:29:06 PM
Hi FLHS and welcome to SimplePortal.

Considering that SMF itself doesn't work on php 7.0 because of (at least) sessions being broken, I can't really see how it's working, but thanks for taking the time to post.

Regards
Title: Degree symbol breaks shoutbox auto refresh
Post by: Jailer on December 17, 2016, 06:19:11 PM
When a shout is entered with the degree symbol (small round circle) it breaks the auto refresh on the shoutbox. You have to refresh the entire page to see new shouts. Once the shout with the degree symbol is deleted the shoutbox starts functioning normally again. Tested with shouts posted from my iphone and my PC with the same results.

Running:
SMF 2.0.12
Simple Portal 2.3.6
SP-Shoutbox Notification Sound HTML5 0.5

ETA: It seems certain Alt characters produce the same thing. Not all of them, just certain ones. § (Alt+21) and ¶ (Alt+20) are a couple of examples that produce the same results. 


Title: Re: Degree symbol breaks shoutbox auto refresh
Post by: ♦ Ninja ZX-10RR ♦ on December 17, 2016, 08:16:24 PM
Hi Jailer,

Thanks for your report, however, next time please use the search function before posting, because the topic literally below this one is about the same exact issue (and contains a fix for it, too).
Which is why I'll merge them.

Regards
SimplePortal 2.3.7 © 2008-2021, SimplePortal