Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 5.2.3 with feature recipient list by sys_dmail_category #125

Open
wants to merge 129 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
129 commits
Select commit Hold shift + click to select a range
d02fc86
[TASK] Allow tt_address ^6.0
Patta Feb 4, 2022
53cf8d4
[BUGFIX] Fix empty $_SERVER['HTTP_HOST'] in CLI context
peterkraume Jul 29, 2022
2324e07
Merge pull request #289 from peterkraume/master
kartolo Sep 20, 2022
f528e74
Merge pull request #285 from Patta/patch-3
kartolo Sep 20, 2022
0826950
[TASK] fix composer.json so packagist can update
kartolo Sep 21, 2022
898d2c6
Merge pull request #292 from kartolo/update_composer
kartolo Sep 21, 2022
9f2d8f6
feat: Add dummy dashboard widget
Jan 11, 2023
a1943fd
feat: add dummy dashboard widget 'dmMailEngineStatus'
Jan 12, 2023
06432a5
Merge branch '11.x' into dashboard
Jan 16, 2023
cdf5e20
refactor: add renurn types in MailerEngineController
Jan 16, 2023
93a9951
feat: update dm widget
Jan 16, 2023
3558923
feat: update DmMailEngineStatusDataProvider
Jan 17, 2023
7c0b5f9
refactor:change version in the xlf files
Jan 18, 2023
c1837e4
feat:add statistics widget
Jan 18, 2023
20bfb79
docs: raise version
Jan 18, 2023
e4fb0ce
fix: change iconIdentifier for dashboard
Jan 18, 2023
d330161
Merge branch 'dashboard' into 11.x
Jan 18, 2023
9f11f54
fix: fix where in countSysDmailsByPid
Jan 19, 2023
c5856d8
Merge branch 'dashboard' into 11.x
Jan 19, 2023
76bc626
docs: raise version
Jan 19, 2023
9f1cf71
Merge pull request #376 from SSFGizmo/11.x
SSFGizmo Jan 19, 2023
c6ac7cf
fix: warning: undefined array key "queryTable"
Jan 24, 2023
9fe5442
fix: warning: undefined array key "fe_users"
Jan 24, 2023
58a7e8f
fix: warning: undefined array key -1
Jan 24, 2023
af857b9
fix: warning: undefined array key "host"
Jan 24, 2023
8eeb205
fix: warning: undefined array key "fragment"
Jan 24, 2023
cfa9528
fix: warnings: undefined array keys "showContentTitle" and "prependCo…
Jan 24, 2023
ce6a2ea
fix: warning: undefined array key "directmail"
Jan 24, 2023
65ed90a
fix: warnings: undefined array key by hooks
Jan 24, 2023
eb22b22
fix: warning: undefined array key
Jan 24, 2023
e49fdb0
fix: warning: undefined array key + max
Jan 24, 2023
82482b9
feat: add php 8.1
Jan 26, 2023
c5c796a
refactor: replace isset
Jan 26, 2023
cf15e9d
Merge pull request #378 from SSFGizmo/11.x
SSFGizmo Jan 26, 2023
b371ed9
[BUGFIX] Stop casting to integer of auth code because it does not pro…
imminger Feb 6, 2023
b5e6434
[TASK] Update sys_dmail_maillog.rid field definition to be able to sa…
imminger Feb 6, 2023
990c857
[TASK] Update variable names to better reflect content, remove specia…
imminger Feb 6, 2023
0fbcaba
Avoid errors when group's list value is NULL
tiggr Feb 8, 2023
1cdfd14
Merge pull request #46 from tiggr/sanitize-group-list-usage
SSFGizmo Feb 11, 2023
4dfab8c
refactor: update part with fieldList
Feb 11, 2023
3166744
fix: don't show the editLink for plainlist row
Feb 11, 2023
33434f7
docs: raise version
Feb 11, 2023
d61293a
Merge pull request #381 from SSFGizmo/11.x
SSFGizmo Feb 11, 2023
95b9a66
Merge pull request #380 from jandaroscher/bugfix/store-full-rid-in-ma…
SSFGizmo Feb 12, 2023
72c7037
Merge pull request #47 from kartolo/11.x
SSFGizmo Feb 12, 2023
12fce4a
Use original filename for attachments
christophlehmann Feb 15, 2023
57da3ed
Merge pull request #383 from christophlehmann/patch-4
SSFGizmo Feb 18, 2023
8b920cf
Merge pull request #48 from kartolo/11.x
SSFGizmo Feb 18, 2023
90286bb
docs: raise version
Feb 18, 2023
56aad77
Do not use return path setting as senders email address
tiggr Feb 23, 2023
829bc99
Merge pull request #49 from tiggr/dont-use-return-path-as-sender
SSFGizmo Feb 23, 2023
55df900
feat: add scheduler utility
Feb 24, 2023
ce447a7
fix: use correct path to file
hannesbochmann Feb 28, 2023
d80fbb5
fix: update scheduler 'MailFromDraft'
Mar 2, 2023
dc724cc
Merge pull request #388 from DMKEBUSINESSGMBH/11.x
SSFGizmo Mar 5, 2023
1c0dc53
Merge pull request #50 from kartolo/11.x
SSFGizmo Mar 5, 2023
f332377
feat: remove old part with cronjob interval
Mar 7, 2023
1553260
Merge pull request #392 from SSFGizmo/11.x
SSFGizmo Mar 7, 2023
dd22c0a
fix: replace andX() with and() in TtAddressRepository
Mar 7, 2023
38efb7e
fix: replace andX() with and() in FeUsersRepository
Mar 7, 2023
43adefd
fix: replace andX() with and() in SysDmailMaillogRepository
Mar 7, 2023
993293a
fix: replace andX() with and() in FeGroupsRepository
Mar 7, 2023
179d280
fix: replace andX() with and() in TempRepository
Mar 7, 2023
4e47fd5
docs: raise version
Mar 7, 2023
ce7714f
Merge pull request #393 from SSFGizmo/11.x
SSFGizmo Mar 7, 2023
8ec33bc
fix: PHP Warning: Undefined array key "no_jumpurl"
Mar 8, 2023
3dc38b3
refactor: create functions 'insertDMailRecord' and 'updateDMailRecord…
Mar 8, 2023
d99414f
fix: change type in condition for selected in 'MailFromDraftAdditiona…
Mar 8, 2023
0eec23b
Merge pull request #395 from SSFGizmo/11.x
SSFGizmo Mar 8, 2023
27b32b0
[BUGFIX] Avoid empty recipient name
Patta Apr 5, 2023
9a97a98
[BUGFIX] Prevent undefined recipientRecord['uid'] when sending newsle…
imminger Apr 19, 2023
b60f194
[BUGFIX] Cast replace parameter to string for str_replace()
imminger Apr 19, 2023
6078212
Merge pull request #402 from jandaroscher/bugfix/undefined-recipientr…
SSFGizmo May 3, 2023
34f375e
Merge pull request #52 from kartolo/11.x
SSFGizmo May 3, 2023
beee0eb
Merge pull request #403 from jandaroscher/bugfix/convert-to-string-fo…
SSFGizmo May 3, 2023
e15f11b
Merge pull request #53 from kartolo/11.x
SSFGizmo May 3, 2023
d573d78
docs: raise version
May 3, 2023
733ab56
Merge pull request #407 from SSFGizmo/11.x
SSFGizmo May 3, 2023
320d968
fix: warnings in Importer
May 4, 2023
9b245f5
Merge branch '11.x' into bugfix/recipientname
Patta May 11, 2023
facca8b
[BUGFIX] Avoid undefined array key "rid" warning in JumpurlController
Patta May 11, 2023
659202e
[TASK] add tt_address v8.0 and drop tt_address v5.3 from dependencies
Patta Jun 7, 2023
9ccca4b
Merge pull request #399 from Patta/bugfix/recipientname
SSFGizmo Jun 8, 2023
69d120c
Merge pull request #410 from Patta/bugfix/undefined-rid
SSFGizmo Jun 8, 2023
db279d0
Merge pull request #54 from kartolo/11.x
SSFGizmo Jun 8, 2023
a4922dd
fix: warning for base64_decode
Jun 8, 2023
6a06b25
fix: php warnings in JumpurlController
Jun 8, 2023
69fdbcd
docs: raise version
Jun 8, 2023
0e25cfb
Merge pull request #416 from SSFGizmo/11.x
SSFGizmo Jun 8, 2023
86322d1
[BUGFIX] Avoid undefined array key warning in StatisticsController
Patta Jun 15, 2023
11b4af7
[BUGFIX] Avoid undefined array key fragment in StatisticsController
Patta Jun 15, 2023
53714cc
Merge pull request #415 from Patta/task/ttaddress-v8
SSFGizmo Jun 23, 2023
3c91a70
Merge pull request #55 from kartolo/11.x
SSFGizmo Jun 23, 2023
53c76a5
Merge branch 'master' into 11.x
kartolo Jun 23, 2023
1f0b6ce
Merge pull request #420 from kartolo/11.x
kartolo Jun 23, 2023
ad426e4
Merge pull request #418 from Patta/bugfix/undefinedarraykey-stats-module
kartolo Jun 23, 2023
0ccaa31
Merge pull request #421 from kartolo/develop
kartolo Jun 23, 2023
37d66a9
Merge pull request #422 from kartolo/11.x
kartolo Jun 23, 2023
9e40bfe
[BUGFIX] fix PHP warning
kartolo Jun 23, 2023
fad47b5
Merge pull request #423 from kartolo/419_php_warning
kartolo Jun 23, 2023
fd34959
Merge pull request #56 from kartolo/11.x
SSFGizmo Jun 26, 2023
4491666
docs: raise version
Jun 26, 2023
614b737
Merge pull request #427 from SSFGizmo/11.x
SSFGizmo Jun 26, 2023
837db7a
feat: add php8.2 support
Jul 8, 2023
5902a3e
fix: php warnings
Jul 8, 2023
30ab67f
docs: raise version
Jul 8, 2023
f2c0503
Merge pull request #430 from SSFGizmo/11.x
SSFGizmo Jul 8, 2023
7835da8
Update Index.rst (jumpurls)
criwe Aug 22, 2023
9556bc8
[BUGFIX] Prevent type error when no categories are defined
linawolf Sep 20, 2023
4249f14
[BUGFIX] Avoid undefined array key warnings in DirectMail Plugin
Patta Nov 8, 2023
e6e08d6
[BUGFIX] Avoid trying to access array offset on value of type null wa…
Patta Nov 8, 2023
42088f4
[BUGFIX] Avoid undefined array key bodytext warning in DirectMail Plugin
Patta Nov 9, 2023
3a9cef7
Merge branch '11.x'
kartolo Nov 23, 2023
634a54c
[Security] prevent user to input multiline value
kartolo Nov 24, 2023
20f8cd9
Fix PHP 8.1 deprecation exceptions
baschny Dec 5, 2023
bd1ea26
PHP 8.1 warning when When editing a category in backend
baschny Dec 5, 2023
20845fa
fix: add missing 'executeQuery()'
Dec 8, 2023
e13b8de
Merge pull request #451 from SSFGizmo/11.x
SSFGizmo Dec 8, 2023
6fb797f
Merge pull request #453 from kartolo/hotfix/2023110110000013
kartolo Dec 12, 2023
9fed47c
Merge pull request #452 from kartolo/11.x
kartolo Dec 12, 2023
90e107b
Merge pull request #443 from linawolf/bugfix/no_cats
kartolo Dec 12, 2023
6aeb2b8
Merge pull request #457 from Patta/bugfix/444
kartolo Dec 13, 2023
088263f
Fix plaintext rendering
baschny Dec 18, 2023
b9691e2
Fix PHP 8.x warnings due to very old code to render plaintext
baschny Dec 18, 2023
ed7e7e5
Merge pull request #463 from cron-eu/fix-plaintext
kartolo Dec 19, 2023
2c377d5
Fix unsafe array access to $mediaData['use_jumpurl']
smichaelsen Jan 31, 2024
07a5100
Merge pull request #478 from smichaelsen/patch-1
kartolo Feb 21, 2024
6223ba5
Merge pull request #449 from cron-eu/fix-php81
kartolo Feb 21, 2024
944392c
Merge pull request #440 from criwe/criwe-patch-1
kartolo Feb 21, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Classes/DirectMailUtility.php
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,12 @@ protected static function addUserPass(string $url, array $params): string
public static function getFullUrlsForDirectMailRecord(array $row): array
{
// Finding the domain to use
if (!$_SERVER['HTTP_HOST']) {
// In CLI / Scheduler context, $_SERVER['HTTP_HOST'] can be null
$siteFinder = GeneralUtility::makeInstance(SiteFinder::class);
$site = $siteFinder->getSiteByPageId((int)$row['page']);
$_SERVER['HTTP_HOST'] = $site->getBase()->getHost();
}
$result = [
'baseUrl' => self::getTypolinkURL((int)$row['page']),
'htmlUrl' => '',
Expand Down
33 changes: 23 additions & 10 deletions Classes/Dmailer.php
Original file line number Diff line number Diff line change
Expand Up @@ -247,8 +247,8 @@ public function prepare(array $row): void
}

//$this->encoding = $row['encoding'];
$this->theParts = unserialize(base64_decode($row['mailContent']));
$this->messageid = $this->theParts['messageid'];
$this->theParts = unserialize(base64_decode((string)$row['mailContent'])) ?: [];
$this->messageid = $this->theParts['messageid'] ?? 0;
$this->subject = $this->ensureCorrectEncoding($row['subject']);
$this->fromEmail = $row['from_email'];
$this->fromName = $this->ensureCorrectEncoding($row['from_name']);
Expand All @@ -262,7 +262,7 @@ public function prepare(array $row): void
$this->dmailer['sectionBoundary'] = '<!--DMAILER_SECTION_BOUNDARY';
$this->dmailer['html_content'] = $this->theParts['html']['content'] ?? '';
$this->dmailer['plain_content'] = $this->theParts['plain']['content'] ?? '';
$this->dmailer['messageID'] = $this->theParts['messageid'];
$this->dmailer['messageID'] = $this->theParts['messageid'] ?? 0;
$this->dmailer['sys_dmail_uid'] = $row['uid'];
$this->dmailer['sys_dmail_rec'] = $row;
$this->dmailer['boundaryParts_html'] = explode($this->dmailer['sectionBoundary'], '_END-->' . $this->dmailer['html_content']);
Expand Down Expand Up @@ -354,7 +354,7 @@ protected function replaceMailMarkers(string $content, array $recipRow, array $m
public function sendAdvanced(array $recipientRow, string $tableNameChar): int
{
$returnCode = 0;
$recipientRow = array_map('htmlspecialchars', $recipientRow);
$recipientRow = array_map(function($a) { return @htmlspecialchars($a); }, $recipientRow);

// Workaround for strict checking of email addresses in TYPO3
// (trailing newline = invalid address)
Expand Down Expand Up @@ -417,7 +417,17 @@ public function sendAdvanced(array $recipientRow, string $tableNameChar): int
$this->dmailer['sys_dmail_rec']['return_path'] = str_replace('###XID###', $midRidId, $this->dmailer['sys_dmail_rec']['return_path']);

if ($returnCode) {
$recipient = $this->createRecipient($recipientRow['email'], $this->ensureCorrectEncoding($recipientRow['name']));
$recipientName = $recipientRow['name'] ?? '';
if ($recipientName == '') {
if ($recipientRow['first_name'] ?? '') {
$recipientName = $recipientRow['first_name'] . ' ';
}
if ($recipientRow['middle_name'] ?? '') {
$recipientName .= $recipientRow['middle_name'] . ' ';
}
$recipientName .= $recipientRow['last_name'] ?? '';
}
$recipient = $this->createRecipient($recipientRow['email'], $this->ensureCorrectEncoding($recipientName));
$this->sendTheMail($recipient, $recipientRow);
}
}
Expand Down Expand Up @@ -506,7 +516,10 @@ public function getListOfRecipentCategories(string $table, int $uid): string
return '';
}

$relationTable = $GLOBALS['TCA'][$table]['columns']['module_sys_dmail_category']['config']['MM'];
$relationTable = $GLOBALS['TCA'][$table]['columns']['module_sys_dmail_category']['config']['MM'] ?? null;
if ($relationTable === null) {
return '';
}

$rows = GeneralUtility::makeInstance(TempRepository::class)->getListOfRecipentCategories($table, $relationTable, $uid);

Expand Down Expand Up @@ -864,7 +877,7 @@ protected function setContent(MailMessage $mailer): void
if ((int)$this->dmailer['sys_dmail_rec']['attachment'] > 0) {
$files = DirectMailUtility::getAttachments((int)$this->dmailer['sys_dmail_rec']['uid']);
foreach ($files as $file) {
$mailer->attachFromPath($file->getForLocalProcessing());
$mailer->attachFromPath($file->getForLocalProcessing(), $file->getName());
}
}
}
Expand All @@ -886,7 +899,7 @@ protected function sendTheMail(Address $recipient, array $recipientRow = null):
}

