Skip to content

Commit

Permalink
Release version 5.2.1
Browse files Browse the repository at this point in the history
It provides compatibility to TYPO3 8.7 LTS
  • Loading branch information
kartolo committed Oct 20, 2017
2 parents da1c2c4 + 1dfb1af commit c45f27c
Show file tree
Hide file tree
Showing 34 changed files with 714 additions and 533 deletions.
6 changes: 3 additions & 3 deletions Classes/Container.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
*/
class Container
{

public $boundaryStartWrap = '<!--DMAILER_SECTION_BOUNDARY_ | -->';
public $boundaryEnd = '<!--DMAILER_SECTION_BOUNDARY_END-->';

Expand Down Expand Up @@ -79,14 +78,15 @@ public function insert_dMailer_boundaries($content, $conf = array())
$foreignTable,
$whereClause,
'',
$orderBy);
$orderBy
);

if ($GLOBALS['TYPO3_DB']->sql_num_rows($res)) {
while (($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res))) {
$categoryList .= $row['uid'] . ',';
}
$GLOBALS['TYPO3_DB']->sql_free_result($res);
$categoryList = rtrim($categoryList, ",");
$categoryList = rtrim($categoryList, ',');
}
}
// wrap boundaries around content
Expand Down
189 changes: 119 additions & 70 deletions Classes/DirectMailUtility.php

Large diffs are not rendered by default.

86 changes: 47 additions & 39 deletions Classes/Dmailer.php

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions Classes/Hooks/JumpurlController.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,14 +143,14 @@ public function preprocessRequest($parameter, $parentObject)
}
} else {
// jumpUrl is not an integer -- then this is a URL, that means that the "dmailerping"
// functionality was used to count the number of "opened mails" received (url, dmailerping)
// functionality was used to count the number of "opened mails" received (url, dmailerping)

// Check if jumpurl is a valid link to a "dmailerping.gif"
// Make $checkPath an absolute path pointing to dmailerping.gif so it can get checked via ::isAllowedAbsPath()
// and remove an eventual "/" at beginning of $jumpurl (because PATH_site already contains "/" at the end)
// Check if jumpurl is a valid link to a "dmailerping.gif"
// Make $checkPath an absolute path pointing to dmailerping.gif so it can get checked via ::isAllowedAbsPath()
// and remove an eventual "/" at beginning of $jumpurl (because PATH_site already contains "/" at the end)
$checkPath = PATH_site . preg_replace('#^/#', '', $jumpurl);

// Now check if $checkPath is a valid path and points to a "/dmailerping.gif"
// Now check if $checkPath is a valid path and points to a "/dmailerping.gif"
if (preg_match('#/dmailerping\\.(gif|png)$#', $checkPath) && GeneralUtility::isAllowedAbsPath($checkPath)) {
// set juHash as done for external_url in core: http://forge.typo3.org/issues/46071
GeneralUtility::_GETset(GeneralUtility::hmac($jumpurl, 'jumpurl'), 'juHash');
Expand Down
16 changes: 8 additions & 8 deletions Classes/Hooks/TtnewsPlaintextHook.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public function extraCodesProcessor(&$invokingObj)
);
$row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res);
$GLOBALS['TYPO3_DB']->sql_free_result($res);
// get the translated record if the content language is not the default language
// get the translated record if the content language is not the default language
if ($GLOBALS['TSFE']->sys_language_content) {
$OLmode = ($this->sys_language_mode == 'strict'?'hideNonTranslated':'');
$row = $GLOBALS['TSFE']->sys_page->getRecordOverlay('tt_news', $row, $GLOBALS['TSFE']->sys_language_content, $OLmode);
Expand All @@ -116,19 +116,19 @@ public function extraCodesProcessor(&$invokingObj)
// Render the title
$lines[] = $this->renderPlainText->renderHeader($row['title']);

// Render author of the tt_news record
// Render author of the tt_news record
$lines[] = $this->renderAuthor($row);

// Render the short version of the tt_news record
// Render the short version of the tt_news record
$lines[] = $this->renderPlainText->breakContent(strip_tags($this->renderPlainText->parseBody($row['short'], 'tt_news_short')));

// Render the main text of the tt_news record
// Render the main text of the tt_news record
$lines[] = $this->renderPlainText->breakContent(strip_tags($this->renderPlainText->parseBody($row['bodytext'], 'tt_news_bodytext')));

// Render the images of the tt_news record.
// Render the images of the tt_news record.
$lines[] = $this->getImages($row);

// Render the downloads of the tt_news record.
// Render the downloads of the tt_news record.
$lines[] = $this->renderPlainText->renderUploads($row['news_files']);
} elseif ($this->sys_language_mode == 'strict' && $this->tt_news_uid) {
$noTranslMsg = $this->cObj->stdWrap($invokingObj->pi_getLL('noTranslMsg', 'Sorry, there is no translation for this news-article'), $this->conf['noNewsIdMsg_stdWrap.']);
Expand All @@ -139,7 +139,7 @@ public function extraCodesProcessor(&$invokingObj)
$content = implode(LF, $lines).$content;
}

