Merge branch 'master' into 2.4

Conflicts:
	lib/Cake/Core/Object.php
This commit is contained in:
mark_story 2013-05-07 22:22:48 -04:00
commit cdede82b7e
7 changed files with 58 additions and 11 deletions

View file

@ -377,6 +377,7 @@ class AclShell extends AppShell {
'help' => __d('cake_console', 'Create a new ACL node'), 'help' => __d('cake_console', 'Create a new ACL node'),
'parser' => array( 'parser' => array(
'description' => __d('cake_console', 'Creates a new ACL object <node> under the parent'), 'description' => __d('cake_console', 'Creates a new ACL object <node> under the parent'),
'epilog' => __d('cake_console', 'You can use `root` as the parent when creating nodes to create top level nodes.'),
'arguments' => array( 'arguments' => array(
'type' => $type, 'type' => $type,
'parent' => array( 'parent' => array(

View file

@ -14,6 +14,8 @@
* @license MIT License (http://www.opensource.org/licenses/mit-license.php) * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/ */
App::uses('CakeLog', 'Log');
App::uses('Dispatcher', 'Routing');
App::uses('Set', 'Utility'); App::uses('Set', 'Utility');
App::uses('CakeLog', 'Log'); App::uses('CakeLog', 'Log');
@ -69,7 +71,6 @@ class Object {
if (empty($url)) { if (empty($url)) {
return false; return false;
} }
App::uses('Dispatcher', 'Routing');
if (($index = array_search('return', $extra)) !== false) { if (($index = array_search('return', $extra)) !== false) {
$extra['return'] = 0; $extra['return'] = 0;
$extra['autoRender'] = 1; $extra['autoRender'] = 1;

View file

@ -570,7 +570,7 @@ class PaginatorComponentTest extends CakeTestCase {
public function testPaginateSpecialType() { public function testPaginateSpecialType() {
$Controller = new PaginatorTestController($this->request); $Controller = new PaginatorTestController($this->request);
$Controller->uses = array('PaginatorControllerPost', 'PaginatorControllerComment'); $Controller->uses = array('PaginatorControllerPost', 'PaginatorControllerComment');
$Controller->passedArgs[] = '1'; $Controller->request->params['pass'][] = '1';
$Controller->params['url'] = array(); $Controller->params['url'] = array();
$Controller->constructClasses(); $Controller->constructClasses();
@ -891,7 +891,7 @@ class PaginatorComponentTest extends CakeTestCase {
/** /**
* Test that a really REALLY large page number gets clamped to the max page size. * Test that a really REALLY large page number gets clamped to the max page size.
* *
* *
* @expectedException NotFoundException * @expectedException NotFoundException
* @return void * @return void
@ -1083,7 +1083,7 @@ class PaginatorComponentTest extends CakeTestCase {
$Controller = new Controller($this->request); $Controller = new Controller($this->request);
$Controller->uses = array('PaginatorControllerPost', 'ControllerComment'); $Controller->uses = array('PaginatorControllerPost', 'ControllerComment');
$Controller->passedArgs[] = '1'; $Controller->request->params['pass'][] = '1';
$Controller->constructClasses(); $Controller->constructClasses();
$Controller->request->params['named'] = array( $Controller->request->params['named'] = array(
@ -1134,11 +1134,26 @@ class PaginatorComponentTest extends CakeTestCase {
), false); ), false);
$Controller->paginate = array( $Controller->paginate = array(
'fields' => array('PaginatorControllerComment.id', 'title', 'PaginatorControllerPost.title'), 'fields' => array(
'PaginatorControllerComment.id',
'title',
'PaginatorControllerPost.title'
),
); );
$Controller->passedArgs = array('sort' => 'PaginatorControllerPost.title', 'dir' => 'asc'); $Controller->request->params['named'] = array(
$result = $Controller->paginate('PaginatorControllerComment'); 'sort' => 'PaginatorControllerPost.title',
$this->assertEquals(array(1, 2, 3, 4, 5, 6), Hash::extract($result, '{n}.PaginatorControllerComment.id')); 'direction' => 'desc'
);
$result = Hash::extract(
$Controller->paginate('PaginatorControllerComment'),
'{n}.PaginatorControllerComment.id'
);
$result1 = array_splice($result, 0, 2);
sort($result1);
$this->assertEquals(array(5, 6), $result1);
sort($result);
$this->assertEquals(array(1, 2, 3, 4), $result);
} }
/** /**

View file

@ -2205,6 +2205,28 @@ class FormHelperTest extends CakeTestCase {
'/div' '/div'
); );
$this->assertTags($result, $expected); $this->assertTags($result, $expected);
$result = $this->Form->input('User.disabled', array(
'label' => 'Disabled',
'type' => 'checkbox',
'data-foo' => 'disabled'
));
$expected = array(
'div' => array('class' => 'input checkbox'),
'input' => array('type' => 'hidden', 'name' => 'data[User][disabled]', 'value' => '0', 'id' => 'UserDisabled_'),
array('input' => array(
'type' => 'checkbox',
'name' => 'data[User][disabled]',
'value' => '1',
'id' => 'UserDisabled',
'data-foo' => 'disabled'
)),
'label' => array('for' => 'UserDisabled'),
'Disabled',
'/label',
'/div'
);
$this->assertTags($result, $expected);
} }
/** /**

View file

@ -168,11 +168,19 @@ class Security {
} }
/** /**
* Encrypts/Decrypts a text using the given key. * Runs $text through a XOR cipher.
*
* *Note* This is not a cryptographically strong method and should not be used
* for sensitive data. Additionally this method does *not* work in environments
* where suhosin is enabled.
*
* Instead you should use Security::rijndael() when you need strong
* encryption.
* *
* @param string $text Encrypted string to decrypt, normal string to encrypt * @param string $text Encrypted string to decrypt, normal string to encrypt
* @param string $key Key to use * @param string $key Key to use
* @return string Encrypted/Decrypted string * @return string Encrypted/Decrypted string
* @deprecated This method will be removed in 3.x
*/ */
public static function cipher($text, $key) { public static function cipher($text, $key) {
if (empty($key)) { if (empty($key)) {

View file

@ -2817,7 +2817,7 @@ class FormHelper extends AppHelper {
} }
$disabledIndex = array_search('disabled', $options, true); $disabledIndex = array_search('disabled', $options, true);
if ($disabledIndex !== false) { if (is_int($disabledIndex)) {
unset($options[$disabledIndex]); unset($options[$disabledIndex]);
$options['disabled'] = true; $options['disabled'] = true;
} }

View file

@ -64,7 +64,7 @@ class SessionHelper extends AppHelper {
* In your view: `$this->Session->error();` * In your view: `$this->Session->error();`
* *
* @return string last error * @return string last error
* @link http://book.cakephp.org/2.0/en/core-libraries/helpers/session.html#displaying-notifcations-or-flash-messages * @link http://book.cakephp.org/2.0/en/core-libraries/helpers/session.html#displaying-notifications-or-flash-messages
*/ */
public function error() { public function error() {
return CakeSession::error(); return CakeSession::error();