]> git.immae.eu Git - github/wallabag/wallabag.git/commitdiff
Prevent "undefined index 'HTTPS'" Notice
authorFatih Orhan <fatihorhan@gmail.com>
Thu, 4 Apr 2013 08:10:31 +0000 (11:10 +0300)
committerFatih Orhan <fatihorhan@gmail.com>
Thu, 4 Apr 2013 08:10:31 +0000 (11:10 +0300)
In servers where notice error_level is enabled, php prints this notice
which mixed in to url.

index.php

index e32996fab206758cd519961be13bdc429f62b29f..167c4401cc792774b1210646281b7cee54539680 100755 (executable)
--- 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'];
 }
 ?>