News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

Please help with errors after changing to HTTPS

Started by Sono, February 24, 2024, 11:15:21 PM

Previous topic - Next topic

Sir Osis of Liver

Quote from: Arantor on March 01, 2024, 12:00:50 PMNo, *I* didn't :P
Didn't say you did, that was directed at OP.

SP hasn't been updated for a while (SMF 2.0.14).  OP can check in SP support topic -

https://www.simplemachines.org/community/index.php?topic=227599.msg4155861#msg4155861

Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Arantor

But you quoted me :P

All I know is that changing HTTPS *does not cause this on its own*, it literally can't. And the evidence is plain to see that *something* is escaping the single quotes.

If it is not HTTPS (and it is not), *something else must have changed*. And it's entirely possible that this change happened a while ago but the slider was fine as it was and so didn't need editing and then *didn't get edited*, so *didn't get broken*.

Correlation continues to not be causation.

Sono

#22
Quote from: Arantor on March 01, 2024, 12:23:11 PMBut you quoted me :P

All I know is that changing HTTPS *does not cause this on its own*, it literally can't. And the evidence is plain to see that *something* is escaping the single quotes.

If it is not HTTPS (and it is not), *something else must have changed*. And it's entirely possible that this change happened a while ago but the slider was fine as it was and so didn't need editing and then *didn't get edited*, so *didn't get broken*.

Correlation continues to not be causation.

I think the slider was last edited about 2 years ago or so. I changed the photos occasionally during the years.

By the way, my database elements differ in character set. Some elements are set to Swedish (I have no clue when it became like that). Isn't it possible that causes some issue? The database itself is considered Swedish as well, in spite of that the majority of the elements are UTF 8:





Though I guess HTML code should be treated independently of language.

By the way, isn't is possible that those Doctype kind of declarations and their links, and others similar to that should have been updated during the years? Those still point to old http links. Maybe some of them are outdated reference shcemes for https, and since SSL is installed, some of those sources became useless and confuse the operation of the forum? 

Arantor

OK so let's tackle all these things one at a time.

Database collation means nothing at all relevant, all that means is "if I create a new table and don't specify a collation in the CREATE TABLE, what should get used?" Almost every well behaved mod should be using SMF's own code to get this right.

The tables that are mixed are more of a question because they shouldn't be mixed. The real question is whether your site is really in UTF-8 mode or not and if it is, manually convert the remaining tables. Though this is not relevant to the encoding problem - and if you have no other issues it would be fine to *leave this alone*. Collation defines how text is sorted and organised and does not deal with HTML encoding at all.

In fact the "Swedish" part is a misnomer, what it really is saying is that "we order these things by the rules of several languages that all have a common order to the letters in their alphabet" and Swedish was the name given to it because it includes a few of the accented letters found in Swedish, but *mostly because* the MySQL AB company that originally made MySQL was based in Sweden.

The doctype declarations are what they are, those are the standard accepted forms for all languages prior to HTML5 and do not require to be changed. In fact changing them will break things - the browser doesn't have to call out to get the DTDs and syntax files, it already has local copies, but the URLs are established pointers. SMF 2.1 correctly does not bother with this as it uses HTML5 where the doctype is just <!DOCTYPE html> as it's no longer holding things over from SGML or XML in the same way.

Last but not least: so what we're saying then is that it was *not* the HTTPS change that broke it. We're saying that something else on the system that changed in the last two years would have been the actual culprit and that the HTTPS change is why you *noticed* it. Not why it *caused* it.

Sono

#24
Quote from: Arantor on March 02, 2024, 03:25:32 AMOK so let's tackle all these things one at a time.

Database collation means nothing at all relevant, all that means is "if I create a new table and don't specify a collation in the CREATE TABLE, what should get used?" Almost every well behaved mod should be using SMF's own code to get this right.

The tables that are mixed are more of a question because they shouldn't be mixed. The real question is whether your site is really in UTF-8 mode or not and if it is, manually convert the remaining tables. Though this is not relevant to the encoding problem - and if you have no other issues it would be fine to *leave this alone*. Collation defines how text is sorted and organised and does not deal with HTML encoding at all.

In fact the "Swedish" part is a misnomer, what it really is saying is that "we order these things by the rules of several languages that all have a common order to the letters in their alphabet" and Swedish was the name given to it because it includes a few of the accented letters found in Swedish, but *mostly because* the MySQL AB company that originally made MySQL was based in Sweden.

The doctype declarations are what they are, those are the standard accepted forms for all languages prior to HTML5 and do not require to be changed. In fact changing them will break things - the browser doesn't have to call out to get the DTDs and syntax files, it already has local copies, but the URLs are established pointers. SMF 2.1 correctly does not bother with this as it uses HTML5 where the doctype is just <!DOCTYPE html> as it's no longer holding things over from SGML or XML in the same way.

Last but not least: so what we're saying then is that it was *not* the HTTPS change that broke it. We're saying that something else on the system that changed in the last two years would have been the actual culprit and that the HTTPS change is why you *noticed* it. Not why it *caused* it.

It just came to my mind one other thing that I changed recently, and it happened before I changed the code in the SP block that I set the PHP version from 5.4 to 7.4. What about that? Could it mess things up for SP?

Sir Osis of Liver

The latest (and last) version of SP is 2.3.7, it seems to runs ok in php 8.0, even though it hasn't been updated to support 8.0.  There's also this from topic I posted earlier -

Quote from: Chen Zhen on August 30, 2023, 11:02:46 PMNo it hasn't..  if you're still using the SMF 2.0 branch then you can use version 2.3.8 from the beta/rc download section of SP.

If you're using SMF 2.1 branch then use EhPortal which is a ported version.

IIRC, EhPortal inherits SP content, so you don't have to reconfigure from scratch. 

But don't believe that's what's causing your problem.  Can you post the complete code you're using for the slideshow?


Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Sono

Of course:

The original code from Dynamic drive with my image, embedded on a single html page on my domain, appearing:
https://congovibes.com/conveyorbelt4.html

The same code embedded in an SP header block, on my frontpage, not appearing:
https://www.congovibes.com

In both cases this is the code:

<script type="text/javascript">


//Specify the slider's width (in pixels)
var sliderwidth="300px"
//Specify the slider's height
var sliderheight="150px"
//Specify the slider's slide speed (larger is faster 1-10)
var slidespeed=3
//configure background color:
slidebgcolor="#EAEAEA"

//Specify the slider's images
var leftrightslide=new Array()
var finalslide=''
leftrightslide[0]='<a href="http://"><img src="https://www.congovibes.com/Images/thierry.jpg" border=1></a>'
leftrightslide[1]='<a href="http://"><img src="https://www.congovibes.com/Images/thierry.jpg" border=1></a>'
leftrightslide[2]='<a href="http://"><img src="https://www.congovibes.com/Images/thierry.jpg" border=1></a>'
leftrightslide[3]='<a href="http://"><img src="https://www.congovibes.com/Images/thierry.jpg" border=1></a>'
leftrightslide[4]='<a href="http://"><img src="https://www.congovibes.com/Images/thierry.jpg" border=1></a>'

//Specify gap between each image (use HTML):
var imagegap=" "

//Specify pixels gap between each slideshow rotation (use integer):
var slideshowgap=5


////NO NEED TO EDIT BELOW THIS LINE////////////

var copyspeed=slidespeed
leftrightslide='<nobr>'+leftrightslide.join(imagegap)+'</nobr>'
var iedom=document.all||document.getElementById
if (iedom)
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100px;left:-9000px">'+leftrightslide+'</span>')
var actualwidth=''
var cross_slide, ns_slide

function fillup(){
if (iedom){
cross_slide=document.getElementById? document.getElementById("test2") : document.all.test2
cross_slide2=document.getElementById? document.getElementById("test3") : document.all.test3
cross_slide.innerHTML=cross_slide2.innerHTML=leftrightslide
actualwidth=document.all? cross_slide.offsetWidth : document.getElementById("temp").offsetWidth
cross_slide2.style.left=actualwidth+slideshowgap+"px"
}
else if (document.layers){
ns_slide=document.ns_slidemenu.document.ns_slidemenu2
ns_slide2=document.ns_slidemenu.document.ns_slidemenu3
ns_slide.document.write(leftrightslide)
ns_slide.document.close()
actualwidth=ns_slide.document.width
ns_slide2.left=actualwidth+slideshowgap
ns_slide2.document.write(leftrightslide)
ns_slide2.document.close()
}
lefttime=setInterval("slideleft()",30)
}
window.onload=fillup

function slideleft(){
if (iedom){
if (parseInt(cross_slide.style.left)>(actualwidth*(-1)+8))
cross_slide.style.left=parseInt(cross_slide.style.left)-copyspeed+"px"
else
cross_slide.style.left=parseInt(cross_slide2.style.left)+actualwidth+slideshowgap+"px"

if (parseInt(cross_slide2.style.left)>(actualwidth*(-1)+8))
cross_slide2.style.left=parseInt(cross_slide2.style.left)-copyspeed+"px"
else
cross_slide2.style.left=parseInt(cross_slide.style.left)+actualwidth+slideshowgap+"px"

}
else if (document.layers){
if (ns_slide.left>(actualwidth*(-1)+8))
ns_slide.left-=copyspeed
else
ns_slide.left=ns_slide2.left+actualwidth+slideshowgap

if (ns_slide2.left>(actualwidth*(-1)+8))
ns_slide2.left-=copyspeed
else
ns_slide2.left=ns_slide.left+actualwidth+slideshowgap
}
}


if (iedom||document.layers){
with (document){
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
if (iedom){
write('<div style="position:relative;width:'+sliderwidth+';height:'+sliderheight+';overflow:hidden">')
write('<div style="position:absolute;width:'+sliderwidth+';height:'+sliderheight+';background-color:'+slidebgcolor+'" onMouseover="copyspeed=0" onMouseout="copyspeed=slidespeed">')
write('<div id="test2" style="position:absolute;left:0px;top:0px"></div>')
write('<div id="test3" style="position:absolute;left:-1000px;top:0px"></div>')
write('</div></div>')
}
else if (document.layers){
write('<ilayer width='+sliderwidth+' height='+sliderheight+' name="ns_slidemenu" bgColor='+slidebgcolor+'>')
write('<layer name="ns_slidemenu2" left=0 top=0 onMouseover="copyspeed=0" onMouseout="copyspeed=slidespeed"></layer>')
write('<layer name="ns_slidemenu3" left=0 top=0 onMouseover="copyspeed=0" onMouseout="copyspeed=slidespeed"></layer>')
write('</ilayer>')
}
document.write('</td></table>')
}
}
</script>

Sir Osis of Liver

Can't get this to work. >:(  Slideshow displays correctly at top of forum when added to index.template.php, but doesn't work in portal block as html or php.  I either get an empty block, or this with custom php running this code -


echo '

<script type="text/javascript">

//Specify the slider\'s width (in pixels)
var sliderwidth="300px"
//Specify the slider\'s height
var sliderheight="150px"
//Specify the slider\'s slide speed (larger is faster 1-10)
var slidespeed=3
//configure background color:
slidebgcolor="#EAEAEA"

//Specify the slider\'s images
var leftrightslide=new Array()
var finalslide=\'\'
leftrightslide[0]=\'<a href="http://"><img src="https://www.congovibes.com/Images/thierry.jpg" border=1></a>\'
leftrightslide[1]=\'<a href="http://"><img src="https://www.congovibes.com/Images/thierry.jpg" border=1></a>\'
leftrightslide[2]=\'<a href="http://"><img src="https://www.congovibes.com/Images/thierry.jpg" border=1></a>\'
leftrightslide[3]=\'<a href="http://"><img src="https://www.congovibes.com/Images/thierry.jpg" border=1></a>\'
leftrightslide[4]=\'<a href="http://"><img src="https://www.congovibes.com/Images/thierry.jpg" border=1></a>\'

//Specify gap between each image (use HTML):
var imagegap=" "

//Specify pixels gap between each slideshow rotation (use integer):
var slideshowgap=5


////NO NEED TO EDIT BELOW THIS LINE////////////

