mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-18 18:46:17 +00:00
Merging fixes and enhancements into trunk.
Revision: [2457] Adding fix for Ticket #612 Revision: [2456] "Enables use of Controller::$data in addition to Controller::$params['data']" Revision: [2455] "Adding fix for Ticket #634" Revision: [2454] "Removing trailing directory separator on ROOT" Revision: [2451] Dispatching and routing changes for IIS Revision: [2450] Downgrading error level in AclNode::create and adding additional filename check in listClasses() git-svn-id: https://svn.cakephp.org/repo/trunk/cake@2462 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
c899c085f5
commit
43e074acb0
12 changed files with 63 additions and 26 deletions
|
@ -6,4 +6,4 @@
|
||||||
// +---------------------------------------------------------------------------------------------------+ //
|
// +---------------------------------------------------------------------------------------------------+ //
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
1.0.0.2449
|
1.0.0.2462
|
|
@ -62,13 +62,13 @@ $singularRules = array();
|
||||||
* You should not have to change this value below if you do change it use same format
|
* You should not have to change this value below if you do change it use same format
|
||||||
* as the $uninflectedPlural above.
|
* as the $uninflectedPlural above.
|
||||||
*/
|
*/
|
||||||
$uninflectedSingluar = $uninflectedPlural;
|
$uninflectedSingular = $uninflectedPlural;
|
||||||
/**
|
/**
|
||||||
* This is a key => value array of singular irregular words.
|
* This is a key => value array of singular irregular words.
|
||||||
* Most of the time this will be a reverse of the above $irregularPlural array
|
* Most of the time this will be a reverse of the above $irregularPlural array
|
||||||
* You should not have to change this value below if you do change it use same format
|
* You should not have to change this value below if you do change it use same format
|
||||||
*
|
*
|
||||||
* $irregularSingluar = array('atlases' => 'atlas', 'beefs' => 'beef', 'brothers' => 'brother')
|
* $irregularSingular = array('atlases' => 'atlas', 'beefs' => 'beef', 'brothers' => 'brother')
|
||||||
*/
|
*/
|
||||||
$irregularSingluar = array_flip($irregularPlural);
|
$irregularSingular = array_flip($irregularPlural);
|
||||||
?>
|
?>
|
|
@ -350,7 +350,7 @@ function listClasses($path)
|
||||||
$classes = array();
|
$classes = array();
|
||||||
while (false !== ($file = readdir($dir)))
|
while (false !== ($file = readdir($dir)))
|
||||||
{
|
{
|
||||||
if ((substr($file, -3, 3) == 'php'))
|
if ((substr($file, -3, 3) == 'php') && substr($file, 0, 1) != '.')
|
||||||
{
|
{
|
||||||
$classes[] = $file;
|
$classes[] = $file;
|
||||||
}
|
}
|
||||||
|
@ -753,7 +753,14 @@ function setUri()
|
||||||
if (env('argv'))
|
if (env('argv'))
|
||||||
{
|
{
|
||||||
$uri = env('argv');
|
$uri = env('argv');
|
||||||
$uri = env('PHP_SELF') .'/'. $uri[0];
|
if (defined('SERVER_IIS'))
|
||||||
|
{
|
||||||
|
$uri = BASE_URL.$uri[0];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$uri = env('PHP_SELF') .'/'. $uri[0];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -59,7 +59,15 @@ if (empty($uri) && defined('BASE_URL'))
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$elements = explode('/index.php', $uri);
|
if (strpos($uri, 'index.php') !== false)
|
||||||
|
{
|
||||||
|
$uri = r ('?', '', $uri);
|
||||||
|
$elements = explode('/index.php', $uri);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$elements = explode('/?', $uri);
|
||||||
|
}
|
||||||
if(!empty($elements[1]))
|
if(!empty($elements[1]))
|
||||||
{
|
{
|
||||||
$_GET['url'] = $elements[1];
|
$_GET['url'] = $elements[1];
|
||||||
|
|
|
@ -405,6 +405,7 @@ class Dispatcher extends Object
|
||||||
return $base;
|
return $base;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return $base;
|
||||||
}
|
}
|
||||||
|
|
||||||
function _restructureParams($params)
|
function _restructureParams($params)
|
||||||
|
|
|
@ -89,7 +89,8 @@ class AclNode extends AppModel
|
||||||
$parent = $this->find($this->_resolveID($parent_id));
|
$parent = $this->find($this->_resolveID($parent_id));
|
||||||
if($parent == null || count($parent) == 0)
|
if($parent == null || count($parent) == 0)
|
||||||
{
|
{
|
||||||
trigger_error("Null parent in {$class}::create()", E_USER_ERROR);
|
trigger_error("Null parent in {$class}::create()", E_USER_WARNING);
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
$parent = $parent[$class];
|
$parent = $parent[$class];
|
||||||
|
|
|
@ -419,7 +419,14 @@ class Controller extends Object
|
||||||
header($codes[$status]);
|
header($codes[$status]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
header ('Location: '.$url);
|
if (defined('SERVER_IIS'))
|
||||||
|
{
|
||||||
|
header ('Location: '.FULL_BASE_URL . $url);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
header ('Location: '.$url);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -248,8 +248,8 @@ class Inflector extends Object
|
||||||
{
|
{
|
||||||
include(CONFIGS.'inflections.php');
|
include(CONFIGS.'inflections.php');
|
||||||
$singularRules = array_merge($singularRules, $coreSingularRules);
|
$singularRules = array_merge($singularRules, $coreSingularRules);
|
||||||
$uninflected = array_merge($uninflectedSingluar, $coreUninflectedSingular);
|
$uninflected = array_merge($uninflectedSingular, $coreUninflectedSingular);
|
||||||
$irregular = array_merge($irregularSingluar, $coreIrregularSingular);
|
$irregular = array_merge($irregularSingular, $coreIrregularSingular);
|
||||||
}
|
}
|
||||||
|
|
||||||
$regexUninflected = __enclose(join( '|', $uninflected));
|
$regexUninflected = __enclose(join( '|', $uninflected));
|
||||||
|
|
|
@ -388,7 +388,7 @@ class DboSource extends DataSource
|
||||||
$count++;
|
$count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($this->execute('INSERT INTO '.$model->table.' ('.join(',', $fieldInsert).') VALUES ('.join(',', $valueInsert).')'))
|
if($this->execute('INSERT INTO '.$this->name($model->table).' ('.join(',', $fieldInsert).') VALUES ('.join(',', $valueInsert).')'))
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -118,7 +118,10 @@ class Router extends Object {
|
||||||
// Here's the fix.
|
// Here's the fix.
|
||||||
if ($url && ('/' != $url[0]))
|
if ($url && ('/' != $url[0]))
|
||||||
{
|
{
|
||||||
$url = '/'.$url;
|
if (!defined('SERVER_IIS'))
|
||||||
|
{
|
||||||
|
$url = '/'.$url;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$out = array();
|
$out = array();
|
||||||
|
|
|
@ -329,25 +329,25 @@ function url($url = null, $return = false)
|
||||||
function checkbox($fieldName, $title = null, $htmlAttributes = null, $return = false)
|
function checkbox($fieldName, $title = null, $htmlAttributes = null, $return = false)
|
||||||
{
|
{
|
||||||
$value = $this->tagValue($fieldName);
|
$value = $this->tagValue($fieldName);
|
||||||
$model = new $this->model;
|
$notCheckedValue = 0;
|
||||||
$db =& ConnectionManager::getDataSource($model->useDbConfig);
|
|
||||||
$value = $db->boolean($value);
|
|
||||||
|
|
||||||
if($value === true || $value === 't')
|
if (isset($htmlAttributes['value']))
|
||||||
{
|
{
|
||||||
$htmlAttributes['checked'] = 'checked';
|
$htmlAttributes['checked'] = ($htmlAttributes['value'] == $value)? 'checked': null;
|
||||||
|
if ($htmlAttributes['checked'] == '0') {
|
||||||
|
$notCheckedValue = -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$htmlAttributes['checked'] = null;
|
$model = new $this->model;
|
||||||
}
|
$db =& ConnectionManager::getDataSource($model->useDbConfig);
|
||||||
|
$value = $db->boolean($value);
|
||||||
if(!isset($htmlAttributes['value']))
|
$htmlAttributes['checked'] = $value? 'checked': null;
|
||||||
{
|
|
||||||
$htmlAttributes['value'] = 1;
|
$htmlAttributes['value'] = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
$output = $this->hidden($fieldName, array('value' => 0), true);
|
$output = $this->hidden($fieldName, array('value' => $notCheckedValue), true);
|
||||||
$output .= sprintf($this->tags['checkbox'], $this->model, $this->field,
|
$output .= sprintf($this->tags['checkbox'], $this->model, $this->field,
|
||||||
$this->_parseAttributes($htmlAttributes, null, '', ' '));
|
$this->_parseAttributes($htmlAttributes, null, '', ' '));
|
||||||
return $output;
|
return $output;
|
||||||
|
@ -601,7 +601,17 @@ function url($url = null, $return = false)
|
||||||
function tagValue ($fieldName)
|
function tagValue ($fieldName)
|
||||||
{
|
{
|
||||||
$this->setFormTag($fieldName);
|
$this->setFormTag($fieldName);
|
||||||
return isset($this->params['data'][$this->model][$this->field])? htmlspecialchars($this->params['data'][$this->model][$this->field]): null;
|
|
||||||
|
if(isset($this->params['data'][$this->model][$this->field]))
|
||||||
|
{
|
||||||
|
return h($this->params['data'][$this->model][$this->field]);
|
||||||
|
}
|
||||||
|
elseif(isset($this->data[$this->model][$this->field]))
|
||||||
|
{
|
||||||
|
return h($this->data[$this->model][$this->field]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
*/
|
*/
|
||||||
define ('APP_DIR', 'app');
|
define ('APP_DIR', 'app');
|
||||||
define ('DS', DIRECTORY_SEPARATOR);
|
define ('DS', DIRECTORY_SEPARATOR);
|
||||||
define ('ROOT', dirname(__FILE__).DS);
|
define ('ROOT', dirname(__FILE__));
|
||||||
define ('WEBROOT_DIR', 'webroot');
|
define ('WEBROOT_DIR', 'webroot');
|
||||||
|
|
||||||
define('WWW_ROOT', ROOT.APP_DIR.DS.WEBROOT_DIR.DS);
|
define('WWW_ROOT', ROOT.APP_DIR.DS.WEBROOT_DIR.DS);
|
||||||
|
|
Loading…
Add table
Reference in a new issue