Simple Machines Community Forum

Customizing SMF => SMF Coding Discussion => Topic started by: Sono on February 24, 2024, 11:15:21 PM

Title: Please help with errors after changing to HTTPS
Post by: Sono on February 24, 2024, 11:15:21 PM
I have just changed my forum to https, but there are some errors I cannot fix. This is one crucial:

<div align="center" style="margin-bottom:10px;overflow:hidden;" >


<script type="text/javascript">

/***********************************************
* Conveyor belt slideshow script- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/


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

//Specify the slider's images
var leftrightslide=new Array()
var finalslide=''

leftrightslide[0]='<a href="https://itunes.apple.com/us/artist/faya-tess/276364137?at=10lRpA&ct=Congovibes_Faya_Tess_Special&itscg=30200&itsct=toolbox_linkbuilder&ls=1&app=music" target="_blank"><img src="https://congovibes.com/Advertisement/faya_tess_special.jpg"  border=1 height="200px" width="200px"></a>'

leftrightslide[1]='<a href="https://apple.co/3m5kDfd" target="_blank"><img src="https://congovibes.com/Advertisement/extravision.PNG"  border=1 height="200px" width="200px"></a>'


leftrightslide[2]='<a href="https://geo.music.apple.com/us/album/s%C3%A8ve/1478884072?at=10lRpA&ct=Congovibes_Zaiko_Seve&itscg=30200&itsct=toolbox_linkbuilder&ls=1&app=music" target="itunes_store"> <img src="https://congovibes.com/Advertisement/zaiko_seve.jpg"  border=1 height="200px" width="200px"></a>'

leftrightslide[3]='<a href="https://geo.music.apple.com/me/album/sissi-ngwema/1526438245?at=10lRpA&ct=Congovibes_Bozi_Acoustique&itscg=30200&itsct=toolbox_linkbuilder&ls=1&app=music" target="_blank"><img src="https://congovibes.com/Advertisement/bozi_acoustique.jpg"  border=1 height="200px" width="200px"></a>'

leftrightslide[4]='<a href="https://geo.music.apple.com/us/album/fiesta-dor/679798073?at=10lRpA&ct=Congovibes_Aurlus_Mabele_Fiesta&itscg=30200&itsct=toolbox_linkbuilder&ls=1&app=music" target="_blank"><img src="https://congovibes.com/Advertisement/aurlus_mabele_fiesta.jpg"  border=1 height="200px" width="200px"></a>'


leftrightslide[5]='<a href="https://geo.music.apple.com/us/album/the-best-of/id980417614?at=10lRpA&ct=Congovibes_Sam_Fan_Thomas&itscg=30200&itsct=toolbox_linkbuilder&ls=1&app=music" target="_blank"><img src="https://congovibes.com/Advertisement/samfanthomas_african_typic.jpg"  border=1 height="200px" width="200px"></a>'

leftrightslide[6]='<a href="https://geo.music.apple.com/us/album/best-of-monique-s%C3%A9ka/1466464944?at=10lRpA&ct=Congovibes_Monique_Seka_Best&itscg=30200&itsct=toolbox_linkbuilder&ls=1&app=music" target="_blank"><img src="https://congovibes.com/Advertisement/moniqueseka_best.jpg"  border=1 height="200px" width="200px"</a>'

leftrightslide[7]='<a href="https://geo.music.apple.com/us/album/g%C3%A9rant/1353372192?at=10lRpA&ct=Congovibes_Pepe_Kalle_Gerant&itscg=30200&itsct=toolbox_linkbuilder&ls=1&app=music" target="_blank"><img src="https://congovibes.com/Advertisement/pepe_kalle_gerant.jpg"  border=1 height="200px" width="200px"></a>'




//Specify gap between each image (use HTML):
var imagegap='<img src="https://congovibes.com/Advertisement/spacer.jpg"  />'

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


////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;border-radius:10px;">'+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)
}



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>
</div>

This conveyor belt slideshow does not work. Originally, the image links in it were http. After the change to https, the slideshow still loaded, but the images were missing, there were only emptry frames displayed. Then I rewritten the code to https in all links, since then  the slideshow does not load at all.  I tried reverting to htt: links in the code, no empty frames loading any more either. I have this slideshow inserted into a Simple Portal block.

The other oddity is that I have another directory for other images, strangely those images are loaded even from the old http links. Their link have not been changed yet, still they load. When I click inspect, I can see in the code that their links are http, but there is also a notification: Current source: https bla bala. How is this possible?
Title: Re: Please help with errors after chaning to HTTPS
Post by: Sir Osis of Liver on February 25, 2024, 04:34:16 PM
Depending on how you istalled the code, you may have to escape all single quotes -


                     //Specify the slider\'s images
                      var rightrightslideltr=new Array()
                      var finalslideltr=\'\'


The links I checked work.  You may have made a typo somewhere in the code.  Shouldn't make any difference to the slideshow if the external links are http or https, if they worked before they should work after.  Did you do anything to force https in the forum?
Title: Re: Please help with errors after chaning to HTTPS
Post by: Sono on February 25, 2024, 08:47:00 PM
Quote from: Sir Osis of Liver on February 25, 2024, 04:34:16 PMDepending on how you istalled the code, you may have to escape all single quotes -


                    //Specify the slider\'s images
                      var rightrightslideltr=new Array()
                      var finalslideltr=\'\'


The links I checked work.  You may have made a typo somewhere in the code.  Shouldn't make any difference to the slideshow if the external links are http or https, if they worked before they should work after.  Did you do anything to force https in the forum?


I know the slideshow should work no matter there is SSL or not, but it happened as written, as soon as I changed the code to https links, the belt itself started disappearing. Before that it worked, the empty frames without the images showed up.

I thought about having made a typo somewhere, but the original of the code is still available online, and that does not work either. The belt itself does not load either. That div where it is placed remains 0 px in height, as if nothing was there. Here is the link to that code: http://dynamicdrive.com/dynamicindex14/leftrightslide.htm

I tried insertin the original code to a Weebly test page, it worked as is. The images were missing, there were empty frames, but the belt was there and working, even after entering my image links it worked, and my images showed up. When I copied the same code to my forum code, it stopped working. Containing div was empty, 0 px in height.

I am not an inspection expert, but I managed to find something in the inspection window of the browser about this. First of all you can find this belt code on my frontpage here: congovibes.com.

Here is the place it should appear:
(https://i.ibb.co/7zZDYB1/place-of-code.jpg)

The tree of elements containing the problematic code are: <content_section> ..... ->...... <sp_header> ..... ->...... <sp_block>. The javascript is in the latter one.

And this is what the inspector reports for that part of the index.PHP code:

"Uncaught SyntaxError: Unexpected token '&'     index.php:310"
In that row you can find this line:

"var finalslide=&#39;&#39;"
Just to clarify again, the code now inserted to my page is the original from the link mentioned above. It is not what I posted in the first message here. And you see it doesn't work either, so I guess it is not a typo problem.
Title: Re: Please help with errors after changing to HTTPS
Post by: Arantor on February 25, 2024, 08:58:43 PM
Looks like something mangled your code. How exactly did you add it?
Title: Re: Please help with errors after changing to HTTPS
Post by: Sono on February 25, 2024, 09:07:39 PM
Quote from: Arantor on February 25, 2024, 08:58:43 PMLooks like something mangled your code. How exactly did you add it?

Well, meanwhile I double checked it, and I have just noticed the inserted and the presented codes are different indeed. As if there was some character misinterpretation thing going on. This is what is inserted by me to the forum 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>


And this is what is presented when the page loads in the browser:



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

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

//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=&#39;<nobr>&#39;+leftrightslide.join(imagegap)+&#39;</nobr>&#39;
var iedom=document.all||document.getElementById
if (iedom)
document.write(&#39;<span id="temp" style="visibility:hidden;position:absolute;top:-100px;left:-9000px">&#39;+leftrightslide+&#39;</span>&#39;)
var actualwidth=&#39;&#39;
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(&#39;<table border="0" cellspacing="0" cellpadding="0"><td>&#39;)
if (iedom){
write(&#39;<div style="position:relative;width:&#39;+sliderwidth+&#39;;height:&#39;+sliderheight+&#39;;overflow:hidden">&#39;)
write(&#39;<div style="position:absolute;width:&#39;+sliderwidth+&#39;;height:&#39;+sliderheight+&#39;;background-color:&#39;+slidebgcolor+&#39;" onMouseover="copyspeed=0" onMouseout="copyspeed=slidespeed">&#39;)
write(&#39;<div id="test2" style="position:absolute;left:0px;top:0px"></div>&#39;)
write(&#39;<div id="test3" style="position:absolute;left:-1000px;top:0px"></div>&#39;)
write(&#39;</div></div>&#39;)
}
else if (document.layers){
write(&#39;<ilayer width=&#39;+sliderwidth+&#39; height=&#39;+sliderheight+&#39; name="ns_slidemenu" bgColor=&#39;+slidebgcolor+&#39;>&#39;)
write(&#39;<layer name="ns_slidemenu2" left=0 top=0 onMouseover="copyspeed=0" onMouseout="copyspeed=slidespeed"></layer>&#39;)
write(&#39;<layer name="ns_slidemenu3" left=0 top=0 onMouseover="copyspeed=0" onMouseout="copyspeed=slidespeed"></layer>&#39;)
write(&#39;</ilayer>&#39;)
}
document.write(&#39;</td></table>&#39;)
}
}

That "&#39" part is repeated everywhere.

I inserted the code in the SimplePortal management panel. It looks like this:

(https://i.ibb.co/wWC6DSn/simpleportal.jpg)

The right sidebar visible on the frontpage is also a Simple Portal block, but as you see there there is no problem with the code.
Title: Re: Please help with errors after changing to HTTPS
Post by: Arantor on February 26, 2024, 03:19:09 AM
I'd replace all the single quotes with double quotes given whatever SP is doing here (which, btw, is almost certainly wrong)
Title: Re: Please help with errors after changing to HTTPS
Post by: Sono on February 26, 2024, 11:07:19 AM
Quote from: Arantor on February 26, 2024, 03:19:09 AMI'd replace all the single quotes with double quotes given whatever SP is doing here (which, btw, is almost certainly wrong)

I ask in its thread what might cause this. It has not been a problem until the SSL was installed.
Title: Re: Please help with errors after changing to HTTPS
Post by: Arantor on February 26, 2024, 11:59:18 AM
HTTPS isn't really relevant. You changed the script because the URLs were old and something in SP is causing the input to be overly sanitised in a way it wasn't before - but HTTPS doesn't cause a change of single quotes to their 039 form, that's either in SMF or SP.
Title: Re: Please help with errors after changing to HTTPS
Post by: Sir Osis of Liver on February 26, 2024, 12:15:20 PM
We're running two instances of it here (https://ebook-mecca.com/) wrapped in php with all single quotes escaped.
Title: Re: Please help with errors after changing to HTTPS
Post by: Sono on February 27, 2024, 02:20:05 AM
Quote from: Arantor on February 26, 2024, 11:59:18 AMHTTPS isn't really relevant. You changed the script because the URLs were old and something in SP is causing the input to be overly sanitised in a way it wasn't before - but HTTPS doesn't cause a change of single quotes to their 039 form, that's either in SMF or SP.

I also have a clue about that it is not the fact of being HTTPS itself, but it is caused by something related to the change of address. For example there was a file to help interpreting characters on a http link, and now SP doesn't reach it. Don't know just guessing. But it is still a fact that it worked before, and after installing the SSL it didn't. Something happened.
Title: Re: Please help with errors after changing to HTTPS
Post by: Kindred on February 27, 2024, 06:05:18 PM
well, sure....  if you MANUALLY put http scripts, etc into your code, then switching to https would break that...

that has nothing to do with SMF itself though
Title: Re: Please help with errors after changing to HTTPS
Post by: Sir Osis of Liver on February 28, 2024, 12:32:19 PM
This is a very old script (20+ years), updates and support ended long ago, but it still works if you treat it kindly.  Wasn't able to find a current script with same functionality.  If you mess with the code you're likely to break it.  You should go back to a clean version of the original script (still available here (http://www.dynamicdrive.com/dynamicindex14/leftrightslide.htm)), and work forward from that.
Title: Re: Please help with errors after changing to HTTPS
Post by: Sono on February 28, 2024, 10:03:29 PM
Quote from: Sir Osis of Liver on February 28, 2024, 12:32:19 PMThis is a very old script (20+ years), updates and support ended long ago, but it still works if you treat it kindly.  Wasn't able to find a current script with same functionality.  If you mess with the code you're likely to break it.  You should go back to a clean version of the original script (still available here (http://www.dynamicdrive.com/dynamicindex14/leftrightslide.htm)), and work forward from that.


But this is what I indicated in my comments above. In the first post I referred to my "messed" code, but later on I inserted the original as well, and indicated that it does not work either. I take the original from the DynamicDrive website, insert it into a Weebly test page, it works, when I insert it into the SimplePortal block on my SMF forum it doesn't work. Because for some reason, the final, presented code is full of those &#39 characters. Something happens when I add the code to the SimplePortal panel and press the Submit button there, or during the process when the forum or Simple Portal scripts process the code that I inserted. And it is like that since I changed to HTTPS. Before that even my messed code worked. Now, none, not even the original. While, in case I test the code on Weebly, it works, both, even with the images from my site, from my hosting space.
Title: Re: Please help with errors after changing to HTTPS
Post by: Sono on February 28, 2024, 10:52:32 PM
You can check it here, this is a separate html page I have just placed to the server, with the conveyor belt code, the original code from DinamicDrive, with my image:

https://congovibes.com/conveyorbelt4.html

It works.

When I add the same code to the Simple Portal block, nothing appears, and when I check the presented code in the inspector this is what I get:


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

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

//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=&#39;<nobr>&#39;+leftrightslide.join(imagegap)+&#39;</nobr>&#39;
var iedom=document.all||document.getElementById
if (iedom)
document.write(&#39;<span id="temp" style="visibility:hidden;position:absolute;top:-100px;left:-9000px">&#39;+leftrightslide+&#39;</span>&#39;)
var actualwidth=&#39;&#39;
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(&#39;<table border="0" cellspacing="0" cellpadding="0"><td>&#39;)
if (iedom){
write(&#39;<div style="position:relative;width:&#39;+sliderwidth+&#39;;height:&#39;+sliderheight+&#39;;overflow:hidden">&#39;)
write(&#39;<div style="position:absolute;width:&#39;+sliderwidth+&#39;;height:&#39;+sliderheight+&#39;;background-color:&#39;+slidebgcolor+&#39;" onMouseover="copyspeed=0" onMouseout="copyspeed=slidespeed">&#39;)
write(&#39;<div id="test2" style="position:absolute;left:0px;top:0px"></div>&#39;)
write(&#39;<div id="test3" style="position:absolute;left:-1000px;top:0px"></div>&#39;)
write(&#39;</div></div>&#39;)
}
else if (document.layers){
write(&#39;<ilayer width=&#39;+sliderwidth+&#39; height=&#39;+sliderheight+&#39; name="ns_slidemenu" bgColor=&#39;+slidebgcolor+&#39;>&#39;)
write(&#39;<layer name="ns_slidemenu2" left=0 top=0 onMouseover="copyspeed=0" onMouseout="copyspeed=slidespeed"></layer>&#39;)
write(&#39;<layer name="ns_slidemenu3" left=0 top=0 onMouseover="copyspeed=0" onMouseout="copyspeed=slidespeed"></layer>&#39;)
write(&#39;</ilayer>&#39;)
}
document.write(&#39;</td></table>&#39;)
}
}

It is full of those &#39 characters. The images should appear on the frontpage but there is only empty space there:

(https://i.ibb.co/7zZDYB1/place-of-code.jpg)

It seems something is happening on the step when the forum is receiving the data from the database to be displayed on pageload. In the database, you can already see the code submitted by me full of those &#39 characters, but there are also a bunch of other strange characters as well. I guess it is some kind of characterset setting, that the database stores the code on its own way. When you check the presented code I get on pageload, most of those strange characters gone, the originals are restored, except for that &#39. That somehow stays in the presented code on pageload, not transformed back. This is what is stored in the database:

https://drive.google.com/file/d/1Ry1yf61uykKZPS4Xsv55RW3fC0V61lK2/view?usp=sharing
Title: Re: Please help with errors after changing to HTTPS
Post by: Arantor on February 29, 2024, 02:17:45 AM
And I already told you how to fix that, change all the single quotes to double quotes.
Title: Re: Please help with errors after changing to HTTPS
Post by: Sono on February 29, 2024, 02:26:24 AM
But how is it that it does not work with single quotes any more? I am just interested.
Title: Re: Please help with errors after changing to HTTPS
Post by: Sir Osis of Liver on February 29, 2024, 03:00:39 PM
Quote from: Sir Osis of Liver on February 25, 2024, 04:34:16 PMDepending on how you installed the code, you may have to escape all single quotes -


                     //Specify the slider\'s images
                      var rightrightslideltr=new Array()
                      var finalslideltr=\'\'



Quote from: Arantor on February 26, 2024, 03:19:09 AMI'd replace all the single quotes with double quotes given whatever SP is doing here (which, btw, is almost certainly wrong)

Either method should fix the problem.  For reasons unknown, SP is apparently running the html in a php echo statement, and php recognizes single quotes as delimiters, so the first ' it hits breaks the statement and crashes the code.
Title: Re: Please help with errors after changing to HTTPS
Post by: Sono on March 01, 2024, 12:23:58 AM
Quote from: Sir Osis of Liver on February 29, 2024, 03:00:39 PM
Quote from: Sir Osis of Liver on February 25, 2024, 04:34:16 PMDepending on how you installed the code, you may have to escape all single quotes -


                     //Specify the slider\'s images
                      var rightrightslideltr=new Array()
                      var finalslideltr=\'\'



Quote from: Arantor on February 26, 2024, 03:19:09 AMI'd replace all the single quotes with double quotes given whatever SP is doing here (which, btw, is almost certainly wrong)

Either method should fix the problem.  For reasons unknown, SP is apparently running the html in a php echo statement, and php recognizes single quotes as delimiters, so the first ' it hits breaks the statement and crashes the code.


The only question is why it hasn't been a problem so far? What made it to be like that from one moment to the other when changing to https?




Title: Re: Please help with errors after changing to HTTPS
Post by: Sir Osis of Liver on March 01, 2024, 11:44:00 AM
Quote from: Arantor on February 26, 2024, 11:59:18 AMHTTPS isn't really relevant. You changed the script because the URLs were old and something in SP is causing the input to be overly sanitised in a way it wasn't before - but HTTPS doesn't cause a change of single quotes to their 039 form, that's either in SMF or SP.
You must have made an error when you edited http/https in the script.
Title: Re: Please help with errors after changing to HTTPS
Post by: Arantor on March 01, 2024, 12:00:50 PM
No, *I* didn't :P

But that's not the problem the OP is having. It's *provably* editing what he's doing - every time he saves it, it's saving the single quotes in escaped form, you wouldn't do that accidentally. Nor would HTTPS cause this, it's just not how that works.

Now, I'd going to suggest that if the change to HTTPS happened, maybe plugins were updated at the same time. Which would explain why it didn't do this before but is now, and why existing blocks are left alone but editing them changes them on saving.
Title: Re: Please help with errors after changing to HTTPS
Post by: Sir Osis of Liver on March 01, 2024, 12:06:01 PM
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

Title: Re: Please help with errors after changing to HTTPS
Post by: Arantor on March 01, 2024, 12:23:11 PM
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.
Title: Re: Please help with errors after changing to HTTPS
Post by: Sono on March 02, 2024, 01:44:07 AM
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:

(https://i.ibb.co/BgHMqtt/swedish.jpg)

(https://i.ibb.co/hZmTnWD/swedish-2.jpg)

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? 
Title: Re: Please help with errors after changing to HTTPS
Post by: Arantor on March 02, 2024, 03:25:32 AM
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.
Title: Re: Please help with errors after changing to HTTPS
Post by: Sono on March 02, 2024, 11:50:48 AM
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?
Title: Re: Please help with errors after changing to HTTPS
Post by: Sir Osis of Liver on March 02, 2024, 03:29:24 PM
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?


Title: Re: Please help with errors after changing to HTTPS
Post by: Sono on March 02, 2024, 11:49:59 PM
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 (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>
Title: Re: Please help with errors after changing to HTTPS
Post by: Sir Osis of Liver on March 03, 2024, 01:32:51 PM
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 (https://www.thekrashsite.com/smf20/index.php) 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.


Title: Re: Please help with errors after changing to HTTPS
Post by: Sono on March 04, 2024, 02:36:18 AM
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 (https://www.thekrashsite.com/smf20/index.php) 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?
Title: Re: Please help with errors after changing to HTTPS
Post by: Sir Osis of Liver on March 04, 2024, 12:52:24 PM
Would be interesting if you can set up a test install where the slideshow works in a portal block.
Title: Re: Please help with errors after changing to HTTPS
Post by: Sono on March 04, 2024, 01:10:17 PM
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.
Title: Re: Please help with errors after changing to HTTPS
Post by: Sir Osis of Liver on March 04, 2024, 09:41:11 PM
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.
Title: Re: Please help with errors after changing to HTTPS
Post by: Chen Zhen on March 17, 2024, 02:09:52 AM
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;
}