Skip to content
Snippets Groups Projects
Commit 1d297039 authored by Torsten Oppermann's avatar Torsten Oppermann
Browse files

[TASK] Fixing a bug with the file security hash

parent 29f9c7fb
No related branches found
No related tags found
1 merge request!11Feature security update
...@@ -69,6 +69,8 @@ class FormEditorController extends \TYPO3\CMS\Form\Controller\FormEditorControll ...@@ -69,6 +69,8 @@ class FormEditorController extends \TYPO3\CMS\Form\Controller\FormEditorControll
* @throws \TYPO3\CMS\Core\Cache\Exception\NoSuchCacheException * @throws \TYPO3\CMS\Core\Cache\Exception\NoSuchCacheException
*/ */
public function saveFormAction(string $formPersistenceIdentifier, FormDefinitionArray $formDefinition) { public function saveFormAction(string $formPersistenceIdentifier, FormDefinitionArray $formDefinition) {
$registrationService = $this->objectManager->get(RegisterService::class);
/** @noinspection PhpInternalEntityUsedInspection */ /** @noinspection PhpInternalEntityUsedInspection */
parent::saveFormAction($formPersistenceIdentifier, $formDefinition); parent::saveFormAction($formPersistenceIdentifier, $formDefinition);
...@@ -79,8 +81,6 @@ class FormEditorController extends \TYPO3\CMS\Form\Controller\FormEditorControll ...@@ -79,8 +81,6 @@ class FormEditorController extends \TYPO3\CMS\Form\Controller\FormEditorControll
/** @var array $finishers */ /** @var array $finishers */
$finishers = $formDefinition['finishers']; $finishers = $formDefinition['finishers'];
$extensionKey = '';
$templateKey = '';
foreach ($finishers as $finisher) { foreach ($finishers as $finisher) {
...@@ -95,51 +95,49 @@ class FormEditorController extends \TYPO3\CMS\Form\Controller\FormEditorControll ...@@ -95,51 +95,49 @@ class FormEditorController extends \TYPO3\CMS\Form\Controller\FormEditorControll
// retrieve the extension and template key and jump out of loop // retrieve the extension and template key and jump out of loop
$extensionKey = $finisher['options']['extension']; $extensionKey = $finisher['options']['extension'];
$templateKey = $finisher['options']['template']; $templateKey = str_replace('_', '-', $finisher['options']['template']);
break;
}
// if no template key was explicitly set, use the form identifier as template key
if ($templateKey === '') {
$templateKey = $formDefinition['identifier'];
}
// if there was no sg mail finisher or an missing key then simply exit the function // if no template key was explicitly set, use the form identifier as template key
if ($extensionKey === '' || $templateKey === '') { if ($templateKey === '') {
return; $templateKey = $formDefinition['identifier'] . '-' . $finisher['identifier'];
} }
// parse yaml for form fields // if there was no sg mail finisher or an missing key then simply exit the function
$absoluteFilePath = GeneralUtility::getFileAbsFileName($formPersistenceIdentifier); if ($extensionKey === '' || $templateKey === '') {
$parsedYaml = Yaml::parse(file_get_contents($absoluteFilePath)); return;
}
$renderables = []; // parse yaml for form fields
foreach ($parsedYaml['renderables'] as $formPage) { $absoluteFilePath = GeneralUtility::getFileAbsFileName($formPersistenceIdentifier);
if (\is_array($formPage['renderables'])) { $parsedYaml = Yaml::parse(file_get_contents($absoluteFilePath));
foreach ($formPage['renderables'] as $row) {
if (!\is_array($row) || !$row['type']) {
continue;
}
if ($row['type'] === 'GridRow') { $renderables = [];
foreach ($row['renderables'] as $renderableInsideGridrow) { foreach ($parsedYaml['renderables'] as $formPage) {
$renderables[] = $renderableInsideGridrow; if (\is_array($formPage['renderables'])) {
foreach ($formPage['renderables'] as $row) {
if (!\is_array($row) || !$row['type']) {
continue;
} }
} elseif (!\in_array($row['type'], self::IGNORE_FIELDS, TRUE)) { if ($row['type'] === 'GridRow') {
$renderables[] = $row; foreach ($row['renderables'] as $renderableInsideGridrow) {
$renderables[] = $renderableInsideGridrow;
}
} elseif (!\in_array($row['type'], self::IGNORE_FIELDS, TRUE)) {
$renderables[] = $row;
}
} }
} else {
return;
} }
} else {
return;
} }
// write the new Register.php file and add it to the registrationFiles array in the RegisterService
$this->writeRegisterFile($renderables, $extensionKey, $templateKey);
} }
// call register function in register service class // call register function in register service class
$registrationService = $this->objectManager->get(RegisterService::class);
// write the new Register.php file and add it to the registrationFiles array in the RegisterService
$this->writeRegisterFile($renderables, $extensionKey, $templateKey);
$registrationService->getRegisterArray(); $registrationService->getRegisterArray();
$this->clearCaches(); $this->clearCaches();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment