Skip to content

Commit

Permalink
replaced error-proned wierd HTTPS server var call in Pico->base_url
Browse files Browse the repository at this point in the history
  • Loading branch information
Bill Ortell committed Apr 18, 2012
1 parent 4314b47 commit ce55a65
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/pico.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,16 @@ function base_url()
$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]);
}

}

?>

0 comments on commit ce55a65

Please sign in to comment.