예제 #1
0
 /**
  * @param int $userId
  * @param int $attachId
  */
 public function deleteAttachment($userId, $attachId)
 {
     /* @var $attachId BOL_Attachment */
     $attach = $this->attachmentDao->findById($attachId);
     if ($attach !== null && OW::getUser()->isAuthenticated() && OW::getUser()->getId() == $attach->getUserId()) {
         OW::getStorage()->removeFile($this->getAttachmentsDir() . $attach->getFileName());
         $this->attachmentDao->delete($attach);
     }
 }
예제 #2
0
 public function saveTempImage($id)
 {
     $attch = $this->attachmentDao->findById($id);
     /* @var $attch BOL_Attachment */
     if ($attch === null) {
         return '_INVALID_URL_';
     }
     $filePath = $this->getAttachmentsTempDir() . $attch->getFileName();
     if (OW::getUser()->isAuthenticated() && file_exists($filePath)) {
         OW::getStorage()->copyFile($filePath, $this->getAttachmentsDir() . $attch->getFileName());
         unlink($filePath);
     }
     $attch->setStatus(true);
     $this->attachmentDao->save($attch);
     return OW::getStorage()->getFileUrl($this->getAttachmentsDir() . $attch->getFileName());
 }