From 24d64b5798bef3f9e0c7dc38b359f0f2733abdca Mon Sep 17 00:00:00 2001 From: Chuck Hagenbuch Date: Fri, 30 Jul 2010 14:39:42 -0400 Subject: [PATCH] When rewriting URLs use /rt/-/* instead of *?rt=rt (#7806) --- chora/.htaccess | 12 ++++++------ chora/lib/Chora.php | 7 +++++-- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/chora/.htaccess b/chora/.htaccess index dc66fa7eb..17ba42e15 100644 --- a/chora/.htaccess +++ b/chora/.htaccess @@ -1,9 +1,9 @@ Allow from all - RewriteEngine On - RewriteRule ^([a-z]+).php/(.*)$ $1.php?f=$2 [QSA,L] - RewriteCond %{REQUEST_FILENAME} !-d - RewriteCond %{REQUEST_FILENAME} !-f - RewriteRule ^browse/(.*)$ browsedir.php?f=$1 [QSA] - RewriteRule ^(.*)$ browsedir.php?f=$1 [QSA] + RewriteEngine On + RewriteRule ^([a-z]+).php/(.*)$ $1.php?f=$2 [QSA,L] + RewriteCond %{REQUEST_FILENAME} !-d + RewriteCond %{REQUEST_FILENAME} !-f + RewriteRule ^browse/(.*)$ browsedir.php?f=$1 [QSA] + RewriteRule ^([a-z-]+)/-/browse/(.*)$ browsedir.php?f=$2&rt=$1 [QSA] diff --git a/chora/lib/Chora.php b/chora/lib/Chora.php index fb0ef02c4..28010382a 100644 --- a/chora/lib/Chora.php +++ b/chora/lib/Chora.php @@ -105,8 +105,7 @@ class Chora * * @return string The URL, with session information if necessary. */ - static public function url($script, $uri = '', $args = array(), - $anchor = '') + static public function url($script, $uri = '', $args = array(), $anchor = '') { $arglist = self::_getArgList($GLOBALS['acts'], $GLOBALS['defaultActs'], $args); $script .= '.php'; @@ -118,6 +117,10 @@ class Chora } else { $script = "browse/$uri"; } + if (isset($args['rt'])) { + $script = urlencode($arglist['rt']) . "/-/$script"; + unset($arglist['rt']); + } } else { $script .= '/' . $uri; } -- 2.11.0