FIX Https detection

theme/eldy/manifest.json.php was returning http:// links instead of the
https link defined in the configuration.
I found that this is because I am behide a proxy and that isHTTPS does
the detection as expected.

Therefore that function is used to detect https which results in the correct
urls.

Detected on my 18.0.2 installation
This commit is contained in:
MDW
2024-01-26 02:22:23 +01:00
parent b05d1c5f6e
commit 3c2bc3a842
2 changed files with 3 additions and 2 deletions

View File

@@ -286,8 +286,9 @@ if (!$found) {
// There is no subdir that compose the main url root or autodetect fails (Ie: when using apache alias that point outside default DOCUMENT_ROOT).
$tmp = $dolibarr_main_url_root;
} else {
$tmp = 'http'.(((empty($_SERVER["HTTPS"]) || $_SERVER["HTTPS"] != 'on') && (empty($_SERVER["SERVER_PORT"]) || $_SERVER["SERVER_PORT"] != 443)) ? '' : 's').'://'.$_SERVER["SERVER_NAME"].((empty($_SERVER["SERVER_PORT"]) || $_SERVER["SERVER_PORT"] == 80 || $_SERVER["SERVER_PORT"] == 443) ? '' : ':'.$_SERVER["SERVER_PORT"]).($tmp3 ? (preg_match('/^\//', $tmp3) ? '' : '/').$tmp3 : '');
$tmp = 'http'.((!isHTTPS() && (empty($_SERVER["SERVER_PORT"]) || $_SERVER["SERVER_PORT"] != 443)) ? '' : 's').'://'.$_SERVER["SERVER_NAME"].((empty($_SERVER["SERVER_PORT"]) || $_SERVER["SERVER_PORT"] == 80 || $_SERVER["SERVER_PORT"] == 443) ? '' : ':'.$_SERVER["SERVER_PORT"]).($tmp3 ? (preg_match('/^\//', $tmp3) ? '' : '/').$tmp3 : '');
}
//print "tmp1=".$tmp1." tmp2=".$tmp2." tmp3=".$tmp3." tmp=".$tmp."\n";
if (!empty($dolibarr_main_force_https)) {
$tmp = preg_replace('/^http:/i', 'https:', $tmp);