diff --git a/cake/libs/view/templates/elements/dump.thtml b/cake/libs/view/templates/elements/dump.ctp similarity index 100% rename from cake/libs/view/templates/elements/dump.thtml rename to cake/libs/view/templates/elements/dump.ctp diff --git a/cake/libs/view/templates/errors/error404.thtml b/cake/libs/view/templates/errors/error404.ctp similarity index 100% rename from cake/libs/view/templates/errors/error404.thtml rename to cake/libs/view/templates/errors/error404.ctp diff --git a/cake/libs/view/templates/errors/missing_action.thtml b/cake/libs/view/templates/errors/missing_action.ctp similarity index 100% rename from cake/libs/view/templates/errors/missing_action.thtml rename to cake/libs/view/templates/errors/missing_action.ctp diff --git a/cake/libs/view/templates/errors/missing_component_class.thtml b/cake/libs/view/templates/errors/missing_component_class.ctp similarity index 100% rename from cake/libs/view/templates/errors/missing_component_class.thtml rename to cake/libs/view/templates/errors/missing_component_class.ctp diff --git a/cake/libs/view/templates/errors/missing_component_file.thtml b/cake/libs/view/templates/errors/missing_component_file.ctp similarity index 100% rename from cake/libs/view/templates/errors/missing_component_file.thtml rename to cake/libs/view/templates/errors/missing_component_file.ctp diff --git a/cake/libs/view/templates/errors/missing_connection.thtml b/cake/libs/view/templates/errors/missing_connection.ctp similarity index 100% rename from cake/libs/view/templates/errors/missing_connection.thtml rename to cake/libs/view/templates/errors/missing_connection.ctp diff --git a/cake/libs/view/templates/errors/missing_controller.thtml b/cake/libs/view/templates/errors/missing_controller.ctp similarity index 100% rename from cake/libs/view/templates/errors/missing_controller.thtml rename to cake/libs/view/templates/errors/missing_controller.ctp diff --git a/cake/libs/view/templates/errors/missing_helper_class.thtml b/cake/libs/view/templates/errors/missing_helper_class.ctp similarity index 100% rename from cake/libs/view/templates/errors/missing_helper_class.thtml rename to cake/libs/view/templates/errors/missing_helper_class.ctp diff --git a/cake/libs/view/templates/errors/missing_helper_file.thtml b/cake/libs/view/templates/errors/missing_helper_file.ctp similarity index 100% rename from cake/libs/view/templates/errors/missing_helper_file.thtml rename to cake/libs/view/templates/errors/missing_helper_file.ctp diff --git a/cake/libs/view/templates/errors/missing_layout.thtml b/cake/libs/view/templates/errors/missing_layout.ctp similarity index 100% rename from cake/libs/view/templates/errors/missing_layout.thtml rename to cake/libs/view/templates/errors/missing_layout.ctp diff --git a/cake/libs/view/templates/errors/missing_model.thtml b/cake/libs/view/templates/errors/missing_model.ctp similarity index 100% rename from cake/libs/view/templates/errors/missing_model.thtml rename to cake/libs/view/templates/errors/missing_model.ctp diff --git a/cake/libs/view/templates/errors/missing_scaffolddb.thtml b/cake/libs/view/templates/errors/missing_scaffolddb.ctp similarity index 100% rename from cake/libs/view/templates/errors/missing_scaffolddb.thtml rename to cake/libs/view/templates/errors/missing_scaffolddb.ctp diff --git a/cake/libs/view/templates/errors/missing_table.thtml b/cake/libs/view/templates/errors/missing_table.ctp similarity index 100% rename from cake/libs/view/templates/errors/missing_table.thtml rename to cake/libs/view/templates/errors/missing_table.ctp diff --git a/cake/libs/view/templates/errors/missing_view.thtml b/cake/libs/view/templates/errors/missing_view.ctp similarity index 100% rename from cake/libs/view/templates/errors/missing_view.thtml rename to cake/libs/view/templates/errors/missing_view.ctp diff --git a/cake/libs/view/templates/errors/private_action.thtml b/cake/libs/view/templates/errors/private_action.ctp similarity index 100% rename from cake/libs/view/templates/errors/private_action.thtml rename to cake/libs/view/templates/errors/private_action.ctp diff --git a/cake/libs/view/templates/errors/scaffold_error.thtml b/cake/libs/view/templates/errors/scaffold_error.ctp similarity index 100% rename from cake/libs/view/templates/errors/scaffold_error.thtml rename to cake/libs/view/templates/errors/scaffold_error.ctp diff --git a/cake/libs/view/templates/layouts/ajax.thtml b/cake/libs/view/templates/layouts/ajax.ctp similarity index 100% rename from cake/libs/view/templates/layouts/ajax.thtml rename to cake/libs/view/templates/layouts/ajax.ctp diff --git a/cake/libs/view/templates/layouts/default.thtml b/cake/libs/view/templates/layouts/default.ctp similarity index 100% rename from cake/libs/view/templates/layouts/default.thtml rename to cake/libs/view/templates/layouts/default.ctp diff --git a/cake/libs/view/templates/layouts/flash.thtml b/cake/libs/view/templates/layouts/flash.ctp similarity index 100% rename from cake/libs/view/templates/layouts/flash.thtml rename to cake/libs/view/templates/layouts/flash.ctp diff --git a/cake/libs/view/templates/pages/home.thtml b/cake/libs/view/templates/pages/home.ctp similarity index 100% rename from cake/libs/view/templates/pages/home.thtml rename to cake/libs/view/templates/pages/home.ctp diff --git a/cake/libs/view/view.php b/cake/libs/view/view.php index 0dba7eaff..b86e17376 100644 --- a/cake/libs/view/view.php +++ b/cake/libs/view/view.php @@ -300,7 +300,6 @@ class View extends Object { } else { $viewFileName = $this->_getViewFileName($action); } - if (!is_file($viewFileName) && !fileExistsInPath($viewFileName) || $viewFileName === '/' || $viewFileName === '\\') { if (strpos($action, 'missingAction') !== false) { $errorAction = 'missingAction'; @@ -319,7 +318,6 @@ class View extends Object { } else { $missingViewFileName = false; } - $missingViewExists = is_file($missingViewFileName); if ($missingViewExists) { @@ -328,32 +326,16 @@ class View extends Object { } if (strpos($action, 'missingView') === false) { + return $this->cakeError('missingView', array(array('className' => $this->name, - 'action' => $action, - 'file' => $viewFileName, - 'base' => $this->base - ))); - - $isFatal = isset($this->isFatal) ? $this->isFatal : false; - - if (!$isFatal) { - $viewFileName = $missingViewFileName; - } - } else { - $missingViewExists = false; - } - if (!$missingViewExists || $isFatal) { - if (DEBUG) { - trigger_error(sprintf(__("No template file for view %s (expected %s), create it first'"), $action, $viewFileName), E_USER_ERROR); - } else { - $this->error('404', 'Not found', sprintf("The requested address %s was not found on this server.", '', "missing view \"{$action}\"")); - } - die(); + 'action' => $action, + 'file' => $viewFileName, + 'base' => $this->base))); } } if ($viewFileName && !$this->hasRendered) { - if (substr($viewFileName, -4) === 'ctp' || substr($viewFileName, -5) === 'thtml') { + if (substr($viewFileName, -3) === 'ctp' || substr($viewFileName, -5) === 'thtml') { $out = View::_render($viewFileName, $this->_viewVars); } else { $out = $this->_render($viewFileName, $this->_viewVars); @@ -431,7 +413,7 @@ class View extends Object { */ function renderLayout($content_for_layout) { $layout_fn = $this->_getLayoutFileName(); - + if (DEBUG > 2 && $this->controller != null) { $debug = View::_render(LIBS . 'view' . DS . 'templates' . DS . 'elements' . DS . 'dump.ctp', array('controller' => $this->controller), false); } else { @@ -614,22 +596,25 @@ class View extends Object { if (!is_null($this->plugin)) { $viewFileName = APP . 'plugins' . DS . $this->plugin . DS . 'views' . DS . $this->viewPath . DS . $action . $this->ext; + if (file_exists(APP . 'views' . DS . 'plugins' . DS . $this->plugin . DS . $this->subDir . $type . $action . $this->ext)) { return APP . 'views' . DS . 'plugins' . DS . $this->plugin . DS . $this->subDir . $type . $action . $this->ext; - } elseif (file_exists($viewFileName)) { - return $viewFileName; + } elseif (file_exists(APP . 'plugins' . DS . $this->plugin . DS . 'views' . DS . $this->viewPath . DS . $action . $this->ext)) { + return APP . 'plugins' . DS . $this->plugin . DS . 'views' . DS . $this->viewPath . DS . $action . $this->ext; } elseif (file_exists(APP . 'views' . DS . 'plugins' . DS . $this->plugin . DS . $this->subDir . $type . $action . '.thtml')) { return APP . 'views' . DS . 'plugins' . DS . $this->plugin . DS . $this->subDir . $type . $action . '.thtml'; } elseif (file_exists(APP . 'plugins' . DS . $this->plugin . DS . 'views' . DS . $this->viewPath . DS . $action . '.thtml')) { return APP . 'plugins' . DS . $this->plugin . DS . 'views' . DS . $this->viewPath . DS . $action . '.thtml'; } else { - return $this->cakeError('missingView', array(array( - 'className' => $this->name, - 'action' => $action, - 'file' => $viewFileName, - 'base' => $this->base))); + $this->cakeError('missingView', array(array( + 'className' => $this->name, + 'action' => $action, + 'file' => $viewFileName, + 'base' => $this->base))); + exit(); } } + foreach($paths->viewPaths as $path) { if (file_exists($path . $this->viewPath . DS . $this->subDir . $type . $action . $this->ext)) { return $path . $this->viewPath . DS . $this->subDir . $type . $action . $this->ext; @@ -637,14 +622,13 @@ class View extends Object { return $path . $this->viewPath . DS . $this->subDir . $type . $action . '.thtml'; } } - - if ($viewFileName = fileExistsInPath(LIBS . 'view' . DS . 'templates' . DS . 'errors' . DS . $type . $action . '.ctp')) { - } elseif($viewFileName = fileExistsInPath(LIBS . 'view' . DS . 'templates' . DS . $this->viewPath . DS . $type . $action . '.ctp')) { - } else { - $viewFileName = VIEWS . $this->viewPath . DS . $this->subDir . $type . $action . $this->ext; - } - return $viewFileName; + if ($viewFileName = fileExistsInPath(LIBS . 'view' . DS . 'templates' . DS . 'errors' . DS . $type . $action . '.ctp')) { + return $viewFileName; + } elseif($viewFileName = fileExistsInPath(LIBS . 'view' . DS . 'templates' . DS . $this->viewPath . DS . $type . $action . '.ctp')) { + return $viewFileName; + } + return APP . DS . 'views' . DS . $this->viewPath . DS . $action . $this->ext; } /** @@ -686,9 +670,9 @@ class View extends Object { } } - if($layoutFileName = fileExistsInPath(LIBS . 'view' . DS . 'templates' . DS . 'layouts' . DS . $type . $this->layout . '.ctp')) { - } else { - $layoutFileName = LAYOUTS . $type . $this->layout . $this->ext; + $layoutFileName = fileExistsInPath(LIBS . 'view' . DS . 'templates' . DS . 'layouts' . DS . $type . $this->layout . '.ctp'); + if(is_null($layoutFileName)) { + return 'missingLayout'; } return $layoutFileName; }