collapse collapse

* Simple Portal Archived Forum

This is an Archive Forum.

The content in this forum may be out-of-date or have been superseded by newer information, and links in forum pages to other sites may not work.
This forum contains archives for future reference.

Visit our thread at Simple Machines Forum for current support.

SMF 2.1 users: EhPortal is a ported version of Simple Portal specifically designed for the SMF 2.1 branch.
Please visit web-develop.ca to download EhPortal and for its support.

* User Info

 
 
Welcome, Guest. Please login or register.

* Who's Online

  • Dot Guests: 131
  • Dot Hidden: 0
  • Dot Users: 0

There aren't any users online.

* Shoutbox

Refresh History
  • Shoutbox is not for support!
  • {OCS}MasterSeal: Yup, Still adore SP
    April 21, 2019, 07:08:06 PM
  • {OCS}MasterSeal: STILL love SP :)
    November 24, 2018, 05:05:50 AM
  • ♦ Ninja ZX-10RR ♦: <3 aegersz
    September 13, 2018, 03:36:09 PM
  • aegersz: I STILL <3 LOVE SimplePortal
    September 13, 2018, 07:11:39 AM
  • aegersz: o LOVE you guys - Simple Portal rocks !
    May 09, 2018, 05:18:59 AM
  • Chen Zhen: our apologies for the site being down.. please read server issues topic
    March 22, 2018, 05:32:38 AM
  • {OCS}MasterSeal: LOL PLEASE forget I just posted that. I found the answer in my own dang post back in 2015. lol sorry!
    July 04, 2017, 10:47:55 PM
  • {OCS}MasterSeal: I know this SB isnt' for support, but I just have a general question. Who would I contact to find out where SP stores its block info? Is it DB driven or files? I searched the site but came up with nothing. probably my fault any insight is appreciated.
    July 04, 2017, 10:43:36 PM
  • ♦ Ninja ZX-10RR ♦: Excuse me but what does Simpleportal have to deal with that?
    February 05, 2017, 08:21:14 PM
  • WhiteEagle: of course IMHO that site appears to be dead :(
    February 04, 2017, 01:08:05 PM
  • WhiteEagle: If I can get that, then I'll use it for that site...
    February 04, 2017, 01:07:35 PM
  • WhiteEagle: decided to not use SMF for any projects, unless I can get a copy of the premium version of the fanfiction archive plugin
    February 04, 2017, 01:06:54 PM
  • expertdecisions: cloudflare
    January 28, 2017, 08:01:47 AM
  • aegersz: SM release 2.0.13 !
    January 12, 2017, 06:00:13 AM
  • raffo: Tks Emanuele, even if I didn't understand the fix :D
    November 07, 2016, 02:01:20 AM
  • emanuele: [link]
    November 01, 2016, 12:43:50 PM
  • emanuele: raffo: the English support board is a good place. ;)
    November 01, 2016, 12:43:38 PM
  • raffo: Where can I find the fix for the shoutbox?
    November 01, 2016, 05:06:09 AM
  • {OCS}MasterSeal: To the SP team, I make a point to come here and thank you as much as possible for your work.  so again, THANK YOU!
    October 28, 2016, 10:38:05 AM
  • emanuele: That's indeed funny, the limit is present only in the patch and not the full install.
    October 22, 2016, 06:14:58 PM

* Recent Posts

Adding Forums Button to Nav bar by jirapon
[August 01, 2019, 09:07:12 AM]


Re: Board Icons by ♦ Ninja ZX-10RR ♦
[July 30, 2019, 04:03:41 PM]


MOVED: Czech translation???? by ♦ Ninja ZX-10RR ♦
[July 30, 2019, 03:04:51 PM]


Board Icons by jirapon
[July 30, 2019, 07:28:44 AM]


Re: Thankyou Simpleportal, by ♦ Ninja ZX-10RR ♦
[July 29, 2019, 09:41:29 AM]

Blocks speak! Do you have an interest in getting more blocks - or even making your own? The Blocks Board is for you!

