예제 #1
0
 /**
  * Getter function to return the folder where the files can
  * be processed. Does not check for access rights here.
  *
  * @return Folder
  */
 public function getProcessingFolder()
 {
     if (!isset($this->processingFolder)) {
         $processingFolder = self::DEFAULT_ProcessingFolder;
         if (!empty($this->storageRecord['processingfolder'])) {
             $processingFolder = $this->storageRecord['processingfolder'];
         }
         try {
             if (strpos($processingFolder, ':') !== false) {
                 list($storageUid, $processingFolderIdentifier) = explode(':', $processingFolder, 2);
                 $storage = ResourceFactory::getInstance()->getStorageObject($storageUid);
                 if ($storage->hasFolder($processingFolderIdentifier)) {
                     $this->processingFolder = $storage->getFolder($processingFolderIdentifier);
                 } else {
                     $this->processingFolder = $storage->createFolder(ltrim($processingFolderIdentifier, '/'));
                 }
             } else {
                 if ($this->driver->folderExists($processingFolder) === false) {
                     $this->processingFolder = $this->createFolder($processingFolder);
                 } else {
                     $data = $this->driver->getFolderInfoByIdentifier($processingFolder);
                     $this->processingFolder = ResourceFactory::getInstance()->createFolderObject($this, $data['identifier'], $data['name']);
                 }
             }
         } catch (Exception\InsufficientFolderWritePermissionsException $e) {
             $this->processingFolder = GeneralUtility::makeInstance(InaccessibleFolder::class, $this, $processingFolder, $processingFolder);
         } catch (Exception\ResourcePermissionsUnavailableException $e) {
             $this->processingFolder = GeneralUtility::makeInstance(InaccessibleFolder::class, $this, $processingFolder, $processingFolder);
         }
     }
     return $this->processingFolder;
 }
 /**
  * Getter function to return the folder where the files can
  * be processed. Does not check for access rights here.
  *
  * @return Folder
  */
 public function getProcessingFolder()
 {
     if (!isset($this->processingFolder)) {
         $processingFolder = self::DEFAULT_ProcessingFolder;
         if (!empty($this->storageRecord['processingfolder'])) {
             $processingFolder = $this->storageRecord['processingfolder'];
         }
         try {
             if (strpos($processingFolder, ':') !== FALSE) {
                 $this->processingFolder = ResourceFactory::getInstance()->getFolderObjectFromCombinedIdentifier($processingFolder);
             } else {
                 if ($this->driver->folderExists($processingFolder) === FALSE) {
                     $this->processingFolder = $this->createFolder($processingFolder);
                 } else {
                     $data = $this->driver->getFolderInfoByIdentifier($processingFolder);
                     $this->processingFolder = ResourceFactory::getInstance()->createFolderObject($this, $data['identifier'], $data['name']);
                 }
             }
         } catch (Exception\InsufficientFolderWritePermissionsException $e) {
             $this->processingFolder = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Resource\\InaccessibleFolder', $this, $processingFolder, $processingFolder);
         } catch (Exception\ResourcePermissionsUnavailableException $e) {
             $this->processingFolder = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Resource\\InaccessibleFolder', $this, $processingFolder, $processingFolder);
         }
     }
     return $this->processingFolder;
 }
예제 #3
0
 /**
  * @param \TYPO3\CMS\Core\Resource\ResourceStorage $resourceStorage
  * @param \TYPO3\CMS\Core\Resource\Driver\DriverInterface $driver
  * @param \TYPO3\CMS\Core\Resource\ResourceInterface $resourceObject
  * @param boolean $relativeToCurrentScript
  * @param string $urlData
  */
 public function getCdnPublicUrl($resourceStorage, $driver, $resourceObject, $relativeToCurrentScript, $urlData)
 {
     if (!$driver instanceof LocalDriver || $this->environmentService->isEnvironmentInBackendMode()) {
         return;
     }
     if (($resourceObject instanceof File || $resourceObject instanceof ProcessedFile) && ($resourceStorage->getCapabilities() & ResourceStorageInterface::CAPABILITY_PUBLIC) == ResourceStorageInterface::CAPABILITY_PUBLIC) {
         $publicUrl = $driver->getPublicUrl($resourceObject->getIdentifier());
         $urlData['publicUrl'] = $GLOBALS['TSFE']->config['config']['cdnBaseUrl'] . $publicUrl;
         if ($resourceObject instanceof File) {
             $urlData['publicUrl'] .= '?' . $resourceObject->getModificationTime();
         } else {
             if ($resourceObject instanceof ProcessedFile) {
                 $urlData['publicUrl'] .= '?' . $resourceObject->getProperty('tstamp');
             }
         }
     }
 }
예제 #4
0
 /**
  * Entry method for use as filelist filter.
  *
  * We have to use -1 as the „don't include“ return value, as call_user_func() will return FALSE
  * if calling the method failed and thus we can't use that as a return value.
  *
  * @param string $itemName
  * @param string $itemIdentifier
  * @param string $parentIdentifier
  * @param array $additionalInformation Additional information about the inspected item
  * @param \TYPO3\CMS\Core\Resource\Driver\DriverInterface $driver
  * @return bool|int -1 if the file should not be included in a listing
  */
 public function filterFileList($itemName, $itemIdentifier, $parentIdentifier, array $additionalInformation, \TYPO3\CMS\Core\Resource\Driver\DriverInterface $driver)
 {
     $returnCode = true;
     // Early return in case no file filters are set at all
     if ($this->allowedFileExtensions === null && $this->disallowedFileExtensions === null) {
         return $returnCode;
     }
     // Check that this is a file and not a folder
     if ($driver->fileExists($itemIdentifier)) {
         if (!$this->isAllowed($itemName)) {
             $returnCode = -1;
         }
     }
     return $returnCode;
 }
예제 #5
0
 /**
  * Getter function to return the folder where the files can
  * be processed. Does not check for access rights here.
  *
  * @return Folder
  */
 public function getProcessingFolder()
 {
     if (!isset($this->processingFolder)) {
         $processingFolder = self::DEFAULT_ProcessingFolder;
         if (!empty($this->storageRecord['processingfolder'])) {
             $processingFolder = $this->storageRecord['processingfolder'];
         }
         if ($this->driver->folderExists($processingFolder) === FALSE) {
             $this->processingFolder = $this->createFolder($processingFolder);
         } else {
             $data = $this->driver->getFolderInfoByIdentifier($processingFolder);
             $this->processingFolder = ResourceFactory::getInstance()->createFolderObject($this, $data['identifier'], $data['name']);
         }
     }
     return $this->processingFolder;
 }