From ce55a6543bd1d43e6b87254d6739e1d879c59186 Mon Sep 17 00:00:00 2001 From: Bill Ortell Date: Tue, 17 Apr 2012 22:14:19 -0400 Subject: [PATCH] replaced error-proned wierd HTTPS server var call in Pico->base_url --- lib/pico.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/pico.php b/lib/pico.php index 31ec87b..17ce990 100644 --- a/lib/pico.php +++ b/lib/pico.php @@ -103,10 +103,16 @@ class Pico { $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), '/'); - $protocol = $_SERVER['HTTPS'] ? "https" : "http"; + $protocol = $this->get_protocol(); 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]); + } + } ?> \ No newline at end of file