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:
pies 2005-06-22 23:16:26 +00:00
parent 0535607f5a
commit 27d16ff9b9
7 changed files with 184 additions and 183 deletions

View file

@ -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.)

View file

@ -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');
}
/**

View file

@ -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;
}
}

View file

@ -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;
}
/**

View file

@ -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