if (GeneralUtility::validEmail($this->dmailer['sys_dmail_rec']['return_path'])) {
$mailer->sender($this->dmailer['sys_dmail_rec']['return_path']);
$mailer->returnPath($this->dmailer['sys_dmail_rec']['return_path']);
}

// TODO: setContent should set the images (includeMedia) or add attachment
Expand Down Expand Up @@ -989,7 +1002,7 @@ protected function substHREFsInHTML(): void
return;
}
foreach ($this->theParts['html']['hrefs'] as $urlId => $val) {
if ($val['no_jumpurl']) {
if ($val['no_jumpurl'] ?? false) {
// A tag attribute "no_jumpurl=1" allows to disable jumpurl for custom links
$substVal = $val['absRef'];
} elseif ($this->jumperURLPrefix && ($val['tag'] != 'form') && (!strstr($val['ref'], 'mailto:'))) {
Expand Down Expand Up @@ -1243,7 +1256,7 @@ public function extractHyperLinks(): void
// get all media and search for use_jumpurl then add it to the hrefs array
$this->extractMediaLinks();
foreach ($this->theParts['html']['media'] as $mediaData) {
if ($mediaData['use_jumpurl'] === 1) {
if (($mediaData['use_jumpurl'] ?? null) === 1) {
$this->theParts['html']['hrefs'][$mediaData['ref']] = $mediaData;
}
}
Expand Down
42 changes: 22 additions & 20 deletions Classes/Importer.php
Original file line number Diff line number Diff line change
Expand Up @@ -211,9 +211,9 @@ public function displayImport(): array
}

// check if "email" is mapped
$error = [];
if (isset($stepCurrent) && $stepCurrent === 'startImport') {
$map = $this->indata['map'];
$error = [];
// check noMap
$newMap = ArrayUtility::removeArrayEntryByValue(array_unique($map), 'noMap');
if (empty($newMap)) {
Expand All @@ -227,6 +227,9 @@ public function displayImport(): array
}

$out = '';
if(!isset($stepCurrent)) {
$stepCurrent = '';
}
switch ($stepCurrent) {
case 'conf':
$output['conf']['show'] = true;
Expand Down Expand Up @@ -269,7 +272,7 @@ public function displayImport(): array
['val' =>'name', 'text' => 'name'],
];

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

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

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

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

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

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

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

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

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

// show charset selector
Expand Down Expand Up @@ -386,7 +389,7 @@ public function displayImport(): array
$output['mapping']['table'][] = [
'mapping_description' => $csv_firstRow[$i],
'mapping_i' => $i,
'mapping_mappingSelected' => $this->indata['map'][$i],
'mapping_mappingSelected' => $this->indata['map'][$i] ?? '',
'mapping_value' => $exampleLines,
];
}
Expand Down Expand Up @@ -427,8 +430,8 @@ public function displayImport(): array
$output['startImport']['remove_dublette'] = $this->indata['remove_dublette'];
$output['startImport']['update_unique'] = $this->indata['update_unique'];
$output['startImport']['record_unique'] = $this->indata['record_unique'];
$output['startImport']['all_html'] = !$this->indata['all_html'] ? false : true;
$output['startImport']['add_cat'] = $this->indata['add_cat'] ? true : false;
$output['startImport']['all_html'] = !($this->indata['all_html'] ?? false) ? false : true;
$output['startImport']['add_cat'] = ($this->indata['add_cat'] ?? false) ? true : false;

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

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

foreach ($endOrder as $order) {
$rowsTable = [];
if (is_array($result[$order])) {
if (is_array($result[$order] ?? false)) {
foreach ($result[$order] as $v) {
$mapKeys = array_keys($v);
$rowsTable[] = [
Expand All @@ -471,12 +474,12 @@ public function displayImport(): array
}

// back button
if (is_array($this->indata['map'])) {
if (is_array($this->indata['map'] ?? false)) {
foreach ($this->indata['map'] as $fieldNr => $fieldMapped) {
$output['startImport']['hiddenMap'][] = ['name' => htmlspecialchars('CSV_IMPORT[map][' . $fieldNr . ']'), 'value' => htmlspecialchars($fieldMapped)];
}
}
if (is_array($this->indata['cat'])) {
if (is_array($this->indata['cat'] ?? false)) {
foreach ($this->indata['cat'] as $k => $catUid) {
$output['startImport']['hiddenCat'][] = ['name' => htmlspecialchars('CSV_IMPORT[cat][' . $k . ']'), 'value' => htmlspecialchars($catUid)];
}
Expand All @@ -487,8 +490,7 @@ public function displayImport(): array
default:
// show upload file form
$output['subtitle'] = $this->getLanguageService()->getLL('mailgroup_import_header_upload');

if (($this->indata['mode'] === 'file') && !(((strpos($currentFileInfo['file'], 'import') === false) ? 0 : 1) && ($currentFileInfo['realFileext'] === 'txt'))) {
if ((($this->indata['mode'] ?? '') === 'file') && !(((strpos($currentFileInfo['file'], 'import') === false) ? 0 : 1) && ($currentFileInfo['realFileext'] === 'txt'))) {
$output['upload']['current'] = true;
$file = $this->getFileById((int)$this->indata['newFileUid']);
if (is_object($file)) {
Expand All @@ -510,8 +512,8 @@ public function displayImport(): array
$output['upload']['csv'] = htmlspecialchars($this->indata['csv'] ?? '');
$output['upload']['target'] = htmlspecialchars($this->userTempFolder());
$output['upload']['target_disabled'] = GeneralUtility::_POST('importNow') ? 'disabled' : '';
$output['upload']['newFile'] = $this->indata['newFile'];
$output['upload']['newFileUid'] = $this->indata['newFileUid'];
$output['upload']['newFile'] = $this->indata['newFile'] ?? '';
$output['upload']['newFileUid'] = $this->indata['newFileUid'] ?? 0;
}

$output['title'] = $this->getLanguageService()->getLL('mailgroup_import') . BackendUtility::cshItem($this->cshTable ?? '', 'mailgroup_import');
Expand Down Expand Up @@ -726,7 +728,7 @@ public function doImport(array $csvData): array
* Hook for doImport Mail
* will be called every time a record is inserted
*/
if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['direct_mail/mod3/class.tx_directmail_recipient_list.php']['doImport'])) {
if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['direct_mail/mod3/class.tx_directmail_recipient_list.php']['doImport'] ?? false)) {
$hookObjectsArr = [];
foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['direct_mail/mod3/class.tx_directmail_recipient_list.php']['doImport'] as $classRef) {
$hookObjectsArr[] = GeneralUtility::makeInstance($classRef);
Expand Down Expand Up @@ -756,7 +758,7 @@ public function addDataArray(array &$data, $id, array $dataArray): void
if ($this->indata['all_html']) {
$data['tt_address'][$id]['module_sys_dmail_html'] = $this->indata['all_html'];
}
if (is_array($this->indata['cat']) && !in_array('cats', $this->indata['map'])) {
if (is_array($this->indata['cat'] ?? false) && !in_array('cats', $this->indata['map'])) {
foreach ($this->indata['cat'] as $k => $v) {
$data['tt_address'][$id]['module_sys_dmail_category'][$k] = $v;
}
Expand Down
41 changes: 23 additions & 18 deletions Classes/Middleware/JumpurlController.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,15 +85,17 @@ public function process(ServerRequestInterface $request, RequestHandlerInterface

if ($this->shouldProcess()) {
$mailId = (int)$this->request->getQueryParams()['mid'];
$submittedRecipient = (string)$this->request->getQueryParams()['rid'];
$submittedAuthCode = $this->request->getQueryParams()['aC'];
$jumpurl = $this->request->getQueryParams()['jumpurl'];
$submittedRecipient = isset($this->request->getQueryParams()['rid']) ? (string)$this->request->getQueryParams()['rid'] : '';
$submittedAuthCode = $this->request->getQueryParams()['aC'] ?? '';
$jumpurl = $this->request->getQueryParams()['jumpurl'] ?? '';

$urlId = 0;
if (MathUtility::canBeInterpretedAsInteger($jumpurl)) {
$urlId = $jumpurl;
$this->initDirectMailRecord($mailId);
$this->initRecipientRecord($submittedRecipient);
$rid = $this->recipientRecord['uid'] ?? 0;

$jumpurl = $this->getTargetUrl((int)$jumpurl);

// try to build the ready-to-use target url
Expand Down Expand Up @@ -123,7 +125,7 @@ public function process(ServerRequestInterface $request, RequestHandlerInterface
}

// to count the dmailerping correctly, we need something unique
$recipientUid = $submittedAuthCode;
$submittedAuthCode = preg_replace("/[^a-zA-Z0-9]/", "", $submittedAuthCode);
}

if ($this->responseType !== 0) {
Expand All @@ -134,7 +136,7 @@ public function process(ServerRequestInterface $request, RequestHandlerInterface
'response_type' => $this->responseType,
'url_id' => (int)$urlId,
'rtbl' => mb_substr($this->recipientTable, 0, 1),
'rid' => (int)($recipientUid ?? $this->recipientRecord['uid']),
'rid' => $rid ?? $submittedAuthCode,
];
$sysDmailMaillogRepository = GeneralUtility::makeInstance(SysDmailMaillogRepository::class);
if ($sysDmailMaillogRepository->hasRecentLog($mailLogParams) === false) {
Expand Down Expand Up @@ -177,25 +179,28 @@ protected function initDirectMailRecord(int $mailId): void
* Fetches the target url from the direct mail record
*
* @param int $targetIndex
* @return string|null
* @return string
*/
protected function getTargetUrl(int $targetIndex): ?string
protected function getTargetUrl(int $targetIndex): string
{
$targetUrl = null;
$targetUrl = '';

if (!empty($this->directMailRecord)) {
$mailContent = unserialize(
base64_decode($this->directMailRecord['mailContent']),
base64_decode((string)$this->directMailRecord['mailContent']),
['allowed_classes' => false]
);
if ($targetIndex >= 0) {
// Link (number)
$this->responseType = self::RESPONSE_TYPE_HREF;
$targetUrl = $mailContent['html']['hrefs'][$targetIndex]['absRef'];
} else {
// Link (number, plaintext)
$this->responseType = self::RESPONSE_TYPE_PLAIN;
$targetUrl = $mailContent['plain']['link_ids'][abs($targetIndex)];

if(is_array($mailContent)) {
if ($targetIndex >= 0) {
// Link (number)
$this->responseType = self::RESPONSE_TYPE_HREF;
$targetUrl = $mailContent['html']['hrefs'][$targetIndex]['absRef'];
} else {
// Link (number, plaintext)
$this->responseType = self::RESPONSE_TYPE_PLAIN;
$targetUrl = $mailContent['plain']['link_ids'][abs($targetIndex)];
}
}
$targetUrl = htmlspecialchars_decode(urldecode($targetUrl));
}
Expand Down Expand Up @@ -261,7 +266,7 @@ protected function substituteUserMarkersFromTargetUrl(string $targetUrl): string
if (isset($this->recipientRecord[$substField])) {
$processedTargetUrl = str_replace(
'###USER_' . $substField . '###',
$this->recipientRecord[$substField],
(string) $this->recipientRecord[$substField],
$processedTargetUrl
);
}
Expand Down
Loading