summaryrefslogtreecommitdiff
path: root/program/steps/mail/addcontact.inc
diff options
context:
space:
mode:
Diffstat (limited to 'program/steps/mail/addcontact.inc')
-rw-r--r--program/steps/mail/addcontact.inc16
1 files changed, 14 insertions, 2 deletions
diff --git a/program/steps/mail/addcontact.inc b/program/steps/mail/addcontact.inc
index 0ad10313b..6f4187ba4 100644
--- a/program/steps/mail/addcontact.inc
+++ b/program/steps/mail/addcontact.inc
@@ -23,7 +23,19 @@ $done = false;
if (!empty($_POST['_address']))
{
- $CONTACTS = new rcube_contacts($DB, $_SESSION['user_id']);
+ $CONTACTS = array();
+ if (!$CONFIG["use_SQL_address_book"]) {
+ // Use the first writable LDAP address book.
+ foreach ($CONFIG["ldap_public"] as $id => $prop) {
+ if ($prop["writable"]) {
+ $CONTACTS = new rcube_ldap($prop);
+ break;
+ } // end if
+ } // end foreach
+ } // end if
+ else {
+ $CONTACTS = new rcube_contacts($DB, $_SESSION['user_id']);
+ } // end else
$contact_arr = $IMAP->decode_address_list(get_input_value('_address', RCUBE_INPUT_POST, true), 1, false);
if (!empty($contact_arr[1]['mailto']))
@@ -50,4 +62,4 @@ if (!$done)
$OUTPUT->show_message('errorsavingcontact', 'warning');
$OUTPUT->send();
-?> \ No newline at end of file
+?>