[Svn] r6055 - in trunk/roundcubemail: . program/include

trac at roundcube.net trac at roundcube.net
Tue Apr 10 09:47:16 CEST 2012


Author: alec
Date: 2012-04-10 02:47:15 -0500 (Tue, 10 Apr 2012)
New Revision: 6055

Modified:
   trunk/roundcubemail/CHANGELOG
   trunk/roundcubemail/program/include/rcube_ldap.php
Log:
- Fix removing all folders on import to LDAP addressbook (added rcube_ldap::delete_all())
- Fix removing sub-entries in delete()


Modified: trunk/roundcubemail/CHANGELOG
===================================================================
--- trunk/roundcubemail/CHANGELOG	2012-04-10 07:02:45 UTC (rev 6054)
+++ trunk/roundcubemail/CHANGELOG	2012-04-10 07:47:15 UTC (rev 6055)
@@ -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)

Modified: trunk/roundcubemail/program/include/rcube_ldap.php
===================================================================
--- trunk/roundcubemail/program/include/rcube_ldap.php	2012-04-10 07:02:45 UTC (rev 6054)
+++ trunk/roundcubemail/program/include/rcube_ldap.php	2012-04-10 07:47:15 UTC (rev 6055)
@@ -1284,7 +1284,7 @@
 
             // 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');
@@ -1315,6 +1315,23 @@
 
 
     /**
+     * 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
      */
     private function _exec_search($count = false)
@@ -2172,7 +2189,7 @@
     /**
      * 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}]");



More information about the svn mailing list