- Timestamp:
- 12/29/11 03:00:36 (5 months ago)
- File:
-
- 1 edited
-
trunk/inc/classes/BxDolStorage.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/inc/classes/BxDolStorage.php
r15630 r15804 447 447 448 448 /** 449 * the same as storeFile, but it tries to do it directly from the same or another storage by file id 450 * @param $aParams['id'] - file ID in the storage 451 * @param $aParams['storage'] - the storage name 452 */ 453 public function storeFileFromStorage($aParams, $isPrivate = true, $iProfileId = 0) { 454 if (!isset($aParams['id']) || !(int)$aParams['id']) 455 $aParams['id'] = 0; 456 457 if (!isset($aParams['storage'])) 458 $aParams['storage'] = $this->_aObject['object']; 459 460 return $this->storeFile('Storage', $aParams, false, $isPrivate, $iProfileId); 461 } 462 463 /** 449 464 * Delete file by file id. 450 465 */ … … 491 506 * Get file url. 492 507 * @param $iFileId file id 493 * @return file url or fals eon error508 * @return file url or false on error 494 509 */ 495 510 public function getFileUrlById($iFileId) { } … … 976 991 } 977 992 } 993 994 /** 995 * Handle file uploads from the same or another storage object 996 */ 997 class BxDolStorageHelperStorage { 998 999 var $iFileId; 1000 var $oStorage; 1001 var $aFile; 1002 1003 function BxDolStorageHelperStorage ($aParams) { 1004 $this->iFileId = $aParams['id']; 1005 $this->oStorage = BxDolStorage::getObjectInstance($aParams['storage']); 1006 1007 $this->aFile = false; 1008 if ($this->oStorage) 1009 $this->aFile = $this->oStorage->getFile($this->iFileId); 1010 } 1011 1012 function getImmediateError() { 1013 1014 if (!$this->iFileId) 1015 return BX_DOL_STORAGE_ERR_NO_FILE; 1016 1017 if (!$this->oStorage) 1018 return BX_DOL_STORAGE_ERR_ENGINE_GET; 1019 1020 if (!$this->aFile) 1021 return BX_DOL_STORAGE_ERR_NO_FILE; 1022 1023 return BX_DOL_STORAGE_ERR_OK; 1024 } 1025 1026 function save($path) { 1027 $s = bx_file_get_contents ($this->oStorage->getFileUrlById($this->iFileId)); 1028 if (!$s) 1029 return false; 1030 1031 return file_put_contents($path, $s) ? true : false; 1032 } 1033 1034 function getName() { 1035 return $this->aFile['file_name']; 1036 } 1037 1038 function getSize() { 1039 return $this->aFile['size']; 1040 } 1041 }
Note: See TracChangeset
for help on using the changeset viewer.