From f9a36d5679e8301b43551745a49f51da95d9a443 Mon Sep 17 00:00:00 2001 From: Nick Scheibenpflug Date: Wed, 26 Aug 2015 14:55:51 -0400 Subject: [PATCH] Add HTTPS detection Add HTTPS detection when figuring out the URL when the URL global variable is not set. --- index.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/index.php b/index.php index e60ec30..cb4b274 100644 --- a/index.php +++ b/index.php @@ -29,7 +29,10 @@ $s->compile_dir = "./templates_c"; if(!URL) { $uri = explode("/",$_SERVER['REQUEST_URI']); array_pop($uri); - define('_URL', "http://".$_SERVER['SERVER_NAME'].implode("/",$uri)."/"); + $_s = ''; + if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != '' && $_SERVER['HTTPS'] != 'off') + $_s = 's'; + define('_URL', "http$_s://".$_SERVER['SERVER_NAME'].implode("/",$uri)."/"); } else { define('_URL', URL); }