aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/phpbb
diff options
context:
space:
mode:
authorCesar G <prototech91@gmail.com>2014-11-11 16:48:25 -0800
committerCesar G <prototech91@gmail.com>2014-11-11 16:48:25 -0800
commitd43f196fa6887fb399be318b30a594f98258aa1a (patch)
tree839e94fe5c0ea734f776a81d0eb2694cf0bc5320 /phpBB/phpbb
parent101945acf98b7fb765a90288bc7dd403ee610dd5 (diff)
downloadforums-d43f196fa6887fb399be318b30a594f98258aa1a.tar
forums-d43f196fa6887fb399be318b30a594f98258aa1a.tar.gz
forums-d43f196fa6887fb399be318b30a594f98258aa1a.tar.bz2
forums-d43f196fa6887fb399be318b30a594f98258aa1a.tar.xz
forums-d43f196fa6887fb399be318b30a594f98258aa1a.zip
[ticket/12642] Ensure CPF type specific options are set when editing booleans.
prepare_hidden_fields is expected to return null if the option is not sent in the request. The boolean method returns false instead, which results in the options being set as false in hidden fields when accessing the first edit step. When checking the "Default value" option, there is also a failure to check whether the "Field type" option is set to checkbox, thus resulting in this option getting lost as well. PHPBB3-12642
Diffstat (limited to 'phpBB/phpbb')
-rw-r--r--phpBB/phpbb/profilefields/type/type_bool.php38
1 files changed, 19 insertions, 19 deletions
diff --git a/phpBB/phpbb/profilefields/type/type_bool.php b/phpBB/phpbb/profilefields/type/type_bool.php
index 0582722833..3a13102117 100644
--- a/phpBB/phpbb/profilefields/type/type_bool.php
+++ b/phpBB/phpbb/profilefields/type/type_bool.php
@@ -367,29 +367,29 @@ class type_bool extends type_base
*/
public function prepare_hidden_fields($step, $key, $action, &$field_data)
{
- if ($key == 'l_lang_options' && $this->request->is_set('l_lang_options'))
+ if ($key == 'field_default_value')
{
- return $this->request->variable($key, array(array('')), true);
- }
- else if ($key == 'field_default_value')
- {
- return $this->request->variable($key, $field_data[$key]);
- }
- else
- {
- if (!$this->request->is_set($key))
- {
- return false;
- }
- else if ($key == 'field_ident' && isset($field_data[$key]))
- {
- return $field_data[$key];
- }
- else
+ $field_length = $this->request->variable('field_length', 0);
+
+ // Do a simple is set check if using checkbox.
+ if ($field_length == 2)
{
- return ($key == 'lang_options') ? $this->request->variable($key, array(''), true) : $this->request->variable($key, '', true);
+ return $this->request->is_set($key);
}
+ return $this->request->variable($key, $field_data[$key], true);
+ }
+
+ $default_lang_options = array(
+ 'l_lang_options' => array(0 => array('')),
+ 'lang_options' => array(0 => ''),
+ );
+
+ if (isset($default_lang_options[$key]) && $this->request->is_set($key))
+ {
+ return $this->request->variable($key, $default_lang_options[$key], true);
}
+
+ return parent::prepare_hidden_fields($step, $key, $action, $field_data);
}
/**