1
0
Fork 0

Add HTTPS detection

Add HTTPS detection when figuring out the URL when the URL global
variable is not set.
This commit is contained in:
Nick Scheibenpflug 2015-08-26 14:55:51 -04:00
parent 112ebf3639
commit f9a36d5679
1 changed files with 4 additions and 1 deletions

View File

@ -29,7 +29,10 @@ $s->compile_dir = "./templates_c";
if(!URL) { if(!URL) {
$uri = explode("/",$_SERVER['REQUEST_URI']); $uri = explode("/",$_SERVER['REQUEST_URI']);
array_pop($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 { } else {
define('_URL', URL); define('_URL', URL);
} }