From 01510fa8bdd2f5920a1121b2b7f7b5a2487623e1 Mon Sep 17 00:00:00 2001 From: MaZderMind Date: Fri, 3 Jul 2015 13:20:35 +0200 Subject: Auto-Prepend protocoll for protocol-relative Base-URLs This allows to have a switching button --- lib/helper.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'lib') 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']; -- cgit v1.2.3