-// Basic input checks
-if ((!get_input_value('_name', RCUBE_INPUT_POST) || !get_input_value('_email', RCUBE_INPUT_POST))) {
- $OUTPUT->show_message('formincomplete', 'warning');
- rcmail_overwrite_action($return_action);
- return;
+// read POST values into hash array
+$a_record = array();
+foreach ($GLOBALS['CONTACT_COLTYPES'] as $col => $colprop) {
+ $fname = '_'.$col;
+ if ($colprop['composite'])
+ continue;
+ // gather form data of composite fields
+ if ($colprop['childs']) {
+ $values = array();
+ foreach ($colprop['childs'] as $childcol => $cp) {
+ $vals = get_input_value('_'.$childcol, RCUBE_INPUT_POST, true);
+ foreach ((array)$vals as $i => $val)
+ $values[$i][$childcol] = $val;
+ }
+ $subtypes = get_input_value('_subtype_' . $col, RCUBE_INPUT_POST);
+ foreach ($subtypes as $i => $subtype)
+ if ($values[$i])
+ $a_record[$col.':'.$subtype][] = $values[$i];
+ }
+ // assign values and subtypes
+ else if (is_array($_POST[$fname])) {
+ $values = get_input_value($fname, RCUBE_INPUT_POST, true);
+ $subtypes = get_input_value('_subtype_' . $col, RCUBE_INPUT_POST);
+ foreach ($values as $i => $val) {
+ $subtype = $subtypes[$i] ? ':'.$subtypes[$i] : '';
+ $a_record[$col.$subtype][] = $val;
+ }
+ }
+ else if (isset($_POST[$fname])) {
+ $a_record[$col] = get_input_value($fname, RCUBE_INPUT_POST, true);
+ }