Get the GAL source uid.
public contacts_getGal ( ) : string | boolean | ||
Résultat | string | boolean | | boolean The address book id of the GAL, or false if not available. |
/** * Handle ResolveRecipient requests * * @param string $type The type of recipient request. e.g., 'certificate' * @param string $search The email to resolve. * @param array $opts Any options required to perform the resolution. * - maxcerts: (integer) The maximum number of certificates to return * as provided by the client. * - maxambiguous: (integer) The maximum number of ambiguous results. If * set to zero, we MUST have an exact match. * - starttime: (Horde_Date) The start time for the availability window if * requesting AVAILABILITY. * - endtime: (Horde_Date) The end of the availability window if * requesting AVAILABILITY. * - maxsize: (integer) The maximum size of any pictures. * DEFAULT: 0 (No limit). * - maxpictures: (integer) The maximum count of images to return. * DEFAULT: - (No limit). * - pictures: (boolean) Return pictures. * * @return array An array of results containing any of the following: * - type: (string) The type of result a GAL entry or personal * address book entry. A * Horde_ActiveSync::RESOLVE_RESULT constant. * - displayname: (string) The display name of the contact. * - emailaddress: (string) The emailaddress. * - entries: (array) An array of certificates. * - availability: (string) A EAS style FB string. * - picture: (Horde_ActiveSync_Message_ResolveRecipientsPicture) */ public function resolveRecipient($type, $search, array $opts = array()) { $return = array(); if ($type == 'certificate') { $results = $this->_connector->resolveRecipient($search, $opts); if (count($results) && isset($results[$search])) { $gal = $this->_connector->contacts_getGal(); $picture_count = 0; foreach ($results[$search] as $result) { if (!empty($opts['pictures'])) { $picture = new Horde_ActiveSync_Message_ResolveRecipientsPicture(array('protocolversion' => $this->_version, 'logger' => $this->_logger)); if (empty($result['photo'])) { $picture->status = Horde_ActiveSync_Status::NO_PICTURE; } elseif (!empty($opts['maxpictures']) && $picture_count > $opts['maxpictures']) { $picture->status = Horde_ActiveSync_Status::PICTURE_LIMIT_REACHED; } elseif (!empty($opts['maxsize']) && strlen($result['photo']) > $opts['maxsize']) { $picture->status = Horde_ActiveSync_Status::PICTURE_TOO_LARGE; } else { $picture->data = $result['photo']; $picture->status = Horde_ActiveSync_Status::PICTURE_SUCCESS; ++$picture_count; } $entry[Horde_ActiveSync::GAL_PICTURE] = $picture; } $result = array('displayname' => $result['name'], 'emailaddress' => $result['email'], 'entries' => !empty($result['smimePublicKey']) ? array($this->_mungeCert($result['smimePublicKey'])) : array(), 'type' => $result['source'] == $gal ? Horde_ActiveSync::RESOLVE_RESULT_GAL : Horde_ActiveSync::RESOLVE_RESULT_ADDRESSBOOK, 'picture' => !empty($picture) ? $picture : null); $return[] = $result; } } } else { $options = array('maxcerts' => 0, 'maxambiguous' => $opts['maxambiguous'], 'maxsize' => !empty($opts['maxsize']) ? $opts['maxsize'] : null, 'maxpictures' => !empty($opts['maxpictures']) ? $opts['maxpictures'] : null, 'pictures' => !empty($opts['pictures'])); $entry = current($this->resolveRecipient('certificate', $search, $options)); $opts['starttime']->setTimezone(date_default_timezone_get()); $opts['endtime']->setTimezone(date_default_timezone_get()); if (!empty($entry)) { $fb = $this->_connector->resolveRecipient($search, $opts); $entry['availability'] = self::buildFbString($fb[$search], $opts['starttime'], $opts['endtime']); $return[] = $entry; } } return $return; }