Changeset - 0e5a369b205f
[Not reviewed]
default
0 1 0
Nathan Brink (binki) - 13 years ago 2012-11-28 00:10:27
ohnobinki@ohnopublishing.net
Avoid creating links with extraneous forward-slashes in them, so that people end up at http://slatepermutate.org/ instead of http://slatepermutate.org//.
1 file changed with 3 insertions and 3 deletions:
0 comments (0 inline, 0 general)
inc/class.page.php
Show inline comments
 
@@ -729,13 +729,13 @@ class page
 
	    }
 
	  
 
	  $base_uri = $proto . '://' . $host;
 
	  if ($port !== NULL)
 
	    $base_uri .= ':' . $port;
 
	  list($base_request_uri) = explode('?', $_SERVER['REQUEST_URI'], 2);
 
	  $base_uri .= substr($base_request_uri, 0, strrpos($base_request_uri, '/')) . '/';
 
	  $base_uri .= rtrim(substr($base_request_uri, 0, strrpos($base_request_uri, '/')), '/') . '/';
 
	}
 

	
 
    if (empty($base_uri) && empty($uri))
 
      return './';
 

	
 
    return $base_uri . $uri;
 
@@ -933,16 +933,16 @@ class page
 
    global $clean_urls, $short_url_base;
 

	
 
    if ($clean_urls && isset($short_url_base)) {
 
      return $this->add_trailing_slash($short_url_base) . $id;
 
    }
 
    elseif ($clean_urls) {
 
      return 'http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['REQUEST_URI']) . '/' . $id;
 
      return 'http://' . $_SERVER['HTTP_HOST'] . $this->add_trailing_slash(dirname($_SERVER['REQUEST_URI'])) . '' . $id;
 
    }
 
    else {
 
      return 'http://' . $_SERVER['HTTP_HOST']  . dirname($_SERVER['REQUEST_URI']) . '/process.php?s=' . $id;
 
      return 'http://' . $_SERVER['HTTP_HOST']  . $this->add_trailing_slash(dirname($_SERVER['REQUEST_URI'])) . 'process.php?s=' . $id;
 
    }
 
  }
 

	
 
  /**
 
   * \brief
 
   *   Generate special code to close a self-closing XHTML/HTML
0 comments (0 inline, 0 general)