Merging fixes and enhancements into trunk.

Revision: [2369]
Added missing doc comments to classes

Revision: [2368]
Removing core view paths from Configure class

Revision: [2367]
Updating View class to use new Configure class to search paths for view files

Revision:[ 2366]
Corrected loadControllers() in basics.php

Revision: [2365]
Updating function in basics.php to use new Configure class

Revision: [2364]
removed duplicate loading of app/config/bootstrap.php

Revision: [2363]
Added new Configure class to hold paths to models, views, and controllers related to Ticket #470.
Moved loading of app/config/bootstrap.php to Configure class from app/webroot/index.php.
Added creating instance of Configure instance in cake/bootstrap.php
Added example of setting custom paths in app/config/bootstrap.php 
Corrected error in Object::_savePersistent().

Revision: [2362]
Added fix for Ticket #534

Revision: [2361]
Refactoring persistent code a little more.
File now holds a variable with the serialized class and is include vs. reading file contents.

Revision: [2360]
Refactored persistent methods to use cache()

Revision: [2359]
Fixing array_combine() Warning in  Model::generateList()

Revision: [2358]
Set var $persistModel to false by default

Revision: [2357]
Moved persistent code to Object class.
Moved $TIME_START variable to top of file.
added __sleep methods for models

Revision: [2356]
Reverting persistent changes to Model class

Revision: [2355]
Adding fix for Ticket #550

Revision: [2354]
Corrected errors in persistent code

Revision: [2353]
Corrected overwrite in the model/model_php4.php file.

Revision: [2352]
Adding persistent methods to Model class.
This will allow caching of classes.
Added app/tmp/persistent directory.

Revision: [2351]
Reverting changes to dbo_source.php in [2350]

Revision: [2350]
Removed name pattern matches related to Ticket #534

Revision: [2349]
Adding fix for Ticket #548

Revision: [2348]
Adding fixes from Ticket #547.

Revision: [2347]
Adding fixes from Ticket #546.

Revision: [2346]
Adding fix for Ticket #527

Revision: [2345]
Refactored Html::url()

Revision: [2344]
Last fix for Ticket #483 

Revision: [2343]
Updating last commit

Revision: [2342]
Adding fix for Ticket #483

Revision: [2341]
Adding fix for Ticket #543, DBO will now only cache SELECT queries

Revision: [2340]
Adding session_write_close() to the CakeSession::__regenerateId()

Revision: [2339]
Adding patch from Ticket #544

Revision: [2338]
Adding patch from Ticket #529

Revision: [2337]
Adding patch from Ticket #528

Revision: [2336]
Removing the converting of \n to <br /> in Sanitize::html()

Revision: [2335]
Added bash script from Ticket #533

Revision: [2334]
Added enhancement for Ticket #474

Revision: [2333]
Correcting errors introduced with prior fix

Revision: [2332]
Correcting errors introduced with prior fix

Revision: [2331]
Performance optimization for NeatArray::findIn(): replaced foreach loop with for

Revision: [2330]
Minor performance optimization: Replacing all occurrences of low() with strtolower()


git-svn-id: https://svn.cakephp.org/repo/trunk/cake@2370 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
phpnut 2006-03-19 03:26:43 +00:00
parent d6f056d5c0
commit 23d183e46b
26 changed files with 557 additions and 149 deletions

View file

@ -6,4 +6,4 @@
// +---------------------------------------------------------------------------------------------------+ // // +---------------------------------------------------------------------------------------------------+ //
/////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////
1.0.0.2329 1.0.0.2370

View file

@ -36,7 +36,15 @@
* *
*/ */
/**
* The settings below can be used to set additional paths to models, views and controllers.
* This is related to Ticket #470 (https://trac.cakephp.org/ticket/470)
*
* $modelPaths = array('full path to models', 'second full path to models', 'etc...');
* $viewPaths = array('this path to views', 'second full path to views', 'etc...');
* $controllerPaths = array('this path to controllers', 'second full path to controllers', 'etc...');
*
*/
//EOF //EOF
?> ?>

View file

