When rewriting URLs use /rt/-/* instead of *?rt=rt (#7806)
authorChuck Hagenbuch <chuck@horde.org>
Fri, 30 Jul 2010 18:39:42 +0000 (14:39 -0400)
committerChuck Hagenbuch <chuck@horde.org>
Sun, 1 Aug 2010 00:26:53 +0000 (20:26 -0400)
chora/.htaccess
chora/lib/Chora.php

index dc66fa7..17ba42e 100644 (file)
@@ -1,9 +1,9 @@
 Allow from all
 <IfModule mod_rewrite.c>
-       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]
 </IfModule>
index fb0ef02..2801038 100644 (file)
@@ -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;
             }