From: Fatih Orhan Date: Thu, 4 Apr 2013 08:10:31 +0000 (+0300) Subject: Prevent "undefined index 'HTTPS'" Notice X-Git-Tag: 0.1~73^2~3 X-Git-Url: https://git.immae.eu/?a=commitdiff_plain;h=aa8e0a27e21c88dcaaf99af602219f1e79188a88;p=github%2Fwallabag%2Fwallabag.git Prevent "undefined index 'HTTPS'" Notice In servers where notice error_level is enabled, php prints this notice which mixed in to url. --- diff --git a/index.php b/index.php index e32996fa..167c4401 100755 --- a/index.php +++ b/index.php @@ -53,7 +53,11 @@ switch ($action) { } function url(){ - $protocol = ($_SERVER['HTTPS'] && $_SERVER['HTTPS'] != "off") ? "https" : "http"; + $protocol = "http"; + if(isset($_SERVER['HTTPS'])) + if($_SERVER['HTTPS'] != "off") + $protocol = "https"; + return $protocol . "://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; } ?>