| | |
| | | $fields = explode(',', get_input_value('_headers', RCUBE_INPUT_GET)); |
| | | |
| | | if (empty($fields)) { |
| | | $fields = $SEARCH_MODS_DEFAULT; |
| | | $fields = array_keys($SEARCH_MODS_DEFAULT); |
| | | } |
| | | else { |
| | | $fields = array_filter($fields); |
| | | } |
| | | |
| | | // update search_mods setting |
| | |
| | | $RCMAIL->user->save_prefs(array('addressbook_search_mods' => $search_mods)); |
| | | } |
| | | |
| | | if ($fields['*'] || count($fields) == count($SEARCH_MODS_DEFAULT)) { |
| | | if (in_array('*', $fields)) { |
| | | $fields = '*'; |
| | | } |
| | | } |
| | |
| | | foreach ($sources as $s) { |
| | | $source = $RCMAIL->get_address_book($s['id']); |
| | | |
| | | // check if all search fields are supported.... |
| | | // check if search fields are supported.... |
| | | if (is_array($fields)) { |
| | | $cols = $source->coltypes[0] ? array_flip($source->coltypes) : $source->coltypes; |
| | | $supported = 0; |
| | |
| | | } |
| | | } |
| | | |
| | | // ...if not, we can skip this source |
| | | if ($supported < count($fields)) { |
| | | // in advanced search we require all fields (AND operator) |
| | | // in quick search we require at least one field (OR operator) |
| | | if (($adv && $supported < count($fields)) || (!$adv && !$supported)) { |
| | | continue; |
| | | } |
| | | } |