| | |
| | | /** |
| | | * Setter for errors for internal use |
| | | * |
| | | * @param int Error type (one of this class' error constants) |
| | | * @param int Error type (one of this class' error constants) |
| | | * @param string Error message (name of a text label) |
| | | */ |
| | | protected function set_error($type, $message) |
| | |
| | | /** |
| | | * Set internal list page |
| | | * |
| | | * @param number Page number to list |
| | | * @access public |
| | | * @param number Page number to list |
| | | */ |
| | | function set_page($page) |
| | | { |
| | |
| | | /** |
| | | * Set internal page size |
| | | * |
| | | * @param number Number of messages to display on one page |
| | | * @access public |
| | | * @param number Number of messages to display on one page |
| | | */ |
| | | function set_pagesize($size) |
| | | { |
| | |
| | | * Check the given data before saving. |
| | | * If input isn't valid, the message to display can be fetched using get_error() |
| | | * |
| | | * @param array Assoziative array with data to save |
| | | * @param array Assoziative array with data to save |
| | | * @param boolean Attempt to fix/complete record automatically |
| | | * |
| | | * @return boolean True if input is valid, False if not. |
| | | */ |
| | | public function validate(&$save_data, $autofix = false) |
| | |
| | | /** |
| | | * Mark one or more contact records as deleted |
| | | * |
| | | * @param array Record identifiers |
| | | * @param bool Remove records irreversible (see self::undelete) |
| | | * @param array Record identifiers |
| | | * @param bool Remove records irreversible (see self::undelete) |
| | | */ |
| | | function delete($ids, $force=true) |
| | | function delete($ids, $force = true) |
| | | { |
| | | /* empty for read-only address books */ |
| | | } |
| | |
| | | /** |
| | | * Unmark delete flag on contact record(s) |
| | | * |
| | | * @param array Record identifiers |
| | | * @param array Record identifiers |
| | | */ |
| | | function undelete($ids) |
| | | { |
| | |
| | | else if ($compose_mode == 1) |
| | | $fn = join(' ', array($contact['firstname'], $contact['middlename'], $contact['surname'])); |
| | | else if ($compose_mode == 0) |
| | | $fn = !empty($contact['name']) ? $contact['name'] : join(' ', array($contact['prefix'], $contact['firstname'], $contact['middlename'], $contact['surname'], $contact['suffix'])); |
| | | $fn = $contact['name'] ?: join(' ', array($contact['prefix'], $contact['firstname'], $contact['middlename'], $contact['surname'], $contact['suffix'])); |
| | | else { |
| | | $plugin = rcube::get_instance()->plugins->exec_hook('contact_listname', array('contact' => $contact)); |
| | | $fn = $plugin['fn']; |
| | |
| | | // fallbacks... |
| | | if ($fn === '') { |
| | | // ... display name |
| | | if (!empty($contact['name'])) { |
| | | $fn = $contact['name']; |
| | | if ($name = trim($contact['name'])) { |
| | | $fn = $name; |
| | | } |
| | | // ... organization |
| | | else if (!empty($contact['organization'])) { |
| | | $fn = $contact['organization']; |
| | | else if ($org = trim($contact['organization'])) { |
| | | $fn = $org; |
| | | } |
| | | // ... email address |
| | | else if (($email = self::get_col_values('email', $contact, true)) && !empty($email)) { |