Parcourir la source

Merge pull request #1 from billortell/master

replaced unusual SERVER var "HTTPS" call as it was causing NOTICE
Gilbert Pellegrom il y a 13 ans
Parent
commit
13d9a0514b
1 fichiers modifiés avec 7 ajouts et 1 suppressions
  1. 7 1
      lib/pico.php

+ 7 - 1
lib/pico.php

@@ -103,10 +103,16 @@ class Pico {
 		$script_url  = (isset($_SERVER['PHP_SELF'])) ? $_SERVER['PHP_SELF'] : '';
 		$script_url  = (isset($_SERVER['PHP_SELF'])) ? $_SERVER['PHP_SELF'] : '';
 		if($request_url != $script_url) $url = trim(preg_replace('/'. str_replace('/', '\/', str_replace('index.php', '', $script_url)) .'/', '', $request_url, 1), '/');
 		if($request_url != $script_url) $url = trim(preg_replace('/'. str_replace('/', '\/', str_replace('index.php', '', $script_url)) .'/', '', $request_url, 1), '/');
 
 
-		$protocol = $_SERVER['HTTPS'] ? "https" : "http";
+		$protocol = $this->get_protocol();
 		return rtrim(str_replace($url, '', $protocol . "://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']), '/');
 		return rtrim(str_replace($url, '', $protocol . "://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']), '/');
 	}
 	}
 
 
+	function get_protocol()
+	{
+		preg_match("|^HTTP[S]?|is",$_SERVER['SERVER_PROTOCOL'],$m);
+		return strtolower($m[0]);
+	}
+
 }
 }
 
 
 ?>
 ?>