Skip to content

Commit b5aeb28

Browse files
authored
Merge branch 'develop' into tmg-digitale-medien-patch-1
2 parents 3a674f6 + d327492 commit b5aeb28

File tree

108 files changed

+3138
-21964
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

108 files changed

+3138
-21964
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
msi.iws
22
.idea/
33
nbproject/
4-
Resources/Private/node_modules/
4+
node_modules
55
.DS_Store
66
.DS_Store?
77
._*

.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/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/Eid/GetLocationEid.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@
22
declare(strict_types = 1);
33
namespace In2code\Powermail\Eid;
44

5+
use InvalidArgumentException;
56
use Psr\Http\Message\ResponseInterface;
67
use Psr\Http\Message\ServerRequestInterface;
8+
use Throwable;
79
use TYPO3\CMS\Core\Exception;
810
use TYPO3\CMS\Core\Http\Response;
911
use TYPO3\CMS\Core\Utility\GeneralUtility;
@@ -59,7 +61,7 @@ public function main(ServerRequestInterface $request): ResponseInterface
5961
$response = new Response();
6062
$response->getBody()->write($this->content);
6163
return $response;
62-
} catch (\InvalidArgumentException $e) {
64+
} catch (InvalidArgumentException $e) {
6365
// add a 410 "gone" if invalid parameters given
6466
return (new Response())->withStatus(410);
6567
} catch (Exception $e) {
@@ -104,9 +106,8 @@ protected function getAddressFromGeo(float $lat, float $lng): array
104106
];
105107
}
106108
}
107-
} catch (\Exception $e) {
109+
} catch (Throwable $e) {
108110
}
109-
110111
return $result;
111112
}
112113
}

Classes/Hook/CreateMarker.php

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

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/String/SanitizeCsvCellViewHelper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@ class SanitizeCsvCellViewHelper extends AbstractViewHelper
1818
*/
1919
public function render(): string
2020
{
21-
return CsvUtility::sanitizeCell($this->renderChildren());
21+
return CsvUtility::sanitizeCell((string)$this->renderChildren());
2222
}
2323
}

Classes/ViewHelpers/Validation/AbstractValidationViewHelper.php

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -72,19 +72,18 @@ protected function addMandatoryAttributes(array $additionalAttributes, ?Field $f
7272
$additionalAttributes['required'] = 'required';
7373
} else {
7474
if ($this->isClientValidationEnabled()) {
75-
$additionalAttributes['data-parsley-required'] = 'true';
75+
$additionalAttributes['data-powermail-required'] = 'true';
7676
}
7777
}
7878
$additionalAttributes['aria-required'] = 'true';
7979

