|
|
@@ -9,7 +9,7 @@
|
|
|
*
|
|
|
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
|
|
|
* @link http://cakephp.org CakePHP(tm) Project
|
|
|
- * @package Cake.View.Helper
|
|
|
+ * @package Cake.View.Helper
|
|
|
* @since CakePHP(tm) v 0.10.0.1076
|
|
|
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
|
|
*/
|
|
|
@@ -2015,7 +2015,7 @@ class FormHelper extends AppHelper {
|
|
|
empty($attributes['disabled']) &&
|
|
|
(!empty($attributes['multiple']) || $hasOptions)
|
|
|
) {
|
|
|
- $this->_secure(true);
|
|
|
+ $this->_secure(true, $this->_secureFieldName($attributes));
|
|
|
}
|
|
|
$select[] = $this->Html->useTag($tag, $attributes['name'], array_diff_key($attributes, array('name' => null, 'value' => null)));
|
|
|
}
|
|
|
@@ -2828,16 +2828,27 @@ class FormHelper extends AppHelper {
|
|
|
$result['required'] = true;
|
|
|
}
|
|
|
|
|
|
- $fieldName = null;
|
|
|
- if (!empty($options['name'])) {
|
|
|
+ $this->_secure($secure, $this->_secureFieldName($options));
|
|
|
+ return $result;
|
|
|
+ }
|
|
|
+
|
|
|
+/**
|
|
|
+ * Get the field name for use with _secure().
|
|
|
+ *
|
|
|
+ * Parses the name attribute to create a dot separated name value for use
|
|
|
+ * in secured field hash.
|
|
|
+ *
|
|
|
+ * @param array $options An array of options possibly containing a name key.
|
|
|
+ * @return string|null
|
|
|
+ */
|
|
|
+ protected function _secureFieldName($options) {
|
|
|
+ if (isset($options['name'])) {
|
|
|
preg_match_all('/\[(.*?)\]/', $options['name'], $matches);
|
|
|
if (isset($matches[1])) {
|
|
|
- $fieldName = $matches[1];
|
|
|
+ return $matches[1];
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- $this->_secure($secure, $fieldName);
|
|
|
- return $result;
|
|
|
+ return null;
|
|
|
}
|
|
|
|
|
|
/**
|