diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/helper.php | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/helper.php b/lib/helper.php index e462089..4cf089f 100644 --- a/lib/helper.php +++ b/lib/helper.php @@ -1,11 +1,21 @@ <?php +function ssl() +{ + return isset($_SERVER['HTTPS']) && $_SERVER['HTTPS']; +} + +function proto() +{ + return ssl() ? 'https' : 'http'; +} + function baseurl() { if(isset($GLOBALS['CONFIG']['BASEURL'])) return $GLOBALS['CONFIG']['BASEURL']; - $base = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS']) ? 'https://' : 'http://'; + $base = ssl() ? 'https://' : 'http://'; $base .= $_SERVER['HTTP_HOST']; $base .= forceslash(dirname($_SERVER['SCRIPT_NAME'])); |