@ -97,7 +97,6 @@ if(!defined('CORE_PATH'))
} }
require CORE_PATH.'cake'.DS.'bootstrap.php'; require CORE_PATH.'cake'.DS.'bootstrap.php';
require APP_PATH.'config'.DS.'bootstrap.php';
if(isset($_GET['url']) && $_GET['url'] === 'favicon.ico') if(isset($_GET['url']) && $_GET['url'] === 'favicon.ico')
{ {

View file

@ -55,13 +55,10 @@ if (!function_exists("ob_get_clean"))
/** /**
* Loads all models. * Loads all models.
*
* @uses listModules()
* @uses APP
* @uses MODELS
*/ */
function loadModels() function loadModels()
{ {
$path = Configure::getInstance();
if(!class_exists('AppModel')) if(!class_exists('AppModel'))
{ {
if(file_exists(APP.'app_model.php')) if(file_exists(APP.'app_model.php'))
@ -73,19 +70,25 @@ function loadModels()
require(CAKE.'app_model.php'); require(CAKE.'app_model.php');
} }
} }
if (phpversion() < 5 && function_exists("overload")) if (phpversion() < 5 && function_exists("overload"))
{ {
overload('AppModel'); overload('AppModel');
} }
$loadedModels = array();
foreach (listClasses(MODELS) as $model_fn) foreach ($path->modelPaths as $path)
{ {
require (MODELS.$model_fn); foreach (listClasses($path) as $model_fn)
if (phpversion() < 5 && function_exists("overload"))
{ {
list($name) = explode('.', $model_fn); if (!key_exists($model_fn, $loadedModels))
overload(Inflector::camelize($name)); {
require ($path.$model_fn);
if (phpversion() < 5 && function_exists("overload"))
{
list($name) = explode('.', $model_fn);
overload(Inflector::camelize($name));
}
$loadedModels[$model_fn] = $model_fn;
}
} }
} }
} }
@ -139,12 +142,16 @@ function loadView ($viewClass)
{ {
if(!class_exists($viewClass)) if(!class_exists($viewClass))
{ {
$paths = Configure::getInstance();
$file = Inflector::underscore($viewClass).'.php'; $file = Inflector::underscore($viewClass).'.php';
if(file_exists(VIEWS.$file)) foreach ($paths->viewPaths as $path)
{ {
return require(VIEWS.$file); if(file_exists($path.$file))
{
return require($path.$file);
}
} }
elseif(file_exists(LIBS.'view'.DS.$file)) if(file_exists(LIBS.'view'.DS.$file))
{ {
return require(LIBS.'view'.DS.$file); return require(LIBS.'view'.DS.$file);
} }
@ -157,16 +164,12 @@ function loadView ($viewClass)
/** /**
* Loads a model by CamelCase name. * Loads a model by CamelCase name.
*
* @uses listModules()
* @uses APP
* @uses MODELS
*/ */
function loadModel($name) function loadModel($name)
{ {
$name = Inflector::underscore($name); $name = Inflector::underscore($name);
$paths = Configure::getInstance();
// Make sure AppModel is loaded
if(!class_exists('AppModel')) if(!class_exists('AppModel'))
{ {
if(file_exists(APP.'app_model.php')) if(file_exists(APP.'app_model.php'))
@ -179,10 +182,13 @@ function loadModel($name)
} }
} }
if(file_exists(MODELS.$name.'.php')) foreach ($paths->modelPaths as $path)
{ {
require (MODELS.$name.'.php'); if(file_exists($path.$name.'.php'))
return true; {
require ($path.$name.'.php');
return true;
}
} }
return false; return false;
@ -190,14 +196,10 @@ function loadModel($name)
/** /**
* Loads all controllers. * Loads all controllers.
*
* @uses APP
* @uses listModules()
* @uses HELPERS
* @uses CONTROLLERS
*/ */
function loadControllers () function loadControllers ()
{ {
$paths = Configure::getInstance();
if(!class_exists('AppController')) if(!class_exists('AppController'))
{ {
if(file_exists(APP.'app_controller.php')) if(file_exists(APP.'app_controller.php'))
@ -209,11 +211,19 @@ function loadControllers ()
require(CAKE.'app_controller.php'); require(CAKE.'app_controller.php');
} }
} }
foreach (listClasses(CONTROLLERS) as $controller) $loadedControllers = array();
foreach ($paths->controllerPaths as $path)
{ {
if(!class_exists($controller)) foreach (listClasses($path) as $controller)
{ {
require (CONTROLLERS.$controller.'.php'); if(file_exists($path.$controller.'.php'))
{
if (!key_exists($controller, $loadedControllers))
{
require ($path.$controller.'.php');
$loadedControllers[$controller] = $controller;
}
}
} }
} }
} }
@ -226,6 +236,7 @@ function loadControllers ()
*/ */
function loadController ($name) function loadController ($name)
{ {
$paths = Configure::getInstance();
if(!class_exists('AppController')) if(!class_exists('AppController'))
{ {
if(file_exists(APP.'app_controller.php')) if(file_exists(APP.'app_controller.php'))
@ -241,23 +252,30 @@ function loadController ($name)
{ {
return true; return true;
} }
if(!class_exists($name.'Controller')) if(!class_exists($name.'Controller'))
{ {
$name = Inflector::underscore($name); $name = Inflector::underscore($name);
if(file_exists(CONTROLLERS.$name.'_controller.php')) foreach ($paths->controllerPaths as $path)
{ {
$controller_fn = CONTROLLERS.$name.'_controller.php'; if(file_exists($path.$name.'_controller.php'))
{
require($path.$name.'_controller.php');
return true;
}
} }
elseif($controller_fn = fileExistsInPath(LIBS.'controller'.DS.$name.'_controller.php')) if($controller_fn = fileExistsInPath(LIBS.'controller'.DS.$name.'_controller.php'))
{ {
if(file_exists($controller_fn))
{
require($controller_fn);
return true;
}
else
{
return false;
}
} }
else
{
return false;
}
require($controller_fn);
return true;
} }
else else
{ {
@ -390,7 +408,7 @@ function uses ()
$args = func_get_args(); $args = func_get_args();
foreach ($args as $arg) foreach ($args as $arg)
{ {
require_once(LIBS.low($arg).'.php'); require_once(LIBS.strtolower($arg).'.php');
} }
} }
@ -861,7 +879,7 @@ function cache($path, $data = null, $expires = '+1 day', $target = 'cache')
$expires = strtotime($expires); $expires = strtotime($expires);
} }
switch (low($target)) switch (strtolower($target))
{ {
case 'cache': case 'cache':
$filename = CACHE . $path; $filename = CACHE . $path;

View file

@ -29,7 +29,6 @@
*/ */
/** /**
* Configuration, directory layout and standard libraries * Configuration, directory layout and standard libraries
*/ */
@ -39,12 +38,14 @@ if(!isset($bootstrap))
require APP_PATH.'config'.DS.'core.php'; require APP_PATH.'config'.DS.'core.php';
require CORE_PATH.'cake'.DS.'config'.DS.'paths.php'; require CORE_PATH.'cake'.DS.'config'.DS.'paths.php';
} }
$TIME_START = getMicrotime();
require LIBS.'object.php'; require LIBS.'object.php';
require LIBS.'session.php'; require LIBS.'session.php';
require LIBS.'security.php'; require LIBS.'security.php';
require LIBS.'neat_array.php'; require LIBS.'neat_array.php';
require LIBS.'inflector.php'; require LIBS.'inflector.php';
require LIBS.'configure.php';
$paths = Configure::getInstance();
/** /**
* Enter description here... * Enter description here...
*/ */
@ -106,8 +107,6 @@ else
error_reporting(0); error_reporting(0);
} }
$TIME_START = getMicrotime();
require CAKE.'dispatcher.php'; require CAKE.'dispatcher.php';
require LIBS.'model'.DS.'connection_manager.php'; require LIBS.'model'.DS.'connection_manager.php';

View file

@ -74,7 +74,7 @@ class ClassRegistry
function addObject($key, &$object) function addObject($key, &$object)
{ {
$_this =& ClassRegistry::getInstance(); $_this =& ClassRegistry::getInstance();
$key = low($key); $key = strtolower($key);
if (array_key_exists($key, $_this->_objects) === false) if (array_key_exists($key, $_this->_objects) === false)
{ {
@ -91,7 +91,7 @@ class ClassRegistry
function removeObject($key) function removeObject($key)
{ {
$_this =& ClassRegistry::getInstance(); $_this =& ClassRegistry::getInstance();
$key = low($key); $key = strtolower($key);
if (array_key_exists($key, $_this->_objects) === true) if (array_key_exists($key, $_this->_objects) === true)
{ {

160
cake/libs/configure.php Normal file
View file

@ -0,0 +1,160 @@
<?php
/* SVN FILE: $Id$ */
/**
* Short description for file.
*
* Long description for file
*
* PHP versions 4 and 5
*
* CakePHP : Rapid Development Framework <http://www.cakephp.org/>
* Copyright (c) 2006, Cake Software Foundation, Inc.
* 1785 E. Sahara Avenue, Suite 490-204
* Las Vegas, Nevada 89104
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @filesource
* @copyright Copyright (c) 2006, Cake Software Foundation, Inc.
* @link http://www.cakefoundation.org/projects/info/cakephp CakePHP Project
* @package cake
* @subpackage cake.cake.libs
* @since CakePHP v 1.0.0.2363
* @version $Revision$
* @modifiedby $LastChangedBy$
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
/**
* Short description for file.
*
* Long description for file
*
* @package cake
* @subpackage cake.cake.libs
* @since CakePHP v 1.0.0.2363
*/
class Configure extends Object
{
/**
* Hold array with paths to view files
*
* @var array
* @access public
*/
var $viewPaths = array();
/**
* Hold array with paths to controller files
*
* @var array
* @access public
*/
var $controllerPaths = array();
/**
* Enter description here...
*
* @var array
* @access public
*/
var $modelPaths = array();
/**
* Return a singleton instance of Configure.
*
* @return Configure instance
* @access public
*/
function &getInstance()
{
static $instance = array();
if (!$instance)
{
$instance[0] =& new Configure;
$instance[0]->__loadBootstrap();
}
return $instance[0];
}
/**
* Sets the var modelPaths
*
* @param array $modelPaths
* @access private
*/
function __buildModelPaths($modelPaths)
{
$_this =& Configure::getInstance();
$_this->modelPaths[] = MODELS;
if(isset($modelPaths))
{
foreach ($modelPaths as $value)
{
$this->modelPaths[] = $value;
}
}
}
/**
* Sets the var viewPaths
*
* @param array $viewPaths
* @access private
*/
function __buildViewPaths($viewPaths)
{
$_this =& Configure::getInstance();
$_this->viewPaths[] = VIEWS;
$_this->viewPaths[] = VIEWS.'errors'.DS;
if(isset($viewPaths))
{
foreach ($viewPaths as $value)
{
$this->viewPaths[] = $value;
}
}
}
/**
* Sets the var controllerPaths
*
* @param array $controllerPaths
* @access private
*/
function __buildControllerPaths($controllerPaths)
{
$_this =& Configure::getInstance();
$_this->controllerPaths[] = CONTROLLERS;
if(isset($controllerPaths))
{
foreach ($controllerPaths as $value)
{
$this->controllerPaths[] = $value;
}
}
}
/**
* Loads the app/config/bootstrap.php
* If the alternative paths are set in this file
* they will be added to the paths vars
*
* @access private
*/
function __loadBootstrap()
{
$_this =& Configure::getInstance();
$modelPaths = null;
$viewPaths = null;
$controllerPaths = null;
require APP_PATH.'config'.DS.'bootstrap.php';
$_this->__buildModelPaths($modelPaths);
$_this->__buildViewPaths($viewPaths);
$_this->__buildControllerPaths($controllerPaths);
}
}
?>

View file

@ -268,8 +268,8 @@ class DB_ACL extends AclBase
// Raise error // Raise error
} }
$aro = new Aro(); $aro = new Aro();
$tmp = $aro->find(is_string($aro) ? "aros.alias = '" . addslashes($aro) . "'" : "aros.user_id = {$aro}"); $tmp = $aro->find(is_numeric($id) ? "Aro.user_id = {$id}" : "Aro.alias = '" . addslashes($id) . "'");
$aro->setId($tmp['aro']['id']); $aro->setId($tmp['Aro']['id']);
return $aro; return $aro;
} }
@ -287,12 +287,11 @@ class DB_ACL extends AclBase
// Raise error // Raise error
} }
$aco = new Aco(); $aco = new Aco();
$tmp = $aco->find(is_string($aco) ? "acos.alias = '" . addslashes($aco) . "'" : "acos.user_id = {$aco}"); $tmp = $aco->find(is_numeric($id) ? "Aco.user_id = {$id}" : "Aco.alias = '" . addslashes($id) . "'");
$aro->setId($tmp['aco']['id']); $aco->setId($tmp['Aco']['id']);
return $aco; return $aco;
} }
/** /**
* Enter description here... * Enter description here...
* *

View file

@ -42,6 +42,8 @@
class AclNode extends AppModel class AclNode extends AppModel
{ {
var $cacheQueries = false;
/** /**
* Enter description here... * Enter description here...
* *
@ -246,10 +248,8 @@ class AclNode extends AppModel
*/ */
function _resolveID($id, $fKey) function _resolveID($id, $fKey)
{ {
$db =& ConnectionManager::getDataSource($this->useDbConfig);
$key = (is_string($id) ? 'alias' : $fKey); $key = (is_string($id) ? 'alias' : $fKey);
$val = (is_string($id) ? '"' . $db->value($id) . '"' : $id); return array($key => $id);
return "{$key} = {$val}";
} }
/** /**
@ -290,7 +290,7 @@ class AclNode extends AppModel
*/ */
function setSource() function setSource()
{ {
$this->table = low(get_class($this)) . "s"; $this->table = strtolower(get_class($this)) . "s";
} }
} }

