Browse Source

Merge branch 'master' into 2.4

Conflicts:
	lib/Cake/Core/Object.php
mark_story 13 years ago
parent
commit
cdede82b7e

+ 1 - 0
lib/Cake/Console/Command/AclShell.php

@@ -377,6 +377,7 @@ class AclShell extends AppShell {
 				'help' => __d('cake_console', 'Create a new ACL node'),
 				'parser' => array(
 					'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(
 						'type' => $type,
 						'parent' => array(

+ 2 - 1
lib/Cake/Core/Object.php

@@ -14,6 +14,8 @@
  * @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('CakeLog', 'Log');
 
@@ -69,7 +71,6 @@ class Object {
 		if (empty($url)) {
 			return false;
 		}
-		App::uses('Dispatcher', 'Routing');
 		if (($index = array_search('return', $extra)) !== false) {
 			$extra['return'] = 0;
 			$extra['autoRender'] = 1;

+ 22 - 7
lib/Cake/Test/Case/Controller/Component/PaginatorComponentTest.php

@@ -570,7 +570,7 @@ class PaginatorComponentTest extends CakeTestCase {
 	public function testPaginateSpecialType() {
 		$Controller = new PaginatorTestController($this->request);
 		$Controller->uses = array('PaginatorControllerPost', 'PaginatorControllerComment');
-		$Controller->passedArgs[] = '1';
+		$Controller->request->params['pass'][] = '1';
 		$Controller->params['url'] = array();
 		$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.
- * 
+ *
  *
  * @expectedException NotFoundException
  * @return void
@@ -1083,7 +1083,7 @@ class PaginatorComponentTest extends CakeTestCase {
 		$Controller = new Controller($this->request);
 
 		$Controller->uses = array('PaginatorControllerPost', 'ControllerComment');
-		$Controller->passedArgs[] = '1';
+		$Controller->request->params['pass'][] = '1';
 		$Controller->constructClasses();
 
 		$Controller->request->params['named'] = array(
@@ -1134,11 +1134,26 @@ class PaginatorComponentTest extends CakeTestCase {
 		), false);
 
 		$Controller->paginate = array(
-			'fields' => array('PaginatorControllerComment.id', 'title', 'PaginatorControllerPost.title'),
+			'fields' => array(
+				'PaginatorControllerComment.id',
+				'title',
+				'PaginatorControllerPost.title'
+			),
+		);
+		$Controller->request->params['named'] = array(
+			'sort' => 'PaginatorControllerPost.title',
+			'direction' => 'desc'
+		);
+		$result = Hash::extract(
+			$Controller->paginate('PaginatorControllerComment'),
+			'{n}.PaginatorControllerComment.id'
 		);
-		$Controller->passedArgs = array('sort' => 'PaginatorControllerPost.title', 'dir' => 'asc');
-		$result = $Controller->paginate('PaginatorControllerComment');
-		$this->assertEquals(array(1, 2, 3, 4, 5, 6), Hash::extract($result, '{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);
 	}
 
 /**

+ 22 - 0
lib/Cake/Test/Case/View/Helper/FormHelperTest.php

@@ -2205,6 +2205,28 @@ class FormHelperTest extends CakeTestCase {
 			'/div'
 		);
 		$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);
 	}
 
 /**

+ 9 - 1
lib/Cake/Utility/Security.php

@@ -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 $key Key to use
  * @return string Encrypted/Decrypted string
+ * @deprecated This method will be removed in 3.x
  */
 	public static function cipher($text, $key) {
 		if (empty($key)) {

+ 1 - 1
lib/Cake/View/Helper/FormHelper.php

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

+ 1 - 1
lib/Cake/View/Helper/SessionHelper.php

@@ -64,7 +64,7 @@ class SessionHelper extends AppHelper {
  * In your view: `$this->Session->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() {
 		return CakeSession::error();