summaryrefslogtreecommitdiff
path: root/program/steps/addressbook
diff options
context:
space:
mode:
Diffstat (limited to 'program/steps/addressbook')
-rw-r--r--program/steps/addressbook/copy.inc9
-rw-r--r--program/steps/addressbook/func.inc11
2 files changed, 4 insertions, 16 deletions
diff --git a/program/steps/addressbook/copy.inc b/program/steps/addressbook/copy.inc
index af8b87c40..268903bf5 100644
--- a/program/steps/addressbook/copy.inc
+++ b/program/steps/addressbook/copy.inc
@@ -23,12 +23,9 @@ $cid = get_input_value('_cid', RCUBE_INPUT_POST);
$target = get_input_value('_to', RCUBE_INPUT_POST);
if ($cid && preg_match('/^[a-z0-9\-_=]+(,[a-z0-9\-_=]+)*$/i', $cid) && strlen($target) && $target != $source)
{
- if ($target != '0')
- $TARGET = new rcube_ldap($CONFIG['ldap_public'][$target]);
- else
- $TARGET = new rcube_contacts($DB, $_SESSION['user_id']);
-
- $success = false;
+ $success = false;
+ $TARGET = $RCMAIL->get_address_book($target);
+
if ($TARGET && $TARGET->ready && !$TARGET->readonly)
$success = $TARGET->insert($CONTACTS->search($CONTACTS->primary_key, $cid), true);
diff --git a/program/steps/addressbook/func.inc b/program/steps/addressbook/func.inc
index 98c56af78..c4fbab219 100644
--- a/program/steps/addressbook/func.inc
+++ b/program/steps/addressbook/func.inc
@@ -20,16 +20,7 @@
*/
// instantiate a contacts object according to the given source
-if (($source = get_input_value('_source', RCUBE_INPUT_GPC)) && isset($CONFIG['ldap_public'][$source]))
- $CONTACTS = new rcube_ldap($CONFIG['ldap_public'][$source]);
-else if (strtolower($CONFIG['address_book_type']) == 'ldap') {
- // Get the first LDAP address book.
- $source = key((array)$CONFIG['ldap_public']);
- $prop = current((array)$CONFIG['ldap_public']);
- $CONTACTS = new rcube_ldap($prop);
-} else {
- $CONTACTS = new rcube_contacts($DB, $_SESSION['user_id']);
-} // end else
+$CONTACTS = $RCMAIL->get_address_book(($source = get_input_value('_source', RCUBE_INPUT_GPC)));
$CONTACTS->set_pagesize($CONFIG['pagesize']);