From 00df232f9e8d192ff873d2b0da10ee544938bff3 Mon Sep 17 00:00:00 2001 From: nate Date: Sun, 27 Aug 2006 17:49:50 +0000 Subject: [PATCH] Fixing /admin issue with HtmlHelper::url() (Sort-of covered by Ticket #1340) git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@3436 3807eeeb-6ff5-0310-8944-8be069107fe0 --- cake/libs/view/helpers/html.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/cake/libs/view/helpers/html.php b/cake/libs/view/helpers/html.php index c4096d52c..c8e78473f 100644 --- a/cake/libs/view/helpers/html.php +++ b/cake/libs/view/helpers/html.php @@ -212,6 +212,9 @@ class HtmlHelper extends Helper { if (isset($url['ext'])) { $extension = '.' . $url['ext']; } + if (defined('CAKE_ADMIN') && !isset($url[CAKE_ADMIN]) && isset($this->params['admin'])) { + $url[CAKE_ADMIN] = $this->params['admin']; + } $named = $args = array(); $keys = array_keys($url); @@ -238,11 +241,17 @@ class HtmlHelper extends Helper { for ($i = 0; $i < $count; $i++) { $named[$i] = join($this->argSeparator, $named[$i]); } + if (defined('CAKE_ADMIN') && isset($named[CAKE_ADMIN])) { + unset($named[CAKE_ADMIN]); + } $combined = join('/', $named); } - $url = array_filter(array($url['plugin'], $url['controller'], $url['action'], join('/', array_filter($args)), $combined)); - $output = $base . '/' . join('/', $url); + $urlOut = array_filter(array($url['plugin'], $url['controller'], $url['action'], join('/', array_filter($args)), $combined)); + if (defined('CAKE_ADMIN') && isset($url[CAKE_ADMIN]) && $url[CAKE_ADMIN]) { + array_unshift($urlOut, CAKE_ADMIN); + } + $output = $base . '/' . join('/', $urlOut); } else { if (((strpos($url, '://')) || (strpos($url, 'javascript:') === 0) || (strpos($url, 'mailto:') === 0)) || $url == '#') { return $this->output($url);