View file

@ -168,7 +168,7 @@ class RequestHandlerComponent extends Object
*/ */
function isPost() function isPost()
{ {
return (low(env('REQUEST_METHOD')) == 'post'); return (strtolower(env('REQUEST_METHOD')) == 'post');
} }
/** /**
@ -178,7 +178,7 @@ class RequestHandlerComponent extends Object
*/ */
function isPut() function isPut()
{ {
return (low(env('REQUEST_METHOD')) == 'put'); return (strtolower(env('REQUEST_METHOD')) == 'put');
} }
/** /**
@ -188,7 +188,7 @@ class RequestHandlerComponent extends Object
*/ */
function isGet() function isGet()
{ {
return (low(env('REQUEST_METHOD')) == 'get'); return (strtolower(env('REQUEST_METHOD')) == 'get');
} }
/** /**
@ -198,7 +198,7 @@ class RequestHandlerComponent extends Object
*/ */
function isDelete() function isDelete()
{ {
return (low(env('REQUEST_METHOD')) == 'delete'); return (strtolower(env('REQUEST_METHOD')) == 'delete');
} }
/** /**

View file

@ -47,7 +47,7 @@ class SessionComponent extends Object
*/ */
function __construct ($base = null) function __construct ($base = null)
{ {
$this->CakeSession = New CakeSession($base); $this->CakeSession = new CakeSession($base);
parent::__construct(); parent::__construct();
} }

