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
* @throws \TYPO3\CMS\Core\Cache\Exception\NoSuchCacheException
*/
public function saveFormAction(string $formPersistenceIdentifier, FormDefinitionArray $formDefinition) {
$registrationService = $this->objectManager->get(RegisterService::class);
/** @noinspection PhpInternalEntityUsedInspection */
parent::saveFormAction($formPersistenceIdentifier, $formDefinition);
......@@ -79,8 +81,6 @@ class FormEditorController extends \TYPO3\CMS\Form\Controller\FormEditorControll
/** @var array $finishers */
$finishers = $formDefinition['finishers'];
$extensionKey = '';
$templateKey = '';
foreach ($finishers as $finisher) {
......@@ -95,51 +95,49 @@ class FormEditorController extends \TYPO3\CMS\Form\Controller\FormEditorControll
// retrieve the extension and template key and jump out of loop
$extensionKey = $finisher['options']['extension'];
$templateKey = $finisher['options']['template'];
break;
}
// if no template key was explicitly set, use the form identifier as template key
if ($templateKey === '') {
$templateKey = $formDefinition['identifier'];
}
$templateKey = str_replace('_', '-', $finisher['options']['template']);
// if there was no sg mail finisher or an missing key then simply exit the function
if ($extensionKey === '' || $templateKey === '') {
return;
}
// if no template key was explicitly set, use the form identifier as template key
if ($templateKey === '') {
$templateKey = $formDefinition['identifier'] . '-' . $finisher['identifier'];
}
// parse yaml for form fields
$absoluteFilePath = GeneralUtility::getFileAbsFileName($formPersistenceIdentifier);
$parsedYaml = Yaml::parse(file_get_contents($absoluteFilePath));
// if there was no sg mail finisher or an missing key then simply exit the function
if ($extensionKey === '' || $templateKey === '') {
return;
}
$renderables = [];
foreach ($parsedYaml['renderables'] as $formPage) {
if (\is_array($formPage['renderables'])) {
foreach ($formPage['renderables'] as $row) {
if (!\is_array($row) || !$row['type']) {
continue;
}
// parse yaml for form fields
$absoluteFilePath = GeneralUtility::getFileAbsFileName($formPersistenceIdentifier);
$parsedYaml = Yaml::parse(file_get_contents($absoluteFilePath));
if ($row['type'] === 'GridRow') {
foreach ($row['renderables'] as $renderableInsideGridrow) {
$renderables[] = $renderableInsideGridrow;
$renderables = [];
foreach ($parsedYaml['renderables'] as $formPage) {
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)) {
$renderables[] = $row;
if ($row['type'] === 'GridRow') {
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
$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();
$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