diff options
| author | thomasb <thomasb@208e9e7b-5314-0410-a742-e7e81cd9613c> | 2008-09-02 07:42:46 +0000 |
|---|---|---|
| committer | thomasb <thomasb@208e9e7b-5314-0410-a742-e7e81cd9613c> | 2008-09-02 07:42:46 +0000 |
| commit | d6bef1e39f44faa270dee193f05ae649605a1ad2 (patch) | |
| tree | 44e05839ce96b6decb8681aa06368f5ad74220fe /roundcubemail/program/steps/addressbook | |
| parent | 13b4725150912f49837c3d2bc7412a3ee1df757a (diff) | |
Let rcmail class create address book instances
git-svn-id: https://svn.roundcube.net/trunk@1712 208e9e7b-5314-0410-a742-e7e81cd9613c
Diffstat (limited to 'roundcubemail/program/steps/addressbook')
| -rw-r--r-- | roundcubemail/program/steps/addressbook/copy.inc | 9 | ||||
| -rw-r--r-- | roundcubemail/program/steps/addressbook/func.inc | 11 |
2 files changed, 4 insertions, 16 deletions
diff --git a/roundcubemail/program/steps/addressbook/copy.inc b/roundcubemail/program/steps/addressbook/copy.inc index af8b87c40..268903bf5 100644 --- a/roundcubemail/program/steps/addressbook/copy.inc +++ b/roundcubemail/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/roundcubemail/program/steps/addressbook/func.inc b/roundcubemail/program/steps/addressbook/func.inc index 98c56af78..c4fbab219 100644 --- a/roundcubemail/program/steps/addressbook/func.inc +++ b/roundcubemail/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']); |
