mirror of
https://gitlab.easter-eggs.com/ee/ldapsaisie.git
synced 2024-11-25 11:29:06 +01:00
LSurl::public_url: fix handling public root URL with a trailing slash
This commit is contained in:
parent
b5b540de65
commit
000222ae89
1 changed files with 15 additions and 4 deletions
|
@ -192,13 +192,24 @@ class LSurl extends LSlog_staticLoggerClass {
|
||||||
$public_root_url = LSconfig :: get('public_root_url', '/', 'string');
|
$public_root_url = LSconfig :: get('public_root_url', '/', 'string');
|
||||||
|
|
||||||
if ($absolute && $public_root_url[0] == '/') {
|
if ($absolute && $public_root_url[0] == '/') {
|
||||||
self :: log_debug("LSurl :: public_root_url(absolute=true): configured public root URL is relative ($public_root_url) => try to detect it from current request infos.");
|
self :: log_debug(
|
||||||
$public_root_url = 'http'.(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on'?'s':'').'://'.$_SERVER['HTTP_HOST'].$public_root_url;
|
"LSurl :: public_root_url(absolute=true): configured public root URL is relative ".
|
||||||
self :: log_debug("LSurl :: public_root_url(absolute=true): detected public absolute root URL: $public_root_url");
|
"($public_root_url) => try to detect it from current request infos."
|
||||||
|
);
|
||||||
|
$public_root_url = sprintf(
|
||||||
|
"http%s://%s%s",
|
||||||
|
isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on'?'s':'',
|
||||||
|
$_SERVER['HTTP_HOST'],
|
||||||
|
$public_root_url
|
||||||
|
);
|
||||||
|
self :: log_debug(
|
||||||
|
"LSurl :: public_root_url(absolute=true): detected public absolute root URL: ".
|
||||||
|
$public_root_url
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($relative_url) {
|
if ($relative_url) {
|
||||||
if ($public_root_url[0] == '/') $public_root_url .= "/";
|
if ($public_root_url[-1] != '/') $public_root_url .= "/";
|
||||||
return $public_root_url.$relative_url;
|
return $public_root_url.$relative_url;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue