Exemplo n.º 1
0
 function syncExistingAttachments()
 {
     $matches = array();
     if (!preg_match_all('/"cid:([\\w.-]{32})"/', $this->getBody(), $matches)) {
         return;
     }
     // Purge current attachments
     $this->attachments->deleteInlines();
     foreach ($matches[1] as $hash) {
         if ($file = AttachmentFile::getIdByHash($hash)) {
             $this->attachments->upload($file, true);
         }
     }
 }
Exemplo n.º 2
0
 function lookup($id)
 {
     $id = is_numeric($id) ? $id : AttachmentFile::getIdByHash($id);
     return $id && ($file = new AttachmentFile($id)) && $file->getId() == $id ? $file : null;
 }