2005-07-04 01:07:14 +00:00
|
|
|
<?php
|
2005-08-21 06:49:02 +00:00
|
|
|
/* SVN FILE: $Id$ */
|
2005-06-19 23:30:36 +00:00
|
|
|
/**
|
2005-08-25 03:45:14 +00:00
|
|
|
* Base controller class.
|
2005-06-19 23:30:36 +00:00
|
|
|
*
|
2005-08-21 06:49:02 +00:00
|
|
|
* PHP versions 4 and 5
|
2005-06-19 23:30:36 +00:00
|
|
|
*
|
2007-02-02 10:39:45 +00:00
|
|
|
* CakePHP(tm) : Rapid Development Framework <http://www.cakephp.org/>
|
2008-01-01 22:18:17 +00:00
|
|
|
* Copyright 2005-2008, Cake Software Foundation, Inc.
|
2006-05-26 05:29:17 +00:00
|
|
|
* 1785 E. Sahara Avenue, Suite 490-204
|
|
|
|
* Las Vegas, Nevada 89104
|
2005-07-10 05:08:19 +00:00
|
|
|
*
|
2005-12-23 21:57:26 +00:00
|
|
|
* Licensed under The MIT License
|
|
|
|
* Redistributions of files must retain the above copyright notice.
|
2005-07-10 05:08:19 +00:00
|
|
|
*
|
2005-08-25 03:45:14 +00:00
|
|
|
* @filesource
|
2008-01-01 22:18:17 +00:00
|
|
|
* @copyright Copyright 2005-2008, Cake Software Foundation, Inc.
|
2007-02-02 10:39:45 +00:00
|
|
|
* @link http://www.cakefoundation.org/projects/info/cakephp CakePHP(tm) Project
|
2006-05-26 05:29:17 +00:00
|
|
|
* @package cake
|
|
|
|
* @subpackage cake.cake.libs.controller
|
2007-02-02 10:39:45 +00:00
|
|
|
* @since CakePHP(tm) v 0.2.9
|
2006-05-26 05:29:17 +00:00
|
|
|
* @version $Revision$
|
|
|
|
* @modifiedby $LastChangedBy$
|
|
|
|
* @lastmodified $Date$
|
|
|
|
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
|
2005-07-10 05:08:19 +00:00
|
|
|
*/
|
|
|
|
/**
|
2005-08-25 03:45:14 +00:00
|
|
|
* Include files
|
2005-07-10 05:08:19 +00:00
|
|
|
*/
|
2007-11-20 00:39:37 +00:00
|
|
|
App::import('Core', array('Component', 'View'));
|
2005-07-10 05:08:19 +00:00
|
|
|
/**
|
2005-08-21 06:49:02 +00:00
|
|
|
* Controller
|
2005-07-10 05:08:19 +00:00
|
|
|
*
|
2005-08-25 03:45:14 +00:00
|
|
|
* Application controller (controllers are where you put all the actual code)
|
2005-08-21 06:49:02 +00:00
|
|
|
* Provides basic functionality, such as rendering views (aka displaying templates).
|
2005-08-25 03:45:14 +00:00
|
|
|
* Automatically selects model name from on singularized object class name
|
2005-08-21 06:49:02 +00:00
|
|
|
* and creates the model object if proper class exists.
|
2005-07-10 05:08:19 +00:00
|
|
|
*
|
2006-05-26 05:29:17 +00:00
|
|
|
* @package cake
|
|
|
|
* @subpackage cake.cake.libs.controller
|
2005-07-10 05:08:19 +00:00
|
|
|
*
|
|
|
|
*/
|
2006-08-18 07:53:45 +00:00
|
|
|
class Controller extends Object {
|
[1285]
Author: phpnut
Date: 10:09:03 PM, Monday, October 31, 2005
Message:
Removed references in the Session class
[1283]
Author: phpnut
Date: 8:47:37 PM, Monday, October 31, 2005
Message:
Added fix to the Controller::constructClassess().
The database should have an instance available if a component will use it.
[1282]
Author: phpnut
Date: 8:36:07 PM, Monday, October 31, 2005
Message:
Updated the Model association methods to correct and error I introduced when reactoring last week.
Added a return from each of the settings in Security::inactiveMins(); This class is not fully implemented.
Updated scaffold and dipatcher with changes to the session class.
Fixed problem with session not working properly.
Added a regenrate id for sessions.
When CAKE_SECURITY is set to high this will regenrate a new session key on each request.
The old session file will be removed from the file system. This is a added security measure.
[1270]
Author: phpnut
Date: 1:55:28 PM, Sunday, October 30, 2005
Message:
Updated Session class to regenrate a new session key on each request when security level set to high.
Updated doc comments in some classes
[1269]
Author: phpnut
Date: 9:49:43 AM, Sunday, October 30, 2005
Message:
Added a fix for Ticket #105
git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1286 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-11-01 04:20:28 +00:00
|
|
|
/**
|
2007-03-04 12:14:33 +00:00
|
|
|
* Tshe name of this controller. Controller names are plural, named after the model they manipulate.
|
[1285]
Author: phpnut
Date: 10:09:03 PM, Monday, October 31, 2005
Message:
Removed references in the Session class
[1283]
Author: phpnut
Date: 8:47:37 PM, Monday, October 31, 2005
Message:
Added fix to the Controller::constructClassess().
The database should have an instance available if a component will use it.
[1282]
Author: phpnut
Date: 8:36:07 PM, Monday, October 31, 2005
Message:
Updated the Model association methods to correct and error I introduced when reactoring last week.
Added a return from each of the settings in Security::inactiveMins(); This class is not fully implemented.
Updated scaffold and dipatcher with changes to the session class.
Fixed problem with session not working properly.
Added a regenrate id for sessions.
When CAKE_SECURITY is set to high this will regenrate a new session key on each request.
The old session file will be removed from the file system. This is a added security measure.
[1270]
Author: phpnut
Date: 1:55:28 PM, Sunday, October 30, 2005
Message:
Updated Session class to regenrate a new session key on each request when security level set to high.
Updated doc comments in some classes
[1269]
Author: phpnut
Date: 9:49:43 AM, Sunday, October 30, 2005
Message:
Added a fix for Ticket #105
git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1286 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-11-01 04:20:28 +00:00
|
|
|
*
|
2006-11-28 11:18:05 +00:00
|
|
|
* @var string
|
[1285]
Author: phpnut
Date: 10:09:03 PM, Monday, October 31, 2005
Message:
Removed references in the Session class
[1283]
Author: phpnut
Date: 8:47:37 PM, Monday, October 31, 2005
Message:
Added fix to the Controller::constructClassess().
The database should have an instance available if a component will use it.
[1282]
Author: phpnut
Date: 8:36:07 PM, Monday, October 31, 2005
Message:
Updated the Model association methods to correct and error I introduced when reactoring last week.
Added a return from each of the settings in Security::inactiveMins(); This class is not fully implemented.
Updated scaffold and dipatcher with changes to the session class.
Fixed problem with session not working properly.
Added a regenrate id for sessions.
When CAKE_SECURITY is set to high this will regenrate a new session key on each request.
The old session file will be removed from the file system. This is a added security measure.
[1270]
Author: phpnut
Date: 1:55:28 PM, Sunday, October 30, 2005
Message:
Updated Session class to regenrate a new session key on each request when security level set to high.
Updated doc comments in some classes
[1269]
Author: phpnut
Date: 9:49:43 AM, Sunday, October 30, 2005
Message:
Added a fix for Ticket #105
git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1286 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-11-01 04:20:28 +00:00
|
|
|
* @access public
|
|
|
|
*/
|
2006-05-26 05:29:17 +00:00
|
|
|
var $name = null;
|
[1285]
Author: phpnut
Date: 10:09:03 PM, Monday, October 31, 2005
Message:
Removed references in the Session class
[1283]
Author: phpnut
Date: 8:47:37 PM, Monday, October 31, 2005
Message:
Added fix to the Controller::constructClassess().
The database should have an instance available if a component will use it.
[1282]
Author: phpnut
Date: 8:36:07 PM, Monday, October 31, 2005
Message:
Updated the Model association methods to correct and error I introduced when reactoring last week.
Added a return from each of the settings in Security::inactiveMins(); This class is not fully implemented.
Updated scaffold and dipatcher with changes to the session class.
Fixed problem with session not working properly.
Added a regenrate id for sessions.
When CAKE_SECURITY is set to high this will regenrate a new session key on each request.
The old session file will be removed from the file system. This is a added security measure.
[1270]
Author: phpnut
Date: 1:55:28 PM, Sunday, October 30, 2005
Message:
Updated Session class to regenrate a new session key on each request when security level set to high.
Updated doc comments in some classes
[1269]
Author: phpnut
Date: 9:49:43 AM, Sunday, October 30, 2005
Message:
Added a fix for Ticket #105
git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1286 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-11-01 04:20:28 +00:00
|
|
|
/**
|
2007-02-17 17:59:44 +00:00
|
|
|
* Stores the current URL, based from the webroot.
|
[1285]
Author: phpnut
Date: 10:09:03 PM, Monday, October 31, 2005
Message:
Removed references in the Session class
[1283]
Author: phpnut
Date: 8:47:37 PM, Monday, October 31, 2005
Message:
Added fix to the Controller::constructClassess().
The database should have an instance available if a component will use it.
[1282]
Author: phpnut
Date: 8:36:07 PM, Monday, October 31, 2005
Message:
Updated the Model association methods to correct and error I introduced when reactoring last week.
Added a return from each of the settings in Security::inactiveMins(); This class is not fully implemented.
Updated scaffold and dipatcher with changes to the session class.
Fixed problem with session not working properly.
Added a regenrate id for sessions.
When CAKE_SECURITY is set to high this will regenrate a new session key on each request.
The old session file will be removed from the file system. This is a added security measure.
[1270]
Author: phpnut
Date: 1:55:28 PM, Sunday, October 30, 2005
Message:
Updated Session class to regenrate a new session key on each request when security level set to high.
Updated doc comments in some classes
[1269]
Author: phpnut
Date: 9:49:43 AM, Sunday, October 30, 2005
Message:
Added a fix for Ticket #105
git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1286 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-11-01 04:20:28 +00:00
|
|
|
*
|
2006-11-28 11:18:05 +00:00
|
|
|
* @var string
|
|
|
|
* @access public
|
[1285]
Author: phpnut
Date: 10:09:03 PM, Monday, October 31, 2005
Message:
Removed references in the Session class
[1283]
Author: phpnut
Date: 8:47:37 PM, Monday, October 31, 2005
Message:
Added fix to the Controller::constructClassess().
The database should have an instance available if a component will use it.
[1282]
Author: phpnut
Date: 8:36:07 PM, Monday, October 31, 2005
Message:
Updated the Model association methods to correct and error I introduced when reactoring last week.
Added a return from each of the settings in Security::inactiveMins(); This class is not fully implemented.
Updated scaffold and dipatcher with changes to the session class.
Fixed problem with session not working properly.
Added a regenrate id for sessions.
When CAKE_SECURITY is set to high this will regenrate a new session key on each request.
The old session file will be removed from the file system. This is a added security measure.
[1270]
Author: phpnut
Date: 1:55:28 PM, Sunday, October 30, 2005
Message:
Updated Session class to regenrate a new session key on each request when security level set to high.
Updated doc comments in some classes
[1269]
Author: phpnut
Date: 9:49:43 AM, Sunday, October 30, 2005
Message:
Added a fix for Ticket #105
git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1286 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-11-01 04:20:28 +00:00
|
|
|
*/
|
2006-05-26 05:29:17 +00:00
|
|
|
var $here = null;
|
2006-06-14 18:02:37 +00:00
|
|
|
/**
|
2007-02-21 03:41:13 +00:00
|
|
|
* The webroot of the application. Helpful if your application is placed in a folder under the current domain name.
|
2006-06-14 18:02:37 +00:00
|
|
|
*
|
|
|
|
* @var string
|
2006-11-28 11:18:05 +00:00
|
|
|
* @access public
|
2006-06-14 18:02:37 +00:00
|
|
|
*/
|
|
|
|
var $webroot = null;
|
[1285]
Author: phpnut
Date: 10:09:03 PM, Monday, October 31, 2005
Message:
Removed references in the Session class
[1283]
Author: phpnut
Date: 8:47:37 PM, Monday, October 31, 2005
Message:
Added fix to the Controller::constructClassess().
The database should have an instance available if a component will use it.
[1282]
Author: phpnut
Date: 8:36:07 PM, Monday, October 31, 2005
Message:
Updated the Model association methods to correct and error I introduced when reactoring last week.
Added a return from each of the settings in Security::inactiveMins(); This class is not fully implemented.
Updated scaffold and dipatcher with changes to the session class.
Fixed problem with session not working properly.
Added a regenrate id for sessions.
When CAKE_SECURITY is set to high this will regenrate a new session key on each request.
The old session file will be removed from the file system. This is a added security measure.
[1270]
Author: phpnut
Date: 1:55:28 PM, Sunday, October 30, 2005
Message:
Updated Session class to regenrate a new session key on each request when security level set to high.
Updated doc comments in some classes
[1269]
Author: phpnut
Date: 9:49:43 AM, Sunday, October 30, 2005
Message:
Added a fix for Ticket #105
git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1286 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-11-01 04:20:28 +00:00
|
|
|
/**
|
2007-02-17 17:59:44 +00:00
|
|
|
* The name of the controller action that was requested.
|
[1285]
Author: phpnut
Date: 10:09:03 PM, Monday, October 31, 2005
Message:
Removed references in the Session class
[1283]
Author: phpnut
Date: 8:47:37 PM, Monday, October 31, 2005
Message:
Added fix to the Controller::constructClassess().
The database should have an instance available if a component will use it.
[1282]
Author: phpnut
Date: 8:36:07 PM, Monday, October 31, 2005
Message:
Updated the Model association methods to correct and error I introduced when reactoring last week.
Added a return from each of the settings in Security::inactiveMins(); This class is not fully implemented.
Updated scaffold and dipatcher with changes to the session class.
Fixed problem with session not working properly.
Added a regenrate id for sessions.
When CAKE_SECURITY is set to high this will regenrate a new session key on each request.
The old session file will be removed from the file system. This is a added security measure.
[1270]
Author: phpnut
Date: 1:55:28 PM, Sunday, October 30, 2005
Message:
Updated Session class to regenrate a new session key on each request when security level set to high.
Updated doc comments in some classes
[1269]
Author: phpnut
Date: 9:49:43 AM, Sunday, October 30, 2005
Message:
Added a fix for Ticket #105
git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1286 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-11-01 04:20:28 +00:00
|
|
|
*
|
|
|
|
* @var string
|
|
|
|
* @access public
|
|
|
|
*/
|
2006-05-26 05:29:17 +00:00
|
|
|
var $action = null;
|
[1285]
Author: phpnut
Date: 10:09:03 PM, Monday, October 31, 2005
Message:
Removed references in the Session class
[1283]
Author: phpnut
Date: 8:47:37 PM, Monday, October 31, 2005
Message:
Added fix to the Controller::constructClassess().
The database should have an instance available if a component will use it.
[1282]
Author: phpnut
Date: 8:36:07 PM, Monday, October 31, 2005
Message:
Updated the Model association methods to correct and error I introduced when reactoring last week.
Added a return from each of the settings in Security::inactiveMins(); This class is not fully implemented.
Updated scaffold and dipatcher with changes to the session class.
Fixed problem with session not working properly.
Added a regenrate id for sessions.
When CAKE_SECURITY is set to high this will regenrate a new session key on each request.
The old session file will be removed from the file system. This is a added security measure.
[1270]
Author: phpnut
Date: 1:55:28 PM, Sunday, October 30, 2005
Message:
Updated Session class to regenrate a new session key on each request when security level set to high.
Updated doc comments in some classes
[1269]
Author: phpnut
Date: 9:49:43 AM, Sunday, October 30, 2005
Message:
Added a fix for Ticket #105
git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1286 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-11-01 04:20:28 +00:00
|
|
|
/**
|
2007-02-17 17:59:44 +00:00
|
|
|
* An array containing the class names of models this controller uses.
|
2007-03-04 12:14:33 +00:00
|
|
|
*
|
2007-02-17 17:59:44 +00:00
|
|
|
* Example: var $uses = array('Product', 'Post', 'Comment');
|
[1285]
Author: phpnut
Date: 10:09:03 PM, Monday, October 31, 2005
Message:
Removed references in the Session class
[1283]
Author: phpnut
Date: 8:47:37 PM, Monday, October 31, 2005
Message:
Added fix to the Controller::constructClassess().
The database should have an instance available if a component will use it.
[1282]
Author: phpnut
Date: 8:36:07 PM, Monday, October 31, 2005
Message:
Updated the Model association methods to correct and error I introduced when reactoring last week.
Added a return from each of the settings in Security::inactiveMins(); This class is not fully implemented.
Updated scaffold and dipatcher with changes to the session class.
Fixed problem with session not working properly.
Added a regenrate id for sessions.
When CAKE_SECURITY is set to high this will regenrate a new session key on each request.
The old session file will be removed from the file system. This is a added security measure.
[1270]
Author: phpnut
Date: 1:55:28 PM, Sunday, October 30, 2005
Message:
Updated Session class to regenrate a new session key on each request when security level set to high.
Updated doc comments in some classes
[1269]
Author: phpnut
Date: 9:49:43 AM, Sunday, October 30, 2005
Message:
Added a fix for Ticket #105
git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1286 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-11-01 04:20:28 +00:00
|
|
|
*
|
|
|
|
* @var mixed A single name as a string or a list of names as an array.
|
|
|
|
* @access protected
|
|
|
|
*/
|
2006-11-27 02:31:18 +00:00
|
|
|
var $uses = false;
|
[1285]
Author: phpnut
Date: 10:09:03 PM, Monday, October 31, 2005
Message:
Removed references in the Session class
[1283]
Author: phpnut
Date: 8:47:37 PM, Monday, October 31, 2005
Message:
Added fix to the Controller::constructClassess().
The database should have an instance available if a component will use it.
[1282]
Author: phpnut
Date: 8:36:07 PM, Monday, October 31, 2005
Message:
Updated the Model association methods to correct and error I introduced when reactoring last week.
Added a return from each of the settings in Security::inactiveMins(); This class is not fully implemented.
Updated scaffold and dipatcher with changes to the session class.
Fixed problem with session not working properly.
Added a regenrate id for sessions.
When CAKE_SECURITY is set to high this will regenrate a new session key on each request.
The old session file will be removed from the file system. This is a added security measure.
[1270]
Author: phpnut
Date: 1:55:28 PM, Sunday, October 30, 2005
Message:
Updated Session class to regenrate a new session key on each request when security level set to high.
Updated doc comments in some classes
[1269]
Author: phpnut
Date: 9:49:43 AM, Sunday, October 30, 2005
Message:
Added a fix for Ticket #105
git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1286 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-11-01 04:20:28 +00:00
|
|
|
/**
|
2007-02-17 17:59:44 +00:00
|
|
|
* An array containing the names of helpers this controller uses. The array elements should
|
|
|
|
* not contain the -Helper part of the classname.
|
2007-03-04 12:14:33 +00:00
|
|
|
*
|
2007-02-17 17:59:44 +00:00
|
|
|
* Example: var $helpers = array('Html', 'Javascript', 'Time', 'Ajax');
|
[1285]
Author: phpnut
Date: 10:09:03 PM, Monday, October 31, 2005
Message:
Removed references in the Session class
[1283]
Author: phpnut
Date: 8:47:37 PM, Monday, October 31, 2005
Message:
Added fix to the Controller::constructClassess().
The database should have an instance available if a component will use it.
[1282]
Author: phpnut
Date: 8:36:07 PM, Monday, October 31, 2005
Message:
Updated the Model association methods to correct and error I introduced when reactoring last week.
Added a return from each of the settings in Security::inactiveMins(); This class is not fully implemented.
Updated scaffold and dipatcher with changes to the session class.
Fixed problem with session not working properly.
Added a regenrate id for sessions.
When CAKE_SECURITY is set to high this will regenrate a new session key on each request.
The old session file will be removed from the file system. This is a added security measure.
[1270]
Author: phpnut
Date: 1:55:28 PM, Sunday, October 30, 2005
Message:
Updated Session class to regenrate a new session key on each request when security level set to high.
Updated doc comments in some classes
[1269]
Author: phpnut
Date: 9:49:43 AM, Sunday, October 30, 2005
Message:
Added a fix for Ticket #105
git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1286 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-11-01 04:20:28 +00:00
|
|
|
*
|
|
|
|
* @var mixed A single name as a string or a list of names as an array.
|
|
|
|
* @access protected
|
|
|
|
*/
|
2007-12-25 09:55:59 +00:00
|
|
|
var $helpers = array('Html', 'Form');
|
2006-06-14 18:02:37 +00:00
|
|
|
/**
|
2007-03-04 12:14:33 +00:00
|
|
|
* Parameters received in the current request: GET and POST data, information
|
2007-02-21 03:41:13 +00:00
|
|
|
* about the request, etc.
|
2006-06-14 18:02:37 +00:00
|
|
|
*
|
|
|
|
* @var array
|
|
|
|
* @access public
|
|
|
|
*/
|
|
|
|
var $params = array();
|
|
|
|
/**
|
2007-02-21 03:41:13 +00:00
|
|
|
* Data POSTed to the controller using the HtmlHelper. Data here is accessible
|
|
|
|
* using the $this->data['ModelName']['fieldName'] pattern.
|
2006-06-14 18:02:37 +00:00
|
|
|
*
|
|
|
|
* @var array
|
|
|
|
* @access public
|
|
|
|
*/
|
|
|
|
var $data = array();
|
2006-10-16 20:02:34 +00:00
|
|
|
/**
|
2007-02-21 03:41:13 +00:00
|
|
|
* Holds pagination defaults for controller actions. The keys that can be included
|
|
|
|
* in this array are: 'conditions', 'fields', 'order', 'limit', 'page', and 'recursive',
|
|
|
|
* similar to the parameters of Model->findAll().
|
|
|
|
*
|
|
|
|
* Pagination defaults can also be supplied in a model-by-model basis by using
|
|
|
|
* the name of the model as a key for a pagination array:
|
2007-03-04 12:14:33 +00:00
|
|
|
*
|
2007-02-21 03:41:13 +00:00
|
|
|
* var $paginate = array(
|
|
|
|
* 'Post' => array(...),
|
|
|
|
* 'Comment' => array(...)
|
|
|
|
* );
|
2007-03-04 12:14:33 +00:00
|
|
|
*
|
2007-02-21 03:41:13 +00:00
|
|
|
* See the manual chapter on Pagination for more information.
|
2006-10-16 20:02:34 +00:00
|
|
|
*
|
|
|
|
* @var array
|
|
|
|
* @access public
|
|
|
|
*/
|
2006-11-08 03:28:24 +00:00
|
|
|
var $paginate = array('limit' => 20, 'page' => 1);
|
[1285]
Author: phpnut
Date: 10:09:03 PM, Monday, October 31, 2005
Message:
Removed references in the Session class
[1283]
Author: phpnut
Date: 8:47:37 PM, Monday, October 31, 2005
Message:
Added fix to the Controller::constructClassess().
The database should have an instance available if a component will use it.
[1282]
Author: phpnut
Date: 8:36:07 PM, Monday, October 31, 2005
Message:
Updated the Model association methods to correct and error I introduced when reactoring last week.
Added a return from each of the settings in Security::inactiveMins(); This class is not fully implemented.
Updated scaffold and dipatcher with changes to the session class.
Fixed problem with session not working properly.
Added a regenrate id for sessions.
When CAKE_SECURITY is set to high this will regenrate a new session key on each request.
The old session file will be removed from the file system. This is a added security measure.
[1270]
Author: phpnut
Date: 1:55:28 PM, Sunday, October 30, 2005
Message:
Updated Session class to regenrate a new session key on each request when security level set to high.
Updated doc comments in some classes
[1269]
Author: phpnut
Date: 9:49:43 AM, Sunday, October 30, 2005
Message:
Added a fix for Ticket #105
git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1286 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-11-01 04:20:28 +00:00
|
|
|
/**
|
2007-02-21 03:41:13 +00:00
|
|
|
* The name of the views subfolder containing views for this controller.
|
[1285]
Author: phpnut
Date: 10:09:03 PM, Monday, October 31, 2005
Message:
Removed references in the Session class
[1283]
Author: phpnut
Date: 8:47:37 PM, Monday, October 31, 2005
Message:
Added fix to the Controller::constructClassess().
The database should have an instance available if a component will use it.
[1282]
Author: phpnut
Date: 8:36:07 PM, Monday, October 31, 2005
Message:
Updated the Model association methods to correct and error I introduced when reactoring last week.
Added a return from each of the settings in Security::inactiveMins(); This class is not fully implemented.
Updated scaffold and dipatcher with changes to the session class.
Fixed problem with session not working properly.
Added a regenrate id for sessions.
When CAKE_SECURITY is set to high this will regenrate a new session key on each request.
The old session file will be removed from the file system. This is a added security measure.
[1270]
Author: phpnut
Date: 1:55:28 PM, Sunday, October 30, 2005
Message:
Updated Session class to regenrate a new session key on each request when security level set to high.
Updated doc comments in some classes
[1269]
Author: phpnut
Date: 9:49:43 AM, Sunday, October 30, 2005
Message:
Added a fix for Ticket #105
git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1286 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-11-01 04:20:28 +00:00
|
|
|
*
|
2006-08-18 07:53:45 +00:00
|
|
|
* @var string
|
2007-10-21 22:49:53 +00:00
|
|
|
* @access public
|
[1285]
Author: phpnut
Date: 10:09:03 PM, Monday, October 31, 2005
Message:
Removed references in the Session class
[1283]
Author: phpnut
Date: 8:47:37 PM, Monday, October 31, 2005
Message:
Added fix to the Controller::constructClassess().
The database should have an instance available if a component will use it.
[1282]
Author: phpnut
Date: 8:36:07 PM, Monday, October 31, 2005
Message:
Updated the Model association methods to correct and error I introduced when reactoring last week.
Added a return from each of the settings in Security::inactiveMins(); This class is not fully implemented.
Updated scaffold and dipatcher with changes to the session class.
Fixed problem with session not working properly.
Added a regenrate id for sessions.
When CAKE_SECURITY is set to high this will regenrate a new session key on each request.
The old session file will be removed from the file system. This is a added security measure.
[1270]
Author: phpnut
Date: 1:55:28 PM, Sunday, October 30, 2005
Message:
Updated Session class to regenrate a new session key on each request when security level set to high.
Updated doc comments in some classes
[1269]
Author: phpnut
Date: 9:49:43 AM, Sunday, October 30, 2005
Message:
Added a fix for Ticket #105
git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1286 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-11-01 04:20:28 +00:00
|
|
|
*/
|
2006-05-26 05:29:17 +00:00
|
|
|
var $viewPath = null;
|
2006-08-18 07:53:45 +00:00
|
|
|
/**
|
2007-02-17 17:59:44 +00:00
|
|
|
* Sub-path for layout files.
|
2006-08-18 07:53:45 +00:00
|
|
|
*
|
|
|
|
* @var string
|
2007-10-21 22:49:53 +00:00
|
|
|
* @access public
|
2006-08-18 07:53:45 +00:00
|
|
|
*/
|
2006-11-01 07:15:44 +00:00
|
|
|
var $layoutPath = null;
|
[1285]
Author: phpnut
Date: 10:09:03 PM, Monday, October 31, 2005
Message:
Removed references in the Session class
[1283]
Author: phpnut
Date: 8:47:37 PM, Monday, October 31, 2005
Message:
Added fix to the Controller::constructClassess().
The database should have an instance available if a component will use it.
[1282]
Author: phpnut
Date: 8:36:07 PM, Monday, October 31, 2005
Message:
Updated the Model association methods to correct and error I introduced when reactoring last week.
Added a return from each of the settings in Security::inactiveMins(); This class is not fully implemented.
Updated scaffold and dipatcher with changes to the session class.
Fixed problem with session not working properly.
Added a regenrate id for sessions.
When CAKE_SECURITY is set to high this will regenrate a new session key on each request.
The old session file will be removed from the file system. This is a added security measure.
[1270]
Author: phpnut
Date: 1:55:28 PM, Sunday, October 30, 2005
Message:
Updated Session class to regenrate a new session key on each request when security level set to high.
Updated doc comments in some classes
[1269]
Author: phpnut
Date: 9:49:43 AM, Sunday, October 30, 2005
Message:
Added a fix for Ticket #105
git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1286 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-11-01 04:20:28 +00:00
|
|
|
/**
|
2007-02-21 03:41:13 +00:00
|
|
|
* Contains variables to be handed to the view.
|
[1285]
Author: phpnut
Date: 10:09:03 PM, Monday, October 31, 2005
Message:
Removed references in the Session class
[1283]
Author: phpnut
Date: 8:47:37 PM, Monday, October 31, 2005
Message:
Added fix to the Controller::constructClassess().
The database should have an instance available if a component will use it.
[1282]
Author: phpnut
Date: 8:36:07 PM, Monday, October 31, 2005
Message:
Updated the Model association methods to correct and error I introduced when reactoring last week.
Added a return from each of the settings in Security::inactiveMins(); This class is not fully implemented.
Updated scaffold and dipatcher with changes to the session class.
Fixed problem with session not working properly.
Added a regenrate id for sessions.
When CAKE_SECURITY is set to high this will regenrate a new session key on each request.
The old session file will be removed from the file system. This is a added security measure.
[1270]
Author: phpnut
Date: 1:55:28 PM, Sunday, October 30, 2005
Message:
Updated Session class to regenrate a new session key on each request when security level set to high.
Updated doc comments in some classes
[1269]
Author: phpnut
Date: 9:49:43 AM, Sunday, October 30, 2005
Message:
Added a fix for Ticket #105
git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1286 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-11-01 04:20:28 +00:00
|
|
|
*
|
|
|
|
* @var array
|
2006-11-28 11:18:05 +00:00
|
|
|
* @access public
|
[1285]
Author: phpnut
Date: 10:09:03 PM, Monday, October 31, 2005
Message:
Removed references in the Session class
[1283]
Author: phpnut
Date: 8:47:37 PM, Monday, October 31, 2005
Message:
Added fix to the Controller::constructClassess().
The database should have an instance available if a component will use it.
[1282]
Author: phpnut
Date: 8:36:07 PM, Monday, October 31, 2005
Message:
Updated the Model association methods to correct and error I introduced when reactoring last week.
Added a return from each of the settings in Security::inactiveMins(); This class is not fully implemented.
Updated scaffold and dipatcher with changes to the session class.
Fixed problem with session not working properly.
Added a regenrate id for sessions.
When CAKE_SECURITY is set to high this will regenrate a new session key on each request.
The old session file will be removed from the file system. This is a added security measure.
[1270]
Author: phpnut
Date: 1:55:28 PM, Sunday, October 30, 2005
Message:
Updated Session class to regenrate a new session key on each request when security level set to high.
Updated doc comments in some classes
[1269]
Author: phpnut
Date: 9:49:43 AM, Sunday, October 30, 2005
Message:
Added a fix for Ticket #105
git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1286 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-11-01 04:20:28 +00:00
|
|
|
*/
|
2006-11-28 11:18:05 +00:00
|
|
|
var $viewVars = array();
|
[1285]
Author: phpnut
Date: 10:09:03 PM, Monday, October 31, 2005
Message:
Removed references in the Session class
[1283]
Author: phpnut
Date: 8:47:37 PM, Monday, October 31, 2005
Message:
Added fix to the Controller::constructClassess().
The database should have an instance available if a component will use it.
[1282]
Author: phpnut
Date: 8:36:07 PM, Monday, October 31, 2005
Message:
Updated the Model association methods to correct and error I introduced when reactoring last week.
Added a return from each of the settings in Security::inactiveMins(); This class is not fully implemented.
Updated scaffold and dipatcher with changes to the session class.
Fixed problem with session not working properly.
Added a regenrate id for sessions.
When CAKE_SECURITY is set to high this will regenrate a new session key on each request.
The old session file will be removed from the file system. This is a added security measure.
[1270]
Author: phpnut
Date: 1:55:28 PM, Sunday, October 30, 2005
Message:
Updated Session class to regenrate a new session key on each request when security level set to high.
Updated doc comments in some classes
[1269]
Author: phpnut
Date: 9:49:43 AM, Sunday, October 30, 2005
Message:
Added a fix for Ticket #105
git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1286 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-11-01 04:20:28 +00:00
|
|
|
/**
|
2007-03-04 12:14:33 +00:00
|
|
|
* Text to be used for the $title_for_layout layout variable (usually
|
2007-02-21 03:41:13 +00:00
|
|
|
* placed inside <title> tags.)
|
[1285]
Author: phpnut
Date: 10:09:03 PM, Monday, October 31, 2005
Message:
Removed references in the Session class
[1283]
Author: phpnut
Date: 8:47:37 PM, Monday, October 31, 2005
Message:
Added fix to the Controller::constructClassess().
The database should have an instance available if a component will use it.
[1282]
Author: phpnut
Date: 8:36:07 PM, Monday, October 31, 2005
Message:
Updated the Model association methods to correct and error I introduced when reactoring last week.
Added a return from each of the settings in Security::inactiveMins(); This class is not fully implemented.
Updated scaffold and dipatcher with changes to the session class.
Fixed problem with session not working properly.
Added a regenrate id for sessions.
When CAKE_SECURITY is set to high this will regenrate a new session key on each request.
The old session file will be removed from the file system. This is a added security measure.
[1270]
Author: phpnut
Date: 1:55:28 PM, Sunday, October 30, 2005
Message:
Updated Session class to regenrate a new session key on each request when security level set to high.
Updated doc comments in some classes
[1269]
Author: phpnut
Date: 9:49:43 AM, Sunday, October 30, 2005
Message:
Added a fix for Ticket #105
git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1286 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-11-01 04:20:28 +00:00
|
|
|
*
|
|
|
|
* @var boolean
|
2006-11-28 11:18:05 +00:00
|
|
|
* @access public
|
[1285]
Author: phpnut
Date: 10:09:03 PM, Monday, October 31, 2005
Message:
Removed references in the Session class
[1283]
Author: phpnut
Date: 8:47:37 PM, Monday, October 31, 2005
Message:
Added fix to the Controller::constructClassess().
The database should have an instance available if a component will use it.
[1282]
Author: phpnut
Date: 8:36:07 PM, Monday, October 31, 2005
Message:
Updated the Model association methods to correct and error I introduced when reactoring last week.
Added a return from each of the settings in Security::inactiveMins(); This class is not fully implemented.
Updated scaffold and dipatcher with changes to the session class.
Fixed problem with session not working properly.
Added a regenrate id for sessions.
When CAKE_SECURITY is set to high this will regenrate a new session key on each request.
The old session file will be removed from the file system. This is a added security measure.
[1270]
Author: phpnut
Date: 1:55:28 PM, Sunday, October 30, 2005
Message:
Updated Session class to regenrate a new session key on each request when security level set to high.
Updated doc comments in some classes
[1269]
Author: phpnut
Date: 9:49:43 AM, Sunday, October 30, 2005
Message:
Added a fix for Ticket #105
git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1286 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-11-01 04:20:28 +00:00
|
|
|
*/
|
2006-05-26 05:29:17 +00:00
|
|
|
var $pageTitle = false;
|
[1285]
Author: phpnut
Date: 10:09:03 PM, Monday, October 31, 2005
Message:
Removed references in the Session class
[1283]
Author: phpnut
Date: 8:47:37 PM, Monday, October 31, 2005
Message:
Added fix to the Controller::constructClassess().
The database should have an instance available if a component will use it.
[1282]
Author: phpnut
Date: 8:36:07 PM, Monday, October 31, 2005
Message:
Updated the Model association methods to correct and error I introduced when reactoring last week.
Added a return from each of the settings in Security::inactiveMins(); This class is not fully implemented.
Updated scaffold and dipatcher with changes to the session class.
Fixed problem with session not working properly.
Added a regenrate id for sessions.
When CAKE_SECURITY is set to high this will regenrate a new session key on each request.
The old session file will be removed from the file system. This is a added security measure.
[1270]
Author: phpnut
Date: 1:55:28 PM, Sunday, October 30, 2005
Message:
Updated Session class to regenrate a new session key on each request when security level set to high.
Updated doc comments in some classes
[1269]
Author: phpnut
Date: 9:49:43 AM, Sunday, October 30, 2005
Message:
Added a fix for Ticket #105
git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1286 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-11-01 04:20:28 +00:00
|
|
|
/**
|
2007-02-21 03:41:13 +00:00
|
|
|
* An array containing the class names of the models this controller uses.
|
[1285]
Author: phpnut
Date: 10:09:03 PM, Monday, October 31, 2005
Message:
Removed references in the Session class
[1283]
Author: phpnut
Date: 8:47:37 PM, Monday, October 31, 2005
Message:
Added fix to the Controller::constructClassess().
The database should have an instance available if a component will use it.
[1282]
Author: phpnut
Date: 8:36:07 PM, Monday, October 31, 2005
Message:
Updated the Model association methods to correct and error I introduced when reactoring last week.
Added a return from each of the settings in Security::inactiveMins(); This class is not fully implemented.
Updated scaffold and dipatcher with changes to the session class.
Fixed problem with session not working properly.
Added a regenrate id for sessions.
When CAKE_SECURITY is set to high this will regenrate a new session key on each request.
The old session file will be removed from the file system. This is a added security measure.
[1270]
Author: phpnut
Date: 1:55:28 PM, Sunday, October 30, 2005
Message:
Updated Session class to regenrate a new session key on each request when security level set to high.
Updated doc comments in some classes
[1269]
Author: phpnut
Date: 9:49:43 AM, Sunday, October 30, 2005
Message:
Added a fix for Ticket #105
git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1286 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-11-01 04:20:28 +00:00
|
|
|
*
|
|
|
|
* @var array Array of model objects.
|
|
|
|
* @access public
|
|
|
|
*/
|
2006-05-26 05:29:17 +00:00
|
|
|
var $modelNames = array();
|
[1285]
Author: phpnut
Date: 10:09:03 PM, Monday, October 31, 2005
Message:
Removed references in the Session class
[1283]
Author: phpnut
Date: 8:47:37 PM, Monday, October 31, 2005
Message:
Added fix to the Controller::constructClassess().
The database should have an instance available if a component will use it.
[1282]
Author: phpnut
Date: 8:36:07 PM, Monday, October 31, 2005
Message:
Updated the Model association methods to correct and error I introduced when reactoring last week.
Added a return from each of the settings in Security::inactiveMins(); This class is not fully implemented.
Updated scaffold and dipatcher with changes to the session class.
Fixed problem with session not working properly.
Added a regenrate id for sessions.
When CAKE_SECURITY is set to high this will regenrate a new session key on each request.
The old session file will be removed from the file system. This is a added security measure.
[1270]
Author: phpnut
Date: 1:55:28 PM, Sunday, October 30, 2005
Message:
Updated Session class to regenrate a new session key on each request when security level set to high.
Updated doc comments in some classes
[1269]
Author: phpnut
Date: 9:49:43 AM, Sunday, October 30, 2005
Message:
Added a fix for Ticket #105
git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1286 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-11-01 04:20:28 +00:00
|
|
|
/**
|
2007-02-21 03:41:13 +00:00
|
|
|
* Base URL path.
|
[1285]
Author: phpnut
Date: 10:09:03 PM, Monday, October 31, 2005
Message:
Removed references in the Session class
[1283]
Author: phpnut
Date: 8:47:37 PM, Monday, October 31, 2005
Message:
Added fix to the Controller::constructClassess().
The database should have an instance available if a component will use it.
[1282]
Author: phpnut
Date: 8:36:07 PM, Monday, October 31, 2005
Message:
Updated the Model association methods to correct and error I introduced when reactoring last week.
Added a return from each of the settings in Security::inactiveMins(); This class is not fully implemented.
Updated scaffold and dipatcher with changes to the session class.
Fixed problem with session not working properly.
Added a regenrate id for sessions.
When CAKE_SECURITY is set to high this will regenrate a new session key on each request.
The old session file will be removed from the file system. This is a added security measure.
[1270]
Author: phpnut
Date: 1:55:28 PM, Sunday, October 30, 2005
Message:
Updated Session class to regenrate a new session key on each request when security level set to high.
Updated doc comments in some classes
[1269]
Author: phpnut
Date: 9:49:43 AM, Sunday, October 30, 2005
Message:
Added a fix for Ticket #105
git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1286 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-11-01 04:20:28 +00:00
|
|
|
*
|
2006-11-28 11:18:05 +00:00
|
|
|
* @var string
|
[1285]
Author: phpnut
Date: 10:09:03 PM, Monday, October 31, 2005
Message:
Removed references in the Session class
[1283]
Author: phpnut
Date: 8:47:37 PM, Monday, October 31, 2005
Message:
Added fix to the Controller::constructClassess().
The database should have an instance available if a component will use it.
[1282]
Author: phpnut
Date: 8:36:07 PM, Monday, October 31, 2005
Message:
Updated the Model association methods to correct and error I introduced when reactoring last week.
Added a return from each of the settings in Security::inactiveMins(); This class is not fully implemented.
Updated scaffold and dipatcher with changes to the session class.
Fixed problem with session not working properly.
Added a regenrate id for sessions.
When CAKE_SECURITY is set to high this will regenrate a new session key on each request.
The old session file will be removed from the file system. This is a added security measure.
[1270]
Author: phpnut
Date: 1:55:28 PM, Sunday, October 30, 2005
Message:
Updated Session class to regenrate a new session key on each request when security level set to high.
Updated doc comments in some classes
[1269]
Author: phpnut
Date: 9:49:43 AM, Sunday, October 30, 2005
Message:
Added a fix for Ticket #105
git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1286 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-11-01 04:20:28 +00:00
|
|
|
* @access public
|
|
|
|
*/
|
2006-05-26 05:29:17 +00:00
|
|
|
var $base = null;
|
[1285]
Author: phpnut
Date: 10:09:03 PM, Monday, October 31, 2005
Message:
Removed references in the Session class
[1283]
Author: phpnut
Date: 8:47:37 PM, Monday, October 31, 2005
Message:
Added fix to the Controller::constructClassess().
The database should have an instance available if a component will use it.
[1282]
Author: phpnut
Date: 8:36:07 PM, Monday, October 31, 2005
Message:
Updated the Model association methods to correct and error I introduced when reactoring last week.
Added a return from each of the settings in Security::inactiveMins(); This class is not fully implemented.
Updated scaffold and dipatcher with changes to the session class.
Fixed problem with session not working properly.
Added a regenrate id for sessions.
When CAKE_SECURITY is set to high this will regenrate a new session key on each request.
The old session file will be removed from the file system. This is a added security measure.
[1270]
Author: phpnut
Date: 1:55:28 PM, Sunday, October 30, 2005
Message:
Updated Session class to regenrate a new session key on each request when security level set to high.
Updated doc comments in some classes
[1269]
Author: phpnut
Date: 9:49:43 AM, Sunday, October 30, 2005
Message:
Added a fix for Ticket #105
git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1286 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-11-01 04:20:28 +00:00
|
|
|
/**
|
2007-02-21 03:41:13 +00:00
|
|
|
* The name of the layout file to render views inside of. The name specified
|
|
|
|
* is the filename of the layout in /app/views/layouts without the .ctp
|
|
|
|
* extension.
|
[1285]
Author: phpnut
Date: 10:09:03 PM, Monday, October 31, 2005
Message:
Removed references in the Session class
[1283]
Author: phpnut
Date: 8:47:37 PM, Monday, October 31, 2005
Message:
Added fix to the Controller::constructClassess().
The database should have an instance available if a component will use it.
[1282]
Author: phpnut
Date: 8:36:07 PM, Monday, October 31, 2005
Message:
Updated the Model association methods to correct and error I introduced when reactoring last week.
Added a return from each of the settings in Security::inactiveMins(); This class is not fully implemented.
Updated scaffold and dipatcher with changes to the session class.
Fixed problem with session not working properly.
Added a regenrate id for sessions.
When CAKE_SECURITY is set to high this will regenrate a new session key on each request.
The old session file will be removed from the file system. This is a added security measure.
[1270]
Author: phpnut
Date: 1:55:28 PM, Sunday, October 30, 2005
Message:
Updated Session class to regenrate a new session key on each request when security level set to high.
Updated doc comments in some classes
[1269]
Author: phpnut
Date: 9:49:43 AM, Sunday, October 30, 2005
Message:
Added a fix for Ticket #105
git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1286 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-11-01 04:20:28 +00:00
|
|
|
*
|
|
|
|
* @var string
|
|
|
|
* @access public
|
|
|
|
*/
|
2006-05-26 05:29:17 +00:00
|
|
|
var $layout = 'default';
|
[1285]
Author: phpnut
Date: 10:09:03 PM, Monday, October 31, 2005
Message:
Removed references in the Session class
[1283]
Author: phpnut
Date: 8:47:37 PM, Monday, October 31, 2005
Message:
Added fix to the Controller::constructClassess().
The database should have an instance available if a component will use it.
[1282]
Author: phpnut
Date: 8:36:07 PM, Monday, October 31, 2005
Message:
Updated the Model association methods to correct and error I introduced when reactoring last week.
Added a return from each of the settings in Security::inactiveMins(); This class is not fully implemented.
Updated scaffold and dipatcher with changes to the session class.
Fixed problem with session not working properly.
Added a regenrate id for sessions.
When CAKE_SECURITY is set to high this will regenrate a new session key on each request.
The old session file will be removed from the file system. This is a added security measure.
[1270]
Author: phpnut
Date: 1:55:28 PM, Sunday, October 30, 2005
Message:
Updated Session class to regenrate a new session key on each request when security level set to high.
Updated doc comments in some classes
[1269]
Author: phpnut
Date: 9:49:43 AM, Sunday, October 30, 2005
Message:
Added a fix for Ticket #105
git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1286 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-11-01 04:20:28 +00:00
|
|
|
/**
|
2007-02-21 03:41:13 +00:00
|
|
|
* Set to true to automatically render the view
|
|
|
|
* after action logic.
|
[1285]
Author: phpnut
Date: 10:09:03 PM, Monday, October 31, 2005
Message:
Removed references in the Session class
[1283]
Author: phpnut
Date: 8:47:37 PM, Monday, October 31, 2005
Message:
Added fix to the Controller::constructClassess().
The database should have an instance available if a component will use it.
[1282]
Author: phpnut
Date: 8:36:07 PM, Monday, October 31, 2005
Message:
Updated the Model association methods to correct and error I introduced when reactoring last week.
Added a return from each of the settings in Security::inactiveMins(); This class is not fully implemented.
Updated scaffold and dipatcher with changes to the session class.
Fixed problem with session not working properly.
Added a regenrate id for sessions.
When CAKE_SECURITY is set to high this will regenrate a new session key on each request.
The old session file will be removed from the file system. This is a added security measure.
[1270]
Author: phpnut
Date: 1:55:28 PM, Sunday, October 30, 2005
Message:
Updated Session class to regenrate a new session key on each request when security level set to high.
Updated doc comments in some classes
[1269]
Author: phpnut
Date: 9:49:43 AM, Sunday, October 30, 2005
Message:
Added a fix for Ticket #105
git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1286 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-11-01 04:20:28 +00:00
|
|
|
*
|
|
|
|
* @var boolean
|
|
|
|
* @access public
|
|
|
|
*/
|
2006-05-26 05:29:17 +00:00
|
|
|
var $autoRender = true;
|
[1285]
Author: phpnut
Date: 10:09:03 PM, Monday, October 31, 2005
Message:
Removed references in the Session class
[1283]
Author: phpnut
Date: 8:47:37 PM, Monday, October 31, 2005
Message:
Added fix to the Controller::constructClassess().
The database should have an instance available if a component will use it.
[1282]
Author: phpnut
Date: 8:36:07 PM, Monday, October 31, 2005
Message:
Updated the Model association methods to correct and error I introduced when reactoring last week.
Added a return from each of the settings in Security::inactiveMins(); This class is not fully implemented.
Updated scaffold and dipatcher with changes to the session class.
Fixed problem with session not working properly.
Added a regenrate id for sessions.
When CAKE_SECURITY is set to high this will regenrate a new session key on each request.
The old session file will be removed from the file system. This is a added security measure.
[1270]
Author: phpnut
Date: 1:55:28 PM, Sunday, October 30, 2005
Message:
Updated Session class to regenrate a new session key on each request when security level set to high.
Updated doc comments in some classes
[1269]
Author: phpnut
Date: 9:49:43 AM, Sunday, October 30, 2005
Message:
Added a fix for Ticket #105
git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1286 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-11-01 04:20:28 +00:00
|
|
|
/**
|
2007-02-21 03:41:13 +00:00
|
|
|
* Set to true to automatically render the layout around views.
|
[1285]
Author: phpnut
Date: 10:09:03 PM, Monday, October 31, 2005
Message:
Removed references in the Session class
[1283]
Author: phpnut
Date: 8:47:37 PM, Monday, October 31, 2005
Message:
Added fix to the Controller::constructClassess().
The database should have an instance available if a component will use it.
[1282]
Author: phpnut
Date: 8:36:07 PM, Monday, October 31, 2005
Message:
Updated the Model association methods to correct and error I introduced when reactoring last week.
Added a return from each of the settings in Security::inactiveMins(); This class is not fully implemented.
Updated scaffold and dipatcher with changes to the session class.
Fixed problem with session not working properly.
Added a regenrate id for sessions.
When CAKE_SECURITY is set to high this will regenrate a new session key on each request.
The old session file will be removed from the file system. This is a added security measure.
[1270]
Author: phpnut
Date: 1:55:28 PM, Sunday, October 30, 2005
Message:
Updated Session class to regenrate a new session key on each request when security level set to high.
Updated doc comments in some classes
[1269]
Author: phpnut
Date: 9:49:43 AM, Sunday, October 30, 2005
Message:
Added a fix for Ticket #105
git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1286 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-11-01 04:20:28 +00:00
|
|
|
*
|
|
|
|
* @var boolean
|
|
|
|
* @access public
|
|
|
|
*/
|
2006-05-26 05:29:17 +00:00
|
|
|
var $autoLayout = true;
|
[1285]
Author: phpnut
Date: 10:09:03 PM, Monday, October 31, 2005
Message:
Removed references in the Session class
[1283]
Author: phpnut
Date: 8:47:37 PM, Monday, October 31, 2005
Message:
Added fix to the Controller::constructClassess().
The database should have an instance available if a component will use it.
[1282]
Author: phpnut
Date: 8:36:07 PM, Monday, October 31, 2005
Message:
Updated the Model association methods to correct and error I introduced when reactoring last week.
Added a return from each of the settings in Security::inactiveMins(); This class is not fully implemented.
Updated scaffold and dipatcher with changes to the session class.
Fixed problem with session not working properly.
Added a regenrate id for sessions.
When CAKE_SECURITY is set to high this will regenrate a new session key on each request.
The old session file will be removed from the file system. This is a added security measure.
[1270]
Author: phpnut
Date: 1:55:28 PM, Sunday, October 30, 2005
Message:
Updated Session class to regenrate a new session key on each request when security level set to high.
Updated doc comments in some classes
[1269]
Author: phpnut
Date: 9:49:43 AM, Sunday, October 30, 2005
Message:
Added a fix for Ticket #105
git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1286 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-11-01 04:20:28 +00:00
|
|
|
/**
|
2007-02-21 03:41:13 +00:00
|
|
|
* Array containing the names of components this controller uses. Component names
|
|
|
|
* should not contain the -Component portion of the classname.
|
2007-03-04 12:14:33 +00:00
|
|
|
*
|
2007-02-17 17:59:44 +00:00
|
|
|
* Example: var $components = array('Session', 'RequestHandler', 'Acl');
|
[1285]
Author: phpnut
Date: 10:09:03 PM, Monday, October 31, 2005
Message:
Removed references in the Session class
[1283]
Author: phpnut
Date: 8:47:37 PM, Monday, October 31, 2005
Message:
Added fix to the Controller::constructClassess().
The database should have an instance available if a component will use it.
[1282]
Author: phpnut
Date: 8:36:07 PM, Monday, October 31, 2005
Message:
Updated the Model association methods to correct and error I introduced when reactoring last week.
Added a return from each of the settings in Security::inactiveMins(); This class is not fully implemented.
Updated scaffold and dipatcher with changes to the session class.
Fixed problem with session not working properly.
Added a regenrate id for sessions.
When CAKE_SECURITY is set to high this will regenrate a new session key on each request.
The old session file will be removed from the file system. This is a added security measure.
[1270]
Author: phpnut
Date: 1:55:28 PM, Sunday, October 30, 2005
Message:
Updated Session class to regenrate a new session key on each request when security level set to high.
Updated doc comments in some classes
[1269]
Author: phpnut
Date: 9:49:43 AM, Sunday, October 30, 2005
Message:
Added a fix for Ticket #105
git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1286 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-11-01 04:20:28 +00:00
|
|
|
*
|
2006-11-28 11:18:05 +00:00
|
|
|
* @var array
|
[1285]
Author: phpnut
Date: 10:09:03 PM, Monday, October 31, 2005
Message:
Removed references in the Session class
[1283]
Author: phpnut
Date: 8:47:37 PM, Monday, October 31, 2005
Message:
Added fix to the Controller::constructClassess().
The database should have an instance available if a component will use it.
[1282]
Author: phpnut
Date: 8:36:07 PM, Monday, October 31, 2005
Message:
Updated the Model association methods to correct and error I introduced when reactoring last week.
Added a return from each of the settings in Security::inactiveMins(); This class is not fully implemented.
Updated scaffold and dipatcher with changes to the session class.
Fixed problem with session not working properly.
Added a regenrate id for sessions.
When CAKE_SECURITY is set to high this will regenrate a new session key on each request.
The old session file will be removed from the file system. This is a added security measure.
[1270]
Author: phpnut
Date: 1:55:28 PM, Sunday, October 30, 2005
Message:
Updated Session class to regenrate a new session key on each request when security level set to high.
Updated doc comments in some classes
[1269]
Author: phpnut
Date: 9:49:43 AM, Sunday, October 30, 2005
Message:
Added a fix for Ticket #105
git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1286 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-11-01 04:20:28 +00:00
|
|
|
* @access public
|
|
|
|
*/
|
2006-11-25 22:58:58 +00:00
|
|
|
var $components = array();
|
2006-01-01 02:05:01 +00:00
|
|
|
/**
|
2007-02-17 17:59:44 +00:00
|
|
|
* The name of the View class this controller sends output to.
|
2006-01-01 02:05:01 +00:00
|
|
|
*
|
2006-11-28 11:18:05 +00:00
|
|
|
* @var string
|
|
|
|
* @access public
|
2006-01-01 02:05:01 +00:00
|
|
|
*/
|
2006-05-26 05:29:17 +00:00
|
|
|
var $view = 'View';
|
2006-08-18 07:53:45 +00:00
|
|
|
/**
|
2007-02-17 17:59:44 +00:00
|
|
|
* File extension for view templates. Defaults to Cake's conventional ".ctp".
|
2006-08-18 07:53:45 +00:00
|
|
|
*
|
2006-11-28 11:18:05 +00:00
|
|
|
* @var string
|
|
|
|
* @access public
|
2006-08-18 07:53:45 +00:00
|
|
|
*/
|
2006-11-25 22:04:43 +00:00
|
|
|
var $ext = '.ctp';
|
2006-01-01 02:05:01 +00:00
|
|
|
/**
|
2006-11-28 11:18:05 +00:00
|
|
|
* Instance of $view class create by a controller
|
2006-01-01 02:05:01 +00:00
|
|
|
*
|
2006-11-28 11:18:05 +00:00
|
|
|
* @var object
|
|
|
|
* @access private
|
2006-01-01 02:05:01 +00:00
|
|
|
*/
|
2006-11-28 11:18:05 +00:00
|
|
|
var $__viewClass = null;
|
2006-02-02 11:48:29 +00:00
|
|
|
/**
|
|
|
|
* The output of the requested action. Contains either a variable
|
|
|
|
* returned from the action, or the data of the rendered view;
|
2007-02-21 03:41:13 +00:00
|
|
|
* You can use this var in Child controllers' afterFilter() to alter output.
|
2006-02-02 11:48:29 +00:00
|
|
|
*
|
2006-11-28 11:18:05 +00:00
|
|
|
* @var string
|
|
|
|
* @access public
|
2006-02-02 11:48:29 +00:00
|
|
|
*/
|
2006-05-26 05:29:17 +00:00
|
|
|
var $output = null;
|
2006-02-02 11:48:29 +00:00
|
|
|
/**
|
2006-11-28 11:18:05 +00:00
|
|
|
* Automatically set to the name of a plugin.
|
2006-02-02 11:48:29 +00:00
|
|
|
*
|
2006-11-28 11:18:05 +00:00
|
|
|
* @var string
|
|
|
|
* @access public
|
2006-02-02 11:48:29 +00:00
|
|
|
*/
|
2006-05-26 05:29:17 +00:00
|
|
|
var $plugin = null;
|
2006-03-12 00:11:40 +00:00
|
|
|
/**
|
2007-03-04 12:14:33 +00:00
|
|
|
* Used to define methods a controller that will be cached. To cache a
|
|
|
|
* single action, the value is set to an array containing keys that match
|
2007-02-21 03:41:13 +00:00
|
|
|
* action names and values that denote cache expiration times (in seconds).
|
|
|
|
*
|
|
|
|
* Example: var $cacheAction = array(
|
2007-06-08 01:17:40 +00:00
|
|
|
* 'view/23/' => 21600,
|
|
|
|
* 'recalled/' => 86400
|
|
|
|
* );
|
2007-02-21 03:41:13 +00:00
|
|
|
*
|
|
|
|
* $cacheAction can also be set to a strtotime() compatible string. This
|
|
|
|
* marks all the actions in the controller for view caching.
|
2006-03-12 00:11:40 +00:00
|
|
|
*
|
2006-11-28 11:18:05 +00:00
|
|
|
* @var mixed
|
|
|
|
* @access public
|
2006-03-12 00:11:40 +00:00
|
|
|
*/
|
2006-05-26 05:29:17 +00:00
|
|
|
var $cacheAction = false;
|
2006-03-19 03:26:43 +00:00
|
|
|
/**
|
2006-11-28 11:18:05 +00:00
|
|
|
* Used to create cached instances of models a controller uses.
|
2007-02-21 03:41:13 +00:00
|
|
|
* When set to true, all models related to the controller will be cached.
|
|
|
|
* This can increase performance in many cases.
|
2006-03-19 03:26:43 +00:00
|
|
|
*
|
|
|
|
* @var boolean
|
2006-11-28 11:18:05 +00:00
|
|
|
* @access public
|
2006-03-19 03:26:43 +00:00
|
|
|
*/
|
2006-05-26 05:29:17 +00:00
|
|
|
var $persistModel = false;
|
2006-07-07 02:46:16 +00:00
|
|
|
/**
|
2007-02-21 03:41:13 +00:00
|
|
|
* Used in CakePHP webservices routing.
|
2006-07-07 02:46:16 +00:00
|
|
|
*
|
2007-10-21 22:49:53 +00:00
|
|
|
* @var array
|
|
|
|
* @access public
|
2006-07-07 02:46:16 +00:00
|
|
|
*/
|
|
|
|
var $webservices = null;
|
2007-06-04 19:40:01 +00:00
|
|
|
/**
|
|
|
|
* Holds all params passed and named.
|
|
|
|
*
|
|
|
|
* @var mixed
|
2007-10-21 22:49:53 +00:00
|
|
|
* @access public
|
2007-06-04 19:40:01 +00:00
|
|
|
*/
|
|
|
|
var $passedArgs = array();
|
[1285]
Author: phpnut
Date: 10:09:03 PM, Monday, October 31, 2005
Message:
Removed references in the Session class
[1283]
Author: phpnut
Date: 8:47:37 PM, Monday, October 31, 2005
Message:
Added fix to the Controller::constructClassess().
The database should have an instance available if a component will use it.
[1282]
Author: phpnut
Date: 8:36:07 PM, Monday, October 31, 2005
Message:
Updated the Model association methods to correct and error I introduced when reactoring last week.
Added a return from each of the settings in Security::inactiveMins(); This class is not fully implemented.
Updated scaffold and dipatcher with changes to the session class.
Fixed problem with session not working properly.
Added a regenrate id for sessions.
When CAKE_SECURITY is set to high this will regenrate a new session key on each request.
The old session file will be removed from the file system. This is a added security measure.
[1270]
Author: phpnut
Date: 1:55:28 PM, Sunday, October 30, 2005
Message:
Updated Session class to regenrate a new session key on each request when security level set to high.
Updated doc comments in some classes
[1269]
Author: phpnut
Date: 9:49:43 AM, Sunday, October 30, 2005
Message:
Added a fix for Ticket #105
git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1286 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-11-01 04:20:28 +00:00
|
|
|
/**
|
|
|
|
* Constructor.
|
|
|
|
*
|
|
|
|
*/
|
2006-05-26 05:29:17 +00:00
|
|
|
function __construct() {
|
|
|
|
if ($this->name === null) {
|
2006-06-14 18:02:37 +00:00
|
|
|
$r = null;
|
2006-05-26 05:29:17 +00:00
|
|
|
|
2006-06-14 18:02:37 +00:00
|
|
|
if (!preg_match('/(.*)Controller/i', get_class($this), $r)) {
|
2006-12-23 09:09:06 +00:00
|
|
|
die (__("Controller::__construct() : Can not get or parse my own class name, exiting."));
|
2006-06-14 18:02:37 +00:00
|
|
|
}
|
|
|
|
$this->name = $r[1];
|
2006-05-26 05:29:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if ($this->viewPath == null) {
|
2006-06-14 18:02:37 +00:00
|
|
|
$this->viewPath = Inflector::underscore($this->name);
|
2006-05-26 05:29:17 +00:00
|
|
|
}
|
2006-11-26 06:15:30 +00:00
|
|
|
$this->modelClass = Inflector::classify($this->name);
|
2006-06-14 18:02:37 +00:00
|
|
|
$this->modelKey = Inflector::underscore($this->modelClass);
|
2007-12-31 23:27:14 +00:00
|
|
|
parent::__construct();
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
* Starts the components linked to this controller.
|
|
|
|
*
|
|
|
|
* @access protected
|
|
|
|
* @see Component::init()
|
|
|
|
*/
|
|
|
|
function _initComponents() {
|
|
|
|
$component = new Component();
|
|
|
|
$component->init($this);
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
* Merge components, helpers, and uses vars from AppController and PluginAppController
|
|
|
|
*
|
|
|
|
* @access protected
|
|
|
|
*/
|
2008-01-05 01:31:15 +00:00
|
|
|
function __mergeVars () {
|
2008-01-01 01:07:24 +00:00
|
|
|
$pluginName = Inflector::camelize($this->plugin);
|
|
|
|
$pluginController = $pluginName . 'AppController';
|
2007-12-31 23:27:14 +00:00
|
|
|
|
|
|
|
if (is_subclass_of($this, 'AppController') || is_subclass_of($this, $pluginController)) {
|
2006-06-14 18:02:37 +00:00
|
|
|
$appVars = get_class_vars('AppController');
|
2006-11-26 20:43:54 +00:00
|
|
|
$uses = $appVars['uses'];
|
|
|
|
$merge = array('components', 'helpers');
|
2007-12-31 23:27:14 +00:00
|
|
|
$plugin = null;
|
|
|
|
|
2008-01-01 01:07:24 +00:00
|
|
|
if (!empty($this->plugin)) {
|
|
|
|
$plugin = $pluginName . '.';
|
2007-12-31 23:27:14 +00:00
|
|
|
if (!is_subclass_of($this, $pluginController)) {
|
|
|
|
$pluginController = null;
|
|
|
|
}
|
2008-01-01 01:07:24 +00:00
|
|
|
} else {
|
|
|
|
$pluginController = null;
|
2007-12-31 23:27:14 +00:00
|
|
|
}
|
|
|
|
|
2006-11-28 22:05:22 +00:00
|
|
|
if ($uses == $this->uses && !empty($this->uses)) {
|
2008-01-01 01:07:24 +00:00
|
|
|
if (!in_array($plugin . $this->modelClass, $this->uses)) {
|
|
|
|
array_unshift($this->uses, $plugin . $this->modelClass);
|
|
|
|
}
|
2007-01-20 15:46:12 +00:00
|
|
|
} elseif ($this->uses !== null || $this->uses !== false) {
|
2006-11-26 20:43:54 +00:00
|
|
|
$merge[] = 'uses';
|
|
|
|
}
|
2007-12-31 23:27:14 +00:00
|
|
|
|
|
|
|
foreach ($merge as $var) {
|
|
|
|
if (isset($appVars[$var]) && !empty($appVars[$var]) && is_array($this->{$var})) {
|
2008-01-01 01:07:24 +00:00
|
|
|
$this->{$var} = Set::merge($this->{$var}, array_diff($appVars[$var], $this->{$var}));
|
2007-12-31 23:27:14 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($pluginController) {
|
|
|
|
$appVars = get_class_vars($pluginController);
|
|
|
|
$uses = $appVars['uses'];
|
|
|
|
$merge = array('components', 'helpers');
|
|
|
|
|
|
|
|
if ($this->uses !== null || $this->uses !== false) {
|
|
|
|
$merge[] = 'uses';
|
|
|
|
}
|
|
|
|
|
2007-06-20 06:15:35 +00:00
|
|
|
foreach ($merge as $var) {
|
2006-06-14 18:02:37 +00:00
|
|
|
if (isset($appVars[$var]) && !empty($appVars[$var]) && is_array($this->{$var})) {
|
2008-01-01 01:07:24 +00:00
|
|
|
$this->{$var} = Set::merge($this->{$var}, array_diff($appVars[$var], $this->{$var}));
|
2006-05-26 05:29:17 +00:00
|
|
|
}
|
2006-06-14 18:02:37 +00:00
|
|
|
}
|
2006-05-26 05:29:17 +00:00
|
|
|
}
|
|
|
|
}
|
[1285]
Author: phpnut
Date: 10:09:03 PM, Monday, October 31, 2005
Message:
Removed references in the Session class
[1283]
Author: phpnut
Date: 8:47:37 PM, Monday, October 31, 2005
Message:
Added fix to the Controller::constructClassess().
The database should have an instance available if a component will use it.
[1282]
Author: phpnut
Date: 8:36:07 PM, Monday, October 31, 2005
Message:
Updated the Model association methods to correct and error I introduced when reactoring last week.
Added a return from each of the settings in Security::inactiveMins(); This class is not fully implemented.
Updated scaffold and dipatcher with changes to the session class.
Fixed problem with session not working properly.
Added a regenrate id for sessions.
When CAKE_SECURITY is set to high this will regenrate a new session key on each request.
The old session file will be removed from the file system. This is a added security measure.
[1270]
Author: phpnut
Date: 1:55:28 PM, Sunday, October 30, 2005
Message:
Updated Session class to regenrate a new session key on each request when security level set to high.
Updated doc comments in some classes
[1269]
Author: phpnut
Date: 9:49:43 AM, Sunday, October 30, 2005
Message:
Added a fix for Ticket #105
git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1286 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-11-01 04:20:28 +00:00
|
|
|
/**
|
2007-08-30 00:19:07 +00:00
|
|
|
* Loads Model classes based on the the uses property
|
|
|
|
* see Controller::loadModel(); for more info
|
[1285]
Author: phpnut
Date: 10:09:03 PM, Monday, October 31, 2005
Message:
Removed references in the Session class
[1283]
Author: phpnut
Date: 8:47:37 PM, Monday, October 31, 2005
Message:
Added fix to the Controller::constructClassess().
The database should have an instance available if a component will use it.
[1282]
Author: phpnut
Date: 8:36:07 PM, Monday, October 31, 2005
Message:
Updated the Model association methods to correct and error I introduced when reactoring last week.
Added a return from each of the settings in Security::inactiveMins(); This class is not fully implemented.
Updated scaffold and dipatcher with changes to the session class.
Fixed problem with session not working properly.
Added a regenrate id for sessions.
When CAKE_SECURITY is set to high this will regenrate a new session key on each request.
The old session file will be removed from the file system. This is a added security measure.
[1270]
Author: phpnut
Date: 1:55:28 PM, Sunday, October 30, 2005
Message:
Updated Session class to regenrate a new session key on each request when security level set to high.
Updated doc comments in some classes
[1269]
Author: phpnut
Date: 9:49:43 AM, Sunday, October 30, 2005
Message:
Added a fix for Ticket #105
git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1286 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-11-01 04:20:28 +00:00
|
|
|
*
|
2007-08-30 00:19:07 +00:00
|
|
|
* @return mixed true if models found and instance created, or cakeError if models not found.
|
2006-11-28 11:18:05 +00:00
|
|
|
* @access public
|
2007-10-30 17:21:23 +00:00
|
|
|
* @see Controller::loadModel()
|
[1285]
Author: phpnut
Date: 10:09:03 PM, Monday, October 31, 2005
Message:
Removed references in the Session class
[1283]
Author: phpnut
Date: 8:47:37 PM, Monday, October 31, 2005
Message:
Added fix to the Controller::constructClassess().
The database should have an instance available if a component will use it.
[1282]
Author: phpnut
Date: 8:36:07 PM, Monday, October 31, 2005
Message:
Updated the Model association methods to correct and error I introduced when reactoring last week.
Added a return from each of the settings in Security::inactiveMins(); This class is not fully implemented.
Updated scaffold and dipatcher with changes to the session class.
Fixed problem with session not working properly.
Added a regenrate id for sessions.
When CAKE_SECURITY is set to high this will regenrate a new session key on each request.
The old session file will be removed from the file system. This is a added security measure.
[1270]
Author: phpnut
Date: 1:55:28 PM, Sunday, October 30, 2005
Message:
Updated Session class to regenrate a new session key on each request when security level set to high.
Updated doc comments in some classes
[1269]
Author: phpnut
Date: 9:49:43 AM, Sunday, October 30, 2005
Message:
Added a fix for Ticket #105
git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1286 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-11-01 04:20:28 +00:00
|
|
|
*/
|
2006-05-26 05:29:17 +00:00
|
|
|
function constructClasses() {
|
2008-01-05 01:31:15 +00:00
|
|
|
$this->__mergeVars();
|
|
|
|
$this->_initComponents();
|
2007-06-20 07:51:52 +00:00
|
|
|
if ($this->uses === null || ($this->uses === array())) {
|
2006-11-28 11:18:05 +00:00
|
|
|
return false;
|
|
|
|
}
|
2006-11-12 00:12:34 +00:00
|
|
|
if (empty($this->passedArgs) || !isset($this->passedArgs['0'])) {
|
2006-05-26 05:29:17 +00:00
|
|
|
$id = false;
|
|
|
|
} else {
|
2006-11-12 00:12:34 +00:00
|
|
|
$id = $this->passedArgs['0'];
|
2006-05-26 05:29:17 +00:00
|
|
|
}
|
2007-08-30 00:19:07 +00:00
|
|
|
|
|
|
|
if ($this->uses === false) {
|
|
|
|
$this->loadModel($this->modelClass, $id);
|
|
|
|
} elseif ($this->uses) {
|
|
|
|
$uses = is_array($this->uses) ? $this->uses : array($this->uses);
|
|
|
|
$this->modelClass = $uses[0];
|
|
|
|
foreach ($uses as $modelClass) {
|
|
|
|
$this->loadModel($modelClass);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
* Loads and instantiates models required by this controller.
|
|
|
|
* If Controller::persistModel; is true, controller will create cached model instances on first request,
|
|
|
|
* additional request will used cached models
|
|
|
|
*
|
2007-10-21 22:49:53 +00:00
|
|
|
* @param string $modelClass Name of model class to load
|
|
|
|
* @param mixed $id Initial ID the instanced model class should have
|
2007-08-30 00:19:07 +00:00
|
|
|
* @return mixed true when single model found and instance created error returned if models not found.
|
|
|
|
* @access public
|
|
|
|
*/
|
Closes #2119 Only define clone() in PHP4 when it hasn't been already defined.
Closes #2213, Support multiple plugin paths.
Closes #2234, filepaths to behavior classes should be cached in class.paths.php also
Closes #2345, ability to group components into subfolders
Closes #2645, Improvement to basic.php for class loading.
Fixes #3526, Cache::write, when using just the config name, it fails.
Fixes #3559, loading plugin model as assoc don't work.
Closes #3567 Controller Folders (Note this does not need routing to work, but controller names can not conflict with others in the same application so naming must still be unique)
Fixes #3579, email.php component: Parse error with php 4.
Adding new class and file importer.
Updated most of the core to use the importer.
Added ClassRegsitry::init() that will create and instance of an object and store it in the registry.
Deprecated most of the load functions in basics.php
Plugin model loading now forces using the dot notation, to use models within a plugin, all the model associations must be in the PluginName.Model syntax, if this is not used, the plugin will look for the models in the main app/models directory first, if not found then it will search the plugin directories recursively until it finds a model.
var $belongsTo = array('SomeModel'); will look for some_model.php in the app/models
var $belongsTo = array('MyPlugin.SomeModel'); will look for some_model.php in my_plugin/models
var $belongsTo = array('MyPlugin.MyPlugin', 'SomeModel'); will used my_plugin/models/my_plugin.php and app/models/some_model.php
The controllers of the plugin will still look for the default models inside the plugin if var $uses is not set:
var $uses = array('SomeModel'); will look for some_model.php in the app/models
var $uses = array('MyPlugin.SomeModel'); will look for some_model.php in my_plugin/models
var $uses = array('MyPlugin.MyPlugin', 'SomeModel'); will used my_plugin/models/my_plugin.php and app/models/some_model.php
All of the above will work between plugins and main app
These changes also allow placing model and controllers is sub directories
Removed old class.paths.php file generation
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@6001 3807eeeb-6ff5-0310-8944-8be069107fe0
2007-11-16 09:35:19 +00:00
|
|
|
function loadModel($modelClass = null, $id = null) {
|
2007-10-28 04:18:18 +00:00
|
|
|
if ($modelClass === null) {
|
2007-08-30 00:19:07 +00:00
|
|
|
$modelClass = $this->modelClass;
|
|
|
|
}
|
2006-05-26 05:29:17 +00:00
|
|
|
$cached = false;
|
|
|
|
$object = null;
|
2007-05-27 02:32:27 +00:00
|
|
|
$plugin = null;
|
Closes #2119 Only define clone() in PHP4 when it hasn't been already defined.
Closes #2213, Support multiple plugin paths.
Closes #2234, filepaths to behavior classes should be cached in class.paths.php also
Closes #2345, ability to group components into subfolders
Closes #2645, Improvement to basic.php for class loading.
Fixes #3526, Cache::write, when using just the config name, it fails.
Fixes #3559, loading plugin model as assoc don't work.
Closes #3567 Controller Folders (Note this does not need routing to work, but controller names can not conflict with others in the same application so naming must still be unique)
Fixes #3579, email.php component: Parse error with php 4.
Adding new class and file importer.
Updated most of the core to use the importer.
Added ClassRegsitry::init() that will create and instance of an object and store it in the registry.
Deprecated most of the load functions in basics.php
Plugin model loading now forces using the dot notation, to use models within a plugin, all the model associations must be in the PluginName.Model syntax, if this is not used, the plugin will look for the models in the main app/models directory first, if not found then it will search the plugin directories recursively until it finds a model.
var $belongsTo = array('SomeModel'); will look for some_model.php in the app/models
var $belongsTo = array('MyPlugin.SomeModel'); will look for some_model.php in my_plugin/models
var $belongsTo = array('MyPlugin.MyPlugin', 'SomeModel'); will used my_plugin/models/my_plugin.php and app/models/some_model.php
The controllers of the plugin will still look for the default models inside the plugin if var $uses is not set:
var $uses = array('SomeModel'); will look for some_model.php in the app/models
var $uses = array('MyPlugin.SomeModel'); will look for some_model.php in my_plugin/models
var $uses = array('MyPlugin.MyPlugin', 'SomeModel'); will used my_plugin/models/my_plugin.php and app/models/some_model.php
All of the above will work between plugins and main app
These changes also allow placing model and controllers is sub directories
Removed old class.paths.php file generation
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@6001 3807eeeb-6ff5-0310-8944-8be069107fe0
2007-11-16 09:35:19 +00:00
|
|
|
if ($this->uses === false) {
|
|
|
|
if ($this->plugin) {
|
|
|
|
$plugin = $this->plugin . '.';
|
|
|
|
}
|
2007-05-27 02:32:27 +00:00
|
|
|
}
|
2006-05-26 05:29:17 +00:00
|
|
|
|
2007-10-27 03:27:09 +00:00
|
|
|
if (strpos($modelClass, '.') !== false) {
|
|
|
|
list($plugin, $modelClass) = explode('.', $modelClass);
|
|
|
|
$plugin = $plugin . '.';
|
|
|
|
}
|
|
|
|
|
Closes #2119 Only define clone() in PHP4 when it hasn't been already defined.
Closes #2213, Support multiple plugin paths.
Closes #2234, filepaths to behavior classes should be cached in class.paths.php also
Closes #2345, ability to group components into subfolders
Closes #2645, Improvement to basic.php for class loading.
Fixes #3526, Cache::write, when using just the config name, it fails.
Fixes #3559, loading plugin model as assoc don't work.
Closes #3567 Controller Folders (Note this does not need routing to work, but controller names can not conflict with others in the same application so naming must still be unique)
Fixes #3579, email.php component: Parse error with php 4.
Adding new class and file importer.
Updated most of the core to use the importer.
Added ClassRegsitry::init() that will create and instance of an object and store it in the registry.
Deprecated most of the load functions in basics.php
Plugin model loading now forces using the dot notation, to use models within a plugin, all the model associations must be in the PluginName.Model syntax, if this is not used, the plugin will look for the models in the main app/models directory first, if not found then it will search the plugin directories recursively until it finds a model.
var $belongsTo = array('SomeModel'); will look for some_model.php in the app/models
var $belongsTo = array('MyPlugin.SomeModel'); will look for some_model.php in my_plugin/models
var $belongsTo = array('MyPlugin.MyPlugin', 'SomeModel'); will used my_plugin/models/my_plugin.php and app/models/some_model.php
The controllers of the plugin will still look for the default models inside the plugin if var $uses is not set:
var $uses = array('SomeModel'); will look for some_model.php in the app/models
var $uses = array('MyPlugin.SomeModel'); will look for some_model.php in my_plugin/models
var $uses = array('MyPlugin.MyPlugin', 'SomeModel'); will used my_plugin/models/my_plugin.php and app/models/some_model.php
All of the above will work between plugins and main app
These changes also allow placing model and controllers is sub directories
Removed old class.paths.php file generation
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@6001 3807eeeb-6ff5-0310-8944-8be069107fe0
2007-11-16 09:35:19 +00:00
|
|
|
if ($this->persistModel === true) {
|
|
|
|
$cached = $this->_persist($modelClass, null, $object);
|
2006-11-21 21:48:05 +00:00
|
|
|
}
|
2006-11-28 11:18:05 +00:00
|
|
|
|
Closes #2119 Only define clone() in PHP4 when it hasn't been already defined.
Closes #2213, Support multiple plugin paths.
Closes #2234, filepaths to behavior classes should be cached in class.paths.php also
Closes #2345, ability to group components into subfolders
Closes #2645, Improvement to basic.php for class loading.
Fixes #3526, Cache::write, when using just the config name, it fails.
Fixes #3559, loading plugin model as assoc don't work.
Closes #3567 Controller Folders (Note this does not need routing to work, but controller names can not conflict with others in the same application so naming must still be unique)
Fixes #3579, email.php component: Parse error with php 4.
Adding new class and file importer.
Updated most of the core to use the importer.
Added ClassRegsitry::init() that will create and instance of an object and store it in the registry.
Deprecated most of the load functions in basics.php
Plugin model loading now forces using the dot notation, to use models within a plugin, all the model associations must be in the PluginName.Model syntax, if this is not used, the plugin will look for the models in the main app/models directory first, if not found then it will search the plugin directories recursively until it finds a model.
var $belongsTo = array('SomeModel'); will look for some_model.php in the app/models
var $belongsTo = array('MyPlugin.SomeModel'); will look for some_model.php in my_plugin/models
var $belongsTo = array('MyPlugin.MyPlugin', 'SomeModel'); will used my_plugin/models/my_plugin.php and app/models/some_model.php
The controllers of the plugin will still look for the default models inside the plugin if var $uses is not set:
var $uses = array('SomeModel'); will look for some_model.php in the app/models
var $uses = array('MyPlugin.SomeModel'); will look for some_model.php in my_plugin/models
var $uses = array('MyPlugin.MyPlugin', 'SomeModel'); will used my_plugin/models/my_plugin.php and app/models/some_model.php
All of the above will work between plugins and main app
These changes also allow placing model and controllers is sub directories
Removed old class.paths.php file generation
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@6001 3807eeeb-6ff5-0310-8944-8be069107fe0
2007-11-16 09:35:19 +00:00
|
|
|
if (($cached === false)) {
|
|
|
|
$this->modelNames[] = $modelClass;
|
|
|
|
|
|
|
|
if (!PHP5) {
|
|
|
|
$this->{$modelClass} =& ClassRegistry::init(array('class' => $plugin . $modelClass, 'alias' => $modelClass, 'id' => $id));
|
|
|
|
} else {
|
|
|
|
$this->{$modelClass} = ClassRegistry::init(array('class' => $plugin . $modelClass, 'alias' => $modelClass, 'id' => $id));
|
2006-05-26 05:29:17 +00:00
|
|
|
}
|
|
|
|
|
Closes #2119 Only define clone() in PHP4 when it hasn't been already defined.
Closes #2213, Support multiple plugin paths.
Closes #2234, filepaths to behavior classes should be cached in class.paths.php also
Closes #2345, ability to group components into subfolders
Closes #2645, Improvement to basic.php for class loading.
Fixes #3526, Cache::write, when using just the config name, it fails.
Fixes #3559, loading plugin model as assoc don't work.
Closes #3567 Controller Folders (Note this does not need routing to work, but controller names can not conflict with others in the same application so naming must still be unique)
Fixes #3579, email.php component: Parse error with php 4.
Adding new class and file importer.
Updated most of the core to use the importer.
Added ClassRegsitry::init() that will create and instance of an object and store it in the registry.
Deprecated most of the load functions in basics.php
Plugin model loading now forces using the dot notation, to use models within a plugin, all the model associations must be in the PluginName.Model syntax, if this is not used, the plugin will look for the models in the main app/models directory first, if not found then it will search the plugin directories recursively until it finds a model.
var $belongsTo = array('SomeModel'); will look for some_model.php in the app/models
var $belongsTo = array('MyPlugin.SomeModel'); will look for some_model.php in my_plugin/models
var $belongsTo = array('MyPlugin.MyPlugin', 'SomeModel'); will used my_plugin/models/my_plugin.php and app/models/some_model.php
The controllers of the plugin will still look for the default models inside the plugin if var $uses is not set:
var $uses = array('SomeModel'); will look for some_model.php in the app/models
var $uses = array('MyPlugin.SomeModel'); will look for some_model.php in my_plugin/models
var $uses = array('MyPlugin.MyPlugin', 'SomeModel'); will used my_plugin/models/my_plugin.php and app/models/some_model.php
All of the above will work between plugins and main app
These changes also allow placing model and controllers is sub directories
Removed old class.paths.php file generation
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@6001 3807eeeb-6ff5-0310-8944-8be069107fe0
2007-11-16 09:35:19 +00:00
|
|
|
if (!$this->{$modelClass}) {
|
|
|
|
return $this->cakeError('missingModel', array(array('className' => $modelClass, 'webroot' => '', 'base' => $this->base)));
|
|
|
|
}
|
2006-05-26 05:29:17 +00:00
|
|
|
|
Closes #2119 Only define clone() in PHP4 when it hasn't been already defined.
Closes #2213, Support multiple plugin paths.
Closes #2234, filepaths to behavior classes should be cached in class.paths.php also
Closes #2345, ability to group components into subfolders
Closes #2645, Improvement to basic.php for class loading.
Fixes #3526, Cache::write, when using just the config name, it fails.
Fixes #3559, loading plugin model as assoc don't work.
Closes #3567 Controller Folders (Note this does not need routing to work, but controller names can not conflict with others in the same application so naming must still be unique)
Fixes #3579, email.php component: Parse error with php 4.
Adding new class and file importer.
Updated most of the core to use the importer.
Added ClassRegsitry::init() that will create and instance of an object and store it in the registry.
Deprecated most of the load functions in basics.php
Plugin model loading now forces using the dot notation, to use models within a plugin, all the model associations must be in the PluginName.Model syntax, if this is not used, the plugin will look for the models in the main app/models directory first, if not found then it will search the plugin directories recursively until it finds a model.
var $belongsTo = array('SomeModel'); will look for some_model.php in the app/models
var $belongsTo = array('MyPlugin.SomeModel'); will look for some_model.php in my_plugin/models
var $belongsTo = array('MyPlugin.MyPlugin', 'SomeModel'); will used my_plugin/models/my_plugin.php and app/models/some_model.php
The controllers of the plugin will still look for the default models inside the plugin if var $uses is not set:
var $uses = array('SomeModel'); will look for some_model.php in the app/models
var $uses = array('MyPlugin.SomeModel'); will look for some_model.php in my_plugin/models
var $uses = array('MyPlugin.MyPlugin', 'SomeModel'); will used my_plugin/models/my_plugin.php and app/models/some_model.php
All of the above will work between plugins and main app
These changes also allow placing model and controllers is sub directories
Removed old class.paths.php file generation
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@6001 3807eeeb-6ff5-0310-8944-8be069107fe0
2007-11-16 09:35:19 +00:00
|
|
|
if ($this->persistModel === true) {
|
|
|
|
$this->_persist($modelClass, true, $model);
|
|
|
|
$registry = ClassRegistry::getInstance();
|
|
|
|
$this->_persist($modelClass . 'registry', true, $registry->__objects, 'registry');
|
2006-05-26 05:29:17 +00:00
|
|
|
}
|
2007-08-30 00:19:07 +00:00
|
|
|
} else {
|
Closes #2119 Only define clone() in PHP4 when it hasn't been already defined.
Closes #2213, Support multiple plugin paths.
Closes #2234, filepaths to behavior classes should be cached in class.paths.php also
Closes #2345, ability to group components into subfolders
Closes #2645, Improvement to basic.php for class loading.
Fixes #3526, Cache::write, when using just the config name, it fails.
Fixes #3559, loading plugin model as assoc don't work.
Closes #3567 Controller Folders (Note this does not need routing to work, but controller names can not conflict with others in the same application so naming must still be unique)
Fixes #3579, email.php component: Parse error with php 4.
Adding new class and file importer.
Updated most of the core to use the importer.
Added ClassRegsitry::init() that will create and instance of an object and store it in the registry.
Deprecated most of the load functions in basics.php
Plugin model loading now forces using the dot notation, to use models within a plugin, all the model associations must be in the PluginName.Model syntax, if this is not used, the plugin will look for the models in the main app/models directory first, if not found then it will search the plugin directories recursively until it finds a model.
var $belongsTo = array('SomeModel'); will look for some_model.php in the app/models
var $belongsTo = array('MyPlugin.SomeModel'); will look for some_model.php in my_plugin/models
var $belongsTo = array('MyPlugin.MyPlugin', 'SomeModel'); will used my_plugin/models/my_plugin.php and app/models/some_model.php
The controllers of the plugin will still look for the default models inside the plugin if var $uses is not set:
var $uses = array('SomeModel'); will look for some_model.php in the app/models
var $uses = array('MyPlugin.SomeModel'); will look for some_model.php in my_plugin/models
var $uses = array('MyPlugin.MyPlugin', 'SomeModel'); will used my_plugin/models/my_plugin.php and app/models/some_model.php
All of the above will work between plugins and main app
These changes also allow placing model and controllers is sub directories
Removed old class.paths.php file generation
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@6001 3807eeeb-6ff5-0310-8944-8be069107fe0
2007-11-16 09:35:19 +00:00
|
|
|
$this->_persist($modelClass . 'registry', true, $object, 'registry');
|
|
|
|
$this->_persist($modelClass, true, $object);
|
|
|
|
$this->modelNames[] = $modelClass;
|
2006-05-26 05:29:17 +00:00
|
|
|
}
|
|
|
|
}
|
2005-12-22 01:07:28 +00:00
|
|
|
/**
|
2006-11-28 11:18:05 +00:00
|
|
|
* Redirects to given $url, after turning off $this->autoRender.
|
|
|
|
* Please notice that the script execution is not stopped after the redirect.
|
2005-12-22 01:07:28 +00:00
|
|
|
*
|
2006-12-08 08:36:36 +00:00
|
|
|
* @param mixed $url A string or array-based URL pointing to another location
|
|
|
|
* within the app, or an absolute URL
|
2007-10-30 17:21:23 +00:00
|
|
|
* @param integer $status Optional HTTP status code (eg: 404)
|
2007-10-22 16:54:36 +00:00
|
|
|
* @param boolean $exit If true, exit() will be called after the redirect
|
2006-11-28 11:18:05 +00:00
|
|
|
* @access public
|
2005-12-22 01:07:28 +00:00
|
|
|
*/
|
2007-12-23 01:17:48 +00:00
|
|
|
function redirect($url, $status = null, $exit = true) {
|
2006-05-26 05:29:17 +00:00
|
|
|
$this->autoRender = false;
|
|
|
|
|
2006-12-08 08:36:36 +00:00
|
|
|
if (is_array($status)) {
|
|
|
|
extract($status, EXTR_OVERWRITE);
|
|
|
|
}
|
|
|
|
|
2007-09-21 17:04:23 +00:00
|
|
|
foreach ($this->components as $c) {
|
|
|
|
$path = preg_split('/\/|\./', $c);
|
|
|
|
$c = $path[count($path) - 1];
|
|
|
|
if (isset($this->{$c}) && is_object($this->{$c}) && is_callable(array($this->{$c}, 'beforeRedirect'))) {
|
|
|
|
if (!array_key_exists('enabled', get_object_vars($this->{$c})) || $this->{$c}->enabled == true) {
|
|
|
|
$resp = $this->{$c}->beforeRedirect($this, $url, $status, $exit);
|
|
|
|
if ($resp === false) {
|
|
|
|
return;
|
|
|
|
} elseif (is_array($resp) && isset($resp['url'])) {
|
|
|
|
extract($resp, EXTR_OVERWRITE);
|
|
|
|
} elseif ($resp !== null) {
|
|
|
|
$url = $resp;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-05-26 05:29:17 +00:00
|
|
|
if (function_exists('session_write_close')) {
|
|
|
|
session_write_close();
|
|
|
|
}
|
|
|
|
|
2007-02-02 03:54:25 +00:00
|
|
|
if (!empty($status)) {
|
2006-06-14 18:02:37 +00:00
|
|
|
$codes = array(
|
2006-10-20 17:24:37 +00:00
|
|
|
100 => "Continue",
|
|
|
|
101 => "Switching Protocols",
|
|
|
|
200 => "OK",
|
|
|
|
201 => "Created",
|
|
|
|
202 => "Accepted",
|
|
|
|
203 => "Non-Authoritative Information",
|
|
|
|
204 => "No Content",
|
|
|
|
205 => "Reset Content",
|
|
|
|
206 => "Partial Content",
|
|
|
|
300 => "Multiple Choices",
|
|
|
|
301 => "Moved Permanently",
|
|
|
|
302 => "Found",
|
|
|
|
303 => "See Other",
|
|
|
|
304 => "Not Modified",
|
|
|
|
305 => "Use Proxy",
|
|
|
|
307 => "Temporary Redirect",
|
|
|
|
400 => "Bad Request",
|
|
|
|
401 => "Unauthorized",
|
|
|
|
402 => "Payment Required",
|
|
|
|
403 => "Forbidden",
|
|
|
|
404 => "Not Found",
|
|
|
|
405 => "Method Not Allowed",
|
|
|
|
406 => "Not Acceptable",
|
|
|
|
407 => "Proxy Authentication Required",
|
|
|
|
408 => "Request Time-out",
|
|
|
|
409 => "Conflict",
|
|
|
|
410 => "Gone",
|
|
|
|
411 => "Length Required",
|
|
|
|
412 => "Precondition Failed",
|
|
|
|
413 => "Request Entity Too Large",
|
|
|
|
414 => "Request-URI Too Large",
|
|
|
|
415 => "Unsupported Media Type",
|
|
|
|
416 => "Requested range not satisfiable",
|
|
|
|
417 => "Expectation Failed",
|
|
|
|
500 => "Internal Server Error",
|
|
|
|
501 => "Not Implemented",
|
|
|
|
502 => "Bad Gateway",
|
|
|
|
503 => "Service Unavailable",
|
2007-02-02 03:54:25 +00:00
|
|
|
504 => "Gateway Time-out"
|
|
|
|
);
|
|
|
|
if (is_string($status)) {
|
|
|
|
$codes = array_combine(array_values($codes), array_keys($codes));
|
|
|
|
}
|
2006-05-26 05:29:17 +00:00
|
|
|
if (isset($codes[$status])) {
|
2007-02-02 03:54:25 +00:00
|
|
|
$code = ife(is_numeric($status), $status, $codes[$status]);
|
|
|
|
$msg = ife(is_string($status), $status, $codes[$status]);
|
|
|
|
$status = "HTTP/1.1 {$code} {$msg}";
|
|
|
|
} else {
|
|
|
|
$status = null;
|
2006-05-26 05:29:17 +00:00
|
|
|
}
|
|
|
|
}
|
2007-02-02 03:54:25 +00:00
|
|
|
if (!empty($status)) {
|
|
|
|
header($status);
|
|
|
|
}
|
2007-02-01 07:06:40 +00:00
|
|
|
if ($url !== null) {
|
|
|
|
header('Location: ' . Router::url($url, true));
|
|
|
|
}
|
2007-11-09 02:34:00 +00:00
|
|
|
if (!empty($status) && ($status >= 300 && $status < 400)) {
|
2007-02-02 03:54:25 +00:00
|
|
|
header($status);
|
|
|
|
}
|
2006-12-08 08:36:36 +00:00
|
|
|
if ($exit) {
|
|
|
|
exit();
|
|
|
|
}
|
2006-05-26 05:29:17 +00:00
|
|
|
}
|
2005-12-22 01:07:28 +00:00
|
|
|
/**
|
|
|
|
* Saves a variable to use inside a template.
|
|
|
|
*
|
|
|
|
* @param mixed $one A string or an array of data.
|
2006-08-12 13:06:21 +00:00
|
|
|
* @param mixed $two Value in case $one is a string (which then works as the key).
|
|
|
|
* Unused if $one is an associative array, otherwise serves as the values to $one's keys.
|
2007-10-21 22:49:53 +00:00
|
|
|
* @access public
|
2005-12-22 01:07:28 +00:00
|
|
|
*/
|
2006-05-26 05:29:17 +00:00
|
|
|
function set($one, $two = null) {
|
2006-08-18 07:58:10 +00:00
|
|
|
$data = array();
|
|
|
|
|
2006-05-26 05:29:17 +00:00
|
|
|
if (is_array($one)) {
|
|
|
|
if (is_array($two)) {
|
2006-08-18 07:58:10 +00:00
|
|
|
$data = array_combine($one, $two);
|
2006-05-26 05:29:17 +00:00
|
|
|
} else {
|
2006-08-18 07:58:10 +00:00
|
|
|
$data = $one;
|
2006-05-26 05:29:17 +00:00
|
|
|
}
|
|
|
|
} else {
|
2006-08-18 07:58:10 +00:00
|
|
|
$data = array($one => $two);
|
|
|
|
}
|
|
|
|
|
2007-06-20 06:15:35 +00:00
|
|
|
foreach ($data as $name => $value) {
|
2006-08-18 07:58:10 +00:00
|
|
|
if ($name == 'title') {
|
|
|
|
$this->pageTitle = $value;
|
|
|
|
} else {
|
2007-06-20 06:15:35 +00:00
|
|
|
if ($two === null) {
|
2007-06-01 23:04:41 +00:00
|
|
|
$this->viewVars[Inflector::variable($name)] = $value;
|
|
|
|
} else {
|
|
|
|
$this->viewVars[$name] = $value;
|
|
|
|
}
|
2006-08-18 07:58:10 +00:00
|
|
|
}
|
2006-05-26 05:29:17 +00:00
|
|
|
}
|
|
|
|
}
|
2005-12-22 01:07:28 +00:00
|
|
|
/**
|
2007-10-30 17:21:23 +00:00
|
|
|
* Internally redirects one action to another. Examples:
|
|
|
|
*
|
|
|
|
* setAction('another_action');
|
|
|
|
* setAction('action_with_parameters', $parameter1);
|
2005-12-22 01:07:28 +00:00
|
|
|
*
|
2006-08-18 07:58:10 +00:00
|
|
|
* @param string $action The new action to be redirected to
|
|
|
|
* @param mixed Any other parameters passed to this method will be passed as
|
|
|
|
* parameters to the new action.
|
2007-10-21 22:49:53 +00:00
|
|
|
* @access public
|
2005-12-22 01:07:28 +00:00
|
|
|
*/
|
2006-05-26 05:29:17 +00:00
|
|
|
function setAction($action) {
|
|
|
|
$this->action = $action;
|
|
|
|
$args = func_get_args();
|
|
|
|
unset($args[0]);
|
|
|
|
call_user_func_array(array(&$this, $action), $args);
|
|
|
|
}
|
2007-07-08 21:01:31 +00:00
|
|
|
/**
|
2007-10-30 17:21:23 +00:00
|
|
|
* Controller callback to tie into Auth component.
|
2007-07-08 21:01:31 +00:00
|
|
|
*
|
2007-10-30 17:21:23 +00:00
|
|
|
* @return bool true if authorized, false otherwise
|
2007-10-21 22:49:53 +00:00
|
|
|
* @access public
|
2007-07-08 21:01:31 +00:00
|
|
|
*/
|
|
|
|
function isAuthorized() {
|
2007-10-20 05:55:37 +00:00
|
|
|
trigger_error(sprintf(__('%s::isAuthorized() is not defined.', true), $this->name), E_USER_WARNING);
|
2007-07-08 21:01:31 +00:00
|
|
|
return false;
|
|
|
|
}
|
2005-12-22 01:07:28 +00:00
|
|
|
/**
|
|
|
|
* Returns number of errors in a submitted FORM.
|
|
|
|
*
|
2007-10-22 16:54:36 +00:00
|
|
|
* @return integer Number of errors
|
2007-10-21 22:49:53 +00:00
|
|
|
* @access public
|
2005-12-22 01:07:28 +00:00
|
|
|
*/
|
2006-05-26 05:29:17 +00:00
|
|
|
function validate() {
|
|
|
|
$args = func_get_args();
|
|
|
|
$errors = call_user_func_array(array(&$this, 'validateErrors'), $args);
|
2005-08-21 06:49:02 +00:00
|
|
|
|
2006-05-26 05:29:17 +00:00
|
|
|
if ($errors === false) {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
return count($errors);
|
|
|
|
}
|
2005-12-22 01:07:28 +00:00
|
|
|
/**
|
2007-10-30 17:21:23 +00:00
|
|
|
* Validates models passed by parameters. Example:
|
2005-12-22 01:07:28 +00:00
|
|
|
*
|
2007-10-30 17:21:23 +00:00
|
|
|
* $errors = $this->validateErrors($this->Article, $this->User);
|
|
|
|
*
|
|
|
|
* @param mixed A list of models as a variable argument
|
|
|
|
* @return array Validation errors, or false if none
|
2007-10-21 22:49:53 +00:00
|
|
|
* @access public
|
2005-12-22 01:07:28 +00:00
|
|
|
*/
|
2006-05-26 05:29:17 +00:00
|
|
|
function validateErrors() {
|
|
|
|
$objects = func_get_args();
|
|
|
|
if (!count($objects)) {
|
|
|
|
return false;
|
|
|
|
}
|
2005-08-21 06:49:02 +00:00
|
|
|
|
2006-05-26 05:29:17 +00:00
|
|
|
$errors = array();
|
2007-06-20 06:15:35 +00:00
|
|
|
foreach ($objects as $object) {
|
2007-10-27 01:32:17 +00:00
|
|
|
$this->{$object->alias}->set($object->data);
|
|
|
|
$errors = array_merge($errors, $this->{$object->alias}->invalidFields());
|
2006-05-26 05:29:17 +00:00
|
|
|
}
|
|
|
|
return $this->validationErrors = (count($errors) ? $errors : false);
|
|
|
|
}
|
2005-12-22 01:07:28 +00:00
|
|
|
/**
|
|
|
|
* Gets an instance of the view object & prepares it for rendering the output, then
|
|
|
|
* asks the view to actualy do the job.
|
|
|
|
*
|
2007-10-21 22:49:53 +00:00
|
|
|
* @param string $action Action name to render
|
|
|
|
* @param string $layout Layout to use
|
|
|
|
* @param string $file File to use for rendering
|
2007-10-22 16:09:35 +00:00
|
|
|
* @return boolean Success
|
2007-10-21 22:49:53 +00:00
|
|
|
* @access public
|
2005-12-22 01:07:28 +00:00
|
|
|
*/
|
2006-05-26 05:29:17 +00:00
|
|
|
function render($action = null, $layout = null, $file = null) {
|
2007-05-25 05:41:07 +00:00
|
|
|
$this->beforeRender();
|
2007-05-27 00:38:10 +00:00
|
|
|
|
2006-06-14 18:02:37 +00:00
|
|
|
$viewClass = $this->view;
|
2006-05-26 05:29:17 +00:00
|
|
|
if ($this->view != 'View') {
|
2007-06-20 07:51:52 +00:00
|
|
|
if (strpos($viewClass, '.') !== false) {
|
2007-05-27 19:54:36 +00:00
|
|
|
list($plugin, $viewClass) = explode('.', $viewClass);
|
|
|
|
}
|
|
|
|
$viewClass = $viewClass . 'View';
|
2007-11-19 16:39:14 +00:00
|
|
|
App::import('View', $this->view);
|
2006-05-26 05:29:17 +00:00
|
|
|
}
|
2007-05-23 18:24:22 +00:00
|
|
|
|
2007-06-20 06:15:35 +00:00
|
|
|
foreach ($this->components as $c) {
|
2007-05-23 18:24:22 +00:00
|
|
|
$path = preg_split('/\/|\./', $c);
|
|
|
|
$c = $path[count($path) - 1];
|
|
|
|
if (isset($this->{$c}) && is_object($this->{$c}) && is_callable(array($this->{$c}, 'beforeRender'))) {
|
|
|
|
if (!array_key_exists('enabled', get_object_vars($this->{$c})) || $this->{$c}->enabled == true) {
|
|
|
|
$this->{$c}->beforeRender($this);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2006-11-27 04:45:03 +00:00
|
|
|
$this->params['models'] = $this->modelNames;
|
2006-05-26 05:29:17 +00:00
|
|
|
|
2007-08-14 18:46:22 +00:00
|
|
|
if (Configure::read() > 2) {
|
|
|
|
$this->set('cakeDebug', $this);
|
|
|
|
}
|
|
|
|
|
2006-11-28 11:18:05 +00:00
|
|
|
$this->__viewClass =& new $viewClass($this);
|
2006-05-26 05:29:17 +00:00
|
|
|
if (!empty($this->modelNames)) {
|
2007-04-29 20:51:59 +00:00
|
|
|
$models = array();
|
2007-06-20 06:15:35 +00:00
|
|
|
foreach ($this->modelNames as $currentModel) {
|
2007-04-29 20:51:59 +00:00
|
|
|
if (isset($this->$currentModel) && is_a($this->$currentModel, 'Model')) {
|
|
|
|
$models[] = Inflector::underscore($currentModel);
|
|
|
|
}
|
|
|
|
if (isset($this->$currentModel) && is_a($this->$currentModel, 'Model') && !empty($this->$currentModel->validationErrors)) {
|
|
|
|
$this->__viewClass->validationErrors[Inflector::camelize($currentModel)] =& $this->$currentModel->validationErrors;
|
|
|
|
}
|
|
|
|
}
|
2007-04-30 09:32:51 +00:00
|
|
|
$models = array_diff(ClassRegistry::keys(), $models);
|
2007-06-20 06:15:35 +00:00
|
|
|
foreach ($models as $currentModel) {
|
2007-04-27 20:16:38 +00:00
|
|
|
if (ClassRegistry::isKeySet($currentModel)) {
|
|
|
|
$currentObject =& ClassRegistry::getObject($currentModel);
|
2007-06-20 06:15:35 +00:00
|
|
|
if (is_a($currentObject, 'Model') && !empty($currentObject->validationErrors)) {
|
2007-04-27 20:16:38 +00:00
|
|
|
$this->__viewClass->validationErrors[Inflector::camelize($currentModel)] =& $currentObject->validationErrors;
|
|
|
|
}
|
2006-05-26 05:29:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2006-11-26 20:43:54 +00:00
|
|
|
|
2006-06-14 18:02:37 +00:00
|
|
|
$this->autoRender = false;
|
2006-11-28 11:18:05 +00:00
|
|
|
return $this->__viewClass->render($action, $layout, $file);
|
2006-05-26 05:29:17 +00:00
|
|
|
}
|
2006-01-25 22:40:17 +00:00
|
|
|
/**
|
|
|
|
* Gets the referring URL of this request
|
|
|
|
*
|
|
|
|
* @param string $default Default URL to use if HTTP_REFERER cannot be read from headers
|
2007-10-22 16:54:36 +00:00
|
|
|
* @param boolean $local If true, restrict referring URLs to local server
|
2007-10-21 22:49:53 +00:00
|
|
|
* @return string Referring URL
|
2006-01-25 22:40:17 +00:00
|
|
|
* @access public
|
|
|
|
*/
|
2006-05-26 05:29:17 +00:00
|
|
|
function referer($default = null, $local = false) {
|
|
|
|
$ref = env('HTTP_REFERER');
|
2007-08-15 18:05:28 +00:00
|
|
|
if (!empty($ref) && defined('FULL_BASE_URL')) {
|
|
|
|
$base = FULL_BASE_URL . $this->webroot;
|
2006-05-26 05:29:17 +00:00
|
|
|
if (strpos($ref, $base) === 0) {
|
|
|
|
return substr($ref, strlen($base) - 1);
|
2007-06-20 06:15:35 +00:00
|
|
|
} elseif (!$local) {
|
2006-05-26 05:29:17 +00:00
|
|
|
return $ref;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($default != null) {
|
|
|
|
return $default;
|
|
|
|
} else {
|
|
|
|
return '/';
|
|
|
|
}
|
|
|
|
}
|
2006-08-29 19:09:35 +00:00
|
|
|
/**
|
2007-10-21 22:49:53 +00:00
|
|
|
* Tells the browser not to cache the results of the current request by sending headers
|
2006-08-29 19:09:35 +00:00
|
|
|
*
|
|
|
|
* @access public
|
|
|
|
*/
|
|
|
|
function disableCache() {
|
|
|
|
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
|
|
|
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
|
|
|
|
header("Cache-Control: no-store, no-cache, must-revalidate");
|
|
|
|
header("Cache-Control: post-check=0, pre-check=0", false);
|
|
|
|
header("Pragma: no-cache");
|
|
|
|
}
|
2005-12-22 01:07:28 +00:00
|
|
|
/**
|
|
|
|
* Shows a message to the user $time seconds, then redirects to $url
|
|
|
|
* Uses flash.thtml as a layout for the messages
|
|
|
|
*
|
|
|
|
* @param string $message Message to display to the user
|
|
|
|
* @param string $url Relative URL to redirect to after the time expires
|
2007-10-22 16:11:12 +00:00
|
|
|
* @param integer $time Time to show the message
|
2007-10-21 22:49:53 +00:00
|
|
|
* @access public
|
2005-12-22 01:07:28 +00:00
|
|
|
*/
|
2006-05-26 05:29:17 +00:00
|
|
|
function flash($message, $url, $pause = 1) {
|
|
|
|
$this->autoRender = false;
|
2006-12-23 20:31:06 +00:00
|
|
|
$this->set('url', Router::url($url));
|
2006-05-26 05:29:17 +00:00
|
|
|
$this->set('message', $message);
|
|
|
|
$this->set('pause', $pause);
|
|
|
|
$this->set('page_title', $message);
|
2007-12-20 01:19:19 +00:00
|
|
|
$this->render(false, 'flash');
|
2006-05-26 05:29:17 +00:00
|
|
|
}
|
2006-03-14 02:26:08 +00:00
|
|
|
/**
|
|
|
|
* Converts POST'ed model data to a model conditions array, suitable for a find
|
|
|
|
* or findAll Model query
|
|
|
|
*
|
|
|
|
* @param array $data POST'ed data organized by model and field
|
2006-06-17 14:10:01 +00:00
|
|
|
* @param mixed $op A string containing an SQL comparison operator, or an array matching operators to fields
|
|
|
|
* @param string $bool SQL boolean operator: AND, OR, XOR, etc.
|
2007-10-22 16:54:36 +00:00
|
|
|
* @param boolean $exclusive If true, and $op is an array, fields not included in $op will not be included in the returned conditions
|
2006-03-14 02:26:08 +00:00
|
|
|
* @return array An array of model conditions
|
2007-10-21 22:49:53 +00:00
|
|
|
* @access public
|
2006-03-14 02:26:08 +00:00
|
|
|
*/
|
2006-09-10 17:08:53 +00:00
|
|
|
function postConditions($data = array(), $op = null, $bool = 'AND', $exclusive = false) {
|
2007-06-23 08:24:26 +00:00
|
|
|
if (!is_array($data) || empty($data)) {
|
|
|
|
if (!empty($this->data)) {
|
|
|
|
$data = $this->data;
|
|
|
|
} else {
|
|
|
|
return null;
|
|
|
|
}
|
2006-05-26 05:29:17 +00:00
|
|
|
}
|
2006-06-17 14:10:01 +00:00
|
|
|
$cond = array();
|
2007-06-23 08:24:26 +00:00
|
|
|
|
2006-09-10 17:08:53 +00:00
|
|
|
if ($op === null) {
|
|
|
|
$op = '';
|
|
|
|
}
|
2006-03-14 02:26:08 +00:00
|
|
|
|
2007-06-20 06:15:35 +00:00
|
|
|
foreach ($data as $model => $fields) {
|
|
|
|
foreach ($fields as $field => $value) {
|
2006-06-17 14:10:01 +00:00
|
|
|
$key = $model . '.' . $field;
|
|
|
|
if (is_string($op)) {
|
|
|
|
$cond[$key] = $this->__postConditionMatch($op, $value);
|
|
|
|
} elseif (is_array($op)) {
|
|
|
|
$opFields = array_keys($op);
|
|
|
|
if (in_array($key, $opFields) || in_array($field, $opFields)) {
|
|
|
|
if (in_array($key, $opFields)) {
|
|
|
|
$cond[$key] = $this->__postConditionMatch($op[$key], $value);
|
|
|
|
} else {
|
|
|
|
$cond[$key] = $this->__postConditionMatch($op[$field], $value);
|
|
|
|
}
|
|
|
|
} elseif (!$exclusive) {
|
|
|
|
$cond[$key] = $this->__postConditionMatch(null, $value);
|
|
|
|
}
|
|
|
|
}
|
2006-05-26 05:29:17 +00:00
|
|
|
}
|
|
|
|
}
|
2007-12-08 06:08:03 +00:00
|
|
|
if ($bool != null && strtoupper($bool) != 'AND') {
|
2006-06-17 14:10:01 +00:00
|
|
|
$cond = array($bool => $cond);
|
|
|
|
}
|
|
|
|
return $cond;
|
|
|
|
}
|
|
|
|
/**
|
2007-10-21 22:49:53 +00:00
|
|
|
* Builds a matching condition using the specified operator and value, used by postConditions
|
2006-06-17 14:10:01 +00:00
|
|
|
*
|
2007-10-21 22:49:53 +00:00
|
|
|
* @param mixed $op A string containing an SQL comparison operator, or an array matching operators to fields
|
|
|
|
* @param string $value Value to check against
|
|
|
|
* @access private
|
2006-06-17 14:10:01 +00:00
|
|
|
*/
|
|
|
|
function __postConditionMatch($op, $value) {
|
|
|
|
if (is_string($op)) {
|
2007-12-08 06:08:03 +00:00
|
|
|
$op = strtoupper(trim($op));
|
2006-06-17 14:10:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
switch($op) {
|
|
|
|
case '':
|
|
|
|
case '=':
|
|
|
|
case null:
|
|
|
|
return $value;
|
|
|
|
break;
|
|
|
|
case 'LIKE':
|
|
|
|
return 'LIKE %' . $value . '%';
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
return $op . ' ' . $value;
|
|
|
|
break;
|
|
|
|
}
|
2006-05-26 05:29:17 +00:00
|
|
|
}
|
2006-02-23 11:40:52 +00:00
|
|
|
/**
|
2007-11-09 02:34:00 +00:00
|
|
|
* Deprecated, see Model::deconstruct();
|
2006-02-23 11:40:52 +00:00
|
|
|
*
|
2007-11-09 02:34:00 +00:00
|
|
|
* @see Model::deconstruct()
|
|
|
|
* @deprecated as of 1.2.0.5970
|
2006-02-23 11:40:52 +00:00
|
|
|
*/
|
2007-11-09 02:34:00 +00:00
|
|
|
function cleanUpFields($modelClass = null) {}
|
2006-08-08 17:33:57 +00:00
|
|
|
/**
|
2007-10-21 22:49:53 +00:00
|
|
|
* Handles automatic pagination of model records.
|
2006-08-08 17:33:57 +00:00
|
|
|
*
|
2007-10-21 22:49:53 +00:00
|
|
|
* @param mixed $object Model to paginate (e.g: model instance, or 'Model', or 'Model.InnerModel')
|
|
|
|
* @param mixed $scope Conditions to use while paginating
|
2007-10-30 17:21:23 +00:00
|
|
|
* @param array $whitelist List of allowed options for paging
|
2006-08-08 17:33:57 +00:00
|
|
|
* @return array Model query results
|
2007-10-21 22:49:53 +00:00
|
|
|
* @access public
|
2006-08-08 17:33:57 +00:00
|
|
|
*/
|
2006-09-28 20:29:04 +00:00
|
|
|
function paginate($object = null, $scope = array(), $whitelist = array()) {
|
|
|
|
if (is_array($object)) {
|
|
|
|
$whitelist = $scope;
|
|
|
|
$scope = $object;
|
|
|
|
$object = null;
|
2006-08-08 17:33:57 +00:00
|
|
|
}
|
2007-08-14 18:46:22 +00:00
|
|
|
$assoc = null;
|
2006-08-08 17:33:57 +00:00
|
|
|
|
2007-12-02 22:58:23 +00:00
|
|
|
if (is_string($object)) {
|
|
|
|
$assoc = null;
|
|
|
|
|
|
|
|
if (strpos($object, '.') !== false) {
|
|
|
|
list($object, $assoc) = explode('.', $object);
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($assoc && isset($this->{$object}->{$assoc})) {
|
|
|
|
$object = $this->{$object}->{$assoc};
|
|
|
|
} elseif ($assoc && isset($this->{$this->modelClass}) && isset($this->{$this->modelClass}->{$assoc})) {
|
|
|
|
$object = $this->{$this->modelClass}->{$assoc};
|
|
|
|
} elseif (isset($this->{$object})) {
|
2006-08-08 17:33:57 +00:00
|
|
|
$object = $this->{$object};
|
2006-09-28 20:29:04 +00:00
|
|
|
} elseif (isset($this->{$this->modelClass}) && isset($this->{$this->modelClass}->{$object})) {
|
2006-08-08 17:33:57 +00:00
|
|
|
$object = $this->{$this->modelClass}->{$object};
|
2007-08-14 18:46:22 +00:00
|
|
|
}
|
2006-08-08 17:33:57 +00:00
|
|
|
} elseif (empty($object) || $object == null) {
|
2006-09-28 20:29:04 +00:00
|
|
|
if (isset($this->{$this->modelClass})) {
|
2006-08-08 17:33:57 +00:00
|
|
|
$object = $this->{$this->modelClass};
|
2006-09-28 20:29:04 +00:00
|
|
|
} else {
|
2007-12-02 22:58:23 +00:00
|
|
|
$className = null;
|
2007-12-02 23:03:13 +00:00
|
|
|
$name = $this->uses[0];
|
2007-11-30 22:27:43 +00:00
|
|
|
if (strpos($this->uses[0], '.') !== false) {
|
2007-12-02 22:58:23 +00:00
|
|
|
list($name, $className) = explode('.', $this->uses[0]);
|
|
|
|
}
|
|
|
|
if ($className) {
|
2007-11-30 22:27:43 +00:00
|
|
|
$object = $this->{$className};
|
|
|
|
} else {
|
2007-12-02 22:58:23 +00:00
|
|
|
$object = $this->{$name};
|
2007-11-30 22:27:43 +00:00
|
|
|
}
|
2006-08-08 17:33:57 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-09-28 20:29:04 +00:00
|
|
|
if (!is_object($object)) {
|
2007-11-23 08:16:23 +00:00
|
|
|
trigger_error(sprintf(__('Controller::paginate() - can\'t find model %1$s in controller %2$sController', true), $object, $this->name), E_USER_WARNING);
|
2006-09-28 20:29:04 +00:00
|
|
|
return array();
|
|
|
|
}
|
2007-12-08 06:08:03 +00:00
|
|
|
$options = array_merge($this->params, $this->params['url'], $this->passedArgs);
|
2007-10-27 01:32:17 +00:00
|
|
|
if (isset($this->paginate[$object->alias])) {
|
|
|
|
$defaults = $this->paginate[$object->alias];
|
2006-08-08 17:33:57 +00:00
|
|
|
} else {
|
|
|
|
$defaults = $this->paginate;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (isset($options['show'])) {
|
|
|
|
$options['limit'] = $options['show'];
|
|
|
|
}
|
2006-09-28 20:29:04 +00:00
|
|
|
|
2006-08-10 03:55:51 +00:00
|
|
|
if (isset($options['sort']) && isset($options['direction'])) {
|
|
|
|
$options['order'] = array($options['sort'] => $options['direction']);
|
2006-08-08 17:33:57 +00:00
|
|
|
} elseif (isset($options['sort'])) {
|
2007-01-05 21:46:28 +00:00
|
|
|
$options['order'] = array($options['sort'] => 'asc');
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!empty($options['order']) && is_array($options['order'])) {
|
|
|
|
$key = key($options['order']);
|
|
|
|
if (strpos($key, '.') === false && $object->hasField($key)) {
|
2007-10-27 01:32:17 +00:00
|
|
|
$options['order'][$object->alias . '.' . $key] = $options['order'][$key];
|
2007-01-05 21:46:28 +00:00
|
|
|
unset($options['order'][$key]);
|
|
|
|
}
|
2006-08-08 17:33:57 +00:00
|
|
|
}
|
|
|
|
|
2006-09-28 20:29:04 +00:00
|
|
|
$vars = array('fields', 'order', 'limit', 'page', 'recursive');
|
2006-08-08 17:33:57 +00:00
|
|
|
$keys = array_keys($options);
|
|
|
|
$count = count($keys);
|
2006-09-28 20:29:04 +00:00
|
|
|
|
2007-06-20 06:15:35 +00:00
|
|
|
for ($i = 0; $i < $count; $i++) {
|
2006-08-08 17:33:57 +00:00
|
|
|
if (!in_array($keys[$i], $vars)) {
|
|
|
|
unset($options[$keys[$i]]);
|
|
|
|
}
|
2006-09-28 20:29:04 +00:00
|
|
|
if (empty($whitelist) && ($keys[$i] == 'fields' || $keys[$i] == 'recursive')) {
|
|
|
|
unset($options[$keys[$i]]);
|
|
|
|
} elseif (!empty($whitelist) && !in_array($keys[$i], $whitelist)) {
|
|
|
|
unset($options[$keys[$i]]);
|
2006-08-08 17:33:57 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$conditions = $fields = $order = $limit = $page = $recursive = null;
|
2006-09-28 20:29:04 +00:00
|
|
|
if (!isset($defaults['conditions'])) {
|
|
|
|
$defaults['conditions'] = array();
|
2006-08-10 03:55:51 +00:00
|
|
|
}
|
|
|
|
|
2007-12-08 06:08:03 +00:00
|
|
|
extract($options = array_merge(array('page' => 1, 'limit' => 20), $defaults, $options));
|
2006-11-25 22:04:43 +00:00
|
|
|
if (is_array($scope) && !empty($scope)) {
|
2007-12-08 06:08:03 +00:00
|
|
|
$conditions = array_merge($conditions, $scope);
|
2006-11-25 22:04:43 +00:00
|
|
|
} elseif (is_string($scope)) {
|
2006-09-28 20:29:04 +00:00
|
|
|
$conditions = array($conditions, $scope);
|
|
|
|
}
|
2007-03-26 19:15:55 +00:00
|
|
|
$recursive = $object->recursive;
|
2007-06-05 19:14:28 +00:00
|
|
|
|
|
|
|
if (method_exists($object, 'paginateCount')) {
|
|
|
|
$count = $object->paginateCount($conditions, $recursive);
|
|
|
|
} else {
|
|
|
|
$count = $object->findCount($conditions, $recursive);
|
|
|
|
}
|
2007-09-30 19:30:48 +00:00
|
|
|
$pageCount = intval(ceil($count / $limit));
|
2007-03-25 03:02:10 +00:00
|
|
|
|
2007-11-22 02:51:21 +00:00
|
|
|
if ($page == 'last' || $page >= $pageCount) {
|
2007-03-25 02:03:34 +00:00
|
|
|
$options['page'] = $page = $pageCount;
|
2007-12-08 08:54:27 +00:00
|
|
|
} elseif (intval($page) < 1) {
|
|
|
|
$options['page'] = $page = 1;
|
2007-03-26 19:15:55 +00:00
|
|
|
}
|
2007-03-28 16:31:16 +00:00
|
|
|
|
2007-06-05 19:14:28 +00:00
|
|
|
if (method_exists($object, 'paginate')) {
|
|
|
|
$results = $object->paginate($conditions, $fields, $order, $limit, $page, $recursive);
|
|
|
|
} else {
|
|
|
|
$results = $object->findAll($conditions, $fields, $order, $limit, $page, $recursive);
|
|
|
|
}
|
2007-03-26 19:15:55 +00:00
|
|
|
$paging = array(
|
2006-12-30 06:12:29 +00:00
|
|
|
'page' => $page,
|
2006-09-28 20:29:04 +00:00
|
|
|
'current' => count($results),
|
|
|
|
'count' => $count,
|
|
|
|
'prevPage' => ($page > 1),
|
|
|
|
'nextPage' => ($count > ($page * $limit)),
|
2007-03-26 19:15:55 +00:00
|
|
|
'pageCount' => $pageCount,
|
2007-12-08 06:08:03 +00:00
|
|
|
'defaults' => array_merge(array('limit' => 20, 'step' => 1), $defaults),
|
2007-03-28 16:31:16 +00:00
|
|
|
'options' => $options
|
|
|
|
);
|
2007-03-26 19:15:55 +00:00
|
|
|
|
2007-10-27 01:32:17 +00:00
|
|
|
$this->params['paging'][$object->alias] = $paging;
|
2006-09-28 20:29:04 +00:00
|
|
|
|
2007-01-05 23:39:47 +00:00
|
|
|
if (!in_array('Paginator', $this->helpers) && !array_key_exists('Paginator', $this->helpers)) {
|
2006-09-28 20:29:04 +00:00
|
|
|
$this->helpers[] = 'Paginator';
|
|
|
|
}
|
2007-03-26 19:15:55 +00:00
|
|
|
|
2006-08-08 17:33:57 +00:00
|
|
|
return $results;
|
|
|
|
}
|
2006-02-02 11:48:29 +00:00
|
|
|
/**
|
2007-10-21 22:49:53 +00:00
|
|
|
* Called before the controller action. Overridden in subclasses.
|
2006-02-02 11:48:29 +00:00
|
|
|
*
|
2007-10-21 22:49:53 +00:00
|
|
|
* @access public
|
2006-02-02 11:48:29 +00:00
|
|
|
*/
|
2006-05-26 05:29:17 +00:00
|
|
|
function beforeFilter() {
|
|
|
|
}
|
2006-02-02 11:48:29 +00:00
|
|
|
/**
|
2007-10-21 22:49:53 +00:00
|
|
|
* Called after the controller action is run, but before the view is rendered. Overridden in subclasses.
|
2006-02-02 11:48:29 +00:00
|
|
|
*
|
2007-10-21 22:49:53 +00:00
|
|
|
* @access public
|
2006-02-02 11:48:29 +00:00
|
|
|
*/
|
2006-05-26 05:29:17 +00:00
|
|
|
function beforeRender() {
|
|
|
|
}
|
2006-02-02 11:48:29 +00:00
|
|
|
/**
|
2007-10-21 22:49:53 +00:00
|
|
|
* Called after the controller action is run and rendered. Overridden in subclasses.
|
2006-02-02 11:48:29 +00:00
|
|
|
*
|
2007-10-21 22:49:53 +00:00
|
|
|
* @access public
|
2006-02-02 11:48:29 +00:00
|
|
|
*/
|
2006-05-26 05:29:17 +00:00
|
|
|
function afterFilter() {
|
|
|
|
}
|
2006-02-23 11:40:52 +00:00
|
|
|
/**
|
|
|
|
* This method should be overridden in child classes.
|
|
|
|
*
|
|
|
|
* @param string $method name of method called example index, edit, etc.
|
2007-10-22 16:09:35 +00:00
|
|
|
* @return boolean Success
|
2007-10-21 22:49:53 +00:00
|
|
|
* @access protected
|
2006-02-23 11:40:52 +00:00
|
|
|
*/
|
2006-05-26 05:29:17 +00:00
|
|
|
function _beforeScaffold($method) {
|
|
|
|
return true;
|
|
|
|
}
|
2006-03-01 19:13:48 +00:00
|
|
|
/**
|
|
|
|
* This method should be overridden in child classes.
|
|
|
|
*
|
|
|
|
* @param string $method name of method called either edit or update.
|
2007-10-22 16:09:35 +00:00
|
|
|
* @return boolean Success
|
2007-10-21 22:49:53 +00:00
|
|
|
* @access protected
|
2006-03-01 19:13:48 +00:00
|
|
|
*/
|
2006-05-26 05:29:17 +00:00
|
|
|
function _afterScaffoldSave($method) {
|
|
|
|
return true;
|
|
|
|
}
|
2006-03-01 19:13:48 +00:00
|
|
|
/**
|
|
|
|
* This method should be overridden in child classes.
|
|
|
|
*
|
|
|
|
* @param string $method name of method called either edit or update.
|
2007-10-22 16:09:35 +00:00
|
|
|
* @return boolean Success
|
2007-10-21 22:49:53 +00:00
|
|
|
* @access protected
|
2006-03-01 19:13:48 +00:00
|
|
|
*/
|
2006-05-26 05:29:17 +00:00
|
|
|
function _afterScaffoldSaveError($method) {
|
|
|
|
return true;
|
|
|
|
}
|
2006-02-23 11:40:52 +00:00
|
|
|
/**
|
|
|
|
* This method should be overridden in child classes.
|
|
|
|
* If not it will render a scaffold error.
|
|
|
|
* Method MUST return true in child classes
|
|
|
|
*
|
|
|
|
* @param string $method name of method called example index, edit, etc.
|
2007-10-22 16:09:35 +00:00
|
|
|
* @return boolean Success
|
2007-10-21 22:49:53 +00:00
|
|
|
* @access protected
|
2006-02-23 11:40:52 +00:00
|
|
|
*/
|
2006-05-26 05:29:17 +00:00
|
|
|
function _scaffoldError($method) {
|
|
|
|
return false;
|
|
|
|
}
|
2006-01-12 02:10:47 +00:00
|
|
|
}
|
2007-05-03 04:35:25 +00:00
|
|
|
?>
|