diff --git a/Classes/Command/AnalyzeBounceMailCommand.php b/Classes/Command/AnalyzeBounceMailCommand.php index 998e7f875..f9a7d34fa 100644 --- a/Classes/Command/AnalyzeBounceMailCommand.php +++ b/Classes/Command/AnalyzeBounceMailCommand.php @@ -1,7 +1,7 @@ getOption('type')) { $type = $input->getOption('type'); //$io->writeln($type); - if(!in_array($type, ['imap', 'pop3'])) { + if (!in_array($type, ['imap', 'pop3'])) { $io->warning('Type: only imap or pop3'); return Command::FAILURE; } @@ -122,7 +122,7 @@ protected function execute(InputInterface $input, OutputInterface $output) // we are connected to mail server // get unread mails $messages = $mailServer->search('UNSEEN', $count); - if(count($messages)) { + if (count($messages)) { /** @var Message $message The message object */ foreach ($messages as $message) { // process the mail @@ -130,8 +130,7 @@ protected function execute(InputInterface $input, OutputInterface $output) //$io->writeln($message->getSubject()); // set delete $message->delete(); - } - else { + } else { $message->setFlag('SEEN'); } } @@ -141,9 +140,8 @@ protected function execute(InputInterface $input, OutputInterface $output) imap_close($mailServer->getImapStream()); return Command::SUCCESS; } - else { - return Command::FAILURE; - } + + return Command::FAILURE; return Command::SUCCESS; } @@ -167,13 +165,12 @@ private function processBounceMail($message) $bouncedMail = $attachment->getData(); // Find mail id $midArray = $readMail->find_XTypo3MID($bouncedMail); - if (false === empty($midArray)) { + if (empty($midArray) === false) { // if mid, rid and rtbl are found, then stop looping break; } } - } - else { + } else { // search in MessageBody (see rfc822-headers as Attachments placed ) $midArray = $readMail->find_XTypo3MID($message->getMessageBody()); } @@ -191,7 +188,6 @@ private function processBounceMail($message) // only write to log table, if we found a corresponding recipient record if (!empty($row)) { - $midArray['email'] = $row['email']; try { return $sysDmailMaillogRepository->analyzeBounceMailAddToMailLog( @@ -204,8 +200,7 @@ private function processBounceMail($message) // Log $e->getMessage(); return false; } - } - else { + } else { return false; } } @@ -240,24 +235,22 @@ private function connectMailServer(string $server, int $port, string $type, stri $imapStream = $mailServer->getImapStream(); return $mailServer; } catch (\Exception $e) { - $io->error($this->languageService->getLL('scheduler.bounceMail.dataVerification').$e->getMessage()); + $io->error($this->languageService->getLL('scheduler.bounceMail.dataVerification') . $e->getMessage()); return false; } } /** - * * @return int */ - private function getTimestampFromAspect(): int { + private function getTimestampFromAspect(): int + { $context = GeneralUtility::makeInstance(Context::class); return $context->getPropertyFromAspect('date', 'timestamp'); } - /** - * @return void - */ - private function setLanguageService(): void { + private function setLanguageService(): void + { $languageServiceFactory = GeneralUtility::makeInstance(LanguageServiceFactory::class); $this->languageService = $languageServiceFactory->create('en'); //@TODO $this->languageService->includeLLFile('EXT:direct_mail/Resources/Private/Language/locallang_mod2-6.xlf'); diff --git a/Classes/Command/DirectmailCommand.php b/Classes/Command/DirectmailCommand.php index 0ff004a51..03800a4b9 100644 --- a/Classes/Command/DirectmailCommand.php +++ b/Classes/Command/DirectmailCommand.php @@ -1,4 +1,5 @@ (time() - (60 * 60 * 24))) { $io->warning('TYPO3 Direct Mail Cron: Aborting, another process is already running!'); return Command::FAILURE; - } else { - $io->writeln('TYPO3 Direct Mail Cron: A .lock file was found but it is older than 1 day! Processing mails ...'); } + $io->writeln('TYPO3 Direct Mail Cron: A .lock file was found but it is older than 1 day! Processing mails ...'); } touch($lockfile); diff --git a/Classes/Container.php b/Classes/Container.php index 97ec7ff1a..e943eafd0 100644 --- a/Classes/Container.php +++ b/Classes/Container.php @@ -1,4 +1,5 @@ @typo3.com> * @author Thorsten Kahler - * - * @package TYPO3 - * @subpackage tx_directmail */ class Container { @@ -71,7 +69,7 @@ public function insert_dMailer_boundaries($content, $conf = []) if ($content != '') { // setting the default $categoryList = ''; - if (intval($this->cObj->data['module_sys_dmail_category']) >= 1) { + if ((int)($this->cObj->data['module_sys_dmail_category']) >= 1) { // if content type "RECORDS" we have to strip off // boundaries from indcluded records if ($this->cObj->data['CType'] == 'shortcut') { @@ -122,7 +120,7 @@ public function stripInnerBoundaries($content) public function breakLines($content, array $conf) { $linebreak = $GLOBALS['TSFE']->cObj->stdWrap(($conf['linebreak'] ? $conf['linebreak'] : chr(32) . LF), $conf['linebreak.']); - $charWidth = $GLOBALS['TSFE']->cObj->stdWrap(($conf['charWidth'] ? intval($conf['charWidth']) : 76), $conf['charWidth.']); + $charWidth = $GLOBALS['TSFE']->cObj->stdWrap(($conf['charWidth'] ? (int)($conf['charWidth']) : 76), $conf['charWidth.']); return MailUtility::breakLinesForEmail($content, $linebreak, $charWidth); } diff --git a/Classes/DirectMailUtility.php b/Classes/DirectMailUtility.php index daab8cf49..0e2efad83 100644 --- a/Classes/DirectMailUtility.php +++ b/Classes/DirectMailUtility.php @@ -1,4 +1,5 @@ * @author Stanislas Rolland * @author Ivan-Dharma Kartolo - * - * @package TYPO3 - * @subpackage tx_directmail */ class DirectMailUtility { @@ -64,7 +62,7 @@ public static function getLanguageService(): LanguageService * * @param string $url * - * @return string & or ? + * @return string&or ? */ public static function getURLGlue(string $url): string { @@ -80,15 +78,14 @@ public static function getTypolinkURL( string $parameter, bool $forceAbsoluteUrl = true, bool $linkAccessRestrictedPages = true - ): string - { + ): string { $typolinkPageUrl = 't3://page?uid='; $cObj = GeneralUtility::makeInstance(ContentObjectRenderer::class); return $cObj->typolink_URL([ 'parameter' => $typolinkPageUrl . $parameter, 'forceAbsoluteUrl' => $forceAbsoluteUrl, - 'linkAccessRestrictedPages' => $linkAccessRestrictedPages + 'linkAccessRestrictedPages' => $linkAccessRestrictedPages, ]); } @@ -120,7 +117,7 @@ public static function fetchUrlContentsForDirectMailRecord(array $row, array $pa $htmlmail->setJumperURLPrefix( $urls['baseUrl'] . $glue . 'mid=###SYS_MAIL_ID###' . - (intval($params['jumpurl_tracking_privacy']) ? '' : '&rid=###SYS_TABLE_NAME###_###USER_uid###') . + ((int)($params['jumpurl_tracking_privacy']) ? '' : '&rid=###SYS_TABLE_NAME###_###USER_uid###') . '&aC=###SYS_AUTHCODE###' . '&jumpurl=' ); @@ -141,8 +138,7 @@ public static function fetchUrlContentsForDirectMailRecord(array $row, array $pa $htmlmail->addPlain($mailContent); if (!$mailContent || !$htmlmail->getPartPlainConfig('content')) { $errorMsg[] = $lang->getLL('dmail_no_plain_content'); - } - elseif (!strstr($htmlmail->getPartPlainConfig('content'), '' . $indata['message'] . ''; if (trim($this->params['use_rdct'])) { @@ -818,9 +810,8 @@ protected function createDMailQuick(array $indata) } // fetch functions $theOutput = $this->compileQuickMail($row, $message); - // end fetch function - } - else { + // end fetch function + } else { if (!$dmail['sys_dmail']['NEW']['sendOptions']) { $this->error = 'no_valid_url'; } @@ -845,7 +836,7 @@ protected function linkDMailRecord($uid) 'id' => $this->id, 'sys_dmail_uid' => $uid, 'fetchAtOnce' => 1, - 'cmd' => 'info' + 'cmd' => 'info', ] ); } @@ -868,7 +859,7 @@ protected function deleteLink($uid) [ 'id' => $this->id, 'uid' => $uid, - 'cmd' => 'delete' + 'cmd' => 'delete', ] ); } @@ -880,8 +871,6 @@ protected function deleteLink($uid) * Delete existing dmail record * * @param int $uid record uid to be deleted - * - * @return void */ protected function deleteDMail(int $uid) { @@ -917,8 +906,7 @@ protected function compileQuickMail(array $row, $message) if (!$message || !$htmlmail->getPartPlainConfig('content')) { $erg['errorTitle'] = $this->getLanguageService()->getLL('dmail_error'); $erg['errorText'] = $this->getLanguageService()->getLL('dmail_no_plain_content'); - } - elseif (!strstr(base64_decode($htmlmail->getPartPlainConfig('content')), '