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.

* User Info

 
 
Welcome, Guest. Please login or register.

* Who's Online

  • Dot Guests: 88
  • 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]

Thanks for having an interest with our portal. If you have any requests for features, have a look at the Feature Requests board.

Author Topic: install problem (SSI.php) and out of memory error in SPStandalone.php javascript  (Read 5635 times)

0 Members and 1 Guest are viewing this topic.

Offline AngelinaBelle

  • Comrade
  • *
  • Posts: 4870
  • Gender: Female
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
I thought my problem was "Standalone portal Fatal error: Call to undefined function: sportal_init()", but I think I'm chasing down some bad install problems.

SMF 1.1.9 (from 1.1.8 )
Colorized Membergroups 1.0
Custom Profile Field Mod 3.20
Custom BBCode 2.00
SimplePortal 2.2.2

The install seemed to go fine.  Sportal1-1.php is in Sources, right where it is supposed to be, and contains the function sportal_init.

I decided to start with the forum in standalone mode while we look into transitioning from the current site front page to the portal. 
  • Standalone Portal is at smf/SPStandalone.php
  • Standalone URL set to match
  • $forum_dir -- edited to match the smf directory, as in Server Settings

I'm not getting any complaints about "Failed opening required", so I assume it succeeds in opening SPortal1-1.php.  So why can't it find it?

I'm getting
Quote
Fatal error: Call to undefined function: sportal_init() in /<smf directory>/SPStandalone.php on line 50

And then I discovered that the edits never got made to SSI.php.  I manually made the SSI.php edits.  And, guess what? it seems to load SPortal1-1.php and get sportal_init().  But now I'm getting out-of-memory errors when I load SPportal.php

The out-of-memory error seems to occur in sp_image_resize;, sometimes at var possible_images = document.getElementsByTagName("img"); and sometimes at window_oldSPImageOnload();

Subs.php seems appropriately modified.  None of the other php's should be involved, right?  Did I do the manual edit incorrectly?

I've attached SSI.php.

Thanks for any advice.
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

Have you tried the SimplePortal documentation?

Offline AngelinaBelle

  • Comrade
  • *
  • Posts: 4870
  • Gender: Female
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Here's something else odd I just realized.  At http://rockhallsailingclub.org/smf/SPStandalone.php, $context['html_headers'] is output twice.  $context['html_headers']  is set in sportal_init (in SPortal1-1.php), but I haven't figured out where it is echoed.  Or why it is echoed twice.  Is this a red herring or not?
Code: [Select]
<link rel="stylesheet" type="text/css" href="http://rockhallsailingclub.org/smf/Themes/default/portal.css?22rc1" />
<!--[if lt IE 7]>
<script defer type="text/javascript" src="http://rockhallsailingclub.org/smf/Themes/default/sp_pngfix.js"></script>
<![endif]-->
<script language="JavaScript" type="text/javascript"><!-- // --><![CDATA[
var sp_images_url = "http://rockhallsailingclub.org/smf/Themes/default/images/sp";
function sp_collapseBlock(id)
{
mode = document.getElementById("sp_block_" + id).style.display == "" ? 0 : 1;
smf_setThemeOption("sp_block_" + id, mode ? 0 : 1, null, "218794d1531f3f01b0af5efff0006a14");
document.getElementById("sp_collapse_" + id).src = smf_images_url + (mode ? "/collapse.gif" : "/expand.gif");
document.getElementById("sp_block_" + id).style.display = mode ? "" : "none";
}
function sp_collapseSide(id)
{
var sp_sides = new Array();
sp_sides[1] = "sp_left";
sp_sides[4] = "sp_right";
mode = document.getElementById(sp_sides[id]).style.display == "" ? 0 : 1;
smf_setThemeOption(sp_sides[id], mode ? 0 : 1, null, "218794d1531f3f01b0af5efff0006a14");
document.getElementById("sp_collapse_side" + id).src = sp_images_url + (mode ? "/collapse.png" : "/expand.png");
document.getElementById(sp_sides[id]).style.display = mode ? "" : "none";
}
var window_oldSPImageOnload = window.onload;
window.onload = sp_image_resize;
function sp_image_resize()
{
var possible_images = document.getElementsByTagName("img");
for (var i = 0; i < possible_images.length; i++)
{
if (possible_images[i].className != "sp_article")
continue;

var temp_image = new Image();
temp_image.src = possible_images[i].src;

if (temp_image.width > 300)
{
possible_images[i].height = (300 * temp_image.height) / temp_image.width;
possible_images[i].width = 300;
}
else
{
possible_images[i].width = temp_image.width;
possible_images[i].height = temp_image.height;
}
}

if (typeof(window_oldSPImageOnload) != "undefined" && window_oldSPImageOnload)
{
window_oldSPImageOnload();
window_oldSPImageOnload = null;
}
}
// ]]></script>

Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

