| | |
| | | +-----------------------------------------------------------------------+ |
| | | | program/steps/mail/autocomplete.inc | |
| | | | | |
| | | | This file is part of the RoundCube Webmail client | |
| | | | Copyright (C) 2008-2010, RoundCube Dev Team | |
| | | | This file is part of the Roundcube Webmail client | |
| | | | Copyright (C) 2008-2010, Roundcube Dev Team | |
| | | | Licensed under the GNU GPL | |
| | | | | |
| | | | PURPOSE: | |
| | |
| | | } |
| | | else if ($book_types && $search = get_input_value('_search', RCUBE_INPUT_GPC, true)) { |
| | | $contacts = array(); |
| | | $books_num = count($book_types); |
| | | |
| | | foreach ($book_types as $id) { |
| | | $abook = $RCMAIL->get_address_book($id); |
| | |
| | | |
| | | if ($result = $abook->search(array('email','name'), $search, false, true, true, 'email')) { |
| | | while ($sql_arr = $result->iterate()) { |
| | | $contacts[] = format_email_recipient($sql_arr['email'], $sql_arr['name']); |
| | | $contact = format_email_recipient($sql_arr['email'], $sql_arr['name']); |
| | | // when we've got more than one book, we need to skip duplicates |
| | | if ($books_num == 1 || !in_array($contact, $contacts)) { |
| | | $contacts[] = $contact; |
| | | if (count($contacts) >= $MAXNUM) |
| | | break 2; |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | { |
| | | $name_a = is_array($a) ? $a['name'] : $a; |
| | | $name_b = is_array($b) ? $b['name'] : $b; |
| | | return strcmp(trim($name_a, '" '), trim($name_b, '" ')); |
| | | return strcoll(trim($name_a, '" '), trim($name_b, '" ')); |
| | | } |
| | | |
| | | ?> |