/** * If the given value is set * * @param boolean $value The value * * @return boolean */ public function isValid($value) { $result = true; if (!$this->fileService->isValid()) { foreach ($this->fileService->getErrors() as $error) { $this->result->addError($error); } $result = false; } return $result; }
/** * Move uploaded image and add to user * * @param \Evoweb\SfRegister\Domain\Model\FrontendUser $user * @return \Evoweb\SfRegister\Domain\Model\FrontendUser */ protected function moveImageFile($user) { $oldFilename = $user->getImage(); $this->fileService->moveFileFromTempFolderToUploadFolder($oldFilename); $user->setImage($oldFilename); return $user; }
/** * Get file object * * @param string $identifier Identifier * * @return \TYPO3\CMS\Core\Resource\File|\TYPO3\CMS\Core\Resource\FileInterface|\TYPO3\CMS\Core\Resource\Folder * @throws \TYPO3\CMS\Core\Resource\Exception\InsufficientFileAccessPermissionsException * @throws \TYPO3\CMS\Core\Resource\Exception\InvalidFileException */ protected function getFileObject($identifier) { $object = $this->fileFactory->retrieveFileOrFolderObject($identifier); if (!is_object($object)) { throw new \TYPO3\CMS\Core\Resource\Exception\InvalidFileException('The item ' . $identifier . ' was not a file or directory!!', 1320122453); } // early escape for fe_users path if (strpos($identifier, $this->fileService->getUploadFolder()) === 0 || strpos($identifier, $this->fileService->getTempFolder()) === 0) { return $object; } // continue like the original one.... if ($object->getStorage()->getUid() === 0) { throw new \TYPO3\CMS\Core\Resource\Exception\InsufficientFileAccessPermissionsException('You are not allowed to access files outside your storages', 1375889830); } return $object; }