From 8d1a23e008048eafa4ff167a3bcaef645641a1a5 Mon Sep 17 00:00:00 2001 From: nate Date: Thu, 7 Dec 2006 05:58:08 +0000 Subject: [PATCH] Fixing reverse-route URL generator for admin routes git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@4077 3807eeeb-6ff5-0310-8944-8be069107fe0 --- cake/libs/router.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/cake/libs/router.php b/cake/libs/router.php index 60cd1d45d..99d2eb240 100644 --- a/cake/libs/router.php +++ b/cake/libs/router.php @@ -394,8 +394,10 @@ class Router extends Overloadable { if (isset($url['ext'])) { $extension = '.' . $url['ext']; } - if (defined('CAKE_ADMIN') && !isset($url[CAKE_ADMIN]) && isset($params['admin'])) { - $url[CAKE_ADMIN] = $params['admin']; + if (defined('CAKE_ADMIN') && !isset($url[CAKE_ADMIN]) && isset($params[CAKE_ADMIN])) { + $url[CAKE_ADMIN] = $params[CAKE_ADMIN]; + } elseif (defined('CAKE_ADMIN') && $url[CAKE_ADMIN] == false) { + unset($url[CAKE_ADMIN]); } foreach ($_this->routes as $route) { @@ -497,6 +499,9 @@ class Router extends Overloadable { } } + sort($route[3]); + sort($url); + if ($route[3] == $url) { return array(Router::__mapRoute($route, $url), array()); } elseif (!empty($params)) { @@ -507,6 +512,8 @@ class Router extends Overloadable { if ($keysFilled != $params) { return false; } + } else { + return false; } /*if (!empty($diffs)) { @@ -557,6 +564,7 @@ class Router extends Overloadable { $out = str_replace(':' . $key, $params[$key], $out); unset($params[$key]); } + // Do something else here for leftover params return $out; }