Have you tried the SimplePortal documentation?

Offline ディン1031

  • ... feel not as a dev at the moment ...
  • Comrade
  • *
  • Posts: 789
  • Gender: Male
  • Overworked <<
  • SMF Version: None
  • SP Version: None
Normla only the index.template.php output the $context['html_header']; Hmmm i think i must look if this really happen =).
Again... I'm having time problems...

Normal Monday to Friday I'm at office from 6:00-16:00 (On my local time ;P).

Offline AngelinaBelle

  • Comrade
  • *
  • Posts: 4870
  • Gender: Female
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Normla only the index.template.php output the $context['html_header']; Hmmm i think i must look if this really happen =).
Thanks for offering to look at this.  Should I attach any other files?
 
Here's something else I just noticed.  At http://rockhallsailingclub.org/smf/SPStandalone.php, and also at http://rockhallsailingclub.org/smf/index.php,
the bit about shrinkHeaderIC(mode) is in there twice, in slightly different versions, but I don't think this is the source of my out-of-memory problem.
« Last Edit: June 16, 2009, 12:25:53 PM by AngelinaBelle »
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

Have you tried the SimplePortal documentation?

Offline AngelinaBelle

  • Comrade
  • *
  • Posts: 4870
  • Gender: Female
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
I followed up on this a bit, and I've come to the conclusion that the out of memory problem is due to recursion in sp_image_resize caused by a problem in the way window.onload is handled, in the doubled "sp_image_resize" section in http://rockhallsailingclub.org/smf/SPStandalone.php
 
The problem is that, effectively, two functions that need to execute at window.onload time are using the same global variable to store their "old_window_onload" information.  One calls the other, and recursion results.  Not only that, the two functions have the same name.
 
Here's the gist of it:
1) window.onload is null
2) window_oldSPImageOnload gets set to window.onload (null)
   window.onload gets set to sp_image_resize
3) window_oldSPImageOnload gets set to window.onload (sp_image_resize)
    window.onload gets set to sp_image_resize
4) window_oldOnload gets set to window.onload (sp_image_resize)
    window.onload gets set to smf_codeFix
5) After the page loads, window.onload (=smf_codeFix) is executed
6) smf_codeFix  calls window_oldOnload() (=sp_image_resize)
7) sp_image_resize calls window_oldSPImageOnload (=sp_image_resize)
8) sp_image_resize calls window_oldSPImageOnload (=sp_image_resize)
 
And the recursion begins  -- the code never has a chance to come to the part where it sets window_oldSPImageOnload to null.
 
Here is some breakpoint action, and the 3 onload variables at each point:
Code: [Select]
window_oldSPimageOnload -- null
 window.onload -- null
 window_oldOnload -- undefined
44  var window_oldSPImageOnload=window.onload
 window_oldSPimageOnload -- null
 window.onload -- null
 window_oldOnload -- undefined
45  window.onload=sp_image_resize
 window_oldSPimageOnload -- null
 window.onload -- sp_image_resize
 window_oldOnload -- undefined
99 var window_oldSPImageOnload = window.onload;
 window_oldSPimageOnload -- sp_image_resize
 window.onload -- sp_image_resize
 window_oldOnload -- undefined
100 var window_oldSPImageOnload = window.onload;
 window_oldSPimageOnload -- sp_image_resize
 window.onload -- sp_image_resize
 window_oldOnload -- undefined
742 var window_oldOnload = window.onload;
 window_oldSPimageOnload -- sp_image_resize
 window.onload -- sp_image_resize
 window_oldOnload -- sp_image_resize
743 window.onload = smf_codeFix;
 window_oldSPimageOnload -- sp_image_resize
 window.onload -- smf_codeFix
 window_oldOnload -- sp_image_resize
755 (window_oldOnload)
 window_oldSPimageOnload -- sp_image_resize
 window.onload -- smf_codeFix
 window_oldOnload -- sp_image_resize
