summaryrefslogtreecommitdiff
path: root/program/steps/addressbook/import.inc
diff options
context:
space:
mode:
authoralecpl <alec@alec.pl>2012-04-12 11:52:09 +0000
committeralecpl <alec@alec.pl>2012-04-12 11:52:09 +0000
commit9336ba21cfdee9aca3898361a62b42a6027242df (patch)
treec6dcbb7840e418cefd4d6447e73b7063dba53065 /program/steps/addressbook/import.inc
parent28391b4ec32d25f688f9d8a96a66e484d6864e67 (diff)
- Fix importing to LDAP addressbook when mail attribute is required by
validating input data with autofix
Diffstat (limited to 'program/steps/addressbook/import.inc')
-rw-r--r--program/steps/addressbook/import.inc8
1 files changed, 4 insertions, 4 deletions
diff --git a/program/steps/addressbook/import.inc b/program/steps/addressbook/import.inc
index 7b52bdcee..018c980eb 100644
--- a/program/steps/addressbook/import.inc
+++ b/program/steps/addressbook/import.inc
@@ -164,10 +164,11 @@ if ($_FILES['_file']['tmp_name'] && is_uploaded_file($_FILES['_file']['tmp_name'
$CONTACTS->delete_all();
foreach ($vcards as $vcard) {
- $email = $vcard->email[0];
+ $email = $vcard->email[0];
+ $a_record = $vcard->get_assoc();
- // skip entries without an e-mail address
- if (empty($email)) {
+ // skip entries without an e-mail address or invalid
+ if (empty($email) || !$CONTACTS->validate($a_record, true)) {
$IMPORT_STATS->nomail++;
continue;
}
@@ -188,7 +189,6 @@ if ($_FILES['_file']['tmp_name'] && is_uploaded_file($_FILES['_file']['tmp_name'
}
}
- $a_record = $vcard->get_assoc();
$a_record['vcard'] = $vcard->export();
$plugin = $RCMAIL->plugins->exec_hook('contact_create', array('record' => $a_record, 'source' => null));