Skip to content

Commit

Permalink
Fix in /classes/Links.php for pretty links.
Browse files Browse the repository at this point in the history
  • Loading branch information
nodesocket committed Aug 10, 2012
1 parent 1b04c72 commit 41597c8
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions classes/Links.php
Expand Up @@ -28,12 +28,15 @@ public static function render($page, array $query_params = array()) {
//
// There may be a better way to do this. Do you know?
////
if(isset($_SERVER['REQUEST_URI']) && isset($_SERVER['HTTP_REFERER']) && $_SERVER['REQUEST_URI'] !== "/" && $_SERVER['HTTP_REFERER'] !== "/") {
if(strpos($_SERVER['HTTP_REFERER'], ".php") === false) {
if(isset($_SERVER['REQUEST_URI']) && isset($_SERVER['HTTP_REFERER']) && isset($_SERVER['HTTP_HOST']) && $_SERVER['REQUEST_URI'] !== "/") {
//Remove http or https from $_SERVER['HTTP_REFERER']
$referer = rtrim(str_replace(array("http://", "https://"), "", $_SERVER['HTTP_REFERER']), "/");

if($referer !== $_SERVER['HTTP_HOST'] && strpos($_SERVER['HTTP_REFERER'], ".php") === false) {
Links::$pretty = true;
}
}

if(Links::$pretty) {
if(count($query_params) > 0) {
return $page . "/" . implode("/", $query_params);
Expand Down

0 comments on commit 41597c8

Please sign in to comment.