adding fix for windows paths in view, thanks renan`saddam for reporting and debugging

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@6895 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
gwoo 2008-05-15 23:57:24 +00:00
parent de086b1be3
commit 84739652c8

View file

@ -766,20 +766,18 @@ class View extends Object {
$name = $this->action; $name = $this->action;
} }
$name = str_replace('/', DS, $name);
if (strpos($name, DS) === false && strpos($name, '..') === false) { if (strpos($name, DS) === false && strpos($name, '..') === false) {
$name = $this->viewPath . DS . $subDir . Inflector::underscore($name); $name = $this->viewPath . DS . $subDir . Inflector::underscore($name);
} elseif (strpos($name, DS) !== false) { } elseif (strpos($name, DS) !== false) {
if ($name{0} === '/' || $name{1} === ':') { if ($name{0} === DS || $name{1} === ':') {
if (is_file($name)) { if (is_file($name)) {
return $name; return $name;
} }
$name = trim($name, '/'); $name = trim($name, DS);
} else { } else {
$name = $this->viewPath . DS . $subDir . $name; $name = $this->viewPath . DS . $subDir . $name;
} }
if (DS !== '/') {
$name = implode(DS, explode('/', $name));
}
} elseif (strpos($name, '..') !== false) { } elseif (strpos($name, '..') !== false) {
$name = explode('/', $name); $name = explode('/', $name);
$i = array_search('..', $name); $i = array_search('..', $name);