757 window_oldOnload();    is sp_image_resize
 window_oldSPimageOnload -- sp_image_resize
 window.onload -- smf_codefix
 window_oldOnload -- sp_image_resize
124 (window_oldSPImageOnload)
 window_oldSPimageOnload -- sp_image_resize
 window.onload -- smf_codefix
 window_oldOnload -- sp_image_resize
126 window_oldSPImageOnload      is sp_image_resize
 
 window_oldSPimageOnload -- sp_image_resize
 window.onload -- smf_codefix
 window_oldOnload -- sp_image_resize
69 (window_oldSPImageOnload)
 window_oldSPimageOnload -- sp_image_resize
 window.onload -- smf_codefix
 window_oldOnload -- sp_image_resize
71 window_oldSPImageOnload();                   is sp_image_resize
 window_oldSPimageOnload -- sp_image_resize
 window.onload -- smf_codefix
 window_oldOnload -- sp_image_resize
69 (window_oldSPImageOnload)
 window_oldSPimageOnload -- sp_image_resize
 window.onload -- smf_codefix
 window_oldOnload -- sp_image_resize
71 window_oldSPImageOnload                    --- sp_image_resize
 window_oldSPimageOnload -- sp_image_resize
 window.onload -- smf_codefix
 window_oldOnload -- sp_image_resize
69 (window_oldSPImageOnload)
69 (window_oldSPImageOnload)
69 (window_oldSPImageOnload)
69 (window_oldSPImageOnload)
69 (window_oldSPImageOnload)
69 (window_oldSPImageOnload)
69 (window_oldSPImageOnload)
69 (window_oldSPImageOnload)
69 (window_oldSPImageOnload)
69 (window_oldSPImageOnload)

(repeat until out of memory error)
 
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

Have you tried the SimplePortal documentation?

Offline AngelinaBelle

  • Comrade
  • *
  • Posts: 4870
  • Gender: Female
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
(Two lengthy posts are awaiting moderation above.)
 
I just discovered that switching to the CORE theme, rather than the board default (slightly modified) theme causes the problem to go away.  -- no memory error, no doubled sections.
 
This means the problem could be in my RHSC theme.

Themes/default/index.template.php seems to have been properly edited by the automatic install.  But these edits did not happen in Themes/RHSC/index.template.php.  So I guess I'll have to work through that by hand.
 
I have set up a test account at
http://rockhallsailingclub.org/SPstandalone.php
 

Manual editing was a partial success.  Now, I have gotten rid of the parts that were duplicated in the forum page, but which are not responsible for the memory error problem.  Plus, I've got all the navigation buttons I was supposed to have.  So that's important.
 
But on the standalone portal page, I still have the duplication of the sp_image_resize block, and the out of memory error that comes with it.
 
Of the files sportal lists in Themes/default, index.template.php is the only one I have in Themes/RHSC.  So I'm almost certain this is the problem file.  Am I missing something obvious?
 
Thanks for any advice
« Last Edit: June 16, 2009, 02:22:13 PM by AngelinaBelle »
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

Have you tried the SimplePortal documentation?

Offline ディン1031

  • ... feel not as a dev at the moment ...
  • Comrade
  • *
  • Posts: 789
  • Gender: Male
  • Overworked <<
  • SMF Version: None
  • SP Version: None
Can i see the site with the double entries?

Hmmm i looked at the theme and i think everything is done correct, at my first look...

Oh i see it now... i was blind... hmmm *testing*, so i can confirm this is a bug... i will see if there is a way to fix it...

Ah first fix is:
Code: (search for) [Select]
if (!empty($context['template_layers']) && !in_array('portal', $context['template_layers']))
$context['template_layers'][] = 'portal';

Code: (Replace with) [Select]
if (!empty($context['template_layers']) && !in_array('portal', $context['template_layers']))
$context['template_layers'][] = 'portal';

// The function is one time loaded.
$initialized = true;
« Last Edit: June 17, 2009, 04:17:30 PM by ディン1031 »
Again... I'm having time problems...

Normal Monday to Friday I'm at office from 6:00-16:00 (On my local time ;P).

Offline [SiNaN]

  • Mr. SimplePortal
  • Developer
  • *
  • Posts: 6782
  • SMF Version: 2.0.15
  • SP Version: 2.3.7
