mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-18 18:46:17 +00:00
I'm sorry, I've reversed two changes. I've changed the error views names to underscored, and I've changed the default DEBUG to 1.
The first one is for consistency (no UppperCase filenames, please), the second is because while I'm no enemy of application security, the application has to be safe _after_ it's written, not before. And to easily write an application, the developer should have the DEBUG mode set to 1 or 2. Other than that, I think it's a very good idea to put the tag generators in helpers :) git-svn-id: https://svn.cakephp.org/repo/trunk/cake@271 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
0535607f5a
commit
27d16ff9b9
7 changed files with 184 additions and 183 deletions
|
@ -22,7 +22,7 @@
|
|||
* - 1: development
|
||||
* - 2: full debug with sql
|
||||
*/
|
||||
define ('DEBUG', 0);
|
||||
define ('DEBUG', 1);
|
||||
|
||||
/**
|
||||
* Compress output CSS (removing comments, whitespace, repeating tags etc.)
|
||||
|
|
328
config/paths.php
328
config/paths.php
|
@ -1,164 +1,164 @@
|
|||
<?PHP
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// + $Id$
|
||||
// +------------------------------------------------------------------+ //
|
||||
// + Cake <https://developers.nextco.com/cake/> + //
|
||||
// + Copyright: (c) 2005, Cake Authors/Developers + //
|
||||
// +------------------------------------------------------------------+ //
|
||||
// + Licensed under The MIT License + //
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* In this file you set paths to different directories used by Cake.
|
||||
*
|
||||
* @package cake
|
||||
* @subpackage cake.config
|
||||
*/
|
||||
|
||||
/**
|
||||
* If the index.php file is used instead of an .htaccess file
|
||||
* or if the user can not set the web root to use the public
|
||||
* directory we will define ROOT there, otherwise we set it
|
||||
* here.
|
||||
*/
|
||||
if(!defined('ROOT'))
|
||||
{
|
||||
define ('ROOT', '../');
|
||||
}
|
||||
|
||||
/**
|
||||
* Path to the application's directory.
|
||||
*/
|
||||
define ('APP', ROOT.'app'.DS);
|
||||
|
||||
/**
|
||||
* Path to the application's models directory.
|
||||
*/
|
||||
define ('MODELS', APP.'models'.DS);
|
||||
|
||||
/**
|
||||
* Path to the application's controllers directory.
|
||||
*/
|
||||
define ('CONTROLLERS', APP.'controllers'.DS);
|
||||
|
||||
/**
|
||||
* Path to the application's helpers directory.
|
||||
*/
|
||||
define ('HELPERS', APP.'helpers'.DS);
|
||||
|
||||
/**
|
||||
* Path to the application's views directory.
|
||||
*/
|
||||
define ('VIEWS', APP.'views'.DS);
|
||||
|
||||
/**
|
||||
* Path to the application's view's layouts directory.
|
||||
*/
|
||||
define ('LAYOUTS', APP.'views'.DS.'layouts'.DS);
|
||||
|
||||
/**
|
||||
* Path to the application's view's elements directory.
|
||||
* It's supposed to hold pieces of PHP/HTML that are used on multiple pages
|
||||
* and are not linked to a particular layout (like polls, footers and so on).
|
||||
*/
|
||||
define ('ELEMENTS', APP.'views'.DS.'elements'.DS);
|
||||
|
||||
/**
|
||||
* Path to the configuration files directory.
|
||||
*/
|
||||
define ('CONFIGS', ROOT.'config'.DS);
|
||||
|
||||
/**
|
||||
* Path to the libs directory.
|
||||
*/
|
||||
define ('LIBS', ROOT.'libs'.DS);
|
||||
|
||||
/**
|
||||
* Path to the logs directory.
|
||||
*/
|
||||
define ('LOGS', ROOT.'logs'.DS);
|
||||
|
||||
/**
|
||||
* Path to the modules directory.
|
||||
*/
|
||||
define ('MODULES', ROOT.'modules'.DS);
|
||||
|
||||
/**
|
||||
* Path to the public directory.
|
||||
*/
|
||||
define ('WWW_ROOT', ROOT.'public'.DS);
|
||||
|
||||
/**
|
||||
* Path to the public directory.
|
||||
*/
|
||||
define ('CSS', WWW_ROOT.'css'.DS);
|
||||
|
||||
/**
|
||||
* Path to the scripts direcotry.
|
||||
*/
|
||||
define('SCRIPTS', ROOT.'scripts'.DS);
|
||||
|
||||
/**
|
||||
* Path to the tests directory.
|
||||
*/
|
||||
define ('TESTS', ROOT.'tests'.DS);
|
||||
|
||||
/**
|
||||
* Path to the controller test directory.
|
||||
*/
|
||||
define ('CONTROLLER_TESTS',TESTS.'app'.DS.'controllers'.DS);
|
||||
|
||||
/**
|
||||
* Path to the helpers test directory.
|
||||
*/
|
||||
define ('HELPER_TESTS', TESTS.'app'.DS.'helpers'.DS);
|
||||
|
||||
/**
|
||||
* Path to the models' test directory.
|
||||
*/
|
||||
define ('MODEL_TESTS', TESTS.'app'.DS.'models'.DS);
|
||||
|
||||
/**
|
||||
* Path to the lib test directory.
|
||||
*/
|
||||
define ('LIB_TESTS', TESTS.'libs'.DS);
|
||||
|
||||
/**
|
||||
* Path to the temporary files directory.
|
||||
*/
|
||||
define ('TMP', ROOT.'tmp'.DS);
|
||||
|
||||
/**
|
||||
* Path to the cache files directory. It can be shared between hosts in a multi-server setup.
|
||||
*/
|
||||
define('CACHE', TMP.'cache'.DS);
|
||||
|
||||
/**
|
||||
* Path to the vendors directory.
|
||||
*/
|
||||
define ('VENDORS', ROOT.'vendors'.DS);
|
||||
|
||||
/**
|
||||
* Path to the Pear directory
|
||||
* The purporse is to make it easy porting Pear libs into Cake
|
||||
* without setting the include_path PHP variable.
|
||||
*/
|
||||
define ('PEAR', VENDORS.'Pear'.DS);
|
||||
|
||||
|
||||
/**
|
||||
* Full url prefix
|
||||
*/
|
||||
define('FULL_BASE_URL', 'http://'.$_SERVER['HTTP_HOST']);
|
||||
|
||||
/**
|
||||
* Web path to the public images directory.
|
||||
*/
|
||||
define ('IMAGES_URL', '/img/');
|
||||
|
||||
/**
|
||||
* Web path to the CSS files directory.
|
||||
*/
|
||||
define ('CSS_URL', '/css/');
|
||||
|
||||
?>
|
||||
<?PHP
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// + $Id$
|
||||
// +------------------------------------------------------------------+ //
|
||||
// + Cake <https://developers.nextco.com/cake/> + //
|
||||
// + Copyright: (c) 2005, Cake Authors/Developers + //
|
||||
// +------------------------------------------------------------------+ //
|
||||
// + Licensed under The MIT License + //
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* In this file you set paths to different directories used by Cake.
|
||||
*
|
||||
* @package cake
|
||||
* @subpackage cake.config
|
||||
*/
|
||||
|
||||
/**
|
||||
* If the index.php file is used instead of an .htaccess file
|
||||
* or if the user can not set the web root to use the public
|
||||
* directory we will define ROOT there, otherwise we set it
|
||||
* here.
|
||||
*/
|
||||
if(!defined('ROOT'))
|
||||
{
|
||||
define ('ROOT', '../');
|
||||
}
|
||||
|
||||
/**
|
||||
* Path to the application's directory.
|
||||
*/
|
||||
define ('APP', ROOT.'app'.DS);
|
||||
|
||||
/**
|
||||
* Path to the application's models directory.
|
||||
*/
|
||||
define ('MODELS', APP.'models'.DS);
|
||||
|
||||
/**
|
||||
* Path to the application's controllers directory.
|
||||
*/
|
||||
define ('CONTROLLERS', APP.'controllers'.DS);
|
||||
|
||||
/**
|
||||
* Path to the application's helpers directory.
|
||||
*/
|
||||
define ('HELPERS', APP.'helpers'.DS);
|
||||
|
||||
/**
|
||||
* Path to the application's views directory.
|
||||
*/
|
||||
define ('VIEWS', APP.'views'.DS);
|
||||
|
||||
/**
|
||||
* Path to the application's view's layouts directory.
|
||||
*/
|
||||
define ('LAYOUTS', APP.'views'.DS.'layouts'.DS);
|
||||
|
||||
/**
|
||||
* Path to the application's view's elements directory.
|
||||
* It's supposed to hold pieces of PHP/HTML that are used on multiple pages
|
||||
* and are not linked to a particular layout (like polls, footers and so on).
|
||||
*/
|
||||
define ('ELEMENTS', APP.'views'.DS.'elements'.DS);
|
||||
|
||||
/**
|
||||
* Path to the configuration files directory.
|
||||
*/
|
||||
define ('CONFIGS', ROOT.'config'.DS);
|
||||
|
||||
/**
|
||||
* Path to the libs directory.
|
||||
*/
|
||||
define ('LIBS', ROOT.'libs'.DS);
|
||||
|
||||
/**
|
||||
* Path to the logs directory.
|
||||
*/
|
||||
define ('LOGS', ROOT.'logs'.DS);
|
||||
|
||||
/**
|
||||
* Path to the modules directory.
|
||||
*/
|
||||
define ('MODULES', ROOT.'modules'.DS);
|
||||
|
||||
/**
|
||||
* Path to the public directory.
|
||||
*/
|
||||
define ('WWW_ROOT', ROOT.'public'.DS);
|
||||
|
||||
/**
|
||||
* Path to the public directory.
|
||||
*/
|
||||
define ('CSS', WWW_ROOT.'css'.DS);
|
||||
|
||||
/**
|
||||
* Path to the scripts direcotry.
|
||||
*/
|
||||
define('SCRIPTS', ROOT.'scripts'.DS);
|
||||
|
||||
/**
|
||||
* Path to the tests directory.
|
||||
*/
|
||||
define ('TESTS', ROOT.'tests'.DS);
|
||||
|
||||
/**
|
||||
* Path to the controller test directory.
|
||||
*/
|
||||
define ('CONTROLLER_TESTS',TESTS.'app'.DS.'controllers'.DS);
|
||||
|
||||
/**
|
||||
* Path to the helpers test directory.
|
||||
*/
|
||||
define ('HELPER_TESTS', TESTS.'app'.DS.'helpers'.DS);
|
||||
|
||||
/**
|
||||
* Path to the models' test directory.
|
||||
*/
|
||||
define ('MODEL_TESTS', TESTS.'app'.DS.'models'.DS);
|
||||
|
||||
/**
|
||||
* Path to the lib test directory.
|
||||
*/
|
||||
define ('LIB_TESTS', TESTS.'libs'.DS);
|
||||
|
||||
/**
|
||||
* Path to the temporary files directory.
|
||||
*/
|
||||
define ('TMP', ROOT.'tmp'.DS);
|
||||
|
||||
/**
|
||||
* Path to the cache files directory. It can be shared between hosts in a multi-server setup.
|
||||
*/
|
||||
define('CACHE', TMP.'cache'.DS);
|
||||
|
||||
/**
|
||||
* Path to the vendors directory.
|
||||
*/
|
||||
define ('VENDORS', ROOT.'vendors'.DS);
|
||||
|
||||
/**
|
||||
* Path to the Pear directory
|
||||
* The purporse is to make it easy porting Pear libs into Cake
|
||||
* without setting the include_path PHP variable.
|
||||
*/
|
||||
define ('PEAR', VENDORS.'Pear'.DS);
|
||||
|
||||
|
||||
/**
|
||||
* Full url prefix
|
||||
*/
|
||||
define('FULL_BASE_URL', 'http://'.$_SERVER['HTTP_HOST']);
|
||||
|
||||
/**
|
||||
* Web path to the public images directory.
|
||||
*/
|
||||
define ('IMAGES_URL', '/img/');
|
||||
|
||||
/**
|
||||
* Web path to the CSS files directory.
|
||||
*/
|
||||
define ('CSS_URL', '/css/');
|
||||
|
||||
?>
|
||||
|
|
|
@ -102,6 +102,8 @@ class Controller extends Template
|
|||
*/
|
||||
function __construct ($params=null)
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
$this->params = $params;
|
||||
|
||||
$r = null;
|
||||
|
@ -140,26 +142,24 @@ class Controller extends Template
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
function missingController()
|
||||
{
|
||||
$this->autoRender = false;
|
||||
$this->render('../errors/missingController');
|
||||
$this->render('../errors/missing_controller');
|
||||
}
|
||||
|
||||
function missingAction()
|
||||
{
|
||||
$this->autoRender = false;
|
||||
$this->render('../errors/missingAction');
|
||||
$this->render('../errors/missing_action');
|
||||
}
|
||||
|
||||
function missingView()
|
||||
{
|
||||
$this->autoRender = false;
|
||||
$this->render('../errors/missingView');
|
||||
$this->render('../errors/missing_view');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -201,4 +201,4 @@ class Controller extends Template
|
|||
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
|
|
|
@ -200,7 +200,7 @@ class DBO_MySQL extends DBO
|
|||
*/
|
||||
function selectLimit ($limit, $offset=null)
|
||||
{
|
||||
return " LIMIT {$limit}".($offset? "{$offset}": null);
|
||||
return $limit? " LIMIT {$limit}".($offset? "{$offset}": null): null;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -333,12 +333,12 @@ class Model extends Object
|
|||
* @param string $conditions SQL conditions (defaults to NULL)
|
||||
* @return field contents
|
||||
*/
|
||||
function field ($name, $conditions=null)
|
||||
function field ($name, $conditions=null, $order=null)
|
||||
{
|
||||
if ($conditions)
|
||||
{
|
||||
$conditions = $this->parseConditions($conditions);
|
||||
$data = $this->find($conditions);
|
||||
$data = $this->find($conditions, $name, $order);
|
||||
return $data[$name];
|
||||
}
|
||||
elseif (isset($this->data[$name]))
|
||||
|
@ -497,9 +497,9 @@ class Model extends Object
|
|||
*
|
||||
* @return boolean True if such a record exists
|
||||
*/
|
||||
function hasAny ($sql_conditions = null)
|
||||
function hasAny ($conditions = null)
|
||||
{
|
||||
return $this->db->hasAny($this->table, $sql_conditions);
|
||||
return $this->findCount($conditions);
|
||||
}
|
||||
|
||||
|
||||
|
@ -508,11 +508,12 @@ class Model extends Object
|
|||
*
|
||||
* @param string $conditions SQL conditions
|
||||
* @param mixed $fields Either a single string of a field name, or an array of field names
|
||||
* @param string $order SQL ORDER BY conditions (e.g. "price DESC" or "name ASC")
|
||||
* @return array Array of records
|
||||
*/
|
||||
function find ($conditions = null, $fields = null)
|
||||
function find ($conditions = null, $fields = null, $order = null)
|
||||
{
|
||||
$data = $this->findAll($conditions, $fields, null, 1);
|
||||
$data = $this->findAll($conditions, $fields, $order, 1);
|
||||
return empty($data[0])? false: $data[0];
|
||||
}
|
||||
|
||||
|
@ -546,7 +547,7 @@ class Model extends Object
|
|||
*
|
||||
* @param mixed $conditions SQL conditions as a string or as an array('field'=>'value',...)
|
||||
* @param mixed $fields Either a single string of a field name, or an array of field names
|
||||
* @param string $order SQL ORDER BY conditions (e.g. "DESC" or "ASC")
|
||||
* @param string $order SQL ORDER BY conditions (e.g. "price DESC" or "name ASC")
|
||||
* @param int $limit SQL LIMIT clause, for calculating items per page
|
||||
* @param int $page Page number
|
||||
* @return array Array of records
|
||||
|
@ -613,8 +614,8 @@ class Model extends Object
|
|||
*/
|
||||
function findCount ($conditions)
|
||||
{
|
||||
list($data) = $this->findAll($conditions, 'COUNT(id) AS count');
|
||||
return $data['count'];
|
||||
list($data) = $this->findAll($conditions, 'COUNT(*) AS count');
|
||||
return isset($data['count'])? $data['count']: false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
uses('log');
|
||||
|
||||
/**
|
||||
* Object class, allowing __construct and __destruct.
|
||||
* Object class, allowing __construct and __destruct in PHP4.
|
||||
*
|
||||
* @package cake
|
||||
* @subpackage cake.libs
|
||||
|
|
|
@ -1290,4 +1290,4 @@ class Template extends Object
|
|||
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
|
|
Loading…
Add table
Reference in a new issue