View file

@ -200,6 +200,12 @@ class Controller extends Object
*/ */
var $cacheAction = false; var $cacheAction = false;
/**
* Enter description here...
*
* @var boolean
*/
var $persistModel = false;
/** /**
* Constructor. * Constructor.
* *
@ -264,10 +270,30 @@ class Controller extends Object
$id = $this->params['pass']; $id = $this->params['pass'];
} }
$cached = false;
$object = null;
if (class_exists($this->modelClass) && ($this->uses === false)) if (class_exists($this->modelClass) && ($this->uses === false))
{ {
$this->{$this->modelClass} =& new $this->modelClass($id); if($this->persistModel === true)
$this->modelNames[] = $this->modelClass; {
$cached = $this->_persist($this->modelClass, null, $object);
}
if(($cached === false))
{
$model =& new $this->modelClass($id);
$this->modelNames[] = $this->modelClass;
$this->{$this->modelClass} = $model;
if($this->persistModel === true)
{
$this->_persist($this->modelClass, true, $model);
}
}
else
{
$this->_persist($this->modelClass, true, $object);
$this->modelNames[] = $this->modelClass;
return true;
}
} }
elseif($this->uses === false) elseif($this->uses === false)
{ {

View file

@ -269,7 +269,7 @@ class DataSource extends Object
$cache = null; $cache = null;
} }
$new = cache('models'.DS.low(get_class($this)).'_'.$object, $cache, $expires); $new = cache('models'.DS.strtolower(get_class($this)).'_'.$object, $cache, $expires);
if($new != null) if($new != null)
{ {
$new = unserialize($new); $new = unserialize($new);

View file

@ -203,7 +203,10 @@ class DboSource extends DataSource
{ {
if ($cache && isset($this->_queryCache[$sql])) if ($cache && isset($this->_queryCache[$sql]))
{ {
return $this->_queryCache[$sql]; if (strpos(trim(strtolower($sql)), 'select') !== false)
{
return $this->_queryCache[$sql];
}
} }
if($this->execute($sql)) if($this->execute($sql))
@ -216,7 +219,10 @@ class DboSource extends DataSource
if ($cache) if ($cache)
{ {
$this->_queryCache[$sql] = $out; if (strpos(trim(strtolower($sql)), 'select') !== false)
{
$this->_queryCache[$sql] = $out;
}
} }
return $out; return $out;
@ -1084,16 +1090,16 @@ class DboSource extends DataSource
{ {
$end = '\\\\'.$this->endQuote.'\\\\'; $end = '\\\\'.$this->endQuote.'\\\\';
} }
preg_match_all('/(\'[^\'\\\]*(?:\\\.[^\'\\\]*)*\')|(?P<field>[a-z0-9_'.$start.$end.']*\\.[a-z0-9_'.$start.$end.']*)/i', $conditions, $match, PREG_PATTERN_ORDER); preg_match_all('/(?:\'[^\'\\\]*(?:\\\.[^\'\\\]*)*\')|([a-z0-9_'.$start.$end.']*\\.[a-z0-9_'.$start.$end.']*)/i', $conditions, $match, PREG_PATTERN_ORDER);
if(isset($match['field'][0])) if(isset($match['1']['0']))
{ {
$pregCount = count($match['field']); $pregCount = count($match['1']);
for ($i = 0; $i < $pregCount; $i++) for ($i = 0; $i < $pregCount; $i++)
{ {
if(!empty($match['field'][$i])) if(!empty($match['1'][$i]))
{ {
$conditions = preg_replace('/'.$match['field'][$i].'/', $this->name($match['field'][$i]), $conditions); $conditions = preg_replace('/'.$match['0'][$i].'/', $this->name($match['1'][$i]), $conditions);
} }
} }
} }
@ -1116,7 +1122,7 @@ class DboSource extends DataSource
foreach ($conditions as $key => $value) foreach ($conditions as $key => $value)
{ {
if (in_array(low(trim($key)), $bool)) if (in_array(strtolower(trim($key)), $bool))
{ {
$out[] = '('.join(') '.$key.' (', $this->conditionKeysToString($value)).')'; $out[] = '('.join(') '.$key.' (', $this->conditionKeysToString($value)).')';
} }
@ -1143,30 +1149,31 @@ class DboSource extends DataSource
{ {
$data = $this->name($key)." = ''"; $data = $this->name($key)." = ''";
} }
elseif (preg_match('/^(?P<operator>[a-z]*\\([a-z0-9]*\\)\\x20?|like\\x20?|or\\x20?|between\\x20?|regexp\\x20?|[<>=!]{1,3}\\x20?)?(?P<value>.*)/i', $value, $match)) elseif (preg_match('/^([a-z]*\\([a-z0-9]*\\)\\x20?|like\\x20?|or\\x20?|between\\x20?|regexp\\x20?|[<>=!]{1,3}\\x20?)?(.*)/i', $value, $match))
{ {
if (preg_match('/(?P<conditional>\\x20[\\w]*\\x20)/', $key, $regs)) if (preg_match('/(\\x20[\\w]*\\x20)/', $key, $regs))
{ {
$clause = $regs['conditional']; $clause = $regs['1'];
$key = preg_replace('/'.$regs['conditional'].'/', '', $key); $key = preg_replace('/'.$regs['1'].'/', '', $key);
} }
if(empty($match['operator'])) if(empty($match['1']))
{ {
$match['operator'] = ' = '; $match['1'] = ' = ';
} }
if (strpos($match['value'], '-!') === 0) if (strpos($match['2'], '-!') === 0)
{ {
$match['value'] = str_replace('-!', '', $match['value']); $match['2'] = str_replace('-!', '', $match['2']);
$data = $this->name($key) . ' '.$match['operator'].' '. $match['value']; $data = $this->name($key) . ' '.$match['1'].' '. $match['2'];
} }
else else
{ {
if($match['value'] != '' && !is_numeric($match['value'])) if($match['2'] != '' && !is_numeric($match['2']))
{ {
$match['value'] = $this->value($match['value']); $match['2'] = $this->value($match['value']);
$match['2'] = str_replace(' AND ', "' AND '", $match['2']);
} }
$data = $this->name($key) . ' '.$match['operator'].' '. $match['value']; $data = $this->name($key) . ' '.$match['1'].' '. $match['2'];
} }
} }
$out[] = $operator.$data; $out[] = $operator.$data;
@ -1220,11 +1227,11 @@ class DboSource extends DataSource
if (strpos('.', $keys)) if (strpos('.', $keys))
{ {
preg_match_all('/([a-zA-Z0-9_]{1,})\\.([a-zA-Z0-9_]{1,})/', $keys, $result, PREG_PATTERN_ORDER); preg_match_all('/([a-zA-Z0-9_]{1,})\\.([a-zA-Z0-9_]{1,})/', $keys, $result, PREG_PATTERN_ORDER);
$pregCount = count($result[0]); $pregCount = count($result['0']);
for ($i = 0; $i < $pregCount; $i++) for ($i = 0; $i < $pregCount; $i++)
{ {
$keys = preg_replace('/'.$result[0][$i].'/', $this->name($result[0][$i]), $keys); $keys = preg_replace('/'.$result['0'][$i].'/', $this->name($result['0'][$i]), $keys);
} }
if (preg_match('/\\x20ASC|\\x20DESC/i', $keys)) if (preg_match('/\\x20ASC|\\x20DESC/i', $keys))
{ {
@ -1235,10 +1242,10 @@ class DboSource extends DataSource
return ' ORDER BY '.$keys.' '.$direction;; return ' ORDER BY '.$keys.' '.$direction;;
} }
} }
elseif (preg_match('/(?P<direction>\\x20ASC|\\x20DESC)/i', $keys, $match)) elseif (preg_match('/(\\x20ASC|\\x20DESC)/i', $keys, $match))
{ {
$direction = $match['direction']; $direction = $match['1'];
$keys = preg_replace('/'.$match['direction'].'/', '', $keys); $keys = preg_replace('/'.$match['1'].'/', '', $keys);
return ' ORDER BY '.$keys.$direction; return ' ORDER BY '.$keys.$direction;
} }
else else

View file

@ -161,14 +161,14 @@ class DboMysql extends DboSource
{ {
return $this->fetchAll($args[0]); return $this->fetchAll($args[0]);
} }
elseif (count($args) > 1 && strpos(low($args[0]), 'findby') === 0) elseif (count($args) > 1 && strpos(strtolower($args[0]), 'findby') === 0)
{ {
$field = Inflector::underscore(preg_replace('/findBy/i', '', $args[0])); $field = Inflector::underscore(preg_replace('/findBy/i', '', $args[0]));
$query = array($args[2]->name.'.'.$field => $args[1][0]); $query = array($args[2]->name.'.'.$field => $args[1][0]);
return $args[2]->find($query); return $args[2]->find($query);
} }
elseif (count($args) > 1 && strpos(low($args[0]), 'findallby') === 0) elseif (count($args) > 1 && strpos(strtolower($args[0]), 'findallby') === 0)
{ {
$field = Inflector::underscore(preg_replace('/findAllBy/i', '', $args[0])); $field = Inflector::underscore(preg_replace('/findAllBy/i', '', $args[0]));
$query = array($args[2]->name.'.'.$field => $args[1][0]); $query = array($args[2]->name.'.'.$field => $args[1][0]);
@ -481,7 +481,7 @@ class DboMysql extends DboSource
if ($limit) if ($limit)
{ {
$rt = ''; $rt = '';
if (!strpos(low($limit), 'limit') || strpos(low($limit), 'limit') === 0) if (!strpos(strtolower($limit), 'limit') || strpos(strtolower($limit), 'limit') === 0)
{ {
$rt = ' LIMIT'; $rt = ' LIMIT';
} }

View file

@ -375,7 +375,7 @@ class DboPostgres extends DboSource
if ($limit) if ($limit)
{ {
$rt = ''; $rt = '';
if (!strpos(low($limit), 'limit') || strpos(low($limit), 'limit') === 0) if (!strpos(strtolower($limit), 'limit') || strpos(strtolower($limit), 'limit') === 0)
{ {
$rt = ' LIMIT'; $rt = ' LIMIT';
} }

View file

@ -557,7 +557,7 @@ class Model extends Object
$db =& ConnectionManager::getDataSource($this->useDbConfig); $db =& ConnectionManager::getDataSource($this->useDbConfig);
if($db->isInterfaceSupported('listSources')) if($db->isInterfaceSupported('listSources'))
{ {
if (!in_array(low($tableName), $db->listSources()) && !in_array($tableName, $db->listSources())) if (!in_array(strtolower($tableName), $db->listSources()) && !in_array($tableName, $db->listSources()))
{ {
return $this->cakeError('missingTable',array(array('className' => $this->name, return $this->cakeError('missingTable',array(array('className' => $this->name,
'table' => $tableName))); 'table' => $tableName)));
@ -764,11 +764,10 @@ class Model extends Object
*/ */
function field ($name, $conditions = null, $order = null) function field ($name, $conditions = null, $order = null)
{ {
if (isset($this->data[$this->name][$name])) if($conditions === null)
{ {
return $this->data[$this->name][$name]; $conditions = array($this->name.'.'.$this->primaryKey => $this->id);
} }
if ($data = $this->find($conditions, $name, $order, 0)) if ($data = $this->find($conditions, $name, $order, 0))
{ {
if (isset($data[$this->name][$name])) if (isset($data[$this->name][$name]))
@ -1518,7 +1517,11 @@ class Model extends Object
} }
$keys = $db->getFieldValue($result, $keyPath); $keys = $db->getFieldValue($result, $keyPath);
$vals = $db->getFieldValue($result, $valuePath); $vals = $db->getFieldValue($result, $valuePath);
return array_combine($keys, $vals); if(!empty($keys) && !empty($vals))
{
$return = array_combine($keys, $vals);
return $return;
}
} }
/** /**
@ -1713,15 +1716,15 @@ class Model extends Object
{ {
if(defined('CACHE_CHECK') && CACHE_CHECK === true) if(defined('CACHE_CHECK') && CACHE_CHECK === true)
{ {
$assoc[] = low(Inflector::pluralize($this->name)); $assoc[] = strtolower(Inflector::pluralize($this->name));
foreach ($this->__associations as $key => $asscociation) foreach ($this->__associations as $key => $asscociation)
{ {
foreach ($this->$asscociation as $key => $className) foreach ($this->$asscociation as $key => $className)
{ {
$check = low(Inflector::pluralize($className['className'])); $check = strtolower(Inflector::pluralize($className['className']));
if(!in_array($check, $assoc)) if(!in_array($check, $assoc))
{ {
$assoc[] = low(Inflector::pluralize($className['className'])); $assoc[] = strtolower(Inflector::pluralize($className['className']));
} }
} }
} }
@ -1734,6 +1737,17 @@ class Model extends Object
//Will use for query cache deleting //Will use for query cache deleting
} }
} }
/**
* Called when serializing a model
*
* @return array
*/
function __sleep()
{
$return = array_keys(get_object_vars($this));
return $return;
}
} }
// --- PHP4 Only // --- PHP4 Only

