# HG changeset patch # User Nathan Phillip Brink # Date 2012-11-28 00:10:27 # Node ID 0e5a369b205fc038d053f138e645a1fdb7cf39eb # Parent b55cc3e8ac74e06c7c327d56e8fb945332e410e4 Avoid creating links with extraneous forward-slashes in them, so that people end up at http://slatepermutate.org/ instead of http://slatepermutate.org//. diff --git a/inc/class.page.php b/inc/class.page.php --- a/inc/class.page.php +++ b/inc/class.page.php @@ -732,7 +732,7 @@ class page 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)) @@ -936,10 +936,10 @@ class page 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; } }