Author Topic: Shoutbox can't refresh  (Read 8735 times)

0 Members and 1 Guest are viewing this topic.

Offline ataru

  • Jr. Member
  • **
  • Posts: 63
  • Gender: Male
    • Biancocelesti.org - Sempre Forza Lazio
  • SMF Version: 2.0.10
  • SP Version: 2.3.6
Shoutbox can't refresh
« on: January 26, 2015, 03:51:47 AM »
I own a forum, http://www.biancocelesti.org, just upgraded from 2.0RC3 to 2.0.9.

I also upgraded SP from 2.3.2 to 2.3.6.

now my shoutboxes can't refresh. shouts are stored in db, can be seen refreshing the whole page (F5), but can't refresh only shoutbox.

Trying to debug js code, i encounter an error:
Code: [Select]
Uncaught TypeError: Cannot read property 'nodeValue' of undefined - portal.js?236:127
onShoutReceived - portal.js?236:127
oMyDoc.onreadystatechange - script.js?rc3:88


this is the portal.js part of the error:
Code: [Select]
for (var i = 0; i < shouts.length; i++)
{
shout = XMLDoc.getElementsByTagName("smf")[0].getElementsByTagName("shout")[i];
id = shout.getElementsByTagName("id")[0].childNodes[0].nodeValue;
---> author = shout.getElementsByTagName("author")[0].childNodes[0].nodeValue;<---
time = shout.getElementsByTagName("time")[0].childNodes[0].nodeValue;
timeclean = shout.getElementsByTagName("timeclean")[0].childNodes[0].nodeValue;
delete_link = shout.getElementsByTagName("delete")[0].childNodes[0].nodeValue;
content = shout.getElementsByTagName("content")[0].childNodes[0].nodeValue;
is_me = shout.getElementsByTagName("is_me")[0].childNodes[0].nodeValue;

new_body += '<li class="smalltext">' + (is_me == 0 ? '<strong>' + author + ':</strong> ' : '') + content + '<br />' + (delete_link != 0 ? ('<span class="shoutbox_delete">' + delete_link + '</span>') : '') + '<span class="smalltext shoutbox_time">' + time + '</span></li>';
}

and this is the script.js part:
Code: [Select]
if (bAsync)
{
oMyDoc.onreadystatechange = function () {
if (oMyDoc.readyState != 4)
return;

if (oMyDoc.responseXML != null && oMyDoc.status == 200)
{
if (funcCallback.call)
{
---> funcCallback.call(oCaller, oMyDoc.responseXML);<---
}
// A primitive substitute for the call method to support IE 5.0.
else
{
oCaller.tmpMethod = funcCallback;
oCaller.tmpMethod(oMyDoc.responseXML);
delete oCaller.tmpMethod;
}
}
};
}
oMyDoc.open('GET', sUrl, bAsync);
oMyDoc.send(null);


no errors in error.log, only client side.
can anyone help me?
« Last Edit: January 26, 2015, 05:19:30 AM by ataru »

Offline ataru

  • Jr. Member
  • **
  • Posts: 63
  • Gender: Male
    • Biancocelesti.org - Sempre Forza Lazio
  • SMF Version: 2.0.10
  • SP Version: 2.3.6
