| | |
| | | $single = (bool) $RCMAIL->config->get('autocomplete_single'); |
| | | $search = rcube_utils::get_input_value('_search', rcube_utils::INPUT_GPC, true); |
| | | $source = rcube_utils::get_input_value('_source', rcube_utils::INPUT_GPC); |
| | | $sid = rcube_utils::get_input_value('_id', rcube_utils::INPUT_GPC); |
| | | $reqid = rcube_utils::get_input_value('_reqid', rcube_utils::INPUT_GPC); |
| | | |
| | | if (strlen($source)) { |
| | | $book_types = array($source); |
| | |
| | | |
| | | // skip duplicates |
| | | if (!in_array($contact, $contacts)) { |
| | | $contacts[] = $contact; |
| | | $contacts[] = array('name' => $contact, 'type' => $sql_arr['_type']); |
| | | $sort_keys[] = sprintf('%s %03d', $sql_arr['name'] , $idx++); |
| | | |
| | | if (count($contacts) >= $MAXNUM) { |
| | |
| | | if ($group_prop['email']) { |
| | | $idx = 0; |
| | | foreach ((array)$group_prop['email'] as $email) { |
| | | $contacts[] = format_email_recipient($email, $group['name']); |
| | | $contacts[] = array('name' => format_email_recipient($email, $group['name']), 'type' => 'group'); |
| | | $sort_keys[] = sprintf('%s %03d', $group['name'] , $idx++); |
| | | |
| | | if (count($contacts) >= $MAXNUM) { |
| | |
| | | $sort_keys[] = $group['name']; |
| | | $contacts[] = array( |
| | | 'name' => $group['name'] . ' (' . intval($result->count) . ')', |
| | | 'type' => 'group', |
| | | 'id' => $group['ID'], |
| | | 'source' => $id |
| | | ); |
| | |
| | | } |
| | | } |
| | | |
| | | $OUTPUT->command('ksearch_query_results', $contacts, $search, $sid); |
| | | $OUTPUT->command('ksearch_query_results', $contacts, $search, $reqid); |
| | | $OUTPUT->send(); |