HTTPS path

Permalink Browser Info Environment
When using backstretch with the browser in secure mode (https), the url to the backstretch image remains in standard mode (http) causing security errors in browsers.

I fixed it by adding the following code to the getJS() function:

if (!empty($_SERVER['HTTPS'])){
$fPath = str_replace('http','https',$fPath);
}


So the function looks like this:

public function getJS(){
$fv = $this->getFileObject()->getApprovedVersion();
$fPath = $fv->getRelativePath(true);
if (!empty($_SERVER['HTTPS'])){
$fPath = str_replace('http','https',$fPath);
}
$speed = $this->getSpeed();
if (!(is_numeric($speed))){
$speed = "'". $speed . "'";
}
$centeredX = $this->getCenteredX();
$centeredY = $this->getCenteredY();
$js = "<script type=\"text/javascript\">\n";
$js .= "\t$.backstretch(\"{$fPath}\", {speed: {$speed}, centeredX: {$centeredX}, centeredY: {$centeredY} });\n";
$js .= "</script>\n";

Type: Discussion
Status: New
mrnoisy
View Replies:
afixia replied on at Permalink Reply
afixia
Thanks I just ran in to this!

concrete5 Environment Information

Browser User-Agent String

Hide Post Content

This will replace the post content with the message: "Content has been removed by an Administrator"

Hide Content

Request Refund

You have not specified a license for this support ticket. You must have a valid license assigned to a support ticket to request a refund.