Skip to content

Commit

Permalink
Simplify, and ensure we always return an array.
Browse files Browse the repository at this point in the history
Bug: 12791
  • Loading branch information
mrubinsk committed Oct 28, 2013
1 parent e6c9fb6 commit 22b5441
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions framework/Core/lib/Horde/Core/ActiveSync/Connector.php
Expand Up @@ -302,21 +302,23 @@ public function contacts_getActionTimestamp($uid, $action)
*/
public function contacts_search($query, array $options = array())
{
$gal = $this->contacts_getGal();
if (!empty($gal)) {
$fields = array($gal => array('firstname', 'lastname', 'alias', 'name', 'email', 'office'));
if (!empty($options['pictures'])) {
$fields[$gal][] = 'photo';
}
$opts = array(
'fields' => $fields,
'matchBegin' => true,
'forceSource' => true,
'sources' => array($gal)
);
if (!$gal = $this->contacts_getGal()) {
return array();
}

return $this->_registry->contacts->search($query, $opts);
$fields = array($gal => array('firstname', 'lastname', 'alias', 'name', 'email', 'office'));
if (!empty($options['pictures'])) {
$fields[$gal][] = 'photo';
}
$opts = array(
'fields' => $fields,
'matchBegin' => true,
'forceSource' => true,
'sources' => array($gal)
);

return $this->_registry->contacts->search($query, $opts);

}

/**
Expand Down

0 comments on commit 22b5441

Please sign in to comment.