From 82a8481a074549ac2f49d1ad97fc023db5d949f5 Mon Sep 17 00:00:00 2001 From: alec Date: Tue, 10 Apr 2012 07:47:15 +0000 Subject: - Fix removing all folders on import to LDAP addressbook (added rcube_ldap::delete_all()) - Fix removing sub-entries in delete() git-svn-id: https://svn.roundcube.net/trunk@6055 208e9e7b-5314-0410-a742-e7e81cd9613c --- roundcubemail/CHANGELOG | 1 + roundcubemail/program/include/rcube_ldap.php | 21 +++++++++++++++++++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/roundcubemail/CHANGELOG b/roundcubemail/CHANGELOG index 6417cc139..31ab964ed 100644 --- a/roundcubemail/CHANGELOG +++ b/roundcubemail/CHANGELOG @@ -1,6 +1,7 @@ CHANGELOG Roundcube Webmail =========================== +- Fix removing all folders on import to LDAP addressbook - Fix so "Back" from compose/show doesn't reset search request (#1488238) - Add option to delete messages instead of moving to Trash when in Junk folder (#1486686) - Fix invisible cursor when replying to a html message (#1487073) diff --git a/roundcubemail/program/include/rcube_ldap.php b/roundcubemail/program/include/rcube_ldap.php index 61c66f340..9f8086bd9 100644 --- a/roundcubemail/program/include/rcube_ldap.php +++ b/roundcubemail/program/include/rcube_ldap.php @@ -1284,7 +1284,7 @@ class rcube_ldap extends rcube_addressbook // Need to delete all sub-entries first if ($this->sub_filter) { - if ($entries = $this->ldap_list($dn, $this->sub_filter, array_keys($this->props['sub_fields']))) { + if ($entries = $this->ldap_list($dn, $this->sub_filter)) { foreach ($entries as $entry) { if (!$this->ldap_delete($entry['dn'])) { $this->set_error(self::ERROR_SAVING, 'errorsaving'); @@ -1314,6 +1314,23 @@ class rcube_ldap extends rcube_addressbook } + /** + * Remove all contact records + */ + function delete_all() + { + //searching for contact entries + $dn_list = $this->ldap_list($this->base_dn, $this->prop['filter'] ? $this->prop['filter'] : '(objectclass=*)'); + + if (!empty($dn_list)) { + foreach ($dn_list as $idx => $entry) { + $dn_list[$idx] = self::dn_encode($entry['dn']); + } + $this->delete($dn_list); + } + } + + /** * Execute the LDAP search based on the stored credentials */ @@ -2172,7 +2189,7 @@ class rcube_ldap extends rcube_addressbook /** * Wrapper for ldap_list() */ - protected function ldap_list($dn, $filter, $attrs) + protected function ldap_list($dn, $filter, $attrs = array('')) { $list = array(); $this->_debug("C: List [dn: $dn] [{$filter}]"); -- cgit v1.2.3