diff --git a/Classes/Container.php b/Classes/Container.php
index 9e587d006..c9e133329 100644
--- a/Classes/Container.php
+++ b/Classes/Container.php
@@ -28,7 +28,6 @@
*/
class Container
{
-
public $boundaryStartWrap = '';
public $boundaryEnd = '';
@@ -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
diff --git a/Classes/DirectMailUtility.php b/Classes/DirectMailUtility.php
index 07d50e584..2d3b6351b 100644
--- a/Classes/DirectMailUtility.php
+++ b/Classes/DirectMailUtility.php
@@ -14,12 +14,13 @@
* The TYPO3 project - inspiring people to share!
*/
+use DirectMailTeam\DirectMail\Utility\FlashMessageRenderer;
use TYPO3\CMS\Backend\Utility\BackendUtility;
+use TYPO3\CMS\Backend\Utility\IconUtility;
use TYPO3\CMS\Core\Imaging\Icon;
use TYPO3\CMS\Core\Imaging\IconFactory;
-use TYPO3\CMS\Core\Utility\GeneralUtility;
-use TYPO3\CMS\Backend\Utility\IconUtility;
use TYPO3\CMS\Core\Messaging\FlashMessage;
+use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Utility\MathUtility;
/**
@@ -111,7 +112,7 @@ public static function cleanPlainList(array $plainlist)
*
* );
*/
- $plainlist = array_map("unserialize", array_unique(array_map("serialize", $plainlist)));
+ $plainlist = array_map('unserialize', array_unique(array_map('serialize', $plainlist)));
return $plainlist;
}
@@ -203,16 +204,16 @@ public static function getIdList($table, $pidList, $groupUid, $cat)
// Direct Mail needs an email address!
$emailIsNotNull = ' AND ' . $switchTable . '.email !=' . $GLOBALS['TYPO3_DB']->fullQuoteStr('', $switchTable);
- // fe user group uid should be in list of fe users list of user groups
-// $field = $switchTable.'.usergroup';
-// $command = $table.'.uid';
+ // fe user group uid should be in list of fe users list of user groups
+ // $field = $switchTable.'.usergroup';
+ // $command = $table.'.uid';
// This approach, using standard SQL, does not work,
// even when fe_users.usergroup is defined as varchar(255) instead of tinyblob
// $usergroupInList = ' AND ('.$field.' LIKE \'%,\'||'.$command.'||\',%\' OR '.$field.' LIKE '.$command.'||\',%\' OR '.$field.' LIKE \'%,\'||'.$command.' OR '.$field.'='.$command.')';
// The following will work but INSTR and CONCAT are available only in mySQL
$usergroupInList = ' AND INSTR( CONCAT(\',\',fe_users.usergroup,\',\'),CONCAT(\',\',fe_groups.uid ,\',\') )';
- $mmTable = $GLOBALS["TCA"][$switchTable]['columns']['module_sys_dmail_category']['config']['MM'];
+ $mmTable = $GLOBALS['TCA'][$switchTable]['columns']['module_sys_dmail_category']['config']['MM'];
$cat = intval($cat);
if ($cat < 1) {
if ($table == 'fe_groups') {
@@ -227,7 +228,7 @@ public static function getIdList($table, $pidList, $groupUid, $cat)
BackendUtility::BEenableFields($table) .
BackendUtility::deleteClause($table) .
$addWhere,
- $switchTable . '.email'
+ $switchTable . '.uid, ' . $switchTable . '.email'
);
} else {
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
@@ -238,7 +239,7 @@ public static function getIdList($table, $pidList, $groupUid, $cat)
BackendUtility::BEenableFields($switchTable) .
BackendUtility::deleteClause($switchTable) .
$addWhere,
- $switchTable . '.email'
+ $switchTable . '.uid, ' . $switchTable . '.email'
);
}
} else {
@@ -258,7 +259,7 @@ public static function getIdList($table, $pidList, $groupUid, $cat)
BackendUtility::deleteClause($table) .
BackendUtility::deleteClause('sys_dmail_group') .
$addWhere,
- $switchTable . '.email'
+ $switchTable . '.uid, ' . $switchTable . '.email'
);
} else {
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
@@ -273,7 +274,7 @@ public static function getIdList($table, $pidList, $groupUid, $cat)
BackendUtility::deleteClause($switchTable) .
BackendUtility::deleteClause('sys_dmail_group') .
$addWhere,
- $switchTable . '.email'
+ $switchTable . '.uid, ' . $switchTable . '.email'
);
}
}
@@ -281,7 +282,7 @@ public static function getIdList($table, $pidList, $groupUid, $cat)
while (($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res))) {
$outArr[] = $row['uid'];
}
- $GLOBALS["TYPO3_DB"]->sql_free_result($res);
+ $GLOBALS['TYPO3_DB']->sql_free_result($res);
return $outArr;
}
@@ -311,8 +312,8 @@ public static function getStaticIdList($table, $uid)
// $usergroupInList = ' AND ('.$field.' LIKE \'%,\'||'.$command.'||\',%\' OR '.$field.' LIKE '.$command.'||\',%\' OR '.$field.' LIKE \'%,\'||'.$command.' OR '.$field.'='.$command.')';
// for fe_users and fe_group, only activated modulde_sys_dmail_newsletter
- if ($switchTable == "fe_users") {
- $addWhere = ' AND ' . $switchTable . ".module_sys_dmail_newsletter = 1";
+ if ($switchTable == 'fe_users') {
+ $addWhere = ' AND ' . $switchTable . '.module_sys_dmail_newsletter = 1';
}
$usergroupInList = ' AND INSTR( CONCAT(\',\',fe_users.usergroup,\',\'),CONCAT(\',\',fe_groups.uid ,\',\') )';
@@ -332,7 +333,7 @@ public static function getStaticIdList($table, $uid)
BackendUtility::deleteClause($table) .
BackendUtility::deleteClause('sys_dmail_group') .
$addWhere,
- $switchTable . '.email'
+ $switchTable . '.uid, ' . $switchTable . '.email'
);
} else {
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
@@ -346,7 +347,7 @@ public static function getStaticIdList($table, $uid)
BackendUtility::deleteClause($switchTable) .
BackendUtility::deleteClause('sys_dmail_group') .
$addWhere,
- $switchTable . '.email'
+ $switchTable . '.uid, ' . $switchTable . '.email'
);
}
@@ -366,7 +367,7 @@ public static function getStaticIdList($table, $uid)
' AND sys_dmail_group_mm.tablenames=' . $GLOBALS['TYPO3_DB']->fullQuoteStr($table, $table) .
BackendUtility::BEenableFields($table) .
BackendUtility::deleteClause($table)
- );
+ );
list($groupId) = $GLOBALS['TYPO3_DB']->sql_fetch_row($res);
$GLOBALS['TYPO3_DB']->sql_free_result($res);
@@ -390,8 +391,8 @@ public static function getStaticIdList($table, $uid)
BackendUtility::deleteClause($switchTable) .
BackendUtility::BEenableFields($table) .
BackendUtility::deleteClause($table) .
- $addWhere,
- $switchTable . '.email'
+ $addWhere,
+ $switchTable . '.uid, ' . $switchTable . '.email'
);
while (($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res))) {
@@ -446,7 +447,7 @@ public static function getSpecialQueryIdList(MailSelect &$queryGenerator, $table
*/
public static function getMailGroups($list, array $parsedGroups, $perms_clause)
{
- $groupIdList = GeneralUtility::intExplode(",", $list);
+ $groupIdList = GeneralUtility::intExplode(',', $list);
$groups = array();
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
@@ -498,8 +499,8 @@ public static function rearrangeCsvValues(array $lines, $fieldList)
// overrides any existing value in the field
$first = $lines[0];
$fieldListArr = explode(',', $fieldList);
- if ($GLOBALS["TYPO3_CONF_VARS"]['EXTCONF']['direct_mail']['addRecipFields']) {
- $fieldListArr = array_merge($fieldListArr, explode(',', $GLOBALS["TYPO3_CONF_VARS"]['EXTCONF']['direct_mail']['addRecipFields']));
+ if ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['direct_mail']['addRecipFields']) {
+ $fieldListArr = array_merge($fieldListArr, explode(',', $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['direct_mail']['addRecipFields']));
}
$fieldName = 1;
$fieldOrder = array();
@@ -514,11 +515,11 @@ public static function rearrangeCsvValues(array $lines, $fieldList)
break;
}
}
- // If not field list, then:
+ // If not field list, then:
if (!$fieldName) {
$fieldOrder = array(array('name'),array('email'));
}
- // Re-map values
+ // Re-map values
reset($lines);
if ($fieldName) {
// Advance pointer if the first line was field names
@@ -601,7 +602,7 @@ public static function makeCategories($table, array $row, $sysLanguageUid)
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
'*',
'sys_dmail_category',
- 'sys_dmail_category.pid IN (' . str_replace(",", "','", $GLOBALS['TYPO3_DB']->fullQuoteStr($pidList, 'sys_dmail_category')) . ')' .
+ 'sys_dmail_category.pid IN (' . str_replace(',', "','", $GLOBALS['TYPO3_DB']->fullQuoteStr($pidList, 'sys_dmail_category')) . ')' .
' AND l18n_parent=0' .
BackendUtility::BEenableFields('sys_dmail_category') .
BackendUtility::deleteClause('sys_dmail_category')
@@ -611,7 +612,7 @@ public static function makeCategories($table, array $row, $sysLanguageUid)
$categories[$localizedRowCat['uid']] = htmlspecialchars($localizedRowCat['category']);
}
}
- $GLOBALS["TYPO3_DB"]->sql_free_result($res);
+ $GLOBALS['TYPO3_DB']->sql_free_result($res);
}
}
return $categories;
@@ -632,20 +633,20 @@ public static function makeCategories($table, array $row, $sysLanguageUid)
public static function getRecordOverlay($table, array $row, $sys_language_content, $OLmode = '')
{
if ($row['uid']>0 && $row['pid']>0) {
- if ($GLOBALS["TCA"][$table] && $GLOBALS["TCA"][$table]['ctrl']['languageField'] && $GLOBALS["TCA"][$table]['ctrl']['transOrigPointerField']) {
- if (!$GLOBALS["TCA"][$table]['ctrl']['transOrigPointerTable']) {
+ if ($GLOBALS['TCA'][$table] && $GLOBALS['TCA'][$table]['ctrl']['languageField'] && $GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField']) {
+ if (!$GLOBALS['TCA'][$table]['ctrl']['transOrigPointerTable']) {
// Will try to overlay a record only
// if the sys_language_content value is larger that zero.
if ($sys_language_content > 0) {
// Must be default language or [All], otherwise no overlaying:
- if ($row[$GLOBALS["TCA"][$table]['ctrl']['languageField']]<=0) {
+ if ($row[$GLOBALS['TCA'][$table]['ctrl']['languageField']]<=0) {
// Select overlay record:
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
'*',
$table,
'pid=' . intval($row['pid']) .
- ' AND ' . $GLOBALS["TCA"][$table]['ctrl']['languageField'] . '=' . intval($sys_language_content) .
- ' AND ' . $GLOBALS["TCA"][$table]['ctrl']['transOrigPointerField'] . '=' . intval($row['uid']) .
+ ' AND ' . $GLOBALS['TCA'][$table]['ctrl']['languageField'] . '=' . intval($sys_language_content) .
+ ' AND ' . $GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField'] . '=' . intval($row['uid']) .
BackendUtility::BEenableFields($table) .
BackendUtility::deleteClause($table),
'',
@@ -653,18 +654,18 @@ public static function getRecordOverlay($table, array $row, $sys_language_conten
'1'
);
$olrow = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res);
- $GLOBALS["TYPO3_DB"]->sql_free_result($res);
+ $GLOBALS['TYPO3_DB']->sql_free_result($res);
- // Merge record content by traversing all fields:
+ // Merge record content by traversing all fields:
if (is_array($olrow)) {
foreach ($row as $fN => $fV) {
if ($fN!='uid' && $fN!='pid' && isset($olrow[$fN])) {
- if ($GLOBALS["TCA"][$table]['l10n_mode'][$fN]!='exclude' && ($GLOBALS["TCA"][$table]['l10n_mode'][$fN]!='mergeIfNotBlank' || strcmp(trim($olrow[$fN]), ''))) {
+ if ($GLOBALS['TCA'][$table]['l10n_mode'][$fN]!='exclude' && ($GLOBALS['TCA'][$table]['l10n_mode'][$fN]!='mergeIfNotBlank' || strcmp(trim($olrow[$fN]), ''))) {
$row[$fN] = $olrow[$fN];
}
}
}
- } elseif ($OLmode === 'hideNonTranslated' && $row[$GLOBALS["TCA"][$table]['ctrl']['languageField']] == 0) {
+ } elseif ($OLmode === 'hideNonTranslated' && $row[$GLOBALS['TCA'][$table]['ctrl']['languageField']] == 0) {
// Unset, if non-translated records should be hidden.
// ONLY done if the source record really is default language and not [All] in which case it is allowed.
unset($row);
@@ -672,13 +673,13 @@ public static function getRecordOverlay($table, array $row, $sys_language_conten
// Otherwise, check if sys_language_content is different from the value of the record
// that means a japanese site might try to display french content.
- } elseif ($sys_language_content!=$row[$GLOBALS["TCA"][$table]['ctrl']['languageField']]) {
+ } elseif ($sys_language_content!=$row[$GLOBALS['TCA'][$table]['ctrl']['languageField']]) {
unset($row);
}
} else {
// When default language is displayed,
// we never want to return a record carrying another language!:
- if ($row[$GLOBALS["TCA"][$table]['ctrl']['languageField']]>0) {
+ if ($row[$GLOBALS['TCA'][$table]['ctrl']['languageField']]>0) {
unset($row);
}
}
@@ -713,11 +714,11 @@ public static function formatTable(array $tableLines, array $cellParams, $header
$rowA = array();
for ($k=0; $k<$cols; $k++) {
$v = $r[$k];
- $v = strlen($v) ? ($cellcmd[$k]?$v:htmlspecialchars($v)) : " ";
+ $v = strlen($v) ? ($cellcmd[$k]?$v:htmlspecialchars($v)) : ' ';
if ($first) {
$rowA[] = '
' . $v . ' | ';
} else {
- $rowA[] = '' . $v . ' | ';
+ $rowA[] = '' . $v . ' | ';
}
}
$lines[] = '';
@@ -818,6 +819,10 @@ public static function getRecordList(array $listArr, $table, $pageId, $editLinkF
// init iconFactory
$iconFactory = GeneralUtility::makeInstance(IconFactory::class);
+ $isAllowedDisplayTable = $GLOBALS['BE_USER']->check('tables_select', $table);
+ $isAllowedEditTable = $GLOBALS['BE_USER']->check('tables_modify', $table);
+ $notAllowedPlaceholder = $GLOBALS['LANG']->getLL('mailgroup_table_disallowed_placeholder');
+
if (is_array($listArr)) {
$count = count($listArr);
$returnUrl = GeneralUtility::getIndpEnv('REQUEST_URI');
@@ -826,7 +831,7 @@ public static function getRecordList(array $listArr, $table, $pageId, $editLinkF
$editLink = '';
if ($row['uid']) {
$tableIcon = '' . $iconFactory->getIconForRecord($table, array()) . ' | ';
- if ($editLinkFlag) {
+ if ($editLinkFlag && $isAllowedEditTable) {
$urlParameters = [
'edit' => [
$table => [
@@ -835,22 +840,28 @@ public static function getRecordList(array $listArr, $table, $pageId, $editLinkF
],
'returnUrl' => $returnUrl
];
- $editLink = '' .
+ $editLink = ' | ' .
$iconFactory->getIcon('actions-open', Icon::SIZE_SMALL) .
' | ';
}
}
+ if ($isAllowedDisplayTable) {
+ $exampleData = ' ' . htmlspecialchars($row['email']) . ' |
+ ' . htmlspecialchars($row['name']) . ' | ';
+ } else {
+ $exampleData = '' . $notAllowedPlaceholder . ' | ';
+ }
+
$lines[]='
' . $tableIcon . '
' . $editLink . '
- | ' . htmlspecialchars($row['email']) . ' |
- ' . htmlspecialchars($row['name']) . ' |
+ ' . $exampleData . '
';
}
}
if (count($lines)) {
- $out = $GLOBALS["LANG"]->getLL('dmail_number_records') . ' ' . $count . '
';
+ $out = $GLOBALS['LANG']->getLL('dmail_number_records') . ' ' . $count . '
';
$out .= '' . implode(LF, $lines) . '
';
}
return $out;
@@ -863,15 +874,15 @@ public static function getRecordList(array $listArr, $table, $pageId, $editLinkF
*
* @return array The all id of fe_groups
*/
- public function getFEgroupSubgroups($groupId)
+ public static function getFEgroupSubgroups($groupId)
{
// get all subgroups of this fe_group
// fe_groups having this id in their subgroup field
- $res = $GLOBALS["TYPO3_DB"]->exec_SELECT_mm_query(
- "DISTINCT fe_groups.uid",
- "fe_groups",
- "sys_dmail_group_mm",
- "sys_dmail_group",
+ $res = $GLOBALS['TYPO3_DB']->exec_SELECT_mm_query(
+ 'DISTINCT fe_groups.uid',
+ 'fe_groups',
+ 'sys_dmail_group_mm',
+ 'sys_dmail_group',
' AND INSTR( CONCAT(\',\',fe_groups.subgroup,\',\'),\',' . intval($groupId) . ',\' )' .
BackendUtility::BEenableFields('fe_groups') .
BackendUtility::deleteClause('fe_groups')
@@ -967,7 +978,9 @@ public static function createDirectMailRecordFromPage($pageUid, array $parameter
'authcode_fieldList' => $parameters['authcode_fieldList'],
'sendOptions' => $GLOBALS['TCA']['sys_dmail']['columns']['sendOptions']['config']['default'],
'long_link_rdct_url' => self::getUrlBase($parameters['use_domain']),
- 'sys_language_uid' => (int)$sysLanguageUid
+ 'sys_language_uid' => (int)$sysLanguageUid,
+ 'attachment' => '',
+ 'mailContent' => ''
);
if ($newRecord['sys_language_uid'] > 0) {
@@ -977,7 +990,7 @@ public static function createDirectMailRecordFromPage($pageUid, array $parameter
}
- // If params set, set default values:
+ // If params set, set default values:
$paramsToOverride = array('sendOptions', 'includeMedia', 'flowedFormat', 'HTMLParams', 'plainParams');
foreach ($paramsToOverride as $param) {
if (isset($parameters[$param])) {
@@ -1009,7 +1022,7 @@ public static function createDirectMailRecordFromPage($pageUid, array $parameter
$newRecord['charset'] = self::getCharacterSetOfPage($pageRecord['uid']);
}
- // save to database
+ // save to database
if ($newRecord['page'] && $newRecord['sendOptions']) {
$tcemainData = array(
'sys_dmail' => array(
@@ -1043,7 +1056,7 @@ public static function getLanguageParam($sysLanguageUid, array $params)
// fallback: L == sys_language_uid
} else {
- $param = "&L=" . $sysLanguageUid;
+ $param = '&L=' . $sysLanguageUid;
}
return $param;
@@ -1085,7 +1098,7 @@ public static function createDirectMailRecordFromExternalURL($subject, $external
);
- // If params set, set default values:
+ // If params set, set default values:
$paramsToOverride = array('sendOptions', 'includeMedia', 'flowedFormat', 'HTMLParams', 'plainParams');
foreach ($paramsToOverride as $param) {
if (isset($parameters[$param])) {
@@ -1097,7 +1110,7 @@ public static function createDirectMailRecordFromExternalURL($subject, $external
}
$urlParts = @parse_url($externalUrlPlain);
- // No plain text url
+ // No plain text url
if (!$externalUrlPlain || $urlParts === false || !$urlParts['host']) {
$newRecord['plainParams'] = '';
$newRecord['sendOptions']&=254;
@@ -1105,7 +1118,7 @@ public static function createDirectMailRecordFromExternalURL($subject, $external
$newRecord['plainParams'] = $externalUrlPlain;
}
- // No html url
+ // No html url
$urlParts = @parse_url($externalUrlHtml);
if (!$externalUrlHtml || $urlParts === false || !$urlParts['host']) {
$newRecord['sendOptions']&=253;
@@ -1113,7 +1126,7 @@ public static function createDirectMailRecordFromExternalURL($subject, $external
$newRecord['HTMLParams'] = $externalUrlHtml;
}
- // save to database
+ // save to database
if ($newRecord['pid'] && $newRecord['sendOptions']) {
$tcemainData = array(
'sys_dmail' => array(
@@ -1139,10 +1152,11 @@ public static function createDirectMailRecordFromExternalURL($subject, $external
*
* @param array $row Directmail DB record
* @param array $params Any default parameters (usually the ones from pageTSconfig)
+ * @param bool $returnArray Return error or warning message as array instead of string
*
* @return string Error or warning message during fetching the content
*/
- public static function fetchUrlContentsForDirectMailRecord(array $row, array $params)
+ public static function fetchUrlContentsForDirectMailRecord(array $row, array $params, $returnArray = false)
{
$theOutput = '';
$errorMsg = array();
@@ -1152,10 +1166,10 @@ public static function fetchUrlContentsForDirectMailRecord(array $row, array $pa
$htmlUrl = $urls['htmlUrl'];
$urlBase = $urls['baseUrl'];
- // Make sure long_link_rdct_url is consistent with use_domain.
+ // Make sure long_link_rdct_url is consistent with use_domain.
$row['long_link_rdct_url'] = $urlBase;
- // Compile the mail
+ // Compile the mail
/* @var $htmlmail Dmailer */
$htmlmail = GeneralUtility::makeInstance('DirectMailTeam\\DirectMail\\Dmailer');
if ($params['enable_jump_url']) {
@@ -1179,20 +1193,20 @@ public static function fetchUrlContentsForDirectMailRecord(array $row, array $pa
$htmlmail->includeMedia = $row['includeMedia'];
if ($plainTextUrl) {
- $mailContent = GeneralUtility::getURL(self::addUserPass($plainTextUrl, $params));
+ $mailContent = GeneralUtility::getURL(self::addUserPass($plainTextUrl, $params), 0, array('User-Agent: Direct Mail'));
$htmlmail->addPlain($mailContent);
if (!$mailContent || !$htmlmail->theParts['plain']['content']) {
- $errorMsg[] = $GLOBALS["LANG"]->getLL('dmail_no_plain_content');
+ $errorMsg[] = $GLOBALS['LANG']->getLL('dmail_no_plain_content');
} elseif (!strstr($htmlmail->theParts['plain']['content'], '', $bContent, 2);
- // Remove useless HTML comments
+ // Remove useless HTML comments
if (substr($this->dmailer['boundaryParts_html'][$bKey][0], 1) == 'END') {
$this->dmailer['boundaryParts_html'][$bKey][1] = $this->removeHTMLComments($this->dmailer['boundaryParts_html'][$bKey][1]);
}
- // Now, analyzing which media files are used in this part of the mail:
+ // Now, analyzing which media files are used in this part of the mail:
$mediaParts = explode('cid:part', $this->dmailer['boundaryParts_html'][$bKey][1]);
reset($mediaParts);
next($mediaParts);
@@ -227,14 +232,14 @@ public function replaceMailMarkers($content, array $recipRow, array $markers)
$markers['###USER_' . $substField . '###'] = $subst;
}
- // uppercase fields with uppercased values
+ // uppercase fields with uppercased values
$uppercaseFieldsArray = array('name', 'firstname');
foreach ($uppercaseFieldsArray as $substField) {
$subst = $this->getLanguageService()->csConvObj->conv($recipRow[$substField], $this->getLanguageService()->charSet, $this->charset);
$markers['###USER_' . strtoupper($substField) . '###'] = strtoupper($subst);
}
- // Hook allows to manipulate the markers to add salutation etc.
+ // Hook allows to manipulate the markers to add salutation etc.
if (isset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/direct_mail']['res/scripts/class.dmailer.php']['mailMarkersHook'])) {
$mailMarkersHook =& $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/direct_mail']['res/scripts/class.dmailer.php']['mailMarkersHook'];
if (is_array($mailMarkersHook)) {
@@ -249,7 +254,9 @@ public function replaceMailMarkers($content, array $recipRow, array $markers)
}
}
- return HtmlParser::substituteMarkerArray($content, $markers);
+ // initialize Marker Support
+ $this->templateService = GeneralUtility::makeInstance(MarkerBasedTemplateService::class);
+ return $this->templateService->substituteMarkerArray($content, $markers);
}
@@ -303,14 +310,14 @@ public function dmailer_sendAdvanced(array $recipRow, $tableNameChar)
}
}
- // Plain
+ // Plain
$this->theParts['plain']['content'] = '';
if ($this->flag_plain) {
$tempContent_Plain = $this->dmailer_getBoundaryParts($this->dmailer['boundaryParts_plain'], $recipRow['sys_dmail_categories_list']);
if ($this->mailHasContent) {
$tempContent_Plain = $this->replaceMailMarkers($tempContent_Plain, $recipRow, $additionalMarkers);
if (trim($this->dmailer['sys_dmail_rec']['use_rdct']) || trim($this->dmailer['sys_dmail_rec']['long_link_mode'])) {
- $tempContent_Plain = GeneralUtility::substUrlsInPlainText($tempContent_Plain, $this->dmailer['sys_dmail_rec']['long_link_mode']?'all':'76', $this->dmailer['sys_dmail_rec']['long_link_rdct_url']);
+ $tempContent_Plain = DirectMailUtility::substUrlsInPlainText($tempContent_Plain, $this->dmailer['sys_dmail_rec']['long_link_mode']?'all':'76', $this->dmailer['sys_dmail_rec']['long_link_rdct_url']);
}
$this->theParts['plain']['content'] = $this->encodeMsg($tempContent_Plain);
$returnCode|=2;
@@ -365,7 +372,7 @@ public function dmailer_sendSimple($addressList)
$this->theParts['plain']['content'] = '';
}
- $recipients = explode(",", $addressList);
+ $recipients = explode(',', $addressList);
foreach ($recipients as $recipient) {
$this->sendTheMail($recipient);
}
@@ -401,7 +408,7 @@ public function dmailer_getBoundaryParts($cArray, $userCategories)
} elseif ($key == 'END') {
$returnVal .= $cP[1];
$this->mediaList .= $cP['mediaList'];
- // There is content and it is not just the header and footer content, or it is the only content because we have no direct mail boundaries.
+ // There is content and it is not just the header and footer content, or it is the only content because we have no direct mail boundaries.
if (($cP[1] && !($bKey == 0 || $bKey == $boundaryMax)) || count($cArray) == 1) {
$this->mailHasContent = true;
}
@@ -472,7 +479,7 @@ public function dmailer_masssend_list(array $query_info, $mid)
foreach ($query_info['id_lists'] as $table => $listArr) {
if (is_array($listArr)) {
$ct = 0;
- // Find tKey
+ // Find tKey
if ($table=='tt_address' || $table=='fe_users') {
$tKey = substr($table, 0, 1);
} elseif ($table=='PLAINLIST') {
@@ -481,7 +488,7 @@ public function dmailer_masssend_list(array $query_info, $mid)
$tKey='u';
}
- // Send mails
+ // Send mails
$sendIds = $this->dmailer_getSentMails($mid, $tKey);
if ($table == 'PLAINLIST') {
$sendIdsArr = explode(',', $sendIds);
@@ -520,7 +527,7 @@ public function dmailer_masssend_list(array $query_info, $mid)
$returnVal = false;
break;
}
- // We are NOT finished!
+ // We are NOT finished!
$this->shipOfMail($mid, $recipRow, $tKey);
$ct++;
$c++;
@@ -603,7 +610,7 @@ public static function convertFields(array $recipRow)
$recipRow['phone'] = $recipRow['telephone'];
}
- // Firstname must be more that 1 character
+ // Firstname must be more that 1 character
$recipRow['firstname'] = trim(strtok(trim($recipRow['name']), ' '));
if (strlen($recipRow['firstname']) < 2 || preg_match('|[^[:alnum:]]$|', $recipRow['firstname'])) {
$recipRow['firstname'] = $recipRow['name'];
@@ -636,11 +643,11 @@ public function dmailer_setBeginEnd($mid, $key)
switch ($key) {
case 'begin':
$subject = $this->getLanguageService()->getLL('dmailer_mid') . ' ' . $mid . ' ' . $this->getLanguageService()->getLL('dmailer_job_begin');
- $message = $this->getLanguageService()->getLL('dmailer_job_begin') . ': ' . date("d-m-y h:i:s");
+ $message = $this->getLanguageService()->getLL('dmailer_job_begin') . ': ' . date('d-m-y h:i:s');
break;
case 'end':
$subject = $this->getLanguageService()->getLL('dmailer_mid') . ' ' . $mid . ' ' . $this->getLanguageService()->getLL('dmailer_job_end');
- $message = $this->getLanguageService()->getLL('dmailer_job_end') . ': ' . date("d-m-y h:i:s");
+ $message = $this->getLanguageService()->getLL('dmailer_job_end') . ': ' . date('d-m-y h:i:s');
break;
default:
// do nothing
@@ -869,7 +876,7 @@ public function start($user_dmailer_sendPerCycle = 50, $user_dmailer_lang = 'en'
$this->linebreak = CRLF;
}
- // Mailer engine parameters
+ // Mailer engine parameters
$this->sendPerCycle = $user_dmailer_sendPerCycle;
$this->user_dmailerLang = $user_dmailer_lang;
if (!$this->nonCron) {
@@ -940,9 +947,9 @@ public function setContent(&$mailer)
// set the attachment from $this->dmailer['sys_dmail_rec']['attachment']
// comma separated files
if (!empty($this->dmailer['sys_dmail_rec']['attachment'])) {
- $files = explode(",", $this->dmailer['sys_dmail_rec']['attachment']);
+ $files = explode(',', $this->dmailer['sys_dmail_rec']['attachment']);
foreach ($files as $file) {
- $mailer->attach(\Swift_Attachment::fromPath(PATH_site . "uploads/tx_directmail/" . $file));
+ $mailer->attach(\Swift_Attachment::fromPath(PATH_site . 'uploads/tx_directmail/' . $file));
}
}
}
@@ -979,7 +986,7 @@ public function sendTheMail($recipient, $recipRow = null)
$header->addTextHeader('Organization', $this->organisation);
}
- // Hook to edit or add the mail headers
+ // Hook to edit or add the mail headers
if (isset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/direct_mail']['res/scripts/class.dmailer.php']['mailHeadersHook'])) {
$mailHeadersHook =& $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/direct_mail']['res/scripts/class.dmailer.php']['mailHeadersHook'];
if (is_array($mailHeadersHook)) {
@@ -1046,11 +1053,11 @@ public function addHTML($file)
return false;
}
if ($this->extractFramesInfo()) {
- return "Document was a frameset. Stopped";
+ return 'Document was a frameset. Stopped';
}
$this->extractHyperLinks();
$this->substHREFsInHTML();
- $this->setHTML($this->encodeMsg($this->theParts["html"]["content"]));
+ $this->setHTML($this->encodeMsg($this->theParts['html']['content']));
return true;
}
@@ -1152,7 +1159,8 @@ public function substHREFsInHTML()
$this->theParts['html']['content'] = str_replace(
$val['subst_str'],
$val['quotes'] . $substVal . $val['quotes'],
- $this->theParts['html']['content']);
+ $this->theParts['html']['content']
+ );
}
}
@@ -1204,7 +1212,7 @@ public function substHTTPurlsInPlainText($content)
return $content;
}
- $textpieces = explode("http://", $content);
+ $textpieces = explode('http://', $content);
$pieces = count($textpieces);
$textstr = $textpieces[0];
for ($i = 1; $i < $pieces; $i++) {
@@ -1216,7 +1224,7 @@ public function substHTTPurlsInPlainText($content)
}
$parts = array();
- $parts[0] = "http://" . substr($textpieces[$i], 0, $len);
+ $parts[0] = 'http://' . substr($textpieces[$i], 0, $len);
$parts[1] = substr($textpieces[$i], $len);
if (strpos($parts[0], '&no_jumpurl=1') !== false) {
@@ -1318,8 +1326,8 @@ public function extractMediaLinks()
$imageData['quotes'] = (substr($codepieces[$i], strpos($codepieces[$i], $imageData['ref']) - 1, 1) == '"') ? '"' : '';
// subst_str is the string to look for, when substituting lateron
$imageData['subst_str'] = $imageData['quotes'] . $imageData['ref'] . $imageData['quotes'];
- if ($imageData['ref'] && !strstr($imageList, "|" . $imageData["subst_str"] . "|")) {
- $imageList .= "|" . $imageData['subst_str'] . "|";
+ if ($imageData['ref'] && !strstr($imageList, '|' . $imageData['subst_str'] . '|')) {
+ $imageList .= '|' . $imageData['subst_str'] . '|';
$imageData['absRef'] = $this->absRef($imageData['ref']);
$imageData['tag'] = $tag;
$imageData['use_jumpurl'] = $attributes['dmailerping'] ? 1 : 0;
@@ -1346,9 +1354,9 @@ public function extractMediaLinks()
$imageData['quotes'] = (substr($codepieces[$i], strpos($codepieces[$i], $imageData['ref']) - 1, 1) == '"') ? '"' : '';
// subst_str is the string to look for, when substituting lateron
$imageData['subst_str'] = $imageData['quotes'] . $imageData['ref'] . $imageData['quotes'];
- if ($imageData['ref'] && !strstr($imageList, "|" . $imageData["subst_str"] . "|")) {
- $imageList .= "|" . $imageData["subst_str"] . "|";
- $imageData['absRef'] = $this->absRef($imageData["ref"]);
+ if ($imageData['ref'] && !strstr($imageList, '|' . $imageData['subst_str'] . '|')) {
+ $imageList .= '|' . $imageData['subst_str'] . '|';
+ $imageData['absRef'] = $this->absRef($imageData['ref']);
$this->theParts['html']['media'][] = $imageData;
}
}
@@ -1374,8 +1382,8 @@ public function extractMediaLinks()
case 'jpeg':
// do like jpg
case 'jpg':
- if ($imageData['ref'] && !strstr($imageList, "|" . $imageData["subst_str"] . "|")) {
- $imageList .= "|" . $imageData['subst_str'] . "|";
+ if ($imageData['ref'] && !strstr($imageList, '|' . $imageData['subst_str'] . '|')) {
+ $imageList .= '|' . $imageData['subst_str'] . '|';
$imageData['absRef'] = $this->absRef($imageData['ref']);
$this->theParts['html']['media'][] = $imageData;
}
@@ -1403,24 +1411,26 @@ public function extractHyperLinks()
$len = strlen($codepieces[0]);
$pieces = count($codepieces);
for ($i = 1; $i < $pieces; $i++) {
- $tag = strtolower(strtok(substr($htmlContent, $len + 1, 10), " "));
+ $tag = strtolower(strtok(substr($htmlContent, $len + 1, 10), ' '));
$len += strlen($tag) + strlen($codepieces[$i]) + 2;
$dummy = preg_match('/[^>]*/', $codepieces[$i], $reg);
// Fetches the attributes for the tag
- $attributes = $this->get_tag_attributes($reg[0]);
+ $attributes = $this->get_tag_attributes($reg[0], false);
$hrefData = array();
$hrefData['ref'] = $attributes['href'] ?: $attributes['action'];
+ $quotes = (substr($hrefData['ref'], 0, 1) === '"') ? '"' : '';
+ $hrefData['ref'] = trim($hrefData['ref'], '"');
if ($hrefData['ref']) {
// Finds out if the value had quotes around it
- $hrefData['quotes'] = (substr($codepieces[$i], strpos($codepieces[$i], $hrefData["ref"]) - 1, 1) == '"') ? '"' : '';
- // subst_str is the string to look for, when substituting lateron
- $hrefData['subst_str'] = $hrefData['quotes'] . $hrefData['ref'] . $hrefData['quotes'];
- if ($hrefData['ref'] && substr(trim($hrefData['ref']), 0, 1) != "#" && !strstr($linkList, "|" . $hrefData['subst_str'] . "|")) {
- $linkList .= "|" . $hrefData['subst_str'] . "|";
+ $hrefData['quotes'] = $quotes;
+ // subst_str is the string to look for when substituting later on
+ $hrefData['subst_str'] = $quotes . $hrefData['ref'] . $quotes;
+ if ($hrefData['ref'] && substr(trim($hrefData['ref']), 0, 1) != '#' && !strstr($linkList, '|' . $hrefData['subst_str'] . '|')) {
+ $linkList .= '|' . $hrefData['subst_str'] . '|';
$hrefData['absRef'] = $this->absRef($hrefData['ref']);
$hrefData['tag'] = $tag;
- $hrefData['no_jumpurl'] = intval($attributes['no_jumpurl']) ? 1 : 0;
+ $hrefData['no_jumpurl'] = intval(trim($attributes['no_jumpurl'], '"')) ? 1 : 0;
$this->theParts['html']['hrefs'][] = $hrefData;
}
}
@@ -1435,8 +1445,8 @@ public function extractHyperLinks()
$hrefData['quotes'] = "'";
// subst_str is the string to look for, when substituting lateron
$hrefData['subst_str'] = $hrefData['quotes'] . $hrefData['ref'] . $hrefData['quotes'];
- if ($hrefData['ref'] && !strstr($linkList, "|" . $hrefData['subst_str'] . "|")) {
- $linkList .= "|" . $hrefData['subst_str'] . "|";
+ if ($hrefData['ref'] && !strstr($linkList, '|' . $hrefData['subst_str'] . '|')) {
+ $linkList .= '|' . $hrefData['subst_str'] . '|';
$hrefData['absRef'] = $this->absRef($hrefData['ref']);
$this->theParts['html']['hrefs'][] = $hrefData;
}
@@ -1509,10 +1519,11 @@ public function tag_regex($tags)
*
* @param string $tag Tag is either like this "" or
* this " OPTION ATTRIB=VALUE>" which means you can omit the tag-name
+ * @param boolean $removeQuotes When TRUE (default) quotes around a value will get removed
*
* @return array array with attributes as keys in lower-case
*/
- public function get_tag_attributes($tag)
+ public function get_tag_attributes($tag, $removeQuotes = true)
{
$attributes = array();
$tag = ltrim(preg_replace('/^<[^ ]*/', '', trim($tag)));
@@ -1525,9 +1536,9 @@ public function get_tag_attributes($tag)
$attrib = $reg[0];
$tag = ltrim(substr($tag, strlen($attrib), $tagLen));
- if (substr($tag, 0, 1) == '=') {
+ if (substr($tag, 0, 1) === '=') {
$tag = ltrim(substr($tag, 1, $tagLen));
- if (substr($tag, 0, 1) == '"') {
+ if (substr($tag, 0, 1) === '"' && $removeQuotes) {
// Quotes around the value
$reg = explode('"', substr($tag, 1, $tagLen), 2);
$tag = ltrim($reg[1]);
@@ -1537,7 +1548,7 @@ public function get_tag_attributes($tag)
preg_match('/^([^[:space:]>]*)(.*)/', $tag, $reg);
$value = trim($reg[1]);
$tag = ltrim($reg[2]);
- if (substr($tag, 0, 1) == '>') {
+ if (substr($tag, 0, 1) === '>') {
$tag = '';
}
}
@@ -1573,7 +1584,7 @@ public function absRef($ref)
} else {
// If the reference is relative, the path is added,
// in order for us to fetch the content
- if (substr($this->theParts['html']['path'], -1) == "/") {
+ if (substr($this->theParts['html']['path'], -1) == '/') {
// if the last char is a /, then prepend the ref
$ref = $this->theParts['html']['path'] . $ref;
} else {
diff --git a/Classes/Hooks/JumpurlController.php b/Classes/Hooks/JumpurlController.php
index e012d3e75..60e68da76 100644
--- a/Classes/Hooks/JumpurlController.php
+++ b/Classes/Hooks/JumpurlController.php
@@ -125,7 +125,6 @@ public function preprocessRequest($parameter, $parentObject)
$_POST['pass'] = $recipRow['password'];
$_POST['pid'] = $recipRow['pid'];
$_POST['logintype'] = 'login';
- $GLOBALS['TSFE']->initFEuser();
}
} else {
throw new \Exception('authCode: Calculated authCode did not match the submitted authCode.', 1376899631);
@@ -144,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');
diff --git a/Classes/Hooks/TtnewsPlaintextHook.php b/Classes/Hooks/TtnewsPlaintextHook.php
index 55efcb517..d79c300e8 100644
--- a/Classes/Hooks/TtnewsPlaintextHook.php
+++ b/Classes/Hooks/TtnewsPlaintextHook.php
@@ -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);
@@ -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.']);
@@ -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);
@@ -223,6 +223,6 @@ public function renderAuthor($row, $type=0)
return implode(LF, $lines);
}
}
- return "";
+ return '';
}
}
diff --git a/Classes/Hooks/TypoScriptFrontendController.php b/Classes/Hooks/TypoScriptFrontendController.php
index 97f1964c7..563fe2318 100644
--- a/Classes/Hooks/TypoScriptFrontendController.php
+++ b/Classes/Hooks/TypoScriptFrontendController.php
@@ -42,7 +42,7 @@ public function simulateUsergroup($parameters, \TYPO3\CMS\Frontend\Controller\Ty
$accessToken = GeneralUtility::_GET('access_token');
if ($directMailFeGroup > 0 && DirectMailUtility::validateAndRemoveAccessToken($accessToken)) {
if ($typoScriptFrontendController->fe_user->user) {
- $typoScriptFrontendController->fe_user->user[$this->$typoScriptFrontendController->usergroup_column] = $directMailFeGroup;
+ $typoScriptFrontendController->fe_user->user[$typoScriptFrontendController->usergroup_column] = $directMailFeGroup;
} else {
$typoScriptFrontendController->fe_user->user = array(
$typoScriptFrontendController->fe_user->usergroup_column => $directMailFeGroup
diff --git a/Classes/Importer.php b/Classes/Importer.php
index a4f3ecd2e..58d6fc09c 100644
--- a/Classes/Importer.php
+++ b/Classes/Importer.php
@@ -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
@@ -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();
@@ -156,7 +157,7 @@ public function cmd_displayImport()
}
}
- $out = "";
+ $out = '';
switch ($stepCurrent) {
case 'conf':
// get list of sysfolder
@@ -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();
@@ -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();
@@ -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;
@@ -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'];
@@ -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)) : " ";
+ $v = strlen($v) ? ($cellcmd[$k]?$v:htmlspecialchars($v)) : ' ';
if ($first) {
$v = '' . $v . '';
}
@@ -967,7 +968,9 @@ public function formatTable(array $tableLines, array $cellParams, $header, array
*/
public function userTempFolder()
{
- return $tempFolder = 'fileadmin/_temp_/';
+ /** @var \TYPO3\CMS\Core\Resource\Folder $folder */
+ $folder = $GLOBALS['BE_USER']->getDefaultUploadTemporaryFolder();
+ return $folder->getPublicUrl();
}
/**
@@ -977,7 +980,7 @@ public function userTempFolder()
*/
public function writeTempFile()
{
- $newfile = "";
+ $newfile = '';
$userPermissions = $GLOBALS['BE_USER']->getFilePermissions();
unset($this->fileProcessor);
@@ -992,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;
@@ -1061,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;
@@ -1073,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;
diff --git a/Classes/MailSelect.php b/Classes/MailSelect.php
index b41aa50bf..51fe4e220 100644
--- a/Classes/MailSelect.php
+++ b/Classes/MailSelect.php
@@ -27,7 +27,6 @@
*/
class MailSelect extends QueryGenerator
{
-
public $allowedTables = array('tt_address','fe_users');
/**
@@ -43,11 +42,11 @@ public function mkTableSelect($name, $cur)
{
$out = '