mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-19 02:56:15 +00:00
Merging fixes and enhancements into trunk.
Revision: [2193] Adding fix for Ticket #471 Revision: [2192] Adding fix from Ticket #464. Revision: [2191] Adding fix for Ticket #461 Revision: [2190] Adding fix for array_merge_recursive() error when unbindModelis used Revision: [2189] merging changes made in model_php5.php Revision: [2188] Fixing controller so $viewPath can be set as a var Revision: [2186] Adding Security component Revision: [2185] Adding additional RequestHandler detection, form security authentication, and automagic view variable $data Revision: [2183] Fixing Ticket #473 Revision: [2182] Adding fix for Ticket #261 Revision: [2181] Changing MySQL column defs from 12 hour times to 24 (#465) Revision: [2180] Fixing Tickets #463 and #462, and an error in Controller::setAction() Revision: [2179] Fixing a bug I found in AjaxHelper::link(), and changing the stopwatch time to 4 decimals Revision: [2177] Added patch from Ticket #459 git-svn-id: https://svn.cakephp.org/repo/trunk/cake@2195 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
f6cf220c40
commit
03ba042f41
15 changed files with 163 additions and 39 deletions
|
@ -6,4 +6,4 @@
|
||||||
// +---------------------------------------------------------------------------------------------------+ //
|
// +---------------------------------------------------------------------------------------------------+ //
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
0.10.8.2176
|
0.10.8.2195
|
|
@ -110,6 +110,6 @@ else
|
||||||
|
|
||||||
if (DEBUG)
|
if (DEBUG)
|
||||||
{
|
{
|
||||||
echo "<!-- ". round(getMicrotime() - $TIME_START, 2) ."s -->";
|
echo "<!-- ". round(getMicrotime() - $TIME_START, 4) ."s -->";
|
||||||
}
|
}
|
||||||
?>
|
?>
|
|
@ -135,6 +135,10 @@ class Dispatcher extends Object
|
||||||
{
|
{
|
||||||
$params['controller'] = Inflector::underscore($ctrlName);
|
$params['controller'] = Inflector::underscore($ctrlName);
|
||||||
$ctrlClass = $ctrlName.'Controller';
|
$ctrlClass = $ctrlName.'Controller';
|
||||||
|
if (!is_null($params['action']))
|
||||||
|
{
|
||||||
|
array_unshift($params['pass'], $params['action']);
|
||||||
|
}
|
||||||
$params['action'] = $oldAction;
|
$params['action'] = $oldAction;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -102,6 +102,36 @@ class RequestHandlerComponent extends Object
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true if the current call a POST request
|
||||||
|
*
|
||||||
|
* @return bool True if call is a POST
|
||||||
|
*/
|
||||||
|
function isPost()
|
||||||
|
{
|
||||||
|
return (low(env('REQUEST_METHOD')) == 'post');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true if the current call a PUT request
|
||||||
|
*
|
||||||
|
* @return bool True if call is a PUT
|
||||||
|
*/
|
||||||
|
function isPut()
|
||||||
|
{
|
||||||
|
return (low(env('REQUEST_METHOD')) == 'put');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true if the current call a GET request
|
||||||
|
*
|
||||||
|
* @return bool True if call is a GET
|
||||||
|
*/
|
||||||
|
function isGet()
|
||||||
|
{
|
||||||
|
return (low(env('REQUEST_METHOD')) == 'get');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets Prototype version if call is Ajax, otherwise empty string.
|
* Gets Prototype version if call is Ajax, otherwise empty string.
|
||||||
|
|
|
@ -90,7 +90,7 @@ class Controller extends Object
|
||||||
*
|
*
|
||||||
* @var unknown_type
|
* @var unknown_type
|
||||||
*/
|
*/
|
||||||
var $viewPath;
|
var $viewPath = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Variables for the view
|
* Variables for the view
|
||||||
|
@ -208,7 +208,12 @@ class Controller extends Object
|
||||||
}
|
}
|
||||||
$this->name = $r[1];
|
$this->name = $r[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($this->viewPath == null)
|
||||||
|
{
|
||||||
$this->viewPath = Inflector::underscore($this->name);
|
$this->viewPath = Inflector::underscore($this->name);
|
||||||
|
}
|
||||||
|
|
||||||
$this->modelClass = Inflector::singularize($this->name);
|
$this->modelClass = Inflector::singularize($this->name);
|
||||||
$this->modelKey = Inflector::underscore($this->modelClass);
|
$this->modelKey = Inflector::underscore($this->modelClass);
|
||||||
|
|
||||||
|
@ -395,6 +400,8 @@ class Controller extends Object
|
||||||
$this->action = $action;
|
$this->action = $action;
|
||||||
|
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
|
unset($args[0]);
|
||||||
|
|
||||||
call_user_func_array(array(&$this, $action), $args);
|
call_user_func_array(array(&$this, $action), $args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -461,6 +468,18 @@ class Controller extends Object
|
||||||
|
|
||||||
$this->beforeRender();
|
$this->beforeRender();
|
||||||
|
|
||||||
|
if (!isset($this->_viewVars['data']))
|
||||||
|
{
|
||||||
|
if (isset($this->params['data']))
|
||||||
|
{
|
||||||
|
$this->set('data', $this->params['data']);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->set('data', array());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$this->_viewClass =& new $viewClass($this);
|
$this->_viewClass =& new $viewClass($this);
|
||||||
if(!empty($this->modelNames))
|
if(!empty($this->modelNames))
|
||||||
{
|
{
|
||||||
|
|
|
@ -445,12 +445,12 @@ class DataSource extends Object
|
||||||
$keys = array('{$__cakeID__$}', '{$__cakeForeignKey__$}');
|
$keys = array('{$__cakeID__$}', '{$__cakeForeignKey__$}');
|
||||||
foreach($keys as $key)
|
foreach($keys as $key)
|
||||||
{
|
{
|
||||||
|
$val = null;
|
||||||
if (strpos($query, $key) !== false)
|
if (strpos($query, $key) !== false)
|
||||||
{
|
{
|
||||||
switch($key)
|
switch($key)
|
||||||
{
|
{
|
||||||
case '{$__cakeID__$}':
|
case '{$__cakeID__$}':
|
||||||
$val = null;
|
|
||||||
if (isset($data[$index][$model->name]))
|
if (isset($data[$index][$model->name]))
|
||||||
{
|
{
|
||||||
if(isset($data[$index][$model->name][$model->primaryKey]))
|
if(isset($data[$index][$model->name][$model->primaryKey]))
|
||||||
|
@ -463,8 +463,9 @@ class DataSource extends Object
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case '{$__cake_foreignKey__$}':
|
case '{$__cakeForeignKey__$}':
|
||||||
|
$foreignKey = Inflector::underscore($linkModel->name).'_id';
|
||||||
|
$val = $data[$index][$model->name][$foreignKey];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
$query = r($key, $this->value($val, $model->getColumnType($model->primaryKey)), $query);
|
$query = r($key, $this->value($val, $model->getColumnType($model->primaryKey)), $query);
|
||||||
|
|
|
@ -383,6 +383,7 @@ class DboSource extends DataSource
|
||||||
$linkedModels = array();
|
$linkedModels = array();
|
||||||
$this->__bypass = false;
|
$this->__bypass = false;
|
||||||
$this->__assocJoins = null;
|
$this->__assocJoins = null;
|
||||||
|
|
||||||
if(!is_null($recursive))
|
if(!is_null($recursive))
|
||||||
{
|
{
|
||||||
$_recursive = $model->recursive;
|
$_recursive = $model->recursive;
|
||||||
|
@ -429,16 +430,15 @@ class DboSource extends DataSource
|
||||||
{
|
{
|
||||||
foreach($model->{$type} as $assoc => $assocData)
|
foreach($model->{$type} as $assoc => $assocData)
|
||||||
{
|
{
|
||||||
|
$linkModel =& $model->{$assocData['className']};
|
||||||
if (!in_array($type.'/'.$assoc, $linkedModels))
|
if (!in_array($type.'/'.$assoc, $linkedModels))
|
||||||
{
|
{
|
||||||
$linkModel =& $model->{$assocData['className']};
|
|
||||||
$this->queryAssociation($model, $linkModel, $type, $assoc, $assocData, $array, true, $resultSet, $model->recursive);
|
$this->queryAssociation($model, $linkModel, $type, $assoc, $assocData, $array, true, $resultSet, $model->recursive);
|
||||||
} else {
|
|
||||||
// Fetch recursively on belongsTo and hasOne
|
|
||||||
if ($model->recursive > 1)
|
|
||||||
{
|
|
||||||
//$this->queryAssociation($model, $linkModel, $type, $assoc, $assocData, $array, true, $resultSet, $model->recursive - 1);
|
|
||||||
}
|
}
|
||||||
|
elseif($model->recursive > 1 && ($type == 'belongsTo' || $type == 'hasOne'))
|
||||||
|
{
|
||||||
|
// Do recursive joins on belongsTo and hasOne relationships
|
||||||
|
$this->queryAssociation($model, $linkModel, $type, $assoc, $assocData, $array, true, $resultSet, $model->recursive - 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -656,10 +656,11 @@ class DboSource extends DataSource
|
||||||
$assocData['fields'] = '';
|
$assocData['fields'] = '';
|
||||||
}
|
}
|
||||||
$sql = 'SELECT '.join(', ', $this->fields($linkModel, $alias, $assocData['fields']));
|
$sql = 'SELECT '.join(', ', $this->fields($linkModel, $alias, $assocData['fields']));
|
||||||
$sql .= ' FROM '.$this->name($linkModel->table).' AS '.$alias;
|
$sql .= ' FROM '.$this->name($linkModel->table).' AS '.$alias.' ';
|
||||||
$conditions = $queryData['conditions'];
|
$conditions = $queryData['conditions'];
|
||||||
$condition = $model->escapeField($assocData['foreignKey']);
|
$condition = $model->escapeField($assocData['foreignKey']);
|
||||||
$condition .= '={$__cakeForeignKey__$}';
|
$condition .= '={$__cakeForeignKey__$}';
|
||||||
|
|
||||||
if (is_array($conditions))
|
if (is_array($conditions))
|
||||||
{
|
{
|
||||||
$conditions[] = $condition;
|
$conditions[] = $condition;
|
||||||
|
@ -722,7 +723,7 @@ class DboSource extends DataSource
|
||||||
$conditions = $assocData['conditions'];
|
$conditions = $assocData['conditions'];
|
||||||
|
|
||||||
$condition = $linkModel->escapeField($linkModel->primaryKey);
|
$condition = $linkModel->escapeField($linkModel->primaryKey);
|
||||||
$condition .= '={$__cakeID__$}';
|
$condition .= '={$__cakeForeignKey__$}';
|
||||||
|
|
||||||
if (is_array($conditions))
|
if (is_array($conditions))
|
||||||
{
|
{
|
||||||
|
@ -1026,7 +1027,7 @@ class DboSource extends DataSource
|
||||||
{
|
{
|
||||||
if (!preg_match('/^WHERE\\x20|^GROUP\\x20BY\\x20|^HAVING\\x20|^ORDER\\x20BY\\x20/i', $conditions, $match))
|
if (!preg_match('/^WHERE\\x20|^GROUP\\x20BY\\x20|^HAVING\\x20|^ORDER\\x20BY\\x20/i', $conditions, $match))
|
||||||
{
|
{
|
||||||
$clause = 'WHERE ';
|
$clause = ' WHERE ';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (is_string($conditions))
|
if (is_string($conditions))
|
||||||
|
@ -1066,7 +1067,7 @@ class DboSource extends DataSource
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$clause = 'WHERE ';
|
$clause = ' WHERE ';
|
||||||
$out = $this->conditionKeysToString($conditions);
|
$out = $this->conditionKeysToString($conditions);
|
||||||
return $clause . ' ('.join(') AND (', $out).')';
|
return $clause . ' ('.join(') AND (', $out).')';
|
||||||
}
|
}
|
||||||
|
|
|
@ -88,9 +88,9 @@ class DboMysql extends DboSource
|
||||||
'text' => array('name' => 'text'),
|
'text' => array('name' => 'text'),
|
||||||
'integer' => array('name' => 'int', 'limit' => '11', 'formatter' => 'intval'),
|
'integer' => array('name' => 'int', 'limit' => '11', 'formatter' => 'intval'),
|
||||||
'float' => array('name' => 'float', 'formatter' => 'floatval'),
|
'float' => array('name' => 'float', 'formatter' => 'floatval'),
|
||||||
'datetime' => array('name' => 'datetime', 'format' => 'Y-m-d h:i:s', 'formatter' => 'date'),
|
'datetime' => array('name' => 'datetime', 'format' => 'Y-m-d H:i:s', 'formatter' => 'date'),
|
||||||
'timestamp' => array('name' => 'timestamp', 'format' => 'Y-m-d h:i:s', 'formatter' => 'date'),
|
'timestamp' => array('name' => 'timestamp', 'format' => 'Y-m-d H:i:s', 'formatter' => 'date'),
|
||||||
'time' => array('name' => 'time', 'format' => 'h:i:s', 'formatter' => 'date'),
|
'time' => array('name' => 'time', 'format' => 'H:i:s', 'formatter' => 'date'),
|
||||||
'date' => array('name' => 'date', 'format' => 'Y-m-d', 'formatter' => 'date'),
|
'date' => array('name' => 'date', 'format' => 'Y-m-d', 'formatter' => 'date'),
|
||||||
'binary' => array('name' => 'blob'),
|
'binary' => array('name' => 'blob'),
|
||||||
'boolean' => array('name' => 'tinyint', 'limit' => '1'));
|
'boolean' => array('name' => 'tinyint', 'limit' => '1'));
|
||||||
|
|
|
@ -389,6 +389,54 @@ class DboPostgres extends DboSource
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts database-layer column types to basic types
|
||||||
|
*
|
||||||
|
* @param string $real Real database-layer column type (i.e. "varchar(255)")
|
||||||
|
* @return string Abstract column type (i.e. "string")
|
||||||
|
*/
|
||||||
|
function column($real)
|
||||||
|
{
|
||||||
|
$col = r(')', '', $real);
|
||||||
|
$limit = null;
|
||||||
|
@list($col, $limit) = explode('(', $col);
|
||||||
|
|
||||||
|
if (in_array($col, array('date', 'time', 'timestamp')))
|
||||||
|
{
|
||||||
|
return $col;
|
||||||
|
}
|
||||||
|
if ($col == 'boolean')
|
||||||
|
{
|
||||||
|
return 'boolean';
|
||||||
|
}
|
||||||
|
if (strpos($col, 'integer') !== false)
|
||||||
|
{
|
||||||
|
return 'integer';
|
||||||
|
}
|
||||||
|
if (strpos($col, 'char') !== false)
|
||||||
|
{
|
||||||
|
return 'string';
|
||||||
|
}
|
||||||
|
if (strpos($col, 'text') !== false)
|
||||||
|
{
|
||||||
|
return 'text';
|
||||||
|
}
|
||||||
|
if (strpos($col, 'bytea') !== false)
|
||||||
|
{
|
||||||
|
return 'binary';
|
||||||
|
}
|
||||||
|
if (in_array($col, array('float', 'double', 'decimal')))
|
||||||
|
{
|
||||||
|
return 'float';
|
||||||
|
}
|
||||||
|
return 'text';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enter description here...
|
||||||
|
*
|
||||||
|
* @param unknown_type $results
|
||||||
|
*/
|
||||||
function resultSet(&$results)
|
function resultSet(&$results)
|
||||||
{
|
{
|
||||||
$this->results =& $results;
|
$this->results =& $results;
|
||||||
|
|
|
@ -417,7 +417,7 @@ class Model extends Object
|
||||||
$this->__backAssociation[$assoc] = $this->{$assoc};
|
$this->__backAssociation[$assoc] = $this->{$assoc};
|
||||||
foreach($models as $model)
|
foreach($models as $model)
|
||||||
{
|
{
|
||||||
$this->__backAssociation = array_merge_recursive($this->__backAssociation, $this->{$assoc});
|
$this->__backAssociation = array_merge($this->__backAssociation, $this->{$assoc});
|
||||||
unset($this->{$assoc}[$model]);
|
unset($this->{$assoc}[$model]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -555,7 +555,7 @@ class Model extends Object
|
||||||
{
|
{
|
||||||
if($this->db->isInterfaceSupported('listSources'))
|
if($this->db->isInterfaceSupported('listSources'))
|
||||||
{
|
{
|
||||||
if (!in_array(strtolower($tableName), $this->db->listSources()))
|
if (!in_array(low($tableName), $this->db->listSources()) && !in_array($tableName, $this->db->listSources()))
|
||||||
{
|
{
|
||||||
return $this->cakeError('missingTable',array(array('className' => $this->name,
|
return $this->cakeError('missingTable',array(array('className' => $this->name,
|
||||||
'table' => $tableName)));
|
'table' => $tableName)));
|
||||||
|
@ -847,6 +847,7 @@ class Model extends Object
|
||||||
$weHaveMulti = false;
|
$weHaveMulti = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$newID = null;
|
||||||
foreach ($this->data as $n => $v)
|
foreach ($this->data as $n => $v)
|
||||||
{
|
{
|
||||||
if(isset($weHaveMulti) && $count > 0 && count($this->hasAndBelongsToMany) > 0)
|
if(isset($weHaveMulti) && $count > 0 && count($this->hasAndBelongsToMany) > 0)
|
||||||
|
@ -917,13 +918,16 @@ class Model extends Object
|
||||||
if($this->db->create($this, $fields, $values))
|
if($this->db->create($this, $fields, $values))
|
||||||
{
|
{
|
||||||
$this->__insertID = $this->db->lastInsertId($this->table, $this->primaryKey);
|
$this->__insertID = $this->db->lastInsertId($this->table, $this->primaryKey);
|
||||||
$this->id = $this->__insertID;
|
|
||||||
|
|
||||||
if(!$this->id > 0 && isset($newID))
|
if (!$this->__insertID && $newID != null)
|
||||||
{
|
{
|
||||||
$this->__insertID = $newID;
|
$this->__insertID = $newID;
|
||||||
$this->id = $newID;
|
$this->id = $newID;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->id = $this->__insertID;
|
||||||
|
}
|
||||||
|
|
||||||
if(!empty($joined))
|
if(!empty($joined))
|
||||||
{
|
{
|
||||||
|
@ -1311,7 +1315,7 @@ class Model extends Object
|
||||||
$sizeOf = sizeof($data);
|
$sizeOf = sizeof($data);
|
||||||
for ($ii=0; $ii < $sizeOf; $ii++)
|
for ($ii=0; $ii < $sizeOf; $ii++)
|
||||||
{
|
{
|
||||||
if ($data[$ii][$this->name]['parent_id'] == $root)
|
if (($data[$ii][$this->name]['parent_id'] == $root) || (($root === null) && ($data[$ii][$this->name]['parent_id'] == '0')))
|
||||||
{
|
{
|
||||||
$tmp = $data[$ii];
|
$tmp = $data[$ii];
|
||||||
if (isset($data[$ii][$this->name][$this->primaryKey]))
|
if (isset($data[$ii][$this->name][$this->primaryKey]))
|
||||||
|
|
|
@ -413,7 +413,7 @@ class Model extends Object
|
||||||
$this->__backAssociation[$assoc] = $this->{$assoc};
|
$this->__backAssociation[$assoc] = $this->{$assoc};
|
||||||
foreach($models as $model)
|
foreach($models as $model)
|
||||||
{
|
{
|
||||||
$this->__backAssociation = array_merge_recursive($this->__backAssociation, $this->{$assoc});
|
$this->__backAssociation = array_merge($this->__backAssociation, $this->{$assoc});
|
||||||
unset($this->{$assoc}[$model]);
|
unset($this->{$assoc}[$model]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -551,7 +551,7 @@ class Model extends Object
|
||||||
{
|
{
|
||||||
if($this->db->isInterfaceSupported('listSources'))
|
if($this->db->isInterfaceSupported('listSources'))
|
||||||
{
|
{
|
||||||
if (!in_array(strtolower($tableName), $this->db->listSources()))
|
if (!in_array(low($tableName), $this->db->listSources()) && !in_array($tableName, $this->db->listSources()))
|
||||||
{
|
{
|
||||||
return $this->cakeError('missingTable',array(array('className' => $this->name,
|
return $this->cakeError('missingTable',array(array('className' => $this->name,
|
||||||
'table' => $tableName)));
|
'table' => $tableName)));
|
||||||
|
@ -843,6 +843,7 @@ class Model extends Object
|
||||||
$weHaveMulti = false;
|
$weHaveMulti = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$newID = null;
|
||||||
foreach ($this->data as $n => $v)
|
foreach ($this->data as $n => $v)
|
||||||
{
|
{
|
||||||
if(isset($weHaveMulti) && $count > 0 && count($this->hasAndBelongsToMany) > 0)
|
if(isset($weHaveMulti) && $count > 0 && count($this->hasAndBelongsToMany) > 0)
|
||||||
|
@ -913,13 +914,16 @@ class Model extends Object
|
||||||
if($this->db->create($this, $fields, $values))
|
if($this->db->create($this, $fields, $values))
|
||||||
{
|
{
|
||||||
$this->__insertID = $this->db->lastInsertId($this->table, $this->primaryKey);
|
$this->__insertID = $this->db->lastInsertId($this->table, $this->primaryKey);
|
||||||
$this->id = $this->__insertID;
|
|
||||||
|
|
||||||
if(!$this->id > 0 && isset($newID))
|
if (!$this->__insertID && $newID != null)
|
||||||
{
|
{
|
||||||
$this->__insertID = $newID;
|
$this->__insertID = $newID;
|
||||||
$this->id = $newID;
|
$this->id = $newID;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->id = $this->__insertID;
|
||||||
|
}
|
||||||
|
|
||||||
if(!empty($joined))
|
if(!empty($joined))
|
||||||
{
|
{
|
||||||
|
@ -1307,7 +1311,7 @@ class Model extends Object
|
||||||
$sizeOf = sizeof($data);
|
$sizeOf = sizeof($data);
|
||||||
for ($ii=0; $ii < $sizeOf; $ii++)
|
for ($ii=0; $ii < $sizeOf; $ii++)
|
||||||
{
|
{
|
||||||
if ($data[$ii][$this->name]['parent_id'] == $root)
|
if (($data[$ii][$this->name]['parent_id'] == $root) || (($root === null) && ($data[$ii][$this->name]['parent_id'] == '0')))
|
||||||
{
|
{
|
||||||
$tmp = $data[$ii];
|
$tmp = $data[$ii];
|
||||||
if (isset($data[$ii][$this->name][$this->primaryKey]))
|
if (isset($data[$ii][$this->name][$this->primaryKey]))
|
||||||
|
|
|
@ -53,7 +53,7 @@ class Security extends Object
|
||||||
|
|
||||||
function inactiveMins()
|
function inactiveMins()
|
||||||
{
|
{
|
||||||
$security =& Security::getInstance();
|
//$security =& Security::getInstance();
|
||||||
switch (CAKE_SECURITY)
|
switch (CAKE_SECURITY)
|
||||||
{
|
{
|
||||||
case 'high':
|
case 'high':
|
||||||
|
@ -71,8 +71,7 @@ class Security extends Object
|
||||||
|
|
||||||
function generateAuthKey()
|
function generateAuthKey()
|
||||||
{
|
{
|
||||||
|
return Security::hash(uniqid(rand(), true));
|
||||||
return $authKey;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function validateAuthKey($authKey)
|
function validateAuthKey($authKey)
|
||||||
|
|
|
@ -189,7 +189,7 @@ class AjaxHelper extends Helper
|
||||||
if (isset($options['id']))
|
if (isset($options['id']))
|
||||||
{
|
{
|
||||||
$htmlOptions['onclick'] = ' return false;';
|
$htmlOptions['onclick'] = ' return false;';
|
||||||
return $this->Html->link($title, $href, $htmlOptions) . $this->Javascript->event("$('{$options['id']}')", "click", $this->remoteFunction($options));
|
return $this->Html->link($title, $href, $htmlOptions, null, $escapeTitle) . $this->Javascript->event("$('{$options['id']}')", "click", $this->remoteFunction($options));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -647,13 +647,19 @@ class AjaxHelper extends Helper
|
||||||
function __getHtmlOptions($options, $extra = array())
|
function __getHtmlOptions($options, $extra = array())
|
||||||
{
|
{
|
||||||
foreach($this->ajaxOptions as $key)
|
foreach($this->ajaxOptions as $key)
|
||||||
|
{
|
||||||
|
if (isset($options[$key]))
|
||||||
{
|
{
|
||||||
unset($options[$key]);
|
unset($options[$key]);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
foreach($extra as $key)
|
foreach($extra as $key)
|
||||||
|
{
|
||||||
|
if (isset($extra[$key]))
|
||||||
{
|
{
|
||||||
unset($options[$key]);
|
unset($options[$key]);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return $options;
|
return $options;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -208,7 +208,7 @@ class HtmlHelper extends Helper
|
||||||
$htmlAttributes['onclick'] = "return confirm('{$confirmMessage}');";
|
$htmlAttributes['onclick'] = "return confirm('{$confirmMessage}');";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (((strpos($url, '://')) || (strpos($url, 'javascript:') === 0)))
|
if (((strpos($url, '://')) || (strpos($url, 'javascript:') === 0) || (strpos($url, 'mailto:') === 0)))
|
||||||
{
|
{
|
||||||
$output = sprintf($this->tags['link'], $url,
|
$output = sprintf($this->tags['link'], $url,
|
||||||
$this->_parseAttributes($htmlAttributes), $title);
|
$this->_parseAttributes($htmlAttributes), $title);
|
||||||
|
@ -1126,7 +1126,13 @@ class HtmlHelper extends Helper
|
||||||
$htmlAttributes['method'] = $type=='get'? 'get': 'post';
|
$htmlAttributes['method'] = $type=='get'? 'get': 'post';
|
||||||
$type == 'file'? $htmlAttributes['enctype'] = 'multipart/form-data': null;
|
$type == 'file'? $htmlAttributes['enctype'] = 'multipart/form-data': null;
|
||||||
|
|
||||||
return sprintf($this->tags['form'], $this->parseHtmlOptions($htmlAttributes, null, ''));
|
$token = '';
|
||||||
|
if (isset($this->params['_Token']) && !empty($this->params['_Token']))
|
||||||
|
{
|
||||||
|
$token = $this->hidden('_Token/key', array('value' => $this->params['_Token']['key']), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
return sprintf($this->tags['form'], $this->parseHtmlOptions($htmlAttributes, null, '')) . $token;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -41,6 +41,7 @@ define ('DS', DIRECTORY_SEPARATOR);
|
||||||
define ('ROOT', dirname(dirname(dirname(__FILE__))).DS);
|
define ('ROOT', dirname(dirname(dirname(__FILE__))).DS);
|
||||||
define ('APP_DIR', 'app');
|
define ('APP_DIR', 'app');
|
||||||
define('CAKE_CORE_INCLUDE_PATH', ROOT);
|
define('CAKE_CORE_INCLUDE_PATH', ROOT);
|
||||||
|
define('CORE_PATH', CAKE_CORE_INCLUDE_PATH);
|
||||||
|
|
||||||
define ('DEBUG', 1);
|
define ('DEBUG', 1);
|
||||||
ini_set('include_path',ini_get('include_path').PATH_SEPARATOR.CAKE_CORE_INCLUDE_PATH.PATH_SEPARATOR.ROOT.DS.APP_DIR.DS);
|
ini_set('include_path',ini_get('include_path').PATH_SEPARATOR.CAKE_CORE_INCLUDE_PATH.PATH_SEPARATOR.ROOT.DS.APP_DIR.DS);
|
||||||
|
@ -53,6 +54,7 @@ uses ('neat_array');
|
||||||
uses ('object');
|
uses ('object');
|
||||||
uses ('session');
|
uses ('session');
|
||||||
uses ('security');
|
uses ('security');
|
||||||
|
uses ('inflector');
|
||||||
uses ('model'.DS.'connection_manager');
|
uses ('model'.DS.'connection_manager');
|
||||||
uses ('model'.DS.'datasources'.DS.'dbo_source');
|
uses ('model'.DS.'datasources'.DS.'dbo_source');
|
||||||
uses ('model'.DS.'model');
|
uses ('model'.DS.'model');
|
||||||
|
|
Loading…
Add table
Reference in a new issue