8080
if ($this->isClientValidationEnabled()) {
81-
$additionalAttributes['data-parsley-required-message'] =
81+
$additionalAttributes['data-powermail-required-message'] =
8282
LocalizationUtility::translate('validationerror_mandatory');
83-
$additionalAttributes['data-parsley-trigger'] = 'change';
8483

8584
/**
8685
* Special case multiselect:
87-
* Parsley sets the error messages after the wrapping div (but only for multiselect)
86+
* JS sets the error messages after the wrapping div (but only for multiselect)
8887
* So we define for this case where the errors should be included
8988
*/
9089
if ($field->getType() === 'select' && $field->isMultiselect()) {
@@ -105,7 +104,7 @@ protected function addMandatoryAttributes(array $additionalAttributes, ?Field $f
105104
*/
106105
protected function addErrorContainer(array $additionalAttributes, Field $field): array
107106
{
108-
$additionalAttributes['data-parsley-errors-container'] =
107+
$additionalAttributes['data-powermail-errors-container'] =
109108
'.powermail_field_error_container_' . $field->getMarker();
110109
return $additionalAttributes;
111110
}
@@ -120,8 +119,8 @@ protected function addErrorContainer(array $additionalAttributes, Field $field):
120119
*/
121120
protected function addClassHandler(array $additionalAttributes, Field $field): array
122121
{
123-
$additionalAttributes['data-parsley-class-handler'] =
124-
'.powermail_fieldwrap_' . $field->getMarker() . ' div:first > div';
122+
$additionalAttributes['data-powermail-class-handler'] =
123+
'.powermail_fieldwrap_' . $field->getMarker() . ' > div > div';
125124
return $additionalAttributes;
126125
}
127126

Classes/ViewHelpers/Validation/CaptchaDataAttributeViewHelper.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,8 @@
1111
*/
1212
class CaptchaDataAttributeViewHelper extends ValidationDataAttributeViewHelper
1313
{
14-
1514
/**
16-
* Returns Data Attribute Array for JS validation with parsley.js
15+
* Returns Data Attribute Array for JS validation
1716
*
1817
* @return array for data attributes
1918
* @throws Exception
@@ -30,12 +29,12 @@ public function render(): array
3029
if ($this->isNativeValidationEnabled()) {
3130
$dataArray['required'] = 'required';
3231
} elseif ($this->isClientValidationEnabled()) {
33-
$dataArray['data-parsley-required'] = 'true';
32+
$dataArray['data-powermail-required'] = 'true';
3433
}
3534
if ($this->isClientValidationEnabled()) {
36-
$dataArray['data-parsley-errors-container'] = '.powermail_field_error_container_' . $field->getMarker();
37-
$dataArray['data-parsley-class-handler'] = '#powermail_field_' . $field->getMarker();
38-
$dataArray['data-parsley-required-message'] = LocalizationUtility::translate('validationerror_mandatory');
35+
$dataArray['data-powermail-errors-container'] = '.powermail_field_error_container_' . $field->getMarker();
36+
$dataArray['data-powermail-class-handler'] = '#powermail_field_' . $field->getMarker();
37+
$dataArray['data-powermail-required-message'] = LocalizationUtility::translate('validationerror_mandatory');
3938
}
4039

4140
return $dataArray;

Classes/ViewHelpers/Validation/DatepickerDataAttributeViewHelper.php

Lines changed: 24 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,6 @@ public function render(): array
3636
$additionalAttributes = $this->arguments['additionalAttributes'];
3737
$value = $this->arguments['value'];
3838

39-
$additionalAttributes['data-datepicker-force'] =
40-
$this->settings['misc']['datepicker']['forceJavaScriptDatePicker'] ?? 0;
41-
$additionalAttributes['data-datepicker-settings'] = $this->getDatepickerSettings($field);
42-
$additionalAttributes['data-datepicker-months'] = $this->getMonthNames();
43-
$additionalAttributes['data-datepicker-days'] = $this->getDayNames();
4439
$additionalAttributes['data-datepicker-format'] = $this->getFormat($field);
4540
if ($value) {
4641
$additionalAttributes['data-date-value'] = $value;
@@ -54,7 +49,7 @@ public function render(): array
5449
/**
5550
* Get Datepicker Settings
5651
*
57-
* @param Field $field
52+
* @param Field|null $field
5853
* @return string
5954
*/
6055
protected function getDatepickerSettings(Field $field = null): string
@@ -66,64 +61,39 @@ protected function getDatepickerSettings(Field $field = null): string
6661
}
6762

6863
/**
69-
* Get timeformat out of datepicker type
70-
*
71-
* @param Field $field
64+
* @param Field|null $field
7265
* @return string
7366
*/
7467
protected function getFormat(Field $field = null): string
7568
{
76-
return LocalizationUtility::translate('datepicker_format_' . $this->getDatepickerSettings($field));
77-
}
78-
79-
/**
80-
* Generate Monthnames from locallang
81-
*
82-
* @return string
83-
*/
84-
protected function getDayNames(): string
85-
{
86-
$days = [
87-
'so',
88-
'mo',
89-
'tu',
90-
'we',
91-
'th',
92-
'fr',
93-
'sa',
94-
];
95-
$dayArray = [];
96-
foreach ($days as $day) {
97-
$dayArray[] = LocalizationUtility::translate('datepicker_day_' . $day);
98-
}
99-
return implode(',', $dayArray);
69+
$format = LocalizationUtility::translate('datepicker_format_' . $this->getDatepickerSettings($field));
70+
return $this->convertFormatForMomentJs($format);
10071
}
10172

10273
/**
103-
* Generate Monthnames from locallang
104-
*
74+
* Because moment.js needs a different format writings, we need to convert this
75+
* "Y-m-d H:i" => "YYYY-MM-DD HH:mm"
76+
* @param string $format
10577
* @return string
10678
*/
107-
protected function getMonthNames(): string
79+
protected function convertFormatForMomentJs(string $format): string
10880
{
109-
$months = [
110-
'jan',
111-
'feb',
112-
'mar',
113-
'apr',
114-
'may',
115-
'jun',
116-
'jul',
117-
'aug',
118-
'sep',
119-
'oct',
120-
'nov',
121-
'dec',
81+
$replace = [
82+
[
83+
'Y',
84+
'm',
85+
'd',
86+
'H',
87+
'i',
88+
],
89+
[
90+
'YYYY',
91+
'MM',
92+
'DD',
93+
'HH',
94+
'mm',
95+
]
12296
];
123-
$monthArray = [];
124-
foreach ($months as $month) {
125-
$monthArray[] = LocalizationUtility::translate('datepicker_month_' . $month);
126-
}
127-
return implode(',', $monthArray);
97+
return str_replace($replace[0], $replace[1], $format);
12898
}
12999
}

0 commit comments

Comments
 (0)