From 63fda8af57a285020dc094adcf6eeb46bee1c2d5 Mon Sep 17 00:00:00 2001 From: alecpl Date: Fri, 8 Jul 2011 13:03:42 +0000 Subject: - Make Undo action optional by setting undo_timeout=0 --- program/include/rcube_addressbook.php | 3 ++- program/include/rcube_contacts.php | 17 +++++++++-------- program/include/rcube_ldap.php | 5 +++-- 3 files changed, 14 insertions(+), 11 deletions(-) (limited to 'program/include') diff --git a/program/include/rcube_addressbook.php b/program/include/rcube_addressbook.php index 3581b83d1..45ad0be5d 100644 --- a/program/include/rcube_addressbook.php +++ b/program/include/rcube_addressbook.php @@ -250,8 +250,9 @@ abstract class rcube_addressbook * Mark one or more contact records as deleted * * @param array Record identifiers + * @param bool Remove records irreversible (see self::undelete) */ - function delete($ids) + function delete($ids, $force=true) { /* empty for read-only address books */ } diff --git a/program/include/rcube_contacts.php b/program/include/rcube_contacts.php index 52667fab3..799d59618 100644 --- a/program/include/rcube_contacts.php +++ b/program/include/rcube_contacts.php @@ -604,13 +604,13 @@ class rcube_contacts extends rcube_addressbook return $updated; } - - + + private function convert_db_data($sql_arr) { $record = array(); $record['ID'] = $sql_arr[$this->primary_key]; - + if ($sql_arr['vcard']) { unset($sql_arr['email']); $vcard = new rcube_vcard($sql_arr['vcard']); @@ -620,7 +620,7 @@ class rcube_contacts extends rcube_addressbook $record += $sql_arr; $record['email'] = preg_split('/,\s*/', $record['email']); } - + return $record; } @@ -668,16 +668,17 @@ class rcube_contacts extends rcube_addressbook /** * Mark one or more contact records as deleted * - * @param array Record identifiers + * @param array Record identifiers + * @param boolean Remove record(s) irreversible (unsupported) */ - function delete($ids) + function delete($ids, $force=true) { if (!is_array($ids)) $ids = explode(',', $ids); $ids = $this->db->array2list($ids, 'integer'); - // flag record as deleted + // flag record as deleted (always) $this->db->query( "UPDATE ".get_table_name($this->db_name). " SET del=1, changed=".$this->db->now(). @@ -704,7 +705,7 @@ class rcube_contacts extends rcube_addressbook $ids = $this->db->array2list($ids, 'integer'); - // flag record as deleted + // clear deleted flag $this->db->query( "UPDATE ".get_table_name($this->db_name). " SET del=0, changed=".$this->db->now(). diff --git a/program/include/rcube_ldap.php b/program/include/rcube_ldap.php index 4ea4f6046..4205df271 100644 --- a/program/include/rcube_ldap.php +++ b/program/include/rcube_ldap.php @@ -834,11 +834,12 @@ class rcube_ldap extends rcube_addressbook /** * Mark one or more contact records as deleted * - * @param array Record identifiers + * @param array Record identifiers + * @param boolean Remove record(s) irreversible (unsupported) * * @return boolean True on success, False on error */ - function delete($ids) + function delete($ids, $force=true) { if (!is_array($ids)) { // Not an array, break apart the encoded DNs. -- cgit v1.2.3