Skip to content

Commit

Permalink
Merge branch '1.3' of github.com:cakephp/cakephp1x into 1.3
Browse files Browse the repository at this point in the history
  • Loading branch information
markstory committed Apr 9, 2010
2 parents 9d3a2c6 + 7eb3055 commit 94391d7
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 3 deletions.
9 changes: 7 additions & 2 deletions cake/libs/view/helpers/form.php
Expand Up @@ -1412,6 +1412,9 @@ function select($fieldName, $options = array(), $selected = null, $attributes =
$escapeOptions = $attributes['escape']; $escapeOptions = $attributes['escape'];
unset($attributes['escape']); unset($attributes['escape']);
} }
if (isset($attributes['secure'])) {
$secure = $attributes['secure'];
}
if (isset($attributes['empty'])) { if (isset($attributes['empty'])) {
$showEmpty = $attributes['empty']; $showEmpty = $attributes['empty'];
unset($attributes['empty']); unset($attributes['empty']);
Expand Down Expand Up @@ -1452,7 +1455,9 @@ function select($fieldName, $options = array(), $selected = null, $attributes =
} }


if (!empty($tag) || isset($template)) { if (!empty($tag) || isset($template)) {
$this->__secure(); if (!isset($secure) || $secure == true) {
$this->__secure();
}
$select[] = sprintf($tag, $attributes['name'], $this->_parseAttributes( $select[] = sprintf($tag, $attributes['name'], $this->_parseAttributes(
$attributes, array('name', 'value')) $attributes, array('name', 'value'))
); );
Expand Down Expand Up @@ -2169,4 +2174,4 @@ function _initInputField($field, $options = array()) {
} }
} }


?> ?>
27 changes: 26 additions & 1 deletion cake/tests/cases/libs/view/helpers/form.test.php
Expand Up @@ -1224,6 +1224,31 @@ function testFormSecuredRadio() {
$this->assertEqual($this->Form->fields, $expected); $this->assertEqual($this->Form->fields, $expected);
} }


/**
* testDisableSecurityUsingForm method
*
* @access public
* @return void
*/
function testDisableSecurityUsingForm() {
$this->Form->params['_Token']['key'] = 'testKey';
$this->Form->params['_Token']['disabledFields'] = array();
$this->Form->create();

$this->Form->hidden('Addresses.id', array('value' => '123456'));
$this->Form->input('Addresses.title');
$this->Form->input('Addresses.first_name', array('secure' => false));
$this->Form->input('Addresses.city', array('type' => 'textarea', 'secure' => false));
$this->Form->input('Addresses.zip', array(
'type' => 'select', 'options' => array(1,2), 'secure' => false
));

$result = $this->Form->fields;
$expected = array(
'Addresses.id' => '123456', 'Addresses.title',
);
$this->assertEqual($result, $expected);
}
/** /**
* testPasswordValidation method * testPasswordValidation method
* *
Expand Down Expand Up @@ -6173,4 +6198,4 @@ function testInputTemplate() {
$this->assertTags($result, $expected); $this->assertTags($result, $expected);
} }
} }
?> ?>

0 comments on commit 94391d7

Please sign in to comment.