Tue Dec 5 14:14:02 PHT 2006 Nimrod A. Abing * Resolve conflicts introduced in CakePHP-v-1.1.11.4064. Reverses lazy-loaded models patch. ATTENTION: This patch will automatically reverse the changes made by 000010-lazy-loaded-models.diff As of CakePHP-v-1.1.11.4064, models are lazy-loaded by default which makes 000010-lazy-loaded-models.diff redundant and unnecessary. If you were using lazy-loaded models prior to CakePHP-v.1.1.11.4064 you should move your lazy-loaded models from lazy_load into the usual models directory. This patch does not remove the lazy_load directory in app/models. lazy_load directory will be removed in the next maintenance patch. You should also update any calls made to lazyLoadModel() and use loadModel() instead. This method is deprecated and will be removed in the next maintenance patch. diff -rN -u old-cake/app/webroot/index.php new-cake/app/webroot/index.php --- old-cake/app/webroot/index.php 2006-12-05 14:16:48.000000000 +0800 +++ new-cake/app/webroot/index.php 2006-12-05 14:16:48.000000000 +0800 @@ -76,12 +76,7 @@ } } require CORE_PATH . 'cake' . DS . 'bootstrap.php'; - if (isset($_GET['url']) && $_GET['url'] === 'favicon.ico') { - } else { - $Dispatcher=new Dispatcher(); - $Dispatcher->dispatch($url); - } - if (DEBUG) { + if (Configure::read() > 0) { echo ""; } ?> \ No newline at end of file diff -rN -u old-cake/cake/basics.php new-cake/cake/basics.php --- old-cake/cake/basics.php 2006-12-05 14:16:48.000000000 +0800 +++ new-cake/cake/basics.php 2006-12-05 14:16:48.000000000 +0800 @@ -182,18 +182,14 @@ } /** * Loads a model by CamelCase name from the lazy_load models directory. + * + * This method is deprecated as of CakePHP-v-1.1.11.4064 merge. It will + * be removed in the next maintenance patch. + * + * @deprecated */ function lazyLoadModel($name) { - $name = Inflector::underscore($name); - $paths = Configure::getInstance(); - - foreach($paths->modelPaths as $path) { - if (file_exists($path . 'lazy_load' . DS . $name . '.php')) { - require($path . 'lazy_load' . DS . $name . '.php'); - return true; - } - } - return false; + return loadModel($name); } /** * Loads all controllers. diff -rN -u old-cake/cake/libs/controller/controller.php new-cake/cake/libs/controller/controller.php --- old-cake/cake/libs/controller/controller.php 2006-12-05 14:16:48.000000000 +0800 +++ new-cake/cake/libs/controller/controller.php 2006-12-05 14:16:48.000000000 +0800 @@ -279,11 +279,35 @@ } function _initComponents(){ - if (!empty($this->components)) { - $component = new Component(); - $component->init($this); + $component = new Component(); + $component->init($this); + } +/** + * Hide method names from dispatcher, preventing them from being accessed using + * a URL. + * + * @param array $names Method names to hide from dispatcher. If omitted, *all* + * class methods will be hidden. + */ + function hideMethods($names = null) { + if (null === $names) { + $this->hiddenMethods = get_class_methods(get_class($this)); + } + if (!empty($this->hiddenMethods)) { + $this->hiddenMethods = array_unique(array_merge($this->hiddenMethods, $names)); + } else { + $this->hiddenMethods = $names; + } + } +/** + * Exposes methods in the array $names. + * + * @param unknown_type $names Array of method names to expose. + */ + function exposeMethods($names) { + if (!empty($this->hiddenMethods)) { + $this->hiddenMethods = array_diff($this->hiddenMethods, $names); } - parent::__construct(); } /** * Loads and instantiates models required by this controller. @@ -305,6 +329,15 @@ $cached = false; $object = null; + if ($this->persistModel === true){ + uses('neat_array'); + } + if($this->uses === false) { + if(!class_exists($this->modelClass)){ + loadModel($this->modelClass); + } + } + if (class_exists($this->modelClass) && ($this->uses === false)) { if ($this->persistModel === true) { $cached = $this->_persist($this->modelClass, null, $object); @@ -339,6 +372,10 @@ $object = null; $modelKey = Inflector::underscore($modelClass); + if(!class_exists($modelClass)){ + loadModel($modelClass); + } + if (class_exists($modelClass)) { if ($this->persistModel === true) { $cached = $this->_persist($modelClass, null, $object); diff -rN -u old-cake/cake/libs/error.php new-cake/cake/libs/error.php --- old-cake/cake/libs/error.php 2006-12-05 14:16:48.000000000 +0800 +++ new-cake/cake/libs/error.php 2006-12-05 14:16:48.000000000 +0800 @@ -48,7 +48,15 @@ function __construct($method, $messages) { parent::__construct(); static $__previousError = null; - $this->__dispatch =& new Dispatcher(); + + $allow = array('.', '/', '_', ' ', '-'); + if(substr(PHP_OS,0,3) == "WIN") { + $allow = array_merge($allow, array('\\', ':') ); + } + $clean = new Sanitize(); + $messages = $clean->paranoid($messages, array('.', '/', '_')); + $dispatcherClass = getDispatcherClass(); + $this->__dispatch =& new $dispatcherClass(); if ($__previousError != array($method, $messages)) { $__previousError = array($method, $messages); diff -rN -u old-cake/cake/libs/model/model_php4.php new-cake/cake/libs/model/model_php4.php --- old-cake/cake/libs/model/model_php4.php 2006-12-05 14:16:48.000000000 +0800 +++ new-cake/cake/libs/model/model_php4.php 2006-12-05 14:16:48.000000000 +0800 @@ -442,9 +442,6 @@ $this->{$assoc} =& ClassRegistry::getObject($colKey); $this->{$className} =& $this->{$assoc}; } else { - if (!class_exists($className)) { - lazyLoadModel($className); - } $this->{$assoc} =& new $className(); $this->{$className} =& $this->{$assoc}; } diff -rN -u old-cake/cake/libs/model/model_php5.php new-cake/cake/libs/model/model_php5.php --- old-cake/cake/libs/model/model_php5.php 2006-12-05 14:16:48.000000000 +0800 +++ new-cake/cake/libs/model/model_php5.php 2006-12-05 14:16:48.000000000 +0800 @@ -435,9 +435,6 @@ $this->{$assoc} = ClassRegistry::getObject($colKey); $this->{$className} = $this->{$assoc}; } else { - if (!class_exists($className)) { - lazyLoadModel($className); - } $this->{$assoc} = new $className(); $this->{$className} = $this->{$assoc}; } diff -rN -u old-cake/cake/scripts/templates/skel/webroot/index.php new-cake/cake/scripts/templates/skel/webroot/index.php --- old-cake/cake/scripts/templates/skel/webroot/index.php 2006-12-05 14:16:48.000000000 +0800 +++ new-cake/cake/scripts/templates/skel/webroot/index.php 2006-12-05 14:16:48.000000000 +0800 @@ -76,12 +76,7 @@ } } require CORE_PATH . 'cake' . DS . 'bootstrap.php'; - if (isset($_GET['url']) && $_GET['url'] === 'favicon.ico') { - } else { - $Dispatcher=new Dispatcher(); - $Dispatcher->dispatch($url); - } - if (DEBUG) { + if (Configure::read() > 0) { echo ""; } ?> \ No newline at end of file