12 use Magento\Customer\Api\Data\AddressInterfaceFactory;
13 use Magento\Customer\Api\Data\CustomerInterfaceFactory;
17 use Magento\Framework\DataObjectFactory;
67 \
Magento\Framework\Registry $coreRegistry,
71 \
Magento\Customer\Model\Metadata\FormFactory $formFactory,
73 \
Magento\Customer\Helper\View $viewHelper,
74 \
Magento\Framework\Math\Random $random,
76 \
Magento\Framework\Api\ExtensibleDataObjectConverter $extensibleDataObjectConverter,
85 DataObjectFactory $objectFactory,
105 $extensibleDataObjectConverter,
135 list($file, $plain) = $this->getFileParams();
139 $directory =
$filesystem->getDirectoryRead(DirectoryList::MEDIA);
140 $fileName = CustomerMetadataInterface::ENTITY_TYPE_CUSTOMER .
'/' . ltrim($file,
'/');
142 if (mb_strpos(
$path,
'..') !==
false || (!$directory->isFile(
$fileName)
143 && !$this->_objectManager->get(\
Magento\MediaStorage\Helper\
File\Storage::class)->processStorageFile(
$path))
152 $contentType =
'image/gif';
155 $contentType =
'image/jpeg';
158 $contentType =
'image/png';
161 $contentType =
'application/octet-stream';
165 $contentLength = $stat[
'size'];
166 $contentModify = $stat[
'mtime'];
169 $resultRaw = $this->resultRawFactory->create();
170 $resultRaw->setHttpResponseCode(200)
171 ->setHeader(
'Pragma',
'public',
true)
172 ->setHeader(
'Content-type', $contentType,
true)
173 ->setHeader(
'Content-Length', $contentLength)
174 ->setHeader(
'Last-Modified', date(
'r', $contentModify));
175 $resultRaw->setContents($directory->readFile(
$fileName));
179 $this->_fileFactory->create(
181 [
'type' =>
'filename',
'value' =>
$fileName],
193 private function getFileParams()
199 $file = $this->urlDecoder->decode(
204 $file = $this->urlDecoder->decode(
209 throw new NotFoundException(
__(
'Page not found.'));
212 return [$file, $plain];
elseif(isset( $params[ 'redirect_parent']))
$customerAccountManagement
__construct(\Magento\Backend\App\Action\Context $context, \Magento\Framework\Registry $coreRegistry, \Magento\Framework\App\Response\Http\FileFactory $fileFactory, \Magento\Customer\Model\CustomerFactory $customerFactory, \Magento\Customer\Model\AddressFactory $addressFactory, \Magento\Customer\Model\Metadata\FormFactory $formFactory, \Magento\Newsletter\Model\SubscriberFactory $subscriberFactory, \Magento\Customer\Helper\View $viewHelper, \Magento\Framework\Math\Random $random, CustomerRepositoryInterface $customerRepository, \Magento\Framework\Api\ExtensibleDataObjectConverter $extensibleDataObjectConverter, Mapper $addressMapper, AccountManagementInterface $customerAccountManagement, AddressRepositoryInterface $addressRepository, CustomerInterfaceFactory $customerDataFactory, AddressInterfaceFactory $addressDataFactory, \Magento\Customer\Model\Customer\Mapper $customerMapper, \Magento\Framework\Reflection\DataObjectProcessor $dataObjectProcessor, \Magento\Framework\Api\DataObjectHelper $dataObjectHelper, DataObjectFactory $objectFactory, \Magento\Framework\View\LayoutFactory $layoutFactory, \Magento\Framework\View\Result\LayoutFactory $resultLayoutFactory, \Magento\Framework\View\Result\PageFactory $resultPageFactory, \Magento\Backend\Model\View\Result\ForwardFactory $resultForwardFactory, \Magento\Framework\Controller\Result\JsonFactory $resultJsonFactory, \Magento\Framework\Controller\Result\RawFactory $resultRawFactory, \Magento\Framework\Url\DecoderInterface $urlDecoder)
if(!isset($_GET['name'])) $name