-
-
Notifications
You must be signed in to change notification settings - Fork 119
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Igor Neyman
committed
Jan 5, 2023
1 parent
6c824ec
commit bffb576
Showing
59 changed files
with
898 additions
and
1,094 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
<?php | ||
|
||
namespace DirectMailTeam\DirectMail\Command; | ||
|
||
use DirectMailTeam\DirectMail\Dmailer; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
<?php | ||
|
||
namespace DirectMailTeam\DirectMail; | ||
|
||
/* | ||
|
@@ -26,9 +27,6 @@ | |
* | ||
* @author Kasper Skårhøj <kasperYYYY>@typo3.com> | ||
* @author Thorsten Kahler <[email protected]> | ||
* | ||
* @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); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
<?php | ||
|
||
namespace DirectMailTeam\DirectMail; | ||
|
||
/* | ||
|
@@ -17,9 +18,9 @@ | |
use DirectMailTeam\DirectMail\Repository\SysDmailRepository; | ||
use DirectMailTeam\DirectMail\Utility\DmRegistryUtility; | ||
use TYPO3\CMS\Backend\Utility\BackendUtility; | ||
use TYPO3\CMS\Core\Messaging\FlashMessageRendererResolver; | ||
use TYPO3\CMS\Core\Localization\LanguageService; | ||
use TYPO3\CMS\Core\Messaging\FlashMessage; | ||
use TYPO3\CMS\Core\Messaging\FlashMessageRendererResolver; | ||
use TYPO3\CMS\Core\Resource\FileRepository; | ||
use TYPO3\CMS\Core\Utility\GeneralUtility; | ||
use TYPO3\CMS\Core\Utility\MathUtility; | ||
|
@@ -33,9 +34,6 @@ | |
* @author Jan-Erik Revsbech <[email protected]> | ||
* @author Stanislas Rolland <stanislas.rolland(arobas)fructifor.ca> | ||
* @author Ivan-Dharma Kartolo <[email protected]> | ||
* | ||
* @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'), '<!--DMAILER_SECTION_BOUNDARY')) { | ||
} elseif (!strstr($htmlmail->getPartPlainConfig('content'), '<!--DMAILER_SECTION_BOUNDARY')) { | ||
$warningMsg[] = $lang->getLL('dmail_no_plain_boundaries'); | ||
} | ||
} | ||
|
@@ -162,21 +158,17 @@ public static function fetchUrlContentsForDirectMailRecord(array $row, array $pa | |
); | ||
if ($res == 1) { | ||
$htmlmail->setCharset($matches[1]); | ||
} | ||
elseif (isset($params['direct_mail_charset'])) { | ||
} elseif (isset($params['direct_mail_charset'])) { | ||
$htmlmail->setCharset($params['direct_mail_charset']); | ||
} | ||
else { | ||
} else { | ||
$htmlmail->setCharset('iso-8859-1'); | ||
} | ||
} | ||
if ($htmlmail->extractFramesInfo()) { | ||
$errorMsg[] = $lang->getLL('dmail_frames_not allowed'); | ||
} | ||
elseif (!$success || !$htmlmail->getPartHtmlConfig('content')) { | ||
} elseif (!$success || !$htmlmail->getPartHtmlConfig('content')) { | ||
$errorMsg[] = $lang->getLL('dmail_no_html_content'); | ||
} | ||
elseif (!strstr($htmlmail->getPartHtmlConfig('content'), '<!--DMAILER_SECTION_BOUNDARY')) { | ||
} elseif (!strstr($htmlmail->getPartHtmlConfig('content'), '<!--DMAILER_SECTION_BOUNDARY')) { | ||
$warningMsg[] = $lang->getLL('dmail_no_html_boundaries'); | ||
} | ||
} | ||
|
@@ -191,7 +183,7 @@ public static function fetchUrlContentsForDirectMailRecord(array $row, array $pa | |
'charset' => $htmlmail->getCharset(), | ||
'mailContent' => $mailContent, | ||
'renderedSize' => strlen($mailContent), | ||
'long_link_rdct_url' => $urls['baseUrl'] | ||
'long_link_rdct_url' => $urls['baseUrl'], | ||
]; | ||
|
||
$done = GeneralUtility::makeInstance(SysDmailRepository::class)->updateSysDmailRecord((int)$row['uid'], $updateData); | ||
|
@@ -202,26 +194,25 @@ public static function fetchUrlContentsForDirectMailRecord(array $row, array $pa | |
$output .= $flashMessageRendererResolver | ||
->resolve() | ||
->render([ | ||
self::createFlashMessage($warning, $lang->getLL('dmail_warning'), FlashMessage::WARNING, false) | ||
self::createFlashMessage($warning, $lang->getLL('dmail_warning'), FlashMessage::WARNING, false), | ||
]); | ||
} | ||
} | ||
} | ||
else { | ||
} else { | ||
$flashMessageRendererResolver = self::getFlashMessageRendererResolver(); | ||
foreach ($errorMsg as $error) { | ||
$output .= $flashMessageRendererResolver | ||
->resolve() | ||
->render([ | ||
self::createFlashMessage($error, $lang->getLL('dmail_error'), FlashMessage::ERROR, false) | ||
self::createFlashMessage($error, $lang->getLL('dmail_error'), FlashMessage::ERROR, false), | ||
]); | ||
} | ||
} | ||
|
||
if ($returnArray) { | ||
return [ | ||
'errors' => $errorMsg, | ||
'warnings' => $warningMsg | ||
'warnings' => $warningMsg, | ||
]; | ||
} | ||
|
||
|
@@ -233,9 +224,9 @@ protected static function createFlashMessage( | |
string $messageHeader = '', | ||
int $messageType = 0, | ||
bool $storeInSession = false | ||
): FlashMessage | ||
{ | ||
return GeneralUtility::makeInstance(FlashMessage::class, | ||
): FlashMessage { | ||
return GeneralUtility::makeInstance( | ||
FlashMessage::class, | ||
$messageText, | ||
$messageHeader, | ||
$messageType, | ||
|
@@ -267,7 +258,7 @@ protected static function addUserPass(string $url, array $params): string | |
} | ||
if (($params['simulate_usergroup'] ?? false) && MathUtility::canBeInterpretedAsInteger($params['simulate_usergroup'])) { | ||
$glue = self::getURLGlue($url); | ||
$url = $url . $glue . 'dmail_fe_group=' . (int)$params['simulate_usergroup'] . '&access_token=' . GeneralUtility::makeInstance(DmRegistryUtility::class)->createAndGetAccessToken(); | ||
$url = $url . $glue . 'dmail_fe_group=' . (int)$params['simulate_usergroup'] . '&access_token=' . GeneralUtility::makeInstance(DmRegistryUtility::class)->createAndGetAccessToken(); | ||
} | ||
return $url; | ||
} | ||
|
@@ -285,7 +276,7 @@ public static function getFullUrlsForDirectMailRecord(array $row): array | |
$result = [ | ||
'baseUrl' => self::getTypolinkURL((int)$row['page']), | ||
'htmlUrl' => '', | ||
'plainTextUrl' => '' | ||
'plainTextUrl' => '', | ||
]; | ||
|
||
// Finding the url to fetch content from | ||
|
@@ -305,8 +296,7 @@ public static function getFullUrlsForDirectMailRecord(array $row): array | |
if ($result['plainTextUrl']) { | ||
if (!($row['sendOptions'] & 1)) { | ||
$result['plainTextUrl'] = ''; | ||
} | ||
else { | ||
} else { | ||
$urlParts = @parse_url($result['plainTextUrl']); | ||
if (!$urlParts['scheme']) { | ||
$result['plainTextUrl'] = 'http://' . $result['plainTextUrl']; | ||
|
@@ -318,8 +308,7 @@ public static function getFullUrlsForDirectMailRecord(array $row): array | |
if ($result['htmlUrl']) { | ||
if (!($row['sendOptions'] & 2)) { | ||
$result['htmlUrl'] = ''; | ||
} | ||
else { | ||
} else { | ||
$urlParts = @parse_url($result['htmlUrl']); | ||
if (!$urlParts['scheme']) { | ||
$result['htmlUrl'] = 'http://' . $result['htmlUrl']; | ||
|
@@ -340,8 +329,7 @@ public static function intInRangeWrapper( | |
int $min, | ||
int $max = 2000000000, | ||
int $zeroValue = 0 | ||
): int | ||
{ | ||
): int { | ||
return MathUtility::forceIntegerInRange($theInt, $min, $max, $zeroValue); | ||
} | ||
|
||
|
@@ -374,8 +362,7 @@ public static function substUrlsInPlainText($message, $urlmode = '76', $index_sc | |
if ($lengthLimit === false) { | ||
// No processing | ||
$messageSubstituted = $message; | ||
} | ||
else { | ||
} else { | ||
$messageSubstituted = preg_replace_callback( | ||
'/(http|https):\\/\\/.+(?=[\\]\\.\\?]*([\\! \'"()<>]+|$))/iU', | ||
function (array $matches) use ($lengthLimit, $index_script_url) { | ||
|
Oops, something went wrong.