/**
  * This method will be called be the signal slot for retrieving the public URL
  * of a file.
  *
  * If the processed file was not modified (the original file is used) and if
  * that file comes from the storage using the Remote driver the public
  * URL will be modified to read the image from the remote server.
  *
  * @param \TYPO3\CMS\Core\Resource\ResourceStorage $resourceStorage
  * @param \TYPO3\CMS\Core\Resource\Driver\DriverInterface $driver
  * @param \TYPO3\CMS\Core\Resource\ResourceInterface $resourceObject
  * @param bool $relativeToCurrentScript
  * @param $urlData
  */
 public function adjustPublicUrlForProcessedFiles($resourceStorage, $driver, $resourceObject, $relativeToCurrentScript, $urlData)
 {
     if (!$resourceObject instanceof ProcessedFile) {
         return;
     }
     if (!$resourceObject->usesOriginalFile()) {
         return;
     }
     $originalDriver = $this->getDriver($resourceObject->getOriginalFile()->getStorage());
     if (!$originalDriver instanceof RemoteDriver) {
         return;
     }
     $urlData['publicUrl'] = $resourceObject->getOriginalFile()->getPublicUrl($relativeToCurrentScript);
 }
예제 #2
0
 /**
  * Perform custom security/access when accessing file
  * Method should issue 403 if access is rejected
  * or 401 if authentication is required
  *
  * @param \TYPO3\CMS\Core\Resource\ResourceInterface $file
  * @return void
  */
 public function checkFileAccess(\TYPO3\CMS\Core\Resource\ResourceInterface $file)
 {
     if (!$file instanceof \TYPO3\CMS\Core\Resource\File) {
         $this->originalFile = $file->getOriginalFile();
     } else {
         $this->originalFile = $file;
     }
     if (!$this->checkPermissions()) {
         if (!$this->isLoggedIn()) {
             if ($this->loginRedirectUrl !== null) {
                 $this->redirectToUrl($this->loginRedirectUrl);
             } else {
                 $this->exitScript('Authentication required!', 401);
             }
         } else {
             if ($this->noAccessRedirectUrl !== null) {
                 $this->redirectToUrl($this->noAccessRedirectUrl);
             } else {
                 $this->exitScript('No access!', 403);
             }
         }
     }
     /** @var \TYPO3\CMS\Extbase\SignalSlot\Dispatcher $signalSlotDispatcher */
     $signalSlotDispatcher = GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\SignalSlot\\Dispatcher');
     $signalSlotDispatcher->dispatch(__CLASS__, 'BeforeFileDump', array($file, $this));
     // todo: find a nicer way to force the download. Other hooks are blocked by this
     if (isset($_REQUEST['download'])) {
         $file->getStorage()->dumpFileContents($file, true);
         exit;
     }
 }
예제 #3
0
 /**
  * @param \TYPO3\CMS\Core\Resource\ResourceInterface $originalResource
  */
 public function setOriginalResource(\TYPO3\CMS\Core\Resource\ResourceInterface $originalResource)
 {
     $this->originalResource = $originalResource;
     $this->uidLocal = (int) $originalResource->getOriginalFile()->getUid();
 }