aboutsummaryrefslogtreecommitdiff
path: root/lib/helper.php
diff options
context:
space:
mode:
authorMaZderMind2015-07-03 13:09:15 +0200
committerMaZderMind2015-07-03 13:09:15 +0200
commitb2cdfa500fa2ae85079e61be4a767b2960e47601 (patch)
tree826c5d169bb1bc2ce8afec22e40a1de15eaf2185 /lib/helper.php
parentfa9baf320c7d4ffda01dbc1509a54390cc9bd1db (diff)
ssl() and proto() helper to keep visitors on their url scheme
Diffstat (limited to 'lib/helper.php')
-rw-r--r--lib/helper.php12
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']));