‪TYPO3CMS  9.5
SvgHookHandler.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types = 1);
4 
5 /*
6  * This file is part of the TYPO3 CMS project.
7  *
8  * It is free software; you can redistribute it and/or modify it under
9  * the terms of the GNU General Public License, either version 2
10  * of the License, or any later version.
11  *
12  * For the full copyright and license information, please read the
13  * LICENSE.txt file that was distributed with this source code.
14  *
15  * The TYPO3 project - inspiring people to share!
16  */
17 
19 
23 
25 {
29  protected ‪$sanitizer;
30 
34  protected ‪$typeCheck;
35 
37  {
38  $this->sanitizer = ‪$sanitizer ?? GeneralUtility::makeInstance(SvgSanitizer::class);
39  $this->typeCheck = ‪$typeCheck ?? GeneralUtility::makeInstance(SvgTypeCheck::class);
40  }
41 
47  public function ‪processMoveUploadedFile(array $parameters)
48  {
49  $filePath = $parameters['source'] ?? null;
50  if ($filePath !== null && $this->typeCheck->forFilePath((string)$filePath)) {
51  $this->sanitizer->sanitizeFile((string)$filePath);
52  }
53  }
54 
61  public function ‪processUpload_postProcessAction(&$filename, DataHandler $parentObject)
62  {
63  if (!empty($filename) && $this->typeCheck->forFilePath($filename)) {
64  $this->sanitizer->sanitizeFile($filename);
65  }
66  }
67 }
‪TYPO3\CMS\Core\DataHandling\DataHandler
Definition: DataHandler.php:81
‪TYPO3\CMS\Core\Resource\Security\SvgHookHandler\processMoveUploadedFile
‪processMoveUploadedFile(array $parameters)
Definition: SvgHookHandler.php:45
‪TYPO3\CMS\Core\Resource\Security
Definition: FileMetadataPermissionsAspect.php:2
‪TYPO3\CMS\Core\Resource\Security\SvgSanitizer
Definition: SvgSanitizer.php:23
‪TYPO3\CMS\Core\Resource\Security\SvgHookHandler\__construct
‪__construct(SvgSanitizer $sanitizer=null, SvgTypeCheck $typeCheck=null)
Definition: SvgHookHandler.php:34
‪TYPO3\CMS\Core\Resource\Security\SvgHookHandler
Definition: SvgHookHandler.php:25
‪TYPO3\CMS\Core\Resource\Security\SvgHookHandler\$sanitizer
‪SvgSanitizer $sanitizer
Definition: SvgHookHandler.php:28
‪TYPO3\CMS\Core\Resource\Security\SvgTypeCheck
Definition: SvgTypeCheck.php:26
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:45
‪TYPO3\CMS\Core\Resource\Security\SvgHookHandler\$typeCheck
‪SvgTypeCheck $typeCheck
Definition: SvgHookHandler.php:32
‪TYPO3\CMS\Core\Resource\Security\SvgHookHandler\processUpload_postProcessAction
‪processUpload_postProcessAction(&$filename, DataHandler $parentObject)
Definition: SvgHookHandler.php:59
‪TYPO3\CMS\Core\DataHandling\DataHandlerProcessUploadHookInterface
Definition: DataHandlerProcessUploadHookInterface.php:22