mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 00:48:25 +00:00
Merging fixes and enhancements into trunk.
Revision: [2175] Merging changes made to model_php5.php Revision: [2174] Adding fix for empty values being set for an update. Fixed problem with view paths being set wrong on Windows. Revision: [2173] Adding additional condition operators Revision: [2172] Adding fix for Ticket #455 git-svn-id: https://svn.cakephp.org/repo/trunk/cake@2176 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
26fbf4a287
commit
f6cf220c40
6 changed files with 39 additions and 19 deletions
|
@ -6,4 +6,4 @@
|
|||
// +---------------------------------------------------------------------------------------------------+ //
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
0.10.8.2171
|
||||
0.10.8.2176
|
|
@ -1076,7 +1076,7 @@ class DboSource extends DataSource
|
|||
{
|
||||
$out = array();
|
||||
$operator = null;
|
||||
$bool = array('and', 'or', 'and not', 'or not');
|
||||
$bool = array('and', 'or', 'and not', 'or not', 'xor', '||', '&&');
|
||||
|
||||
foreach ($conditions as $key => $value)
|
||||
{
|
||||
|
|
|
@ -283,6 +283,7 @@ class DboMysql extends DboSource
|
|||
function value ($data, $column = null, $safe = false)
|
||||
{
|
||||
$parent = parent::value($data, $column);
|
||||
|
||||
if ($parent != null)
|
||||
{
|
||||
return $parent;
|
||||
|
@ -292,15 +293,21 @@ class DboMysql extends DboSource
|
|||
{
|
||||
return 'NULL';
|
||||
}
|
||||
|
||||
if($data == '')
|
||||
{
|
||||
return "''";
|
||||
}
|
||||
|
||||
if (ini_get('magic_quotes_gpc') == 1)
|
||||
{
|
||||
$data = stripslashes($data);
|
||||
}
|
||||
|
||||
$data = mysql_real_escape_string($data, $this->connection);
|
||||
|
||||
if ($column == null)
|
||||
{
|
||||
$data = mysql_real_escape_string($data, $this->connection);
|
||||
|
||||
if(!is_numeric($data) || $safe == true)
|
||||
{
|
||||
$return = "'" . $data . "'";
|
||||
|
@ -311,9 +318,10 @@ class DboMysql extends DboSource
|
|||
}
|
||||
return $return;
|
||||
|
||||
} else {
|
||||
|
||||
$colData = $this->columns[$column];
|
||||
}
|
||||
else
|
||||
{
|
||||
$colData = $this->columns[$column];
|
||||
if (isset($colData['limit']) && strlen(strval($data)) > $colData['limit'])
|
||||
{
|
||||
$data = substr(strval($data), 0, $colData['limit']);
|
||||
|
@ -323,12 +331,16 @@ class DboMysql extends DboSource
|
|||
{
|
||||
$data = $this->__formatColumnData($data, $colData);
|
||||
}
|
||||
|
||||
switch($column) {
|
||||
|
||||
switch($column)
|
||||
{
|
||||
case 'integer':
|
||||
case 'int':
|
||||
return $data;
|
||||
break;
|
||||
case 'string':
|
||||
case 'text':
|
||||
case 'binary':
|
||||
return "'" . mysql_real_escape_string($data, $this->connection) . "'";
|
||||
case 'date':
|
||||
case 'time':
|
||||
case 'datetime':
|
||||
|
|
|
@ -769,7 +769,7 @@ class Model extends Object
|
|||
$conditions = $this->db->conditions($conditions);
|
||||
}
|
||||
|
||||
if ($data = $this->find($conditions, $name, $order))
|
||||
if ($data = $this->find($conditions, $name, $order, 0))
|
||||
{
|
||||
if (isset($data[$this->name][$name]))
|
||||
{
|
||||
|
|
|
@ -765,7 +765,7 @@ class Model extends Object
|
|||
$conditions = $this->db->conditions($conditions);
|
||||
}
|
||||
|
||||
if ($data = $this->find($conditions, $name, $order))
|
||||
if ($data = $this->find($conditions, $name, $order, 0))
|
||||
{
|
||||
if (isset($data[$this->name][$name]))
|
||||
{
|
||||
|
|
|
@ -532,6 +532,20 @@ class View extends Object
|
|||
{
|
||||
$type = null;
|
||||
}
|
||||
|
||||
$position = strpos($action, '..');
|
||||
if ($position === false)
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
$action = explode('/', $action);
|
||||
$i = array_search('..', $action);
|
||||
unset($action[$i-1]);
|
||||
unset($action[$i]);
|
||||
$action = '..'.DS.implode(DS, $action);
|
||||
}
|
||||
|
||||
$viewFileName = VIEWS.$this->viewPath.DS.$this->subDir.$type.$action.$this->ext;
|
||||
|
||||
if(file_exists(VIEWS.$this->viewPath.DS.$this->subDir.$type.$action.$this->ext))
|
||||
|
@ -550,13 +564,7 @@ class View extends Object
|
|||
{
|
||||
|
||||
}
|
||||
|
||||
$viewPath = explode(DS, $viewFileName);
|
||||
$i = array_search('..', $viewPath);
|
||||
unset($viewPath[$i-1]);
|
||||
unset($viewPath[$i]);
|
||||
$return = '/'.implode('/', $viewPath);
|
||||
return $return;
|
||||
return $viewFileName;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Reference in a new issue