Skip to content

Commit ab5d4ad

Browse files
committed
Merge branch 'release/10.2.0'
2 parents eff594d + f82796d commit ab5d4ad

File tree

18 files changed

+168
-136
lines changed

18 files changed

+168
-136
lines changed

.project/data/fileadmin.tar.gz

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
version https://git-lfs.github.com/spec/v1
2-
oid sha256:ac0afc7063785f117138db6878145b81b6b4dcce8231e2d1c580782dcf5f8d73
3-
size 926025
2+
oid sha256:866b96608d10172784cf62bdcce7358cb121dbc2e4e6a39c61eb01d39b65d8f4
3+
size 926099

Classes/Command/CleanupUploadsCommand.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
declare(strict_types = 1);
33
namespace In2code\Powermail\Command;
44

5+
use Symfony\Component\Console\Command\Command;
56
use Symfony\Component\Console\Input\InputArgument;
67
use Symfony\Component\Console\Input\InputInterface;
78
use Symfony\Component\Console\Output\OutputInterface;

Classes/Controller/FormController.php

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ class FormController extends AbstractController
5959
protected $dataProcessorRunner;
6060

6161
/**
62-
* @return void
62+
* @return ResponseInterface
6363
* @throws InvalidSlotException
6464
* @throws InvalidSlotReturnException
6565
* @throws Exception
@@ -122,7 +122,7 @@ public function initializeConfirmationAction(): void
122122
* @ExtbaseAnnotation\Validate("In2code\Powermail\Domain\Validator\UniqueValidator", param="mail")
123123
* @ExtbaseAnnotation\Validate("In2code\Powermail\Domain\Validator\ForeignValidator", param="mail")
124124
* @ExtbaseAnnotation\Validate("In2code\Powermail\Domain\Validator\CustomValidator", param="mail")
125-
* @return void
125+
* @return ResponseInterface
126126
* @throws InvalidConfigurationTypeException
127127
* @throws InvalidExtensionNameException
128128
* @throws InvalidSlotException
@@ -180,7 +180,7 @@ public function initializeCreateAction(): void
180180
* @ExtbaseAnnotation\Validate("In2code\Powermail\Domain\Validator\UniqueValidator", param="mail")
181181
* @ExtbaseAnnotation\Validate("In2code\Powermail\Domain\Validator\ForeignValidator", param="mail")
182182
* @ExtbaseAnnotation\Validate("In2code\Powermail\Domain\Validator\CustomValidator", param="mail")
183-
* @return void
183+
* @return ResponseInterface
184184
* @throws IllegalObjectTypeException
185185
* @throws InvalidConfigurationTypeException
186186
* @throws InvalidExtensionNameException
@@ -322,10 +322,9 @@ protected function saveMail(Mail $mail): void
322322
*
323323
* @param int $mail mail uid
324324
* @param string $hash Given Hash String
325-
* @return void
325+
* @return ResponseInterface
326326
* @throws InvalidSlotException
327327
* @throws InvalidSlotReturnException
328-
* @throws StopActionException
329328
* @throws IllegalObjectTypeException
330329
* @throws UnknownObjectException
331330
* @throws Exception
@@ -361,7 +360,7 @@ public function optinConfirmAction(int $mail, string $hash): ResponseInterface
361360
/**
362361
* @param int $mail
363362
* @param string $hash
364-
* @return void
363+
* @return ResponseInterface
365364
* @throws \Exception
366365
* @noinspection PhpUnused
367366
*/
@@ -386,7 +385,7 @@ public function disclaimerAction(int $mail, string $hash): ResponseInterface
386385
* @param int $language Frontend Language Uid
387386
* @param int $pid Page Id
388387
* @param bool $mobileDevice Is mobile device?
389-
* @return string
388+
* @return ResponseInterface
390389
* @noinspection PhpUnused
391390
* @codeCoverageIgnore
392391
*/
@@ -458,7 +457,6 @@ protected function forwardIfFormParamsDoNotMatch(): void
458457
* Forward to formAction if no mail param given
459458
*
460459
* @return ForwardResponse|null
461-
* @throws StopActionException
462460
*/
463461
protected function forwardIfMailParamEmpty(): ?ForwardResponse
464462
{
@@ -478,7 +476,6 @@ protected function forwardIfMailParamEmpty(): ?ForwardResponse
478476
*
479477
* @param Mail|null $mail
480478
* @return ResponseInterface|null
481-
* @throws StopActionException
482479
*/
483480
protected function forwardIfFormParamsDoNotMatchForOptinConfirm(Mail $mail = null): ?ResponseInterface
484481
{
@@ -500,8 +497,7 @@ protected function forwardIfFormParamsDoNotMatchForOptinConfirm(Mail $mail = nul
500497
* a validator for createAction fails, confirmationAction is called (if function is turned on) and same validators
501498
* are firing again
502499
*
503-
* @return void
504-
* @throws StopActionException
500+
* @return ResponseInterface|null
505501
*/
506502
protected function forwardToReferringRequest(): ?ResponseInterface
507503
{

Classes/Controller/ModuleController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ public function exportXlsAction(): ResponseInterface
110110

111111
$fileName = StringUtility::conditionalVariable($this->settings['export']['filenameXls'], 'export.xls');
112112
header('Content-Type: application/vnd.ms-excel');
113-
header('Content-Disposition: inline; filename="' . $fileName . '"');
113+
header('Content-Disposition: attachment; filename="' . $fileName . '"');
114114
header('Pragma: no-cache');
115115
return $this->htmlResponse();
116116
}

Classes/Domain/Factory/FileFactory.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
use In2code\Powermail\Utility\StringUtility;
1313
use TYPO3\CMS\Core\Configuration\Exception\ExtensionConfigurationExtensionNotConfiguredException;
1414
use TYPO3\CMS\Core\Configuration\Exception\ExtensionConfigurationPathDoesNotExistException;
15+
use TYPO3\CMS\Core\Type\File\FileInfo;
1516
use TYPO3\CMS\Extbase\Object\Exception;
1617
use TYPO3\CMS\Extbase\Persistence\Exception\InvalidQueryException;
1718
use TYPO3\CMS\Extbase\SignalSlot\Exception\InvalidSlotException;
@@ -131,11 +132,11 @@ protected function makeFileInstance(
131132
$file->setNewName(StringUtility::cleanString($originalName));
132133
$file->setUploadFolder($this->getUploadFolder());
133134
if ($size === 0) {
134-
$size = filesize($file->getNewPathAndFilename(true));
135+
$size = filesize($file->getTemporaryName());
135136
}
136137
$file->setSize((int)$size);
137138
if ($type === '') {
138-
$type = mime_content_type($file->getNewPathAndFilename(true));
139+
$type = (new FileInfo($file->getTemporaryName()))->getMimeType() ?: 'application/octet-stream';
139140
}
140141
$file->setType($type);
141142
$file->setUploaded($uploaded);
@@ -161,7 +162,7 @@ protected function getUploadFolder(): string
161162
protected function getFormUid(Form $form = null): int
162163
{
163164
if ($form === null) {
164-
$arguments = FrontendUtility::getArguments();
165+
$arguments = FrontendUtility::getArguments(FrontendUtility::getPluginName());
165166
return (int)$arguments['mail']['form'];
166167
}
167168
return $form->getUid();

Classes/Domain/Service/Mail/SendMailService.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,9 @@ protected function initialize(Mail $mail, array $settings, string $type): void
507507
$this->mail = $mail;
508508
$this->settings = $settings;
509509
$this->configuration = $this->getConfigurationFromSettings($settings);
510-
$this->overwriteConfig = $this->configuration[$type . '.']['overwrite.'];
510+
if (\TYPO3\CMS\Core\Utility\ArrayUtility::isValidPath($this->configuration, $type . './overwrite')) {
511+
$this->overwriteConfig = $this->configuration[$type . '.']['overwrite.'];
512+
}
511513
$mailRepository = ObjectUtility::getObjectManager()->get(MailRepository::class);
512514
ObjectUtility::getContentObject()->start($mailRepository->getVariablesWithMarkersFromMail($mail));
513515
$this->type = $type;

Classes/Hook/CreateMarker.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ protected function shouldProcessField(): bool
371371
*/
372372
protected function shouldRenameMarker(array $markers): bool
373373
{
374-
return !empty($markers[$this->uid]) && !empty($this->properties['marker'])
375-
&& $markers[$this->uid] !== $this->properties['marker'];
374+
return !empty($markers[$this->uid]) && isset($this->properties['marker'])
375+
&& $markers[$this->uid] !== $this->properties['marker'];
376376
}
377377
}

Classes/Tca/ShowFormNoteEditForm.php

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
use TYPO3\CMS\Backend\Utility\BackendUtility as BackendUtilityCore;
1919
use TYPO3\CMS\Core\Configuration\Exception\ExtensionConfigurationExtensionNotConfiguredException;
2020
use TYPO3\CMS\Core\Configuration\Exception\ExtensionConfigurationPathDoesNotExistException;
21+
use TYPO3\CMS\Core\Utility\ArrayUtility as CoreArrayUtility;
2122
use TYPO3\CMS\Core\Utility\GeneralUtility;
2223
use TYPO3\CMS\Extbase\Configuration\Exception\InvalidConfigurationTypeException;
2324
use TYPO3\CMS\Extbase\Mvc\Exception\InvalidExtensionNameException;
@@ -147,6 +148,9 @@ protected function getLabel(string $key): string
147148
*/
148149
protected function getEditFormLink(): string
149150
{
151+
if (!CoreArrayUtility::isValidPath($this->getFormProperties(), 'uid')) {
152+
return '';
153+
}
150154
return BackendUtility::createEditUri(Form::TABLE_NAME, (int)$this->getFormProperties()['uid']);
151155
}
152156

@@ -218,7 +222,7 @@ protected function getFormProperties(): array
218222
protected function getRelatedFormUid(): int
219223
{
220224
$flexFormArray = (array)$this->data['databaseRow']['pi_flexform']['data']['main']['lDEF'];
221-
$formUid = (int)$flexFormArray['settings.flexform.main.form']['vDEF'][0];
225+
$formUid = (int)($flexFormArray['settings.flexform.main.form']['vDEF'][0] ?? 0);
222226
$language = (int)($this->data['databaseRow']['sys_language_uid'][0] ?? $this->data['databaseRow']['sys_language_uid'] ?? 0);
223227
$formUid = $this->getLocalizedFormUid($formUid, $language);
224228
return $formUid;
@@ -231,7 +235,17 @@ protected function getRelatedFormUid(): int
231235
*/
232236
protected function getStoragePageProperties(): array
233237
{
234-
return (array)BackendUtilityCore::getRecord('pages', (int)$this->getFormProperties()['pid'], '*', '', false);
238+
if (!CoreArrayUtility::isValidPath($this->getFormProperties(), 'pid')) {
239+
return [];
240+
}
241+
242+
return (array)BackendUtilityCore::getRecord(
243+
'pages',
244+
(int)$this->getFormProperties()['pid'],
245+
'*',
246+
'',
247+
false
248+
);
235249
}
236250

237251
/**
@@ -248,6 +262,9 @@ protected function getRelatedPages(): array
248262
return $this->getRelatedPagesAlternative();
249263
}
250264

265+
if (!CoreArrayUtility::isValidPath($this->getFormProperties(), 'uid')) {
266+
return [];
267+
}
251268
$queryBuilder = DatabaseUtility::getQueryBuilderForTable(Form::TABLE_NAME, true);
252269
$rows = (array)$queryBuilder
253270
->select('p.title')
@@ -306,6 +323,9 @@ protected function getRelatedFields(): array
306323
return $this->getRelatedFieldsAlternative();
307324
}
308325

326+
if (!CoreArrayUtility::isValidPath($this->getFormProperties(), 'uid')) {
327+
return [];
328+
}
309329
$titles = [];
310330
$queryBuilder = DatabaseUtility::getQueryBuilderForTable(Form::TABLE_NAME, true);
311331
$rows = $queryBuilder

Classes/ViewHelpers/Condition/IsNotExcludedFromPowermailAllViewHelper.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ protected function getExcludedValues(
9090
string $configurationType = 'excludeFromFieldTypes'
9191
): array {
9292
if (
93+
isset($this->typeToTypoScriptType[$type]) &&
9394
ArrayUtility::isValidPath($settings, 'excludeFromPowermailAllMarker/' . $this->typeToTypoScriptType[$type] . '/' . $configurationType)
9495
&& !empty($settings['excludeFromPowermailAllMarker'][$this->typeToTypoScriptType[$type]][$configurationType])
9596
) {

Classes/ViewHelpers/Misc/ManipulateValueWithTypoScriptViewHelper.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,9 @@ public function render(): string
5858
$type = $this->arguments['type'];
5959
$value = $this->renderChildren();
6060
if ($answer->getField()) {
61-
if (!empty($this->typoScriptContext[$this->typeToTsType[$type] . '.'][$answer->getField()->getMarker()])) {
61+
if (
62+
isset($this->typeToTypoScriptType[$type]) &&
63+
!empty($this->typoScriptContext[$this->typeToTsType[$type] . '.'][$answer->getField()->getMarker()])) {
6264
$this->contentObjectRenderer->start($answer->_getProperties());
6365
$value = $this->contentObjectRenderer->cObjGetSingle(
6466
$this->typoScriptContext[$this->typeToTsType[$type] . '.'][$answer->getField()->getMarker()],

0 commit comments

Comments
 (0)