예제 #1
0
파일: file_dao.php 프로젝트: ZyXelP/oxwall
 /**
  * Returns an instance of class.
  *
  * @return BOL_FileDao
  */
 public static function getInstance()
 {
     if (self::$classInstance === null) {
         self::$classInstance = new self();
     }
     return self::$classInstance;
 }
예제 #2
0
 /**
  * Get path to file in file system
  *
  * @param int $id
  *
  * @return string
  */
 public function getFilePath($id)
 {
     $userfilesDir = OW::getPluginManager()->getPlugin('base')->getUserFilesDir();
     $file = $this->fileDao->findById($id);
     return $userfilesDir . $id . $file->filename;
 }
예제 #3
0
 public function moveTemporaryFile($tmpId, $desc)
 {
     $tmp = $this->fileTemporaryDao->findById($tmpId);
     if (!$tmp) {
         return false;
     }
     $tmpFilePath = $this->getTemporaryFilePath($tmp->id);
     $fileService = BOL_FileService::getInstance();
     $file = new BOL_File();
     $file->description = htmlspecialchars(trim($desc));
     $file->addDatetime = time();
     $file->filename = $tmp->filename;
     $file->userId = $tmp->userId;
     BOL_FileDao::getInstance()->save($file);
     try {
         copy($tmpFilePath, $fileService->getFilePath($file->id));
     } catch (Exception $e) {
         $photo = null;
     }
     return $file;
 }