var copyspeed=slidespeed
leftrightslide=\'<nobr>\'+leftrightslide.join(imagegap)+\'</nobr>\'
var iedom=document.all||document.getElementById
if (iedom)
document.write(\'<span id="temp" style="visibility:hidden;position:absolute;top:-100px;left:-9000px">\'+leftrightslide+\'</span>\')
var actualwidth=\'\'
var cross_slide, ns_slide

function fillup(){
if (iedom){
cross_slide=document.getElementById? document.getElementById("test2") : document.all.test2
cross_slide2=document.getElementById? document.getElementById("test3") : document.all.test3
cross_slide.innerHTML=cross_slide2.innerHTML=leftrightslide
actualwidth=document.all? cross_slide.offsetWidth : document.getElementById("temp").offsetWidth
cross_slide2.style.left=actualwidth+slideshowgap+"px"
}
else if (document.layers){
ns_slide=document.ns_slidemenu.document.ns_slidemenu2
ns_slide2=document.ns_slidemenu.document.ns_slidemenu3
ns_slide.document.write(leftrightslide)
ns_slide.document.close()
actualwidth=ns_slide.document.width
ns_slide2.left=actualwidth+slideshowgap
ns_slide2.document.write(leftrightslide)
ns_slide2.document.close()
}
lefttime=setInterval("slideleft()",30)
}
window.onload=fillup

function slideleft(){
if (iedom){
if (parseInt(cross_slide.style.left)>(actualwidth*(-1)+8))
cross_slide.style.left=parseInt(cross_slide.style.left)-copyspeed+"px"
else
cross_slide.style.left=parseInt(cross_slide2.style.left)+actualwidth+slideshowgap+"px"

if (parseInt(cross_slide2.style.left)>(actualwidth*(-1)+8))
cross_slide2.style.left=parseInt(cross_slide2.style.left)-copyspeed+"px"
else
cross_slide2.style.left=parseInt(cross_slide.style.left)+actualwidth+slideshowgap+"px"

}
else if (document.layers){
if (ns_slide.left>(actualwidth*(-1)+8))
ns_slide.left-=copyspeed
else
ns_slide.left=ns_slide2.left+actualwidth+slideshowgap

if (ns_slide2.left>(actualwidth*(-1)+8))
ns_slide2.left-=copyspeed
else
ns_slide2.left=ns_slide.left+actualwidth+slideshowgap
}
}


if (iedom||document.layers){
with (document){
document.write(\'<table border="0" cellspacing="0" cellpadding="0"><td>\')
if (iedom){
write(\'<div style="position:relative;width:\'+sliderwidth+\';height:\'+sliderheight+\';overflow:hidden">\')
write(\'<div style="position:absolute;width:\'+sliderwidth+\';height:\'+sliderheight+\';background-color:\'+slidebgcolor+\'" onMouseover="copyspeed=0" onMouseout="copyspeed=slidespeed">\')
write(\'<div id="test2" style="position:absolute;left:0px;top:0px"></div>\')
write(\'<div id="test3" style="position:absolute;left:-1000px;top:0px"></div>\')
write(\'</div></div>\')
}
else if (document.layers){
write(\'<ilayer width=\'+sliderwidth+\' height=\'+sliderheight+\' name="ns_slidemenu" bgColor=\'+slidebgcolor+\'>\')
write(\'<layer name="ns_slidemenu2" left=0 top=0 onMouseover="copyspeed=0" onMouseout="copyspeed=slidespeed"></layer>\')
write(\'<layer name="ns_slidemenu3" left=0 top=0 onMouseover="copyspeed=0" onMouseout="copyspeed=slidespeed"></layer>\')
write(\'</ilayer>\')
}
document.write(\'</td></table>\')
}
}
</script>';


Same result when I use working slideshow from another forum.  Console gives me this error -

 Error: Promised response from onMessage listener went out of scope

Don't know what's causing it.


Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Sono

Quote from: Sir Osis of Liver on March 03, 2024, 01:32:51 PMCan't get this to work. >:(  Slideshow displays correctly at top of forum when added to index.template.php, but doesn't work in portal block as html or php.  I either get an empty block, or this with custom php running this code -




Can it help you to track the source of problems in case I reinstate an old version of the forum to another test domain and you check the outcome there?

Sir Osis of Liver

Would be interesting if you can set up a test install where the slideshow works in a portal block.
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Sono

Quote from: Sir Osis of Liver on March 04, 2024, 12:52:24 PMWould be interesting if you can set up a test install where the slideshow works in a portal block.


Okay I'll do it during the week and will get back when ready.

Sir Osis of Liver

FYI, can't get the slideshow to work in Tinyportal either.  Using a working version from another forum, it works in index template but not in TP block.
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Chen Zhen

The block worked fine for me in EhPortal although it needed some adjustment.

document.write() & window.onload() aren't really supposed to be used in a live environment as they're more for testing & may cause conflicts with other scripts or perhaps may not work at all.

If you just want a basic horzontal marquee scroll for images that passes w3c you can try this PHP block code:

/*  Image display - Using javascript marquee */

// data that you want within the marquee
// format: link, image, title
$data = array(
array('https://example.com', 'https://www.congovibes.com/Images/thierry.jpg', 'title1'),
array('https://example.com', 'https://www.congovibes.com/Images/thierry.jpg', 'title2'),
array('https://example.com', 'https://www.congovibes.com/Images/thierry.jpg', 'title3'),
array('https://example.com', 'https://www.congovibes.com/Images/thierry.jpg', 'title4'),
array('https://example.com', 'https://www.congovibes.com/Images/thierry.jpg', 'title5'),
);

/* Image dimensions  */
$width = 300;
$height = 200;

/* For these dimensions... Set width to what suits your block, set height to what is needed for your images + gap-increment */
// $gap=5 for px but this will need to be changed for other measurement types
$gap = 5;
$mar_width = 1400;
$mar_height = $height + $gap;
$mar_speed = 3;
$mar_pause = 1;

// meaurement type - examples: px, em, rem
$msr = 'px';

// edit below this comment if you know some basic coding beyond the above variable settings
$mar_width = empty($mar_width) || $mar_width > 1400 ? 1400 : abs($mar_width);

/*  Execute the function and start the display  */
$display = fill_display($data, $width, $height, $msr);
echo '
    <div style="display: flex-block;overflow:hidden;border: 0px;white-space: nowrap;">
        <div style="display: inline;position:relative;width:' . $mar_width . $msr . ';height:' . $mar_height . $msr . ';overflow:hidden;">
            <div style="display: inline;position:relative;width:' . $mar_width . $msr . ';height:' . $mar_height . $msr . ';">
                <div id="contentsBlockInnerMarquee" style="position:relative;left:0px;top:0px;" onmouseover="contentsMarqueeSpeedVar(true)" onmouseout="contentsMarqueeSpeedVar(false)">
                    <div id="contentsBlockInnerContainer1" style="display: inline;visibility:hidden;position:relative;"></div>
                </div>
            </div>
        </div>
    </div>';
echo javascript_marquee($display, $mar_width, $mar_height, $mar_speed, $mar_pause, $msr);

function javascript_marquee($display2, $mar_width, $mar_height, $mar_speed, $mar_pause, $msr)
{
    echo '
    <script type="text/javascript">
        var marqueewidth = "' . $mar_width . $msr . '";
        var marqueeheight = "' . $mar_height . $msr . '";
        var marqueespeed = "' . $mar_speed . '";
        var pauseit = "' . $mar_pause . '";
        var marqueecontents1 = \'<span id="contentsBlockInnerContainer1" style="font-face: Arial;white-space: nowrap;">' . $display2 . '</span>\';
        marqueespeed = Math.max(1, marqueespeed-1);
        var copyspeed = marqueespeed;
        var pausespeed = (pauseit==0) ? copyspeed: 0;
        document.getElementById("contentsBlockInnerContainer1").innerHTML = marqueecontents1;

        var actualwidth = "";
        var cross_marquee, ns_marquee;
        function contentsPopulateBlockContainer1(){
            cross_marquee = document.getElementById("contentsBlockInnerMarquee");
            cross_marquee.style.left = parseInt(marqueewidth)+8+"' . $msr. '";
            cross_marquee.innerHTML = marqueecontents1;
            actualwidth = document.getElementById("contentsBlockInnerContainer1") ? document.getElementById("contentsBlockInnerContainer1").offsetWidth : 0;
            lefttime=setInterval("scrollmarquee()",20);
        }

        function scrollmarquee(){
            if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
                cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed+"' . $msr . '";
            else
                cross_marquee.style.left=parseInt(marqueewidth)+8+"' . $msr . '";
        }
        function contentsMarqueeSpeedVar(pauseitz) {
            if (!pauseitz)
                copyspeed = marqueespeed;
            else {
                copyspeed = pausespeed;
            }
        }
        if (window.addEventListener)
            window.addEventListener("load", contentsPopulateBlockContainer1, false);
        else if (window.attachEvent)
            window.attachEvent("onload", contentsPopulateBlockContainer1);
        else
            window.onload = contentsPopulateBlockContainer1();
    </script>';
}

/*  Function to fill the display with relevant info */
function fill_display($data, $width, $height, $msr)
{
$display = '&nbsp;';
$space1 =  '<span style="padding-left: 1em;"></span>';
foreach ($data as $datum) {
$display .= '<a href="' . $datum[0] . '"><img src="' . $datum[1] . '" style="border: 1px;height: ' . $height . '' . $msr . ';width: ' . $width . $msr . ';" alt="" title="' . $datum[2] . '" /></a>' . $space1;
}
return $display;
}



My SMF Mods & Plug-Ins

WebDev

"Either you repeat the same conventional doctrines everybody is saying, or else you say something true, and it will sound like it's from Neptune." - Noam Chomsky

Advertisement: