diff options
author | MaZderMind | 2015-07-03 13:20:35 +0200 |
---|---|---|
committer | MaZderMind | 2015-07-03 13:20:35 +0200 |
commit | 01510fa8bdd2f5920a1121b2b7f7b5a2487623e1 (patch) | |
tree | a613ccaa7f0050fdbeaf6ebd10f2047247e8b769 /lib | |
parent | b2cdfa500fa2ae85079e61be4a767b2960e47601 (diff) |
Auto-Prepend protocoll for protocol-relative Base-URLs
This allows to have a switching button
Diffstat (limited to 'lib')
-rw-r--r-- | lib/helper.php | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/helper.php b/lib/helper.php index 4cf089f..711ac6a 100644 --- a/lib/helper.php +++ b/lib/helper.php @@ -13,7 +13,13 @@ function proto() function baseurl() { if(isset($GLOBALS['CONFIG']['BASEURL'])) - return $GLOBALS['CONFIG']['BASEURL']; + { + $base = $GLOBALS['CONFIG']['BASEURL']; + if(startswith('//', $base)) + $base = proto().':'.$base; + + return $base; + } $base = ssl() ? 'https://' : 'http://'; $base .= $_SERVER['HTTP_HOST']; |