Skip to content

Commit 0e25cfb

Browse files
authored
Merge pull request #416 from SSFGizmo/11.x
11.x
2 parents 69d120c + 69fdbcd commit 0e25cfb

File tree

3 files changed

+40
-35
lines changed

3 files changed

+40
-35
lines changed

Classes/Importer.php

+22-20
Original file line numberDiff line numberDiff line change
@@ -211,9 +211,9 @@ public function displayImport(): array
211211
}
212212

213213
// check if "email" is mapped
214+
$error = [];
214215
if (isset($stepCurrent) && $stepCurrent === 'startImport') {
215216
$map = $this->indata['map'];
216-
$error = [];
217217
// check noMap
218218
$newMap = ArrayUtility::removeArrayEntryByValue(array_unique($map), 'noMap');
219219
if (empty($newMap)) {
@@ -227,6 +227,9 @@ public function displayImport(): array
227227
}
228228

229229
$out = '';
230+
if(!isset($stepCurrent)) {
231+
$stepCurrent = '';
232+
}
230233
switch ($stepCurrent) {
231234
case 'conf':
232235
$output['conf']['show'] = true;
@@ -269,7 +272,7 @@ public function displayImport(): array
269272
['val' =>'name', 'text' => 'name'],
270273
];
271274

272-
$output['conf']['disableInput'] = $this->params['inputDisable'] == 1 ? true : false;
275+
$output['conf']['disableInput'] = ($this->params['inputDisable'] ?? 0) == 1 ? true : false;
273276

274277
// show configuration
275278
$output['subtitle'] = $this->getLanguageService()->getLL('mailgroup_import_header_conf');
@@ -279,10 +282,10 @@ public function displayImport(): array
279282
$output['conf']['storageSelected'] = $this->indata['storage'] ?? '';
280283

281284
// remove existing option
282-
$output['conf']['remove_existing'] = !$this->indata['remove_existing'] ? false : true;
285+
$output['conf']['remove_existing'] = !($this->indata['remove_existing'] ?? false) ? false : true;
283286

284287
// first line in csv is to be ignored
285-
$output['conf']['first_fieldname'] = !$this->indata['first_fieldname'] ? false : true;
288+
$output['conf']['first_fieldname'] = !($this->indata['first_fieldname'] ?? false) ? false : true;
286289

287290
// csv separator
288291
$output['conf']['delimiter'] = $optDelimiter;
@@ -293,13 +296,13 @@ public function displayImport(): array
293296
$output['conf']['encapsulationSelected'] = $this->indata['encapsulation'] ?? '';
294297

295298
// import only valid email
296-
$output['conf']['valid_email'] = !$this->indata['valid_email'] ? false : true;
299+
$output['conf']['valid_email'] = !($this->indata['valid_email'] ?? false) ? false : true;
297300

298301
// only import distinct records
299-
$output['conf']['remove_dublette'] = !$this->indata['remove_dublette'] ? false : true;
302+
$output['conf']['remove_dublette'] = !($this->indata['remove_dublette'] ?? false) ? false : true;
300303

301304
// update the record instead renaming the new one
302-
$output['conf']['update_unique'] = !$this->indata['update_unique'] ? false : true;
305+
$output['conf']['update_unique'] = !($this->indata['update_unique'] ?? false) ? false : true;
303306

304307
// which field should be use to show uniqueness of the records
305308
$output['conf']['record_unique'] = $optUnique;
@@ -320,7 +323,7 @@ public function displayImport(): array
320323
$output['mapping']['remove_dublette'] = $this->indata['remove_dublette'];
321324
$output['mapping']['update_unique'] = $this->indata['update_unique'];
322325
$output['mapping']['record_unique'] = $this->indata['record_unique'];
323-
$output['mapping']['all_html'] = !$this->indata['all_html'] ? false : true;
326+
$output['mapping']['all_html'] = !($this->indata['all_html'] ?? false) ? false : true;
324327
$output['mapping']['error'] = $error;
325328

326329
// show charset selector
@@ -386,7 +389,7 @@ public function displayImport(): array
386389
$output['mapping']['table'][] = [
387390
'mapping_description' => $csv_firstRow[$i],
388391
'mapping_i' => $i,
389-
'mapping_mappingSelected' => $this->indata['map'][$i],
392+
'mapping_mappingSelected' => $this->indata['map'][$i] ?? '',
390393
'mapping_value' => $exampleLines,
391394
];
392395
}
@@ -427,8 +430,8 @@ public function displayImport(): array
427430
$output['startImport']['remove_dublette'] = $this->indata['remove_dublette'];
428431
$output['startImport']['update_unique'] = $this->indata['update_unique'];
429432
$output['startImport']['record_unique'] = $this->indata['record_unique'];
430-
$output['startImport']['all_html'] = !$this->indata['all_html'] ? false : true;
431-
$output['startImport']['add_cat'] = $this->indata['add_cat'] ? true : false;
433+
$output['startImport']['all_html'] = !($this->indata['all_html'] ?? false) ? false : true;
434+
$output['startImport']['add_cat'] = ($this->indata['add_cat'] ?? false) ? true : false;
432435

433436
$output['startImport']['error'] = $error;
434437

@@ -454,7 +457,7 @@ public function displayImport(): array
454457

455458
foreach ($endOrder as $order) {
456459
$rowsTable = [];
457-
if (is_array($result[$order])) {
460+
if (is_array($result[$order] ?? false)) {
458461
foreach ($result[$order] as $v) {
459462
$mapKeys = array_keys($v);
460463
$rowsTable[] = [
@@ -471,12 +474,12 @@ public function displayImport(): array
471474
}
472475

473476
// back button
474-
if (is_array($this->indata['map'])) {
477+
if (is_array($this->indata['map'] ?? false)) {
475478
foreach ($this->indata['map'] as $fieldNr => $fieldMapped) {
476479
$output['startImport']['hiddenMap'][] = ['name' => htmlspecialchars('CSV_IMPORT[map][' . $fieldNr . ']'), 'value' => htmlspecialchars($fieldMapped)];
477480
}
478481
}
479-
if (is_array($this->indata['cat'])) {
482+
if (is_array($this->indata['cat'] ?? false)) {
480483
foreach ($this->indata['cat'] as $k => $catUid) {
481484
$output['startImport']['hiddenCat'][] = ['name' => htmlspecialchars('CSV_IMPORT[cat][' . $k . ']'), 'value' => htmlspecialchars($catUid)];
482485
}
@@ -487,8 +490,7 @@ public function displayImport(): array
487490
default:
488491
// show upload file form
489492
$output['subtitle'] = $this->getLanguageService()->getLL('mailgroup_import_header_upload');
490-
491-
if (($this->indata['mode'] === 'file') && !(((strpos($currentFileInfo['file'], 'import') === false) ? 0 : 1) && ($currentFileInfo['realFileext'] === 'txt'))) {
493+
if ((($this->indata['mode'] ?? '') === 'file') && !(((strpos($currentFileInfo['file'], 'import') === false) ? 0 : 1) && ($currentFileInfo['realFileext'] === 'txt'))) {
492494
$output['upload']['current'] = true;
493495
$file = $this->getFileById((int)$this->indata['newFileUid']);
494496
if (is_object($file)) {
@@ -510,8 +512,8 @@ public function displayImport(): array
510512
$output['upload']['csv'] = htmlspecialchars($this->indata['csv'] ?? '');
511513
$output['upload']['target'] = htmlspecialchars($this->userTempFolder());
512514
$output['upload']['target_disabled'] = GeneralUtility::_POST('importNow') ? 'disabled' : '';
513-
$output['upload']['newFile'] = $this->indata['newFile'];
514-
$output['upload']['newFileUid'] = $this->indata['newFileUid'];
515+
$output['upload']['newFile'] = $this->indata['newFile'] ?? '';
516+
$output['upload']['newFileUid'] = $this->indata['newFileUid'] ?? 0;
515517
}
516518

517519
$output['title'] = $this->getLanguageService()->getLL('mailgroup_import') . BackendUtility::cshItem($this->cshTable ?? '', 'mailgroup_import');
@@ -726,7 +728,7 @@ public function doImport(array $csvData): array
726728
* Hook for doImport Mail
727729
* will be called every time a record is inserted
728730
*/
729-
if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['direct_mail/mod3/class.tx_directmail_recipient_list.php']['doImport'])) {
731+
if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['direct_mail/mod3/class.tx_directmail_recipient_list.php']['doImport'] ?? false)) {
730732
$hookObjectsArr = [];
731733
foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['direct_mail/mod3/class.tx_directmail_recipient_list.php']['doImport'] as $classRef) {
732734
$hookObjectsArr[] = GeneralUtility::makeInstance($classRef);
@@ -756,7 +758,7 @@ public function addDataArray(array &$data, $id, array $dataArray): void
756758
if ($this->indata['all_html']) {
757759
$data['tt_address'][$id]['module_sys_dmail_html'] = $this->indata['all_html'];
758760
}
759-
if (is_array($this->indata['cat']) && !in_array('cats', $this->indata['map'])) {
761+
if (is_array($this->indata['cat'] ?? false) && !in_array('cats', $this->indata['map'])) {
760762
foreach ($this->indata['cat'] as $k => $v) {
761763
$data['tt_address'][$id]['module_sys_dmail_category'][$k] = $v;
762764
}

Classes/Middleware/JumpurlController.php

+17-14
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,8 @@ public function process(ServerRequestInterface $request, RequestHandlerInterface
8686
if ($this->shouldProcess()) {
8787
$mailId = (int)$this->request->getQueryParams()['mid'];
8888
$submittedRecipient = isset($this->request->getQueryParams()['rid']) ? (string)$this->request->getQueryParams()['rid'] : '';
89-
$submittedAuthCode = $this->request->getQueryParams()['aC'];
90-
$jumpurl = $this->request->getQueryParams()['jumpurl'];
89+
$submittedAuthCode = $this->request->getQueryParams()['aC'] ?? '';
90+
$jumpurl = $this->request->getQueryParams()['jumpurl'] ?? '';
9191

9292
$urlId = 0;
9393
if (MathUtility::canBeInterpretedAsInteger($jumpurl)) {
@@ -179,25 +179,28 @@ protected function initDirectMailRecord(int $mailId): void
179179
* Fetches the target url from the direct mail record
180180
*
181181
* @param int $targetIndex
182-
* @return string|null
182+
* @return string
183183
*/
184-
protected function getTargetUrl(int $targetIndex): ?string
184+
protected function getTargetUrl(int $targetIndex): string
185185
{
186-
$targetUrl = null;
186+
$targetUrl = '';
187187

188188
if (!empty($this->directMailRecord)) {
189189
$mailContent = unserialize(
190-
base64_decode($this->directMailRecord['mailContent']),
190+
base64_decode((string)$this->directMailRecord['mailContent']),
191191
['allowed_classes' => false]
192192
);
193-
if ($targetIndex >= 0) {
194-
// Link (number)
195-
$this->responseType = self::RESPONSE_TYPE_HREF;
196-
$targetUrl = $mailContent['html']['hrefs'][$targetIndex]['absRef'];
197-
} else {
198-
// Link (number, plaintext)
199-
$this->responseType = self::RESPONSE_TYPE_PLAIN;
200-
$targetUrl = $mailContent['plain']['link_ids'][abs($targetIndex)];
193+
194+
if(is_array($mailContent)) {
195+
if ($targetIndex >= 0) {
196+
// Link (number)
197+
$this->responseType = self::RESPONSE_TYPE_HREF;
198+
$targetUrl = $mailContent['html']['hrefs'][$targetIndex]['absRef'];
199+
} else {
200+
// Link (number, plaintext)
201+
$this->responseType = self::RESPONSE_TYPE_PLAIN;
202+
$targetUrl = $mailContent['plain']['link_ids'][abs($targetIndex)];
203+
}
201204
}
202205
$targetUrl = htmlspecialchars_decode(urldecode($targetUrl));
203206
}

ext_emconf.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
'author_company' => 'd.k.d Internet Service GmbH',
1010
'state' => 'stable',
1111
'clearcacheonload' => 0,
12-
'version' => '9.3.0',
12+
'version' => '9.4.0',
1313
'constraints' => [
1414
'depends' => [
1515
'typo3' => '11.5.0-11.99.99',

0 commit comments

Comments
 (0)