mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-19 19:16:16 +00:00
Merge branch '1.3' of git://github.com/cakephp/cakephp into 1.3
This commit is contained in:
commit
d3ff625409
18 changed files with 165 additions and 28 deletions
|
@ -18,4 +18,4 @@
|
|||
// @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||
// +--------------------------------------------------------------------------------------------+ //
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
1.3.7
|
||||
1.3.8
|
|
@ -17,4 +17,4 @@
|
|||
* @since CakePHP(tm) v 1.1.11.4062
|
||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||
*/
|
||||
return $config['Cake.version'] = '1.3.7';
|
||||
return $config['Cake.version'] = '1.3.8';
|
||||
|
|
|
@ -519,6 +519,7 @@ class ShellDispatcher {
|
|||
$params['root'] .= '/' . dirname($params['app']);
|
||||
}
|
||||
|
||||
$params['app'] = basename($params['app']);
|
||||
$params['working'] = rtrim($params['root'], '/');
|
||||
if (!$isWin || !preg_match('/^[A-Z]:$/i', $params['app'])) {
|
||||
$params['working'] .= '/' . $params['app'];
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
<div class="<?php echo $pluralVar;?> form">
|
||||
<?php echo "<?php echo \$this->Form->create('{$modelClass}');?>\n";?>
|
||||
<fieldset>
|
||||
<legend><?php printf("<?php __('%s %s'); ?>", Inflector::humanize($action), $singularHumanName); ?></legend>
|
||||
<legend><?php printf("<?php __('%s %s'); ?>", Inflector::humanize($action), $singularHumanName); ?></legend>
|
||||
<?php
|
||||
echo "\t<?php\n";
|
||||
foreach ($fields as $field) {
|
||||
|
|
|
@ -54,8 +54,8 @@
|
|||
|
||||
echo "\t\t<td class=\"actions\">\n";
|
||||
echo "\t\t\t<?php echo \$this->Html->link(__('View', true), array('action' => 'view', \${$singularVar}['{$modelClass}']['{$primaryKey}'])); ?>\n";
|
||||
echo "\t\t\t<?php echo \$this->Html->link(__('Edit', true), array('action' => 'edit', \${$singularVar}['{$modelClass}']['{$primaryKey}'])); ?>\n";
|
||||
echo "\t\t\t<?php echo \$this->Html->link(__('Delete', true), array('action' => 'delete', \${$singularVar}['{$modelClass}']['{$primaryKey}']), null, sprintf(__('Are you sure you want to delete # %s?', true), \${$singularVar}['{$modelClass}']['{$primaryKey}'])); ?>\n";
|
||||
echo "\t\t\t<?php echo \$this->Html->link(__('Edit', true), array('action' => 'edit', \${$singularVar}['{$modelClass}']['{$primaryKey}'])); ?>\n";
|
||||
echo "\t\t\t<?php echo \$this->Html->link(__('Delete', true), array('action' => 'delete', \${$singularVar}['{$modelClass}']['{$primaryKey}']), null, sprintf(__('Are you sure you want to delete # %s?', true), \${$singularVar}['{$modelClass}']['{$primaryKey}'])); ?>\n";
|
||||
echo "\t\t</td>\n";
|
||||
echo "\t</tr>\n";
|
||||
|
||||
|
|
|
@ -89,6 +89,21 @@ class Cache {
|
|||
*
|
||||
* `Cache::config('default');`
|
||||
*
|
||||
* The following keys are used in core cache engines:
|
||||
*
|
||||
* - `duration` Specify how long items in this cache configuration last.
|
||||
* - `prefix` Prefix appended to all entries. Good for when you need to share a keyspace
|
||||
* with either another cache config or annother application.
|
||||
* - `probability` Probability of hitting a cache gc cleanup. Setting to 0 will disable
|
||||
* cache::gc from ever being called automatically.
|
||||
* - `servers' Used by memcache. Give the address of the memcached servers to use.
|
||||
* - `compress` Used by memcache. Enables memcache's compressed format.
|
||||
* - `serialize` Used by FileCache. Should cache objects be serialized first.
|
||||
* - `path` Used by FileCache. Path to where cachefiles should be saved.
|
||||
* - `lock` Used by FileCache. Should files be locked before writing to them?
|
||||
* - `user` Used by Xcache. Username for XCache
|
||||
* - `password` Used by Xcache. Password for XCache
|
||||
*
|
||||
* @see app/config/core.php for configuration settings
|
||||
* @param string $name Name of the configuration
|
||||
* @param array $settings Optional associative array of settings passed to the engine
|
||||
|
@ -149,7 +164,7 @@ class Cache {
|
|||
$cacheClass = $class . 'Engine';
|
||||
$this->_engines[$name] =& new $cacheClass();
|
||||
if ($this->_engines[$name]->init($config)) {
|
||||
if (time() % $this->_engines[$name]->settings['probability'] === 0) {
|
||||
if ($this->_engines[$name]->settings['probability'] && time() % $this->_engines[$name]->settings['probability'] === 0) {
|
||||
$this->_engines[$name]->gc();
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -287,5 +287,6 @@ class CakeLog {
|
|||
}
|
||||
|
||||
if (!defined('DISABLE_DEFAULT_ERROR_HANDLING')) {
|
||||
set_error_handler(array('CakeLog', 'handleError'));
|
||||
$cakeLog =& CakeLog::getInstance();
|
||||
set_error_handler(array($cakeLog, 'handleError'));
|
||||
}
|
||||
|
|
|
@ -122,7 +122,7 @@ class CakeSocket extends Object {
|
|||
}
|
||||
|
||||
if (!empty($errNum) || !empty($errStr)) {
|
||||
$this->setLastError($errStr, $errNum);
|
||||
$this->setLastError($errNum, $errStr);
|
||||
}
|
||||
|
||||
$this->connected = is_resource($this->connection);
|
||||
|
|
|
@ -146,7 +146,7 @@ class HttpSocket extends CakeSocket {
|
|||
* You can use a url string to set the url and use default configurations for
|
||||
* all other options:
|
||||
*
|
||||
* `$http =& new HttpSockect('http://cakephp.org/');`
|
||||
* `$http =& new HttpSocket('http://cakephp.org/');`
|
||||
*
|
||||
* Or use an array to configure multiple options:
|
||||
*
|
||||
|
|
|
@ -1422,18 +1422,20 @@ class FormHelper extends AppHelper {
|
|||
$style = null;
|
||||
$tag = null;
|
||||
$attributes += array(
|
||||
'class' => null,
|
||||
'class' => null,
|
||||
'escape' => true,
|
||||
'secure' => null,
|
||||
'empty' => '',
|
||||
'showParents' => false
|
||||
'showParents' => false,
|
||||
'hiddenField' => true
|
||||
);
|
||||
|
||||
$escapeOptions = $this->_extractOption('escape', $attributes);
|
||||
$secure = $this->_extractOption('secure', $attributes);
|
||||
$showEmpty = $this->_extractOption('empty', $attributes);
|
||||
$showParents = $this->_extractOption('showParents', $attributes);
|
||||
unset($attributes['escape'], $attributes['secure'], $attributes['empty'], $attributes['showParents']);
|
||||
$hiddenField = $this->_extractOption('hiddenField', $attributes);
|
||||
unset($attributes['escape'], $attributes['secure'], $attributes['empty'], $attributes['showParents'], $attributes['hiddenField']);
|
||||
|
||||
$attributes = $this->_initInputField($fieldName, array_merge(
|
||||
(array)$attributes, array('secure' => false)
|
||||
|
@ -1456,13 +1458,15 @@ class FormHelper extends AppHelper {
|
|||
$style = ($attributes['multiple'] === 'checkbox') ? 'checkbox' : null;
|
||||
$template = ($style) ? 'checkboxmultiplestart' : 'selectmultiplestart';
|
||||
$tag = $this->Html->tags[$template];
|
||||
$hiddenAttributes = array(
|
||||
'value' => '',
|
||||
'id' => $attributes['id'] . ($style ? '' : '_'),
|
||||
'secure' => false,
|
||||
'name' => $attributes['name']
|
||||
);
|
||||
$select[] = $this->hidden(null, $hiddenAttributes);
|
||||
if ($hiddenField) {
|
||||
$hiddenAttributes = array(
|
||||
'value' => '',
|
||||
'id' => $attributes['id'] . ($style ? '' : '_'),
|
||||
'secure' => false,
|
||||
'name' => $attributes['name']
|
||||
);
|
||||
$select[] = $this->hidden(null, $hiddenAttributes);
|
||||
}
|
||||
} else {
|
||||
$tag = $this->Html->tags['selectstart'];
|
||||
}
|
||||
|
@ -2048,6 +2052,8 @@ class FormHelper extends AppHelper {
|
|||
|
||||
if (empty($attributes['class'])) {
|
||||
$attributes['class'] = 'checkbox';
|
||||
} elseif ($attributes['class'] === 'form-error') {
|
||||
$attributes['class'] = 'checkbox ' . $attributes['class'];
|
||||
}
|
||||
$label = $this->label(null, $title, $label);
|
||||
$item = sprintf(
|
||||
|
@ -2189,7 +2195,7 @@ class FormHelper extends AppHelper {
|
|||
} else {
|
||||
$secure = (isset($this->params['_Token']) && !empty($this->params['_Token']));
|
||||
}
|
||||
|
||||
|
||||
$fieldName = null;
|
||||
if ($secure && !empty($options['name'])) {
|
||||
preg_match_all('/\[(.*?)\]/', $options['name'], $matches);
|
||||
|
|
|
@ -428,7 +428,10 @@ class JsHelper extends AppHelper {
|
|||
* @access protected
|
||||
*/
|
||||
function _getHtmlOptions($options, $additional = array()) {
|
||||
$htmlKeys = array_merge(array('class', 'id', 'escape', 'onblur', 'onfocus', 'rel', 'title'), $additional);
|
||||
$htmlKeys = array_merge(
|
||||
array('class', 'id', 'escape', 'onblur', 'onfocus', 'rel', 'title', 'style'),
|
||||
$additional
|
||||
);
|
||||
$htmlOptions = array();
|
||||
foreach ($htmlKeys as $key) {
|
||||
if (isset($options[$key])) {
|
||||
|
|
|
@ -21,7 +21,7 @@ if (Configure::read() == 0):
|
|||
endif;
|
||||
?>
|
||||
<h2><?php echo sprintf(__('Release Notes for CakePHP %s.', true), Configure::version()); ?></h2>
|
||||
<a href="http://cakephp.org/changelogs/1.3.7"><?php __('Read the changelog'); ?> </a>
|
||||
<a href="http://cakephp.org/changelogs/1.3.8"><?php __('Read the changelog'); ?> </a>
|
||||
<?php
|
||||
if (Configure::read() > 0):
|
||||
Debugger::checkSecurityKeys();
|
||||
|
|
|
@ -451,6 +451,23 @@ class ShellDispatcherTest extends CakeTestCase {
|
|||
$Dispatcher->params = $Dispatcher->args = array();
|
||||
$Dispatcher->parseParams($params);
|
||||
$this->assertEqual($expected, $Dispatcher->params);
|
||||
|
||||
$params = array(
|
||||
'cake.php',
|
||||
'-working',
|
||||
'D:\ ',
|
||||
'bake',
|
||||
'my_app',
|
||||
);
|
||||
$expected = array(
|
||||
'working' => '.',
|
||||
'app' => 'D:',
|
||||
'root' => '.',
|
||||
'webroot' => 'webroot'
|
||||
);
|
||||
$Dispatcher->params = $Dispatcher->args = array();
|
||||
$Dispatcher->parseParams($params);
|
||||
$this->assertEqual($expected, $Dispatcher->params);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -190,6 +190,7 @@ class TestAppSchema extends CakeSchema {
|
|||
var $datatypes = array(
|
||||
'id' => array('type' => 'integer', 'null' => false, 'default' => 0, 'key' => 'primary'),
|
||||
'float_field' => array('type' => 'float', 'null' => false, 'length' => '5,2', 'default' => ''),
|
||||
'bool' => array('type' => 'boolean', 'null' => false, 'default' => false),
|
||||
'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => true)),
|
||||
'tableParameters' => array()
|
||||
);
|
||||
|
|
|
@ -3051,7 +3051,8 @@ class ModelWriteTest extends BaseModelTest {
|
|||
'published' => 'Y',
|
||||
'user_id' => 1
|
||||
))
|
||||
), array('validate' => 'only'));
|
||||
), array('validate' => 'first'));
|
||||
$this->assertFalse($result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -3589,6 +3589,42 @@ class FormHelperTest extends CakeTestCase {
|
|||
'label' => false
|
||||
));
|
||||
$this->assertTags($result, $expected);
|
||||
|
||||
$this->Form->validationErrors['Model']['tags'] = 'Select atleast one option';
|
||||
$result = $this->Form->input('Model.tags', array(
|
||||
'options' => array('one'),
|
||||
'multiple' => 'checkbox',
|
||||
'label' => false,
|
||||
'div' => false
|
||||
));
|
||||
$expected = array(
|
||||
'input' => array('type' => 'hidden', 'name' => 'data[Model][tags]', 'value' => '', 'id' => 'ModelTags'),
|
||||
array('div' => array('class' => 'checkbox form-error')),
|
||||
array('input' => array('type' => 'checkbox', 'name' => 'data[Model][tags][]', 'value' => '0', 'id' => 'ModelTags0')),
|
||||
array('label' => array('for' => 'ModelTags0')),
|
||||
'one',
|
||||
'/label',
|
||||
'/div'
|
||||
);
|
||||
$this->assertTags($result, $expected);
|
||||
|
||||
$result = $this->Form->input('Model.tags', array(
|
||||
'options' => array('one'),
|
||||
'multiple' => 'checkbox',
|
||||
'class' => 'mycheckbox',
|
||||
'label' => false,
|
||||
'div' => false
|
||||
));
|
||||
$expected = array(
|
||||
'input' => array('type' => 'hidden', 'name' => 'data[Model][tags]', 'value' => '', 'id' => 'ModelTags'),
|
||||
array('div' => array('class' => 'mycheckbox form-error')),
|
||||
array('input' => array('type' => 'checkbox', 'name' => 'data[Model][tags][]', 'value' => '0', 'id' => 'ModelTags0')),
|
||||
array('label' => array('for' => 'ModelTags0')),
|
||||
'one',
|
||||
'/label',
|
||||
'/div'
|
||||
);
|
||||
$this->assertTags($result, $expected);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -3719,6 +3755,62 @@ class FormHelperTest extends CakeTestCase {
|
|||
);
|
||||
$this->assertTags($result, $expected);
|
||||
}
|
||||
/**
|
||||
* testSelectHiddenFieldOmission method
|
||||
*
|
||||
* test that select() with 'hiddenField' => false omits the hidden field
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testSelectHiddenFieldOmission() {
|
||||
$result = $this->Form->select('Model.multi_field',
|
||||
array('first', 'second'),
|
||||
null,
|
||||
array('multiple' => 'checkbox', 'hiddenField' => false)
|
||||
);
|
||||
$expected = array(
|
||||
array('div' => array('class' => 'checkbox')),
|
||||
array('input' => array('type' => 'checkbox', 'name' => 'data[Model][multi_field][]', 'value' => '0', 'id' => 'ModelMultiField0')),
|
||||
array('label' => array('for' => 'ModelMultiField0')),
|
||||
'first',
|
||||
'/label',
|
||||
'/div',
|
||||
array('div' => array('class' => 'checkbox')),
|
||||
array('input' => array('type' => 'checkbox', 'name' => 'data[Model][multi_field][]', 'value' => '1', 'id' => 'ModelMultiField1')),
|
||||
array('label' => array('for' => 'ModelMultiField1')),
|
||||
'second',
|
||||
'/label',
|
||||
'/div'
|
||||
);
|
||||
$this->assertTags($result, $expected);
|
||||
|
||||
$result = $this->Form->input('Model.multi_field', array(
|
||||
'options' => array('first', 'second'),
|
||||
'multiple' => 'checkbox',
|
||||
'hiddenField' => false
|
||||
));
|
||||
$expected = array(
|
||||
array('div' => array('class' => 'input select')),
|
||||
array('label' => array('for' => 'ModelMultiField')),
|
||||
'Multi Field',
|
||||
'/label',
|
||||
array('div' => array('class' => 'checkbox')),
|
||||
array('input' => array('type' => 'checkbox', 'name' => 'data[Model][multi_field][]', 'value' => '0', 'id' => 'ModelMultiField0')),
|
||||
array('label' => array('for' => 'ModelMultiField0')),
|
||||
'first',
|
||||
'/label',
|
||||
'/div',
|
||||
array('div' => array('class' => 'checkbox')),
|
||||
array('input' => array('type' => 'checkbox', 'name' => 'data[Model][multi_field][]', 'value' => '1', 'id' => 'ModelMultiField1')),
|
||||
array('label' => array('for' => 'ModelMultiField1')),
|
||||
'second',
|
||||
'/label',
|
||||
'/div',
|
||||
'/div'
|
||||
);
|
||||
$this->assertTags($result, $expected);
|
||||
}
|
||||
|
||||
/**
|
||||
* test that select() with multiple = checkbox works with overriding name attribute.
|
||||
|
@ -6349,7 +6441,7 @@ class FormHelperTest extends CakeTestCase {
|
|||
'/form'
|
||||
);
|
||||
$this->assertTags($result, $expected);
|
||||
|
||||
|
||||
$result = $this->Form->end(array('label' => ''));
|
||||
$expected = array(
|
||||
'div' => array('class' => 'submit'),
|
||||
|
|
|
@ -402,7 +402,7 @@ CODE;
|
|||
function testSubmitWithMock() {
|
||||
$this->_useMock();
|
||||
|
||||
$options = array('update' => '#content', 'id' => 'test-submit');
|
||||
$options = array('update' => '#content', 'id' => 'test-submit', 'style' => 'margin: 0');
|
||||
$this->Js->TestJsEngine->setReturnValue('dispatchMethod', 'serialize-code', array('serializeform', '*'));
|
||||
$this->Js->TestJsEngine->setReturnValue('dispatchMethod', 'serialize-code', array('serializeForm', '*'));
|
||||
$this->Js->TestJsEngine->setReturnValue('dispatchMethod', 'ajax-code', array('request', '*'));
|
||||
|
@ -422,7 +422,7 @@ CODE;
|
|||
$result = $this->Js->submit('Save', $options);
|
||||
$expected = array(
|
||||
'div' => array('class' => 'submit'),
|
||||
'input' => array('type' => 'submit', 'id' => $options['id'], 'value' => 'Save'),
|
||||
'input' => array('type' => 'submit', 'id' => $options['id'], 'value' => 'Save', 'style' => 'margin: 0'),
|
||||
'/div'
|
||||
);
|
||||
$this->assertTags($result, $expected);
|
||||
|
|
|
@ -92,13 +92,13 @@ class CakeCliReporter extends CakeBaseReporter {
|
|||
/**
|
||||
* Paint exception faildetail to STDERR.
|
||||
*
|
||||
* @param string $message Message of the Error
|
||||
* @param object $exception Exception instance
|
||||
* @return void
|
||||
* @access public
|
||||
*/
|
||||
function paintException($exception) {
|
||||
parent::paintException($exception);
|
||||
$message .= sprintf('Unexpected exception of type [%s] with message [%s] in [%s] line [%s]',
|
||||
$message = sprintf('Unexpected exception of type [%s] with message [%s] in [%s] line [%s]',
|
||||
get_class($exception),
|
||||
$exception->getMessage(),
|
||||
$exception->getFile(),
|
||||
|
|
Loading…
Add table
Reference in a new issue