I don't have net access ATM, posting this from my phone. I'll check this myself after 20th. This will fix your js issue until then:

SPortal(1-1|2).php
Find:
$modSettings['sp_resize_images'] = true;
Replace:
$modSettings['sp_resize_images'] = false;
And slowly, you come to realize... It's all as it should be...

Offline AngelinaBelle

  • Comrade
  • *
  • Posts: 4870
  • Gender: Female
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Thanks for the advice!  That ought to keep things for a while.  I guess the problem is in index.template.php, but I just haven't found it.
 
I just realized that the problem happens when I use IE8 in compatability mode, but not if I turn compatability mode off.  The the php generates a different set of js for the onload event in the two cases.
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

Have you tried the SimplePortal documentation?

Offline AngelinaBelle

  • Comrade
  • *
  • Posts: 4870
  • Gender: Female
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
I decided it would be easier to find and fix the problem if I started with a clean copy of the Default theme-- the one that works.  So I did that, using "Create a copy of Default named:"  Then, as soon as I applied the theme, I got the error. I hadn't modified the new theme at all.
 
This makes me think the problem is not in template.index.php, but in another file altogether.  Puzzling!
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

Have you tried the SimplePortal documentation?

Offline AngelinaBelle

  • Comrade
  • *
  • Posts: 4870
  • Gender: Female
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Sportal_init concatenates that stuff to $context['html_headers'] twice. 
 
It appears that sportal_init is called twice.  The second call to sportal_init is in SPstandalone.php. 
 
The first call to sportal_init is in SSI.php.
 
I think this is the source of my problem.  Is there a reason for SPstandalone.php to call sportal_init a second time?  If so, can you introduce some flags sportal_init to use to figure out if it has already done the $context['html_headers'] stuff?
 
I see that sportal_init has a static variable $initialized to do just that.  It is checked for empty, but it is never set.
 
Should it be set in the if (empty($initialized)) block?   $initialized=True, right at the top of the block seems to fix that problem.
 
« Last Edit: June 18, 2009, 01:14:12 PM by AngelinaBelle »
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

Have you tried the SimplePortal documentation?

Offline ディン1031

  • ... feel not as a dev at the moment ...
  • Comrade
  • *
  • Posts: 789
  • Gender: Male
  • Overworked <<
  • SMF Version: None
  • SP Version: None
Again... I'm having time problems...

Normal Monday to Friday I'm at office from 6:00-16:00 (On my local time ;P).

Offline AngelinaBelle

  • Comrade
  • *
  • Posts: 4870
  • Gender: Female
  • SMF Version: 2 RC3
  • SP Version: 2.3.2

Oh i see it now... i was blind... hmmm *testing*, so i can confirm this is a bug... i will see if there is a way to fix it...

Code: (search for) [Select]
   if (!empty($context['template_layers']) && !in_array('portal', $context['template_layers']))
      $context['template_layers'][] = 'portal';

Code: (Replace with) [Select]
   if (!empty($context['template_layers']) && !in_array('portal', $context['template_layers']))
      $context['template_layers'][] = 'portal';
   
   // The function is one time loaded.
   $initialized = true;
Yes, that's exactly the fix I made to sportal_init.  It means that, the second time through, sportal_init will skip adding all that stuff to $context['html_headers'].  And it did solve my problem.
 
I am still mildly curious why, even before the fix, I did not have the problem when I used Theme/Default.  There may be something else going on there.
 
But my problem is fixed.  Except, of course, for those running ie8 browsers -- the onload event can't run, because SMF doesn't recognize ie8 and SimplePortal does the wrong onload event for the sp_image_resize. But that's a different topic!
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

Have you tried the SimplePortal documentation?

Offline [SiNaN]

  • Mr. SimplePortal
  • Developer
  • *
  • Posts: 6782
  • SMF Version: 2.0.15
  • SP Version: 2.3.7
Setting the $initialized variable to true was missing only for SMF 1.1 versions. Moved to the bug reports.

I'll check the other issue later.
And slowly, you come to realize... It's all as it should be...

Offline AngelinaBelle

  • Comrade
  • *
  • Posts: 4870
  • Gender: Female
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
I think the IE8 issue is a feature of SMF 1.1
http://www.simplemachines.org/community/index.php?topic=318651.0
 
Thanks for verifying my problem as a bug.  I'm happy with simpleportal.  It is simple to use now.
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

Have you tried the SimplePortal documentation?