diff --git a/addressbook/inc/class.contacts_ldap.inc.php b/addressbook/inc/class.contacts_ldap.inc.php index 6148d6d955..4ee7d7f02e 100644 --- a/addressbook/inc/class.contacts_ldap.inc.php +++ b/addressbook/inc/class.contacts_ldap.inc.php @@ -709,8 +709,8 @@ } } - // This is for testing, not intended for release - function delete_all() + // This is for the admin script deleteaccount.php + function delete_all($owner=0) { global $phpgw_info; @@ -718,12 +718,16 @@ return False; } - $sri = ldap_search($this->ldap, $phpgw_info["server"]["ldap_contact_context"], "uidnumber=*"); - $ldap_fields = ldap_get_entries($this->ldap, $sri); + if ($owner) { + $sri = ldap_search($this->ldap, $phpgw_info["server"]["ldap_contact_context"], "uidnumber=".$owner); + $ldap_fields = ldap_get_entries($this->ldap, $sri); - $entry = ""; - while (list($null,$entry) = each($ldap_fields)) { - $err = ldap_delete($this->ldap,$entry['dn']); + $entry = ""; + while (list($null,$entry) = each($ldap_fields)) { + $err = ldap_delete($this->ldap,$entry['dn']); + } + + $this->db->query("DELETE FROM $this->ext_table WHERE owner=$owner",__LINE__,__FILE__); } return; } diff --git a/addressbook/inc/class.contacts_sql.inc.php b/addressbook/inc/class.contacts_sql.inc.php index 33ed2eb86d..8d1516a0ef 100644 --- a/addressbook/inc/class.contacts_sql.inc.php +++ b/addressbook/inc/class.contacts_sql.inc.php @@ -285,8 +285,7 @@ } // send this the range, query, sort, order and whatever fields you want to see - // 'rights' and 'access' are unused at this time - function read($start=0,$offset=0,$fields="",$query="",$filter="",$sort="",$order="",$rights="",$access="") + function read($start=0,$offset=0,$fields="",$query="",$filter="",$sort="",$order="") { global $phpgw,$phpgw_info; @@ -587,11 +586,14 @@ . $this->account_id . "'",__LINE__,__FILE__); } - // This is for testing, not intended for release - function delete_all() + // This is for the admin script deleteaccount.php + function delete_all($owner=0) { - $this->db->query("delete from $this->std_table",__LINE__,__FILE__); - $this->db->query("delete from $this->ext_table",__LINE__,__FILE__); + if ($owner) + { + $this->db->query("DELETE FROM $this->std_table WHERE owner=$owner",__LINE__,__FILE__); + $this->db->query("DELETE FROM $this->ext_table WHERE owner=$owner",__LINE__,__FILE__); + } return; } }