/** * sets up the pdb_data_keys value * * the purpose of this value is to tell the submission processor which fields * to process. This is a security measure so that trying to spoof the submission * by adding extra fields, editing readonly fields or deleting fields in the * browser HTML won't work. * * readonly fields and hidden fields that have values set are not included in the * set because they are not processed in this context * * @return string the value for the pdb_data_keys field */ protected function _form_data_keys() { $displayed = array(); foreach ($this->display_columns as $column) { $field = $this->fields[$column]; if (!in_array($field->form_element, array('hidden')) && $field->readonly === '0' || $field->form_element === 'captcha') { $displayed[] = $field->name; } } return implode('.', PDb_Base::get_field_indices(array_unique(array_merge($displayed, array_keys($this->hidden_fields))))); // return PDb_Base::xcrypt(implode('.', PDb_Base::get_field_indices(array_unique(array_merge($displayed, array_keys($this->hidden_fields)))))); }
/** * prints the form open tag and all hidden fields * * The incoming hidden fields are merged with the default fields * * @param array $hidden array of hidden fields to print * @return null */ protected function _print_form_head($hidden = '') { $uri_components = parse_url($_SERVER['REQUEST_URI']); echo '<form method="post" enctype="multipart/form-data" autocomplete="off" action="' . $_SERVER['REQUEST_URI'] . '" >'; $default_hidden_fields = array('action' => $this->module, 'subsource' => Participants_Db::PLUGIN_NAME, 'shortcode_page' => $uri_components['path'], 'thanks_page' => $this->submission_page, 'instance_index' => Participants_Db::$instance_index, 'pdb_data_keys' => implode('.', PDb_Base::get_field_indices($this->display_columns))); if (!$this->_empty($hidden)) { $hidden_fields = $hidden + $default_hidden_fields; } else { $hidden_fields = $default_hidden_fields; } if (!$this->_empty($this->hidden_fields)) { $hidden_fields = $hidden_fields + $this->hidden_fields; } PDb_FormElement::print_hidden_fields($hidden_fields); }