calendar_getAttachment() public method

Return an event attachment.
public calendar_getAttachment ( string $filereference ) : array
$filereference string A filereference pointing to the file: calendar:{calendar_id}:{event_uid}:{filename}
return array An array containing: 'content-type' and 'data'.
Esempio n. 1
0
 /**
  * Return the specified attachement data for an ITEMOPERATIONS request.
  *
  * @param string $filereference  The attachment identifier.
  *
  * @return Horde_ActiveSync_Message_AirSyncBaseFileAttachment
  */
 public function itemOperationsGetAttachmentData($filereference)
 {
     // @todo Slight issue here. Since the filereferences that had previously
     // been returned to the client for email attachments only contain
     // the mailbox name/uid/part of the message, leaving things as-is would
     // mean that a mailbox named 'calendar' would break this code.
     // To deal with that cleanly, we really need to prepend 'mail'
     // to all email attachments, but this would require a resync of all
     // clients to be sure the new filereferences are sent. For now, do
     // some sniffing to try to figure it out.
     //
     // Calendar would have 4 parts, so check that first.
     $name_parts = explode(':', $filereference, 4);
     if ($name_parts[0] == 'calendar' && !empty($name_parts[3])) {
         $att = $atc = $this->_connector->calendar_getAttachment($filereference);
     } else {
         $att = $this->getAttachment($filereference);
     }
     $airatt = Horde_ActiveSync::messageFactory('AirSyncBaseFileAttachment');
     $airatt->data = $att['data'];
     $airatt->contenttype = $att['content-type'];
     return $airatt;
 }