View file

@ -553,7 +553,7 @@ class Model extends Object
$db =& ConnectionManager::getDataSource($this->useDbConfig); $db =& ConnectionManager::getDataSource($this->useDbConfig);
if($db->isInterfaceSupported('listSources')) if($db->isInterfaceSupported('listSources'))
{ {
if (!in_array(low($tableName), $db->listSources()) && !in_array($tableName, $db->listSources())) if (!in_array(strtolower($tableName), $db->listSources()) && !in_array($tableName, $db->listSources()))
{ {
return $this->cakeError('missingTable',array(array('className' => $this->name, return $this->cakeError('missingTable',array(array('className' => $this->name,
'table' => $tableName))); 'table' => $tableName)));
@ -760,11 +760,10 @@ class Model extends Object
*/ */
function field ($name, $conditions = null, $order = null) function field ($name, $conditions = null, $order = null)
{ {
if (isset($this->data[$this->name][$name])) if($conditions === null)
{ {
return $this->data[$this->name][$name]; $conditions = array($this->name.'.'.$this->primaryKey => $this->id);
} }
if ($data = $this->find($conditions, $name, $order, 0)) if ($data = $this->find($conditions, $name, $order, 0))
{ {
if (isset($data[$this->name][$name])) if (isset($data[$this->name][$name]))
@ -1514,7 +1513,11 @@ class Model extends Object
} }
$keys = $db->getFieldValue($result, $keyPath); $keys = $db->getFieldValue($result, $keyPath);
$vals = $db->getFieldValue($result, $valuePath); $vals = $db->getFieldValue($result, $valuePath);
return array_combine($keys, $vals); if(!empty($keys) && !empty($vals))
{
$return = array_combine($keys, $vals);
return $return;
}
} }
/** /**
@ -1709,15 +1712,15 @@ class Model extends Object
{ {
if(defined('CACHE_CHECK') && CACHE_CHECK === true) if(defined('CACHE_CHECK') && CACHE_CHECK === true)
{ {
$assoc[] = low(Inflector::pluralize($this->name)); $assoc[] = strtolower(Inflector::pluralize($this->name));
foreach ($this->__associations as $key => $asscociation) foreach ($this->__associations as $key => $asscociation)
{ {
foreach ($this->$asscociation as $key => $className) foreach ($this->$asscociation as $key => $className)
{ {
$check = low(Inflector::pluralize($className['className'])); $check = strtolower(Inflector::pluralize($className['className']));
if(!in_array($check, $assoc)) if(!in_array($check, $assoc))
{ {
$assoc[] = low(Inflector::pluralize($className['className'])); $assoc[] = strtolower(Inflector::pluralize($className['className']));
} }
} }
} }
@ -1730,6 +1733,17 @@ class Model extends Object
//Will use for query cache deleting //Will use for query cache deleting
} }
} }
/**
* Called when serializing a model
*
* @return array
*/
function __sleep()
{
$return = array_keys(get_object_vars($this));
return $return;
}
} }
?> ?>

View file

@ -76,11 +76,14 @@ class NeatArray
} }
$out = false; $out = false;
foreach ($this->value as $k=>$v) $keys = array_keys($this->value);
$count = sizeof($keys);
for ($i = 0; $i < $count; $i++)
{ {
if (isset($v[$fieldName]) && ($v[$fieldName] == $value)) if (isset($this->value[$keys[$i]][$fieldName]) && ($this->value[$keys[$i]][$fieldName] == $value))
{ {
$out[$k] = $v; $out[$keys[$i]] = $this->value[$keys[$i]];
} }
} }

