|
|
@ -128,28 +128,19 @@ foreach ($GLOBALS['CONTACT_COLTYPES'] as $col => $colprop) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (empty($a_record['name']))
|
|
|
|
if (empty($a_record['name'])) {
|
|
|
|
|
|
|
|
// TODO: let a dedicated function or a plugin compose the full name
|
|
|
|
$a_record['name'] = join(' ', array_filter(array($a_record['prefix'], $a_record['firstname'], $a_record['middlename'], $a_record['surname'], $a_record['suffix'],)));
|
|
|
|
$a_record['name'] = join(' ', array_filter(array($a_record['prefix'], $a_record['firstname'], $a_record['middlename'], $a_record['surname'], $a_record['suffix'],)));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Basic input checks (TODO: delegate to $CONTACTS instance)
|
|
|
|
|
|
|
|
if (empty($a_record['name'])/* || empty($a_record['email'])*/) {
|
|
|
|
|
|
|
|
$OUTPUT->show_message('formincomplete', 'warning');
|
|
|
|
|
|
|
|
rcmail_overwrite_action($return_action);
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Validity checks
|
|
|
|
|
|
|
|
foreach ($CONTACTS->get_col_values('email', $a_record, true) as $email) {
|
|
|
|
// do input checks (delegated to $CONTACTS instance)
|
|
|
|
if (strlen($email)) {
|
|
|
|
if (!$CONTACTS->validate($a_record)) {
|
|
|
|
$_email = rcube_idn_to_ascii($email);
|
|
|
|
$err = (array)$CONTACTS->get_error() + array('message' => 'formincomplete', 'type' => 'warning');
|
|
|
|
if (!check_email($_email)) {
|
|
|
|
$OUTPUT->show_message($err['message'], $err['type']);
|
|
|
|
$OUTPUT->show_message('emailformaterror', 'warning', array('email' => $email));
|
|
|
|
|
|
|
|
rcmail_overwrite_action($return_action);
|
|
|
|
rcmail_overwrite_action($return_action);
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// get raw photo data if changed
|
|
|
|
// get raw photo data if changed
|
|
|
|
if (isset($a_record['photo'])) {
|
|
|
|
if (isset($a_record['photo'])) {
|
|
|
|