Browse Source

Merge branch 'master' into 2.4

Conflicts:
	lib/Cake/VERSION.txt
ADmad 13 years ago
parent
commit
19f8274a95

+ 3 - 3
app/Config/core.php

@@ -206,7 +206,7 @@
 
 /**
  * Apply timestamps with the last modified time to static assets (js, css, images).
- * Will append a querystring parameter containing the time the file was modified. This is
+ * Will append a query string parameter containing the time the file was modified. This is
  * useful for invalidating browser caches.
  *
  * Set to `true` to apply timestamps when debug > 0. Set to 'force' to always enable
@@ -232,7 +232,7 @@
 	//Configure::write('Asset.filter.js', 'custom_javascript_output_filter.php');
 
 /**
- * The classname and database used in CakePHP's
+ * The class name and database used in CakePHP's
  * access control lists.
  */
 	Configure::write('Acl.classname', 'DbAcl');
@@ -312,7 +312,7 @@
  * By default File is used, but for improved performance you should use APC.
  *
  * Note: 'default' and other application caches should be configured in app/Config/bootstrap.php.
- *       Please check the comments in boostrap.php for more info on the cache engines available
+ *       Please check the comments in bootstrap.php for more info on the cache engines available
  *       and their settings.
  */
 $engine = 'File';

+ 3 - 3
lib/Cake/Console/Templates/skel/Config/core.php

@@ -197,7 +197,7 @@
 
 /**
  * Apply timestamps with the last modified time to static assets (js, css, images).
- * Will append a querystring parameter containing the time the file was modified. This is
+ * Will append a query string parameter containing the time the file was modified. This is
  * useful for invalidating browser caches.
  *
  * Set to `true` to apply timestamps when debug > 0. Set to 'force' to always enable
@@ -223,7 +223,7 @@
 	//Configure::write('Asset.filter.js', 'custom_javascript_output_filter.php');
 
 /**
- * The classname and database used in CakePHP's
+ * The class name and database used in CakePHP's
  * access control lists.
  */
 	Configure::write('Acl.classname', 'DbAcl');
@@ -303,7 +303,7 @@
  * By default File is used, but for improved performance you should use APC.
  *
  * Note: 'default' and other application caches should be configured in app/Config/bootstrap.php.
- *       Please check the comments in boostrap.php for more info on the cache engines available
+ *       Please check the comments in bootstrap.php for more info on the cache engines available
  *       and their settings.
  */
 $engine = 'File';

+ 8 - 2
lib/Cake/Console/cake.php