View file

@ -171,6 +171,79 @@ class Object
} }
return new ErrorHandler($method, $messages); return new ErrorHandler($method, $messages);
} }
/**
* Checks for a persistent class file, if found file is opened and true returned
* If file is not found a file is created and false returned
* If used in other locations of the model you should choose a unique name for the persistent file
* There are many uses for this method, see manual for examples
*
* @param string $name name of the class to persist
* @return boolean
* @param string $object the object to persist
* @access public
* @todo add examples to manual
*/
function _persist($name, $return = null, &$object)
{
$file = CACHE.'persistent'.DS.strtolower($name).'.php';
if($return === null)
{
if(!file_exists($file))
{
return false;
}
else
{
return true;
}
}
if(!file_exists($file))
{
$this->_savePersistent($name, &$object);
return false;
}
else
{
$this->__openPersistent($name);
return true;
}
}
/**
* When a Model::persist; is set to true, a file with the model name it auto created.
* If used in other locations of the model you should choose a unique name for the persistent file
* There are many uses for this method, see manual for examples
*
* @param string $name name used for object to cach
* @param string $object the object to persist
* @return true on save, throws error if file can not be created
* @access public
* @todo add examples to manual
*/
function _savePersistent($name, &$object)
{
$file = 'persistent'.DS.strtolower($name).'.php';
$objectArray = array(&$object);
$data = '<?php $'.$name.' = \''.str_replace('\'', '\\\'', serialize($objectArray)).'\' ?>';
cache($file, $data, '+1 day');
}
/**
* Open the persistent class file for reading
*
* @param string $name name of the class
* @access private
*/
function __openPersistent($name)
{
$file = CACHE.'persistent'.DS.strtolower($name).'.php';
include($file);
$vars = unserialize(${$name});
$this->{$name} = $vars['0'];
}
} }
?> ?>

View file