// Substitute labels
// Substitute labels
if (!empty($content)) {
$markerArray = array();
$markerArray = $this->renderPlainText->addLabelsMarkers($markerArray);
Expand Down Expand Up @@ -223,6 +223,6 @@ public function renderAuthor($row, $type=0)
return implode(LF, $lines);
}
}
return "";
return '';
}
}
32 changes: 19 additions & 13 deletions Classes/Importer.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Utility\File\BasicFileUtility;
use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Core\Resource\DuplicationBehavior;

/**
* Recipient list module for tx_directmail extension
Expand Down Expand Up @@ -102,10 +103,10 @@ public function cmd_displayImport()
// merge it with inData, but inData has priority.
$this->indata = $this->indata + $this->params;

// $currentFileInfo = BasicFileUtility::getTotalFileInfo($this->indata['newFile']);
// $currentFileName = $currentFileInfo['file'];
// $currentFileSize = GeneralUtility::formatSize($currentFileInfo['size']);
// $currentFileMessage = $currentFileName . ' (' . $currentFileSize . ')';
// $currentFileInfo = BasicFileUtility::getTotalFileInfo($this->indata['newFile']);
// $currentFileName = $currentFileInfo['file'];
// $currentFileSize = GeneralUtility::formatSize($currentFileInfo['size']);
// $currentFileMessage = $currentFileName . ' (' . $currentFileSize . ')';

if (empty($this->indata['csv']) && !empty($_FILES['upload_1']['name'])) {
$this->indata['newFile'] = $this->checkUpload();
Expand Down Expand Up @@ -156,7 +157,7 @@ public function cmd_displayImport()
}
}

$out = "";
$out = '';
switch ($stepCurrent) {
case 'conf':
// get list of sysfolder
Expand Down Expand Up @@ -646,7 +647,7 @@ public function doImport(array $csvData)
$mappedCSV = $filteredCSV['clean'];
}

// array for the process_datamap();
// array for the process_datamap();
$data = array();
if ($this->indata['update_unique']) {
$user = array();
Expand Down Expand Up @@ -805,7 +806,7 @@ public function makeDropdown($name, array $option, $selected, $disableInput='')
*
* @return string HTML code
*/
public function makeHidden($name, $value="")
public function makeHidden($name, $value='')
{
if (is_array($name)) {
$hiddenFields = array();
Expand All @@ -830,7 +831,7 @@ public function readCSV()
{
ini_set('auto_detect_line_endings', true);
$mydata = array();
$handle = fopen($this->indata['newFile'], "r");
$handle = fopen($this->indata['newFile'], 'r');
$delimiter = $this->indata['delimiter'];
$encaps = $this->indata['encapsulation'];
$delimiter = ($delimiter === 'comma') ? ',' : $delimiter;
Expand Down Expand Up @@ -869,7 +870,7 @@ public function readExampleCSV($records=3)
if (!is_file($this->indata['newFile']) && (strpos($this->indata['newFile'], PATH_site) === false)) {
$this->indata['newFile'] = PATH_site . $this->indata['newFile'];
}
$handle = fopen($this->indata['newFile'], "r");
$handle = fopen($this->indata['newFile'], 'r');
$i = 0;
$delimiter = $this->indata['delimiter'];
$encaps = $this->indata['encapsulation'];
Expand Down Expand Up @@ -936,7 +937,7 @@ public function formatTable(array $tableLines, array $cellParams, $header, array
$rowA = array();
for ($k = 0; $k < count($r); $k++) {
$v = $r[$k];
$v = strlen($v) ? ($cellcmd[$k]?$v:htmlspecialchars($v)) : "&nbsp;";
$v = strlen($v) ? ($cellcmd[$k]?$v:htmlspecialchars($v)) : '&nbsp;';
if ($first) {
$v = '<B>' . $v . '</B>';
}
Expand Down Expand Up @@ -979,7 +980,7 @@ public function userTempFolder()
*/
public function writeTempFile()
{
$newfile = "";
$newfile = '';
$userPermissions = $GLOBALS['BE_USER']->getFilePermissions();

unset($this->fileProcessor);
Expand All @@ -994,7 +995,9 @@ public function writeTempFile()
// Initializing:
/* @var $fileProcessor \TYPO3\CMS\Core\Utility\File\ExtendedFileUtility */
$this->fileProcessor = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Utility\\File\\ExtendedFileUtility');
$this->fileProcessor->init($GLOBALS['FILEMOUNTS'], $GLOBALS['TYPO3_CONF_VARS']['BE']['fileExtensions']);
if (version_compare(TYPO3_branch, '8.3', '<')) {
$this->fileProcessor->init($GLOBALS['FILEMOUNTS'], $GLOBALS['TYPO3_CONF_VARS']['BE']['fileExtensions']);
}
$this->fileProcessor->setActionPermissions($userPermissions);
$this->fileProcessor->dontCheckForUnique = 1;

Expand Down Expand Up @@ -1063,7 +1066,9 @@ public function checkUpload()
// Initializing:
/* @var $fileProcessor \TYPO3\CMS\Core\Utility\File\ExtendedFileUtility */
$this->fileProcessor = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Utility\\File\\ExtendedFileUtility');
$this->fileProcessor->init($fm, $GLOBALS['TYPO3_CONF_VARS']['BE']['fileExtensions']);
if (version_compare(TYPO3_branch, '8.3', '<')) {
$this->fileProcessor->init($fm, $GLOBALS['TYPO3_CONF_VARS']['BE']['fileExtensions']);
}
$this->fileProcessor->setActionPermissions();
$this->fileProcessor->dontCheckForUnique = 1;

Expand All @@ -1075,6 +1080,7 @@ public function checkUpload()
$this->fileProcessor->writeLog(0, 2, 1, 'Referer host "%s" and server host "%s" did not match!', array($refInfo['host'], $httpHost));
} else {
$this->fileProcessor->start($file);
$this->fileProcessor->setExistingFilesConflictMode(DuplicationBehavior::cast(DuplicationBehavior::REPLACE));
$newfile = $this->fileProcessor->func_upload($file['upload']['1']);
}
return $newfile;
Expand Down
9 changes: 4 additions & 5 deletions Classes/MailSelect.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
*/
class MailSelect extends QueryGenerator
{

public $allowedTables = array('tt_address','fe_users');

/**
Expand All @@ -43,11 +42,11 @@ public function mkTableSelect($name, $cur)
{
$out = '<select name="' . $name . '" onChange="submit();">';
$out .= '<option value=""></option>';
reset($GLOBALS["TCA"]);
foreach ($GLOBALS["TCA"] as $tN => $_) {
if ($GLOBALS["BE_USER"]->check('tables_select', $tN) && in_array($tN, $this->allowedTables)) {
reset($GLOBALS['TCA']);
foreach ($GLOBALS['TCA'] as $tN => $_) {
if ($GLOBALS['BE_USER']->check('tables_select', $tN) && in_array($tN, $this->allowedTables)) {
$out .='<option value="' . $tN . '"' . ($tN == $cur ? ' selected':'') . '>' .
$GLOBALS["LANG"]->sl($GLOBALS["TCA"][$tN]['ctrl']['title']) .
$GLOBALS['LANG']->sl($GLOBALS['TCA'][$tN]['ctrl']['title']) .
'</option>';
}
}
Expand Down
47 changes: 24 additions & 23 deletions Classes/Module/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Messaging\FlashMessage;
use DirectMailTeam\DirectMail\DirectMailUtility;
use DirectMailTeam\DirectMail\Utility\FlashMessageRenderer;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;

Expand Down Expand Up @@ -115,7 +116,7 @@ public function init()
}
$this->MOD_MENU['dmail_mode'] = BackendUtility::unsetMenuItems($this->params, $this->MOD_MENU['dmail_mode'], 'menu.dmail_mode');

// initialize the page selector
// initialize the page selector
$this->sys_page = GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\Page\\PageRepository');
$this->sys_page->init(true);

Expand All @@ -137,9 +138,9 @@ public function init()
}
$GLOBALS['TYPO3_DB']->sql_free_result($res);
}
// load contextual help
// load contextual help
$this->cshTable = '_MOD_' . $this->MCONF['name'];
if ($GLOBALS["BE_USER"]->uc['edit_showFieldHelp']) {
if ($GLOBALS['BE_USER']->uc['edit_showFieldHelp']) {
$this->getLanguageService()->loadSingleTableDescription($this->cshTable);
}

Expand Down Expand Up @@ -181,11 +182,11 @@ public function main()
$this->pageinfo = BackendUtility::readPageAccess($this->id, $this->perms_clause);
$access = is_array($this->pageinfo) ? 1 : 0;

if (($this->id && $access) || ($GLOBALS["BE_USER"]->user['admin'] && !$this->id)) {
if (($this->id && $access) || ($GLOBALS['BE_USER']->user['admin'] && !$this->id)) {

// Draw the header.
$this->doc = GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\DocumentTemplate');
$this->doc->backPath = $GLOBALS["BACK_PATH"];
$this->doc->backPath = $GLOBALS['BACK_PATH'];
$this->doc->setModuleTemplate('EXT:direct_mail/Resources/Private/Templates/Module.html');
$this->doc->form = '<form action="" method="post" name="' . $this->formname . '" enctype="multipart/form-data">';

Expand Down Expand Up @@ -273,10 +274,10 @@ function toggleDisplay(toggleId, e, countBox) { //
'PAGEPATH' => $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.php:labels.path') . ': ' .
GeneralUtility::fixed_lgd_cs($this->pageinfo['_thePath'], 50),
'SHORTCUT' => '',
'CSH' => BackendUtility::cshItem($this->cshTable, '', $GLOBALS["BACK_PATH"])
'CSH' => BackendUtility::cshItem($this->cshTable, '', $GLOBALS['BACK_PATH'])
);
// shortcut icon
if ($GLOBALS["BE_USER"]->mayMakeShortcut()) {
// shortcut icon
if ($GLOBALS['BE_USER']->mayMakeShortcut()) {
$docHeaderButtons['SHORTCUT'] = $this->doc->makeShortcutIcon('id', implode(',', array_keys($this->MOD_MENU)), $this->MCONF['name']);
}

Expand All @@ -285,30 +286,30 @@ function toggleDisplay(toggleId, e, countBox) { //
$pidrec=BackendUtility::getRecord('pages', intval($this->pageinfo['pid']));
$module=$pidrec['module'];
}

if ($module == 'dmail') {
// Direct mail module
if (($this->pageinfo['doktype'] == 254) && ($this->pageinfo['module'] == 'dmail')) {
$markers['CONTENT'] = '<h1>' . $this->getLanguageService()->getLL('header_conf') . '</h1>' .
$this->moduleContent();
} elseif ($this->id != 0) {
/**
* Generate flash message
* @var \TYPO3\CMS\Core\Messaging\FlashMessage
*/
$flashMessage = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
/* @var $flashMessage FlashMessage */
$flashMessage = GeneralUtility::makeInstance(
'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
$this->getLanguageService()->getLL('dmail_noRegular'),
$this->getLanguageService()->getLL('dmail_newsletters'),
FlashMessage::WARNING
);
$markers['FLASHMESSAGES'] = $flashMessage->render();
$markers['FLASHMESSAGES'] = GeneralUtility::makeInstance(FlashMessageRenderer::class)->render($flashMessage);
}
} else {
$flashMessage = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
$flashMessage = GeneralUtility::makeInstance(
'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
$this->getLanguageService()->getLL('select_folder'),
$this->getLanguageService()->getLL('header_conf'),
FlashMessage::WARNING
);
$markers['FLASHMESSAGES'] = $flashMessage->render();
$markers['FLASHMESSAGES'] = GeneralUtility::makeInstance(FlashMessageRenderer::class)->render($flashMessage);
}


Expand All @@ -318,7 +319,7 @@ function toggleDisplay(toggleId, e, countBox) { //
// If no access or if ID == zero

$this->doc = GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\DocumentTemplate');
$this->doc->backPath = $GLOBALS["BACK_PATH"];
$this->doc->backPath = $GLOBALS['BACK_PATH'];

$this->content .= $this->doc->startPage($this->getLanguageService()->getLL('title'));
$this->content .= $this->doc->header($this->getLanguageService()->getLL('title'));
Expand Down Expand Up @@ -393,7 +394,7 @@ protected function moduleContent()
'testmail' => array('short', $this->getLanguageService()->getLL('configure_testmail'), $this->getLanguageService()->getLL('configure_testmail_description'))
);

// Set default values
// Set default values
if (!isset($this->implodedParams['plainParams'])) {
$this->implodedParams['plainParams'] = '&type=99';
}
Expand All @@ -404,7 +405,7 @@ protected function moduleContent()
$this->implodedParams['direct_mail_charset'] = 'iso-8859-1';
}

// Set domain selection list
// Set domain selection list
$rootline = $this->sys_page->getRootLine($this->id);
$rootlineId = array();
foreach ($rootline as $rArr) {
Expand All @@ -420,7 +421,7 @@ protected function moduleContent()
while (($row_domain = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res_domain))) {
$configArray[3]['use_domain']['3'][$row_domain['uid']] = $row_domain['domainName'];
}
$GLOBALS["TYPO3_DB"]->sql_free_result($res_domain);
$GLOBALS['TYPO3_DB']->sql_free_result($res_domain);

$this->configArray_length = count($configArray);
$form ='';
Expand Down Expand Up @@ -456,7 +457,7 @@ public function makeConfigForm(array $configArray, array$params, $dataPrefix)
if (is_array($config)) {
$lines[$fname] = '<strong>' . htmlspecialchars($config[1]) . '</strong>';
$lines[$fname] .= $wrapHelp1 . $config[2] . $wrapHelp2 . '<br />';
$formEl = "";
$formEl = '';
switch ($config[0]) {
case 'string':
// do as short
Expand Down Expand Up @@ -517,8 +518,8 @@ public function makeConfigForm(array $configArray, array$params, $dataPrefix)
* @return void
*/
public function updatePageTS()
{
if ($GLOBALS["BE_USER"]->doesUserHaveAccess(BackendUtility::getRecord('pages', $this->id), 2)) {
{
if ($GLOBALS['BE_USER']->doesUserHaveAccess(BackendUtility::getRecord('pages', $this->id), 2)) {
$pageTypoScript= GeneralUtility::_GP('pageTS');
if (is_array($pageTypoScript)) {
DirectMailUtility::updatePagesTSconfig($this->id, $pageTypoScript, $this->TSconfPrefix);
Expand Down
Loading

0 comments on commit c45f27c

Please sign in to comment.