Re: Shoutbox can't refresh
« Reply #1 on: January 26, 2015, 09:11:53 AM »
i tried to see the xml generated by myurl/index.php?action=portal;sa=shoutbox;shoutbox_id=1;xml and i see:
Code: [Select]
<smf>
<shoutbox>1</shoutbox>
<updated>1</updated>
<error>0</error>
<warning>0</warning>
<reverse>0</reverse>
<shout>
<id>167015</id>
<author/>
<time/>
<timeclean/>
<delete>
<a href="myurl/index.php?action=portal;sa=shoutbox;shoutbox_id=1;delete=167015;ed3d3dff0=b6e1b2b659ad6f39f96b2b0c33928ef4" onclick="sp_delete_shout(1, 167015, 'ed3d3dff0', 'b6e1b2b659ad6f39f96b2b0c33928ef4'); return false;"><img src="myurl/Themes/mytheme/images/sp/delete_small.png" alt="Elimina" title="Elimina" /></a>
</delete>
<content/>
<is_me>0</is_me>
</shout>
<shout>
<id>166299</id>
<author/>
<time/>
<timeclean/>
<delete>
<a href="myurl/index.php?action=portal;sa=shoutbox;shoutbox_id=1;delete=166299;ed3d3dff0=b6e1b2b659ad6f39f96b2b0c33928ef4" onclick="sp_delete_shout(1, 166299, 'ed3d3dff0', 'b6e1b2b659ad6f39f96b2b0c33928ef4'); return false;"><img src="myurl/Themes/mytheme/images/sp/delete_small.png" alt="Elimina" title="Elimina" /></a>
</delete>
<content/>
<is_me>0</is_me>
</shout>

it seems like it couldn't get nothing but id from xml
« Last Edit: January 26, 2015, 10:23:56 AM by ataru »

Offline ataru

  • Jr. Member
  • **
  • Posts: 63
  • Gender: Male
    • Biancocelesti.org - Sempre Forza Lazio
  • SMF Version: 2.0.10
  • SP Version: 2.3.6
Re: Shoutbox can't refresh
« Reply #2 on: February 02, 2015, 10:09:32 AM »
nobody can help me? where can i finf xml parsing function for shoutbox?

Offline ataru

  • Jr. Member
  • **
  • Posts: 63
  • Gender: Male
    • Biancocelesti.org - Sempre Forza Lazio
  • SMF Version: 2.0.10
  • SP Version: 2.3.6
Re: Shoutbox can't refresh
« Reply #3 on: February 02, 2015, 10:36:43 AM »
ok another step forward:

in Portalshoutbox.template.php i found xml generator:

Code: [Select]
function template_shoutbox_xml()
Code: [Select]
<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>';

htmlspecialchars sometimes returns empty values, i think it's something related to utf stuff and php 5.4.

it seems that in php 5.4 htmlspecialchars uses utf-8 as default encoding

how can i workaround?
« Last Edit: February 02, 2015, 10:41:22 AM by ataru »

Offline ataru

  • Jr. Member
  • **
  • Posts: 63
  • Gender: Male
    • Biancocelesti.org - Sempre Forza Lazio
  • SMF Version: 2.0.10
  • SP Version: 2.3.6
Re: Shoutbox can't refresh
« Reply #4 on: February 02, 2015, 11:08:12 AM »
ok. solved adding $smcFunc and using $smcFunc['htmlspecialchars'] instead of php htmlspecialchars


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>';


/* old code
<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>';


Offline ccbtimewiz

  • Hero Member
  • *****
  • Posts: 2185
  • Gender: Male
  • $("div.content:dd").hide();
  • SMF Version: None
  • SP Version: None
  • Elkarte Version: None
  • EhPortal Version: None
Re: Shoutbox can't refresh
« Reply #5 on: February 04, 2015, 09:19:26 PM »
Sorry for the somewhat late response.

Yes, the function passed through $smcFunc is a UTF8 safe version of htmlspecialchars(). This check should happen before the template though, so it's actually just a small oversight in SP right now.

Perhaps make a report in the bug report board and it'll be addressed.

Offline [SiNaN]

  • Mr. SimplePortal
  • Developer
  • *
  • Posts: 6782
  • SMF Version: 2.0.15
  • SP Version: 2.3.7
Re: Shoutbox can't refresh
« Reply #6 on: August 01, 2015, 07:48:26 AM »
I'm sorry that I couldn't respond to this earlier. Again, thank you for your report and suggested fix!
And slowly, you come to realize... It's all as it should be...

Offline timp11

  • Semi Newbie
  • *
  • Posts: 10
Re: Shoutbox can't refresh
« Reply #7 on: November 28, 2015, 09:44:08 PM »
Mine doesnt refresh.. and i have tried everything.

 

SimplePortal 2.3.7 © 2008-2021, SimplePortal