@ -105,9 +105,9 @@ class Sanitize
} }
else else
{ {
$patterns = array("/\&/", "/%/", "/</", "/>/", '/"/', "/'/", "/\(/", "/\)/", "/\+/", "/-/", "/\n/"); $patterns = array("/\&/", "/%/", "/</", "/>/", '/"/', "/'/", "/\(/", "/\)/", "/\+/", "/-/");
$replacements = array("&amp;", "&#37;", "&lt;", "&gt;", "&quot;", "&#39;", "&#40;", "&#41;", "&#43;", "&#45;", "<br />"); $replacements = array("&amp;", "&#37;", "&lt;", "&gt;", "&quot;", "&#39;", "&#40;", "&#41;", "&#43;", "&#45;");
$string = preg_replace($patterns, $replacements, $string); $string = preg_replace($patterns, $replacements, $string);
} }
return $string; return $string;
@ -257,7 +257,7 @@ class Sanitize
if (isset($colData['formatter']) || isset($colData['format'])) if (isset($colData['formatter']) || isset($colData['format']))
{ {
switch(low($colData['formatter'])) switch(strtolower($colData['formatter']))
{ {
case 'date': case 'date':
$data = date($colData['format'], strtotime($data)); $data = date($colData['format'], strtotime($data));

View file

@ -123,7 +123,10 @@ class CakeSession extends Object
$this->time = time(); $this->time = time();
$this->sessionTime = $this->time + (Security::inactiveMins() * CAKE_SESSION_TIMEOUT); $this->sessionTime = $this->time + (Security::inactiveMins() * CAKE_SESSION_TIMEOUT);
$this->security = CAKE_SECURITY; $this->security = CAKE_SECURITY;
session_write_close(); if (function_exists('session_write_close'))
{
session_write_close();
}
$this->__initSession(); $this->__initSession();
@ -537,6 +540,10 @@ class CakeSession extends Object
$file = $sessionpath.DS."sess_$oldSessionId"; $file = $sessionpath.DS."sess_$oldSessionId";
@unlink($file); @unlink($file);
@session_destroy($oldSessionId); @session_destroy($oldSessionId);
if (function_exists('session_write_close'))
{
session_write_close();
}
$this->__initSession(); $this->__initSession();
session_id($newSessid); session_id($newSessid);
session_start(); session_start();

View file

@ -41,10 +41,35 @@
*/ */
class CacheHelper extends Helper class CacheHelper extends Helper
{ {
/**
* Array of strings replaced in cached views.
* The strings are found between <cake:nocache><cake:nocache> in views
*
* @var array
*/
var $replace = array(); var $replace = array();
/**
* Array of string that are replace with there var replace above.
* The strings are any content inside <cake:nocache><cake:nocache> and includes the tags in views
*
* @var array
*/
var $match = array(); var $match = array();
/**
* holds the View object passed in final call to CacheHelper::cache()
*
* @var object
*/
var $view; var $view;
/**
* Enter description here...
*
* @param string $file
* @param string $out
* @param string $cache
* @return view ouput
*/
function cache($file, $out, $cache = false) function cache($file, $out, $cache = false)
{ {
if(is_array($this->cacheAction)) if(is_array($this->cacheAction))
@ -116,6 +141,12 @@ class CacheHelper extends Helper
} }
/**
* Enter description here...
*
* @param string $file
* @param boolean $cache
*/
function __parseFile($file, $cache) function __parseFile($file, $cache)
{ {
if(is_file($file)) if(is_file($file))
@ -127,24 +158,30 @@ class CacheHelper extends Helper
$file = file_get_contents($file); $file = file_get_contents($file);
} }
preg_match_all('/(?P<found><cake:nocache>(?<=<cake:nocache>)[\\s\\S]*?(?=<\/cake:nocache>)<\/cake:nocache>)/i', $cache, $oresult, PREG_PATTERN_ORDER); preg_match_all('/(<cake:nocache>(?<=<cake:nocache>)[\\s\\S]*?(?=<\/cake:nocache>)<\/cake:nocache>)/i', $cache, $oresult, PREG_PATTERN_ORDER);
preg_match_all('/(?<=<cake:nocache>)(?P<replace>[\\s\\S]*?)(?=<\/cake:nocache>)/i', $file, $result, PREG_PATTERN_ORDER); preg_match_all('/(?<=<cake:nocache>)([\\s\\S]*?)(?=<\/cake:nocache>)/i', $file, $result, PREG_PATTERN_ORDER);
if(!empty($result['replace'])) if(!empty($result['0']))
{ {
$count = 0; $count = 0;
foreach($result['replace'] as $result) foreach($result['0'] as $result)
{ {
if(isset($oresult['found'][$count])) if(isset($oresult['0'][$count]))
{ {
$this->replace[] = $result; $this->replace[] = $result;
$this->match[] = $oresult['found'][$count]; $this->match[] = $oresult['0'][$count];
} }
$count++; $count++;
} }
} }
} }
/**
* Enter description here...
*
* @param sting $cache
* @return string with all replacements made to <cake:nocache><cake:nocache>
*/
function __parseOutput($cache) function __parseOutput($cache)
{ {
$count = 0; $count = 0;
@ -160,6 +197,13 @@ class CacheHelper extends Helper
return $cache; return $cache;
} }
/**
* Enter description here...
*
* @param string $file
* @param sting $timestamp
* @return cached view
*/
function __writeFile($file, $timestamp) function __writeFile($file, $timestamp)
{ {
$now = time(); $now = time();

View file

@ -149,21 +149,33 @@ class HtmlHelper extends Helper
* @return mixed Either string or boolean value, depends on AUTO_OUTPUT * @return mixed Either string or boolean value, depends on AUTO_OUTPUT
* and $return. * and $return.
*/ */
function url($url = null, $return = false) function url($url = null, $return = false)
{ {
$base = $this->base;
if($this->plugin != null)
{
$match = str_replace('/', '', $this->plugin);
$base = preg_replace('/'.$match.'/', '', $this->base);
$base = str_replace('//','', $base);
$pos1 = strrpos($base, '/');
$char = strlen($base) -1;
if($pos1 == $char)
{
$base = substr($base, 0, $char);
}
}
if (empty($url)) if (empty($url))
{ {
return $this->here; return $this->here;
} }
elseif ($url{0} == '/') elseif ($url{0} == '/')
{ {
$output = $this->base . $url; $output = $base . $url;
} }
else else
{ {
$output = $this->base.'/'.strtolower($this->params['controller']).'/'.$url; $output = $base.'/'.strtolower($this->params['controller']).'/'.$url;
} }
return $this->output(preg_replace('/&([^a])/', '&amp;\1', $output), $return); return $this->output(preg_replace('/&([^a])/', '&amp;\1', $output), $return);
} }
@ -364,20 +376,24 @@ class HtmlHelper extends Helper
* Returns the breadcrumb trail as a sequence of &raquo;-separated links. * Returns the breadcrumb trail as a sequence of &raquo;-separated links.
* *
* @param string $separator Text to separate crumbs. * @param string $separator Text to separate crumbs.
* @param string $startText This will be the first crumb, if false it defaults to first crumb in array
* @param boolean $return Wheter this method should return a value * @param boolean $return Wheter this method should return a value
* or output it. This overrides AUTO_OUTPUT. * or output it. This overrides AUTO_OUTPUT.
* @return mixed Either string or boolean value, depends on AUTO_OUTPUT * @return mixed Either string or boolean value, depends on AUTO_OUTPUT
* and $return. If $this->_crumbs is empty, return null. * and $return. If $this->_crumbs is empty, return null.
*/ */
function getCrumbs($separator = '&raquo;', $return = false) function getCrumbs($separator = '&raquo;', $startText = false, $return = false)
{ {
if(count($this->_crumbs)) if(count($this->_crumbs))
{ {
$out = array();
$out = array("<a href=\"{$this->base}\">START</a>"); if($startText)
{
$out[] = $this->link($startText, '/');
}
foreach ($this->_crumbs as $crumb) foreach ($this->_crumbs as $crumb)
{ {
$out[] = "<a href=\"{$this->base}{$crumb[1]}\">{$crumb[0]}</a>"; $out[] = $this->link($crumb[0], $crumb[1]);
} }
return $this->output(join($separator, $out), $return); return $this->output(join($separator, $out), $return);
@ -1015,13 +1031,28 @@ class HtmlHelper extends Helper
function selectTag($fieldName, $optionElements, $selected=null, $selectAttr=null, $optionAttr=null, $showEmpty=true) function selectTag($fieldName, $optionElements, $selected=null, $selectAttr=null, $optionAttr=null, $showEmpty=true)
{ {
$this->setFormTag($fieldName); $this->setFormTag($fieldName);
if ($this->tagIsInvalid($this->model, $this->field))
// do not display the select tag if no option elements are avaible {
if (isset($selectAttr['class']) && trim($selectAttr['class']) != "")
{
$selectAttr['class'] .= ' form_error';
}
else
{
$selectAttr['class'] = 'form_error';
}
}
// do not display the select tag if no option elements are avaible
if (!is_array($optionElements) || count($optionElements) == 0) if (!is_array($optionElements) || count($optionElements) == 0)
{ {
return null; return null;
} }
if(!isset($selected))
{
$selected = $this->tagValue($fieldName);
}
if( isset($selectAttr) && array_key_exists( "multiple", $selectAttr) ) if( isset($selectAttr) && array_key_exists( "multiple", $selectAttr) )
{ {
$select[] = sprintf($this->tags['selectmultiplestart'], $this->model, $this->field, $this->parseHtmlOptions($selectAttr)); $select[] = sprintf($this->tags['selectmultiplestart'], $this->model, $this->field, $this->parseHtmlOptions($selectAttr));
@ -1405,7 +1436,7 @@ class HtmlHelper extends Helper
{ {
$mins[$minCount] = sprintf('%02d', $minCount); $mins[$minCount] = sprintf('%02d', $minCount);
} }
$option = $this->selectTag($tagName.'_hour', $hours, $hourValue, $selectAttr, $optionAttr, $showEmpty); $option = $this->selectTag($tagName.'_min', $mins, $minValue, $selectAttr, $optionAttr, $showEmpty);
return $option; return $option;
} }
@ -1423,7 +1454,7 @@ class HtmlHelper extends Helper
$value = isset($value)? $value : $this->tagValue($tagName."_meridian"); $value = isset($value)? $value : $this->tagValue($tagName."_meridian");
$merValue = empty($selected) ? date('a') : $selected ; $merValue = empty($selected) ? date('a') : $selected ;
$meridians = array('am'=>'am','pm'=>'pm'); $meridians = array('am'=>'am','pm'=>'pm');
$option = $this->selectTag($tagName.'_hour', $hours, $hourValue, $selectAttr, $optionAttr, $showEmpty); $option = $this->selectTag($tagName.'_meridian', $meridians, $merValue, $selectAttr, $optionAttr, $showEmpty);
return $option; return $option;
} }

View file

@ -523,6 +523,7 @@ class View extends Object
function _getViewFileName($action) function _getViewFileName($action)
{ {
$action = Inflector::underscore($action); $action = Inflector::underscore($action);
$paths = Configure::getInstance();
if(!is_null($this->webservices)) if(!is_null($this->webservices))
{ {
@ -546,15 +547,16 @@ class View extends Object
$action = '..'.DS.implode(DS, $action); $action = '..'.DS.implode(DS, $action);
} }
if(file_exists(VIEWS.$this->viewPath.DS.$this->subDir.$type.$action.$this->ext)) foreach ($paths->controllerPaths as $path)
{ {
$viewFileName = VIEWS.$this->viewPath.DS.$this->subDir.$type.$action.$this->ext; if(file_exists($path.$this->viewPath.DS.$this->subDir.$type.$action.$this->ext))
{
$viewFileName = $path.$this->viewPath.DS.$this->subDir.$type.$action.$this->ext;
return $viewFileName;
}
} }
elseif(file_exists(VIEWS.'errors'.DS.$this->subDir.$type.$action.$this->ext))
{ if($viewFileName = fileExistsInPath(LIBS.'view'.DS.'templates'.DS.'errors'.DS.$type.$action.'.thtml'))
$viewFileName = VIEWS.'errors'.DS.$this->subDir.$type.$action.$this->ext;
}
elseif($viewFileName = fileExistsInPath(LIBS.'view'.DS.'templates'.DS.'errors'.DS.$type.$action.'.thtml'))
{ {
} }
@ -659,7 +661,8 @@ class View extends Object
} }
$out = ob_get_clean(); $out = ob_get_clean();
if($this->controller->cacheAction != false && (defined('CACHE_CHECK') && CACHE_CHECK === true)) if(isset($this->loaded['cache']) && ((isset($this->controller) && $this->controller->cacheAction != false)) &&
(defined('CACHE_CHECK') && CACHE_CHECK === true))
{ {
if (is_a($this->loaded['cache'], 'CacheHelper')) if (is_a($this->loaded['cache'], 'CacheHelper'))
{ {
@ -744,6 +747,7 @@ class View extends Object
${$camelBackedHelper}->data = $this->data; ${$camelBackedHelper}->data = $this->data;
${$camelBackedHelper}->themeWeb = $this->themeWeb; ${$camelBackedHelper}->themeWeb = $this->themeWeb;
${$camelBackedHelper}->tags = $tags; ${$camelBackedHelper}->tags = $tags;
${$camelBackedHelper}->plugin = $this->plugin;
if(!empty($this->validationErrors)) if(!empty($this->validationErrors))
{ {

2
cake/scripts/bake Normal file
View file

@ -0,0 +1,2 @@
#!/bin/bash
php -q $0.php $@