@@ -31,8 +31,14 @@ foreach ($paths as $path) {
 }
 
 if (!$found) {
-	$root = dirname(dirname(dirname(__FILE__)));
-	if (!include $root . $ds . $dispatcher) {
+	$rootInstall = dirname(dirname(dirname(__FILE__))) . $ds . $dispatcher;
+	$composerInstall = dirname(dirname(__FILE__)) . $ds. $dispatcher;
+
+	if (file_exists($composerInstall)) {
+		include $composerInstall;
+	} elseif (file_exists($rootInstall)) {
+		include $rootInstall;
+	} else {
 		trigger_error('Could not locate CakePHP core files.', E_USER_ERROR);
 	}
 } else {

+ 5 - 5
lib/Cake/Controller/Component/Auth/FormAuthenticate.php

@@ -49,11 +49,11 @@ class FormAuthenticate extends BaseAuthenticate {
 		if (empty($request->data[$model])) {
 			return false;
 		}
-		if (
-			empty($request->data[$model][$fields['username']]) ||
-			empty($request->data[$model][$fields['password']])
-		) {
-			return false;
+		foreach (array($fields['username'], $fields['password']) as $field) {
+			$value = $request->data($model . '.' . $field);
+			if (empty($value) || !is_string($value)) {
+				return false;
+			}
 		}
 		return true;
 	}

+ 1 - 1
lib/Cake/Model/Behavior/TranslateBehavior.php

@@ -539,7 +539,7 @@ class TranslateBehavior extends ModelBehavior {
 				$className = $Model->translateModel;
 			}
 
-			$this->runtime[$Model->alias]['model'] = ClassRegistry::init($className, 'Model');
+			$this->runtime[$Model->alias]['model'] = ClassRegistry::init($className);
 		}
 		if (!empty($Model->translateTable) && $Model->translateTable !== $this->runtime[$Model->alias]['model']->useTable) {
 			$this->runtime[$Model->alias]['model']->setSource($Model->translateTable);

+ 1 - 2
lib/Cake/Model/ConnectionManager.php

@@ -86,8 +86,7 @@ class ConnectionManager {
 		}
 
 		if (!empty(self::$_dataSources[$name])) {
-			$return = self::$_dataSources[$name];
-			return $return;
+			return self::$_dataSources[$name];
 		}
 
 		if (empty(self::$_connectionsEnum[$name])) {

+ 1 - 1
lib/Cake/Model/Datasource/DboSource.php

@@ -2588,7 +2588,7 @@ class DboSource extends DataSource {
 		}
 
 		if (!preg_match($operatorMatch, trim($operator))) {
-			$operator .= is_array($value) ? ' IN' :  ' =';
+			$operator .= is_array($value) ? ' IN' : ' =';
 		}
 		$operator = trim($operator);
 

+ 2 - 0
lib/Cake/Model/Model.php

@@ -1694,6 +1694,8 @@ class Model extends Object implements CakeEventListener {
 			}
 		}
 
+		$db = $this->getDataSource();
+
 		if (empty($this->data[$this->alias][$this->primaryKey])) {
 			unset($this->data[$this->alias][$this->primaryKey]);
 		}

+ 22 - 0
lib/Cake/Test/Case/Controller/Component/Auth/FormAuthenticateTest.php

@@ -116,6 +116,28 @@ class FormAuthenticateTest extends CakeTestCase {
 	}
 
 /**
+ * test authenticate field is not string
+ *
+ * @return void
+ */
+	public function testAuthenticateFieldsAreNotString() {
+		$request = new CakeRequest('posts/index', false);
+		$request->data = array(
+			'User' => array(
+				'user' => array('mariano', 'phpnut'),
+				'password' => 'my password'
+		));
+		$this->assertFalse($this->auth->authenticate($request, $this->response));
+
+		$request->data = array(
+			'User' => array(
+				'user' => 'mariano',
+				'password' => array('password1', 'password2')
+		));
+		$this->assertFalse($this->auth->authenticate($request, $this->response));
+	}
+
+/**
  * test the authenticate method
  *
  * @return void

+ 1 - 1
lib/Cake/Test/Case/Model/ModelReadTest.php

@@ -7765,7 +7765,7 @@ class ModelReadTest extends BaseModelTest {
 		$this->assertEquals(4, $result[0][0]['other_field']);
 
 		ClassRegistry::flush();
-		$Writing = ClassRegistry::init(array('class' => 'Post', 'alias' => 'Writing'), 'Model');
+		$Writing = ClassRegistry::init(array('class' => 'Post', 'alias' => 'Writing'));
 		$Writing->virtualFields = array('two' => "1 + 1");
 		$result = $Writing->find('first');
 		$this->assertEquals(2, $result['Writing']['two']);

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

@@ -2328,7 +2328,6 @@ class FormHelperTest extends CakeTestCase {
  * @return void
  */
 	public function testInputTimeWithIntervalAnd12HourFormat() {
-		/*
 		$result = $this->Form->input('Model.start_time', array(
 			'type' => 'time',
 			'timeFormat' => 12,
@@ -2348,7 +2347,6 @@ class FormHelperTest extends CakeTestCase {
 		$this->assertContains('<option value="04" selected="selected">4</option>', $result);
 		$this->assertContains('<option value="30" selected="selected">30</option>', $result);
 		$this->assertContains('<option value="pm" selected="selected">pm</option>', $result);
-		*/
 
 		$result = $this->Form->input('Model.start_time', array(
 			'type' => 'time',

+ 1 - 1
lib/Cake/Utility/ClassRegistry.php

@@ -73,7 +73,7 @@ class ClassRegistry {
  * Examples
  * Simple Use: Get a Post model instance ```ClassRegistry::init('Post');```
  *
- * Expanded: ```array('class' => 'ClassName', 'alias' => 'AliasNameStoredInTheRegistry', 'type' => 'Model');```
+ * Expanded: ```array('class' => 'ClassName', 'alias' => 'AliasNameStoredInTheRegistry');```
  *
  * Model Classes can accept optional ```array('id' => $id, 'table' => $table, 'ds' => $ds, 'alias' => $alias);```
  *

+ 1 - 1
lib/Cake/Utility/Debugger.php

@@ -421,7 +421,7 @@ class Debugger {
 	}
 
 /**
- * Wraps the highlight_string funciton in case the server API does not
+ * Wraps the highlight_string function in case the server API does not
  * implement the function as it is the case of the HipHop interpreter
  *
  * @param string $str the string to convert