function template_shoutbox_embed($shoutbox)
{
global $context, $scripturl, $settings, $txt;
if (!empty($shoutbox['refresh']))
echo '
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.0/jquery.min.js"></script>
<script type="text/javascript">
var auto_refresh = setInterval(
function ()
{
$(\'#result\').load(\'', currentPageShoutbox($shoutbox['id']) ,'\').fadeIn("slow");
}, ', ($shoutbox['refresh'] * 1000), ');
</script>';
?>
/* Current shoutbox url & container */
function currentPageShoutbox($shoutid, $pageURL = 'http://')
{
if (!empty($_SERVER["HTTPS"]))
$pageURL = "https://";
if ($_SERVER["SERVER_PORT"] != "80")
$pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
else
$pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
return $pageURL . '#shoutbox_load_' . $shoutid;
}
I fixed mine this morning. i went to the root directory, and found a file called .htacess
I edited this file to force the server to run the same version of php my old server ran which was 5.3
the code looks like this pick except mine was set to 5.3
http://i.imgur.com/mCk292r.png
smf_scripturl
sp_script_url
var sp_date = new Date;
eval("last_refresh_" + shoutbox_id + " = " + Math.round(sp_date.getTime() / 1000, 0) + ";");
sp_refresh_shout(', $shoutbox['id'], ', last_refresh_', $shoutbox['id'], ');
sp_refresh_shout(', $shoutbox['id'], ', last_refresh_', $shoutbox['id'], ');
last_refresh_', $shoutbox['id'], ' += ', $shoutbox['refresh'], ';
global $context, $settings, $modSettings;
static $initialized;
if (!empty($initialized))
return;
$context['html_headers'] .= '
<script type="text/javascript" src="' . $settings['default_theme_url'] . '/scripts/portal.js?235"></script>
<script language="JavaScript" type="text/javascript"><!-- // --><![CDATA[
var sp_images_url = "' . $settings['sp_images_url'] . '";
global $context, $scripturl, $settings, $modSettings;
static $initialized;
if (!empty($initialized))
return;
$safe_scripturl = $scripturl;
$current_request = empty($_SERVER['HTTP_HOST']) ? $_SERVER['SERVER_NAME'] : $_SERVER['HTTP_HOST'];
if (strpos($scripturl, 'www.') !== false && strpos($current_request, 'www.') === false)
$safe_scripturl = str_replace('://www.', '://', $scripturl);
elseif (strpos($scripturl, 'www.') === false && strpos($current_request, 'www.') !== false)
$safe_scripturl = str_replace('://', '://www.', $scripturl);
$context['html_headers'] .= '
<script type="text/javascript" src="' . $settings['default_theme_url'] . '/scripts/portal.js?235"></script>
<script language="JavaScript" type="text/javascript"><!-- // --><![CDATA[
var sp_images_url = "' . $settings['sp_images_url'] . '";
var sp_script_url = "' . $safe_scripturl . '";
I followed your instructions and now have the new update installed. So far, so good. The shoutbox is updating fine now and you have made me a happy camper. Thanks for all the effort you and the Simple Portal Team put into fixing this problem.
Set up 2 accounts for you on our active site - will PM the details in a moment.
Within 24 hours I will hopefully put a clean install of smf and simple portal on another domain I have.
$data = preg_replace('~<\!\[CDATA\[(.+?)\]\]>~e' . ($context['utf8'] ? 'u' : ''), '\'#cdata_escape_encode#\' . $smcFunc[\'htmlspecialchars\'](\'$1\')', $data);
$data = preg_replace_callback('~<\!\[CDATA\[(.+?)\]\]>~' . ($context['utf8'] ? 'u' : ''), function($m) {return "#cdata_escape_encode#" . htmlspecialchars($m[1]);}, $data);
junk after document elementindex.php:5TypeError: XMLDoc.getElementsByTagName(...)[0] is undefinedportal.js:104
Downloads System 2.1a
Treasury 2.12
Say Thanks 1.1.2
Event Registration Mod 0.177 BETA
Breeze 1.0.7
RSS Feed Poster 4.1
Country Flags 2.1
Simple Audio Video Embedder 3.0.2
SimplePortal 2.3.6
Add Social Media Icons To Profiles 1.2.0
SMF Staff Page 1.7
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?
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
ok. solved adding $smcFunc and using $smcFunc['htmlspecialchars'] instead of php htmlspecialcharsCode: [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>';
http://sitename/smf/index.php?action=portal;sa=shoutbox;shoutbox_id=1;time=1436025373;xmlApply Filter: Only show the errors with the same message2: require_once(/home/sitename/public_html/smf/Sources/PortalShoutbox.php) [<a href='function.require-once'>function.require-once</a>]: failed to open stream: No such file or directoryApply Filter: Only show the errors from this file File: /home/sitename/public_html/smf/Sources/PortalMain.php
Line: 52
It's 100% related to your forum, but there are many reasons that can cause this,
no idea at all on how it got reinstated on the site.
<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>';
<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>';
<b>Fatal error</b>: Function name must be a string in <b>/home/accounts/carding1/public_html/Sources/Load.php(2179) : eval()'d code</b> on line <b>271</b><br />
global $context, $txt;
global $context, $txt, $smcFunc;
This is the error that I see on shoutbox update on your site:Well I made the changes but did not effect !!Code: [Select]<b>Fatal error</b>: Function name must be a string in <b>/home/accounts/carding1/public_html/Sources/Load.php(2179) : eval()'d code</b> on line <b>271</b><br />
It's not very informative but it's probably because of the latest change you've made. You need to make this following change in addition to that one:
Themes/default/PortalShoutbox.template.phpCode: (Find) [Select]global $context, $txt;
Code: (Replace) [Select]global $context, $txt, $smcFunc;
Can you attach your Themes/default/PortalShoutbox.template.php file here?Yes, check please!
Try replacing the file with the attached one.Thanks bro now if it works!