Skip to content

Commit

Permalink
Merge pull request #39 from franzholz/develop
Browse files Browse the repository at this point in the history
fix language and search issue
  • Loading branch information
franzholz authored Apr 4, 2024
2 parents 7933fc3 + 83a21c6 commit d3a8676
Show file tree
Hide file tree
Showing 6 changed files with 70 additions and 51 deletions.
18 changes: 13 additions & 5 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
TODO:
Replace $GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$extensionKey] by
https://docs.typo3.org/m/typo3/reference-coreapi/11.5/en-us/ExtensionArchitecture/FileStructure/ExtConfTemplate.html#accessing-saved-options


2024-04-04 Franz Holzinger <[email protected]>
* use checkMXRecord for each e-mail address before sending a notification e-mail
* fix bug to show the errors formerly shown in a flash error page message in the front end

2023-12-01 Franz Holzinger <[email protected]>
* add Documentation fixes
Expand Down Expand Up @@ -44,7 +52,7 @@

2020-07-31 Franz Holzinger <[email protected]>
* add the field tstamp to the TCA
* add the page browser header to the ###TEMPLATE_FORUM### subpart of the template file board_template2.html
* add the page browser header to the ###TEMPLATE_FORUM### subpart of the template file board_template2.html

2020-07-27 Franz Holzinger <[email protected]>
* add new field city
Expand All @@ -65,7 +73,7 @@
2019-12-18 Franz Holzinger <[email protected]>
* fix issue #5: tt_board 1.10.15 works under TYPO3 9.5
* compatibility for TYPO3 9 breaking 82803: $TYPO3_CONF_VARS['FE']['content_doktypes'] has been removed in TYPO3 9

2019-11-02 Franz Holzinger <[email protected]>
* adapt composer.json to current needs
* add alias files tt_board_list for JambageCom\TtBoard\Controller\ListPluginController and tt_board_tree for JambageCom\TtBoard\Controller\TreePluginController
Expand Down Expand Up @@ -131,7 +139,7 @@
* readd the API to use a commenting system inside of external extensions. Only the method getDefaultConfig is needed.

2018-11-25 Franz Holzinger <[email protected]>
* new: Replace the labels from the newReply and newThread processScript setup by language labels:
* new: Replace the labels from the newReply and newThread processScript setup by language labels:
newReply.didWhat, newReply.subjectPrefix, newReply.followThisLink, newThread.didWhat, newThread.subjectPrefix
* Add a new label for each text entry in the file template/board_notify.txt
* fix in composer.json: require shall use the namespace typo3-ter instead of jambagecom
Expand Down Expand Up @@ -165,7 +173,7 @@
* bugfix for TYPO3 9.x: replace deprecated method ContentObjectRenderer::substituteMarkerArrayCached by TYPO3\CMS\Core\Service\MarkerBasedTemplateService::substituteMarkerArrayCached

2018-07-30 Franz Holzinger <[email protected]>
* bugfix for TYPO3 9.x: replace deprecated method ContentObjectRenderer::fileResource by $TSFE->tmpl->getFileName and file_get_contents.
* bugfix for TYPO3 9.x: replace deprecated method ContentObjectRenderer::fileResource by $TSFE->tmpl->getFileName and file_get_contents.

2018-06-28 Franz Holzinger <[email protected]>
* bugfix: because of the new base class \JambageCom\Div2007\Base\TranslationBase the new \JambageCom\Div2007\Utility\BrowserUtility must be used.
Expand All @@ -189,7 +197,7 @@
* HTML templates: remove the font entries. Use CSS instead.

2018-04-02 Franz Holzinger <[email protected]>
* new feature: disallow fields by exclude.tt_board. Set it to cr_ip for GDPR compliance
* new feature: disallow fields by exclude.tt_board. Set it to cr_ip for GDPR compliance

2018-03-19 Franz Holzinger <[email protected]>
* rename PostForm into Form
Expand Down
34 changes: 18 additions & 16 deletions Classes/Controller/Submit.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/***************************************************************
* Copyright notice
*
* (c) 2023 Kasper Skårhøj <[email protected]>
* (c) 2024 Kasper Skårhøj <[email protected]>
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
Expand Down Expand Up @@ -97,7 +97,7 @@ public static function execute(TypoScriptFrontendDataController $pObj, $conf)
false
);
if (is_array($row)) {
$email = $row['email'];
$email = $row['email'] ?? '';
}
}

Expand Down Expand Up @@ -354,11 +354,7 @@ public static function execute(TypoScriptFrontendDataController $pObj, $conf)
if (
$notify &&
$conf['notify'] &&
trim($row['email']) &&
(
!$conf['emailCheck'] ||
MailUtility::checkMXRecord($row['email'])
)
!empty($row['email'])
) {
$labelKeys = ['p_at', 'p_content', 'p_salutation', 'p_subject', 'p_text_snippet', 'p_url_title'];
$markersArray = [];
Expand Down Expand Up @@ -426,14 +422,19 @@ public static function execute(TypoScriptFrontendDataController $pObj, $conf)
}
$fromName = $senderArray[0];
foreach ($addresses as $email) {
MailUtility::send(
$email,
$msgParts[0],
$msgParts[1],
'',
$fromEmail,
$fromName
);
if (
empty($conf['emailCheck']) ||
MailUtility::checkMXRecord($email)
) {
MailUtility::send(
$email,
$msgParts[0],
$msgParts[1],
'',
$fromEmail,
$fromName
);
}
}
}
}
Expand Down Expand Up @@ -461,7 +462,8 @@ public static function execute(TypoScriptFrontendDataController $pObj, $conf)
$message
);
$sessionData = [];
$sessionData['error'] = $content;
$sessionData['error-title'] = $title;
$sessionData['error-message'] = $message;
$session->setSessionData($sessionData);
}

Expand Down
12 changes: 7 additions & 5 deletions Classes/Domain/TtBoard.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,18 @@
* @author Kasper Skårhøj <[email protected]>
* @author Franz Holzinger <[email protected]>
*/
use TYPO3\CMS\Core\SingletonInterface;
use JambageCom\Div2007\Utility\TableUtility;

use TYPO3\CMS\Core\Database\Query\Restriction\FrontendRestrictionContainer;
use JambageCom\Div2007\Database\QueryBuilderApi;
use TYPO3\CMS\Core\Database\Connection;
use TYPO3\CMS\Core\Database\ConnectionPool;
use TYPO3\CMS\Core\Database\Query\Expression\CompositeExpression;
use TYPO3\CMS\Core\Database\Query\QueryBuilder;
use TYPO3\CMS\Core\Information\Typo3Version;
use TYPO3\CMS\Core\SingletonInterface;
use TYPO3\CMS\Core\Utility\GeneralUtility;

use JambageCom\Div2007\Utility\TableUtility;
use JambageCom\Div2007\Database\QueryBuilderApi;

use JambageCom\TtBoard\Constants\TreeMark;
use JambageCom\TtBoard\Domain\QueryParameter;
Expand Down Expand Up @@ -247,9 +249,9 @@ public static function getPagesInPage($pid_list)
* Returns number of post in a forum.
* @param string ... $pidList comma separated list of page ids.
* @param array ... $andWhereEqualsArray array of QueryParameter for equation comparisons
* @param where ... $where
* @param where ... $where
*/
public function getNumPosts($pidList, array $queryParameters = [], QueryBuilder $where = null)
public function getNumPosts($pidList, array $queryParameters = [], CompositeExpression $where = null)
{
$pageIds = GeneralUtility::intExplode(',', (string) $pidList, true);
$queryBuilder = $this->getQueryBuilder();
Expand Down
41 changes: 24 additions & 17 deletions Classes/View/Form.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ function enableSubmitButtonFunc() {
document.getElementById("' . $buttonId . '").disabled = !this.checked;
}
}
window.onload = addListeners;
window.onload = addListeners;
';

return $result;
Expand All @@ -82,10 +82,23 @@ public function render(
$content = '';
$session = GeneralUtility::makeInstance(SessionHandler::class);
$currentSessionData = $session->getSessionData();

$errorOut = '';
if (
!empty($currentSessionData['error-title']) &&
!empty($currentSessionData['error-message'])
) {
$errorOut =
'<div class="typo3-error-page-container">
<h1 class="typo3-error-page-title">' . $currentSessionData['error-title'] . '</h1>
<p class="typo3-error-page-message">' . $currentSessionData['error-message'] . '</p>
</div>';
}
$sessionData = [];
$conf = $composite->getConf();
$modelObj = $composite->getModelObj();
$languageObj = $composite->getLanguageObj();
$langKey = $languageObj->getLocalLangKey();
$request = $cObj->getRequest();
$uid = $composite->getTtBoardUid();
$xhtmlFix = HtmlUtility::determineXhtmlFix();
Expand All @@ -96,15 +109,17 @@ public function render(
$spamWord = '';
$cssPrefix = 'tx-ttboard-';
$notify = [];
$content .= $errorOut;

if (
empty($errorOut) &&
isset($GLOBALS['TSFE']->applicationData[$extensionKey]) &&
is_array($GLOBALS['TSFE']->applicationData[$extensionKey]) &&
!isset($GLOBALS['TSFE']->applicationData[$extensionKey]['error']) &&
isset($GLOBALS['TSFE']->applicationData[$extensionKey]['row']) &&
is_array($GLOBALS['TSFE']->applicationData[$extensionKey]['row'])
) {
$content = $languageObj->getLabel(
$content .= $languageObj->getLabel(
'post.thanks'
);
}
Expand Down Expand Up @@ -440,9 +455,9 @@ public function render(
) {
foreach ($lConf['dataArray.'] as $k => $dataRow) {
if (strpos($dataRow['type'], '[author]') !== false) {
$lConf['dataArray.'][$k]['value'] = $GLOBALS['TSFE']->fe_user->user['name'];
$lConf['dataArray.'][$k]['value'] = $GLOBALS['TSFE']->fe_user->user['name'] ?? '';
} elseif (strpos($dataRow['type'], '[email]') !== false) {
$lConf['dataArray.'][$k]['value'] = $GLOBALS['TSFE']->fe_user->user['email'];
$lConf['dataArray.'][$k]['value'] = $GLOBALS['TSFE']->fe_user->user['email'] ?? '';
}
}
}
Expand All @@ -459,21 +474,15 @@ public function render(
is_array($lConf['dataArray.'][$k . '.'])
) {
if (
empty($lConf['dataArray.'][$k . '.'][$type]) ||
(
!$languageObj->getLocalLangKey() ||
$languageObj->getLocalLangKey() == 'default'
) &&
!$lConf['dataArray.'][$k . '.'][$type] ||

(
$languageObj->getLocalLangKey() != 'default' &&
(
isset($lConf['dataArray.'][$k . '.'][$type . '.']) &&
!is_array($lConf['dataArray.'][$k . '.'][$type . '.']) ||
isset($lConf['dataArray.'][$k . '.'][$type . '.']['lang.']) &&
!is_array($lConf['dataArray.'][$k . '.'][$type . '.']['lang.']) ||
isset($lConf['dataArray.'][$k . '.'][$type . '.']['lang.'][$languageObj->getLocalLangKey() . '.']) &&
!is_array($lConf['dataArray.'][$k . '.'][$type . '.']['lang.'][$languageObj->getLocalLangKey() . '.'])
isset($lConf['dataArray.'][$k . '.'][$type . '.']['lang.'][$langKey . '.']) &&
!is_array($lConf['dataArray.'][$k . '.'][$type . '.']['lang.'][$langKey . '.'])
)
)
) {
Expand All @@ -489,14 +498,13 @@ public function render(
$lConf['dataArray.'][$k . '.']['value'] = $origRow[$theField];
} elseif (
$theField == 'subject' &&
$conf['fillSubject'] &&
isset($row[$theField])
!empty($conf['fillSubject']) &&
!empty($row[$theField])
) {
$fillSubjectPrefix =
$languageObj->getLabel(
'post.fillSubjectPrefix'
);

$lConf['dataArray.'][$k . '.']['value'] = $fillSubjectPrefix . $row[$theField];
}
}
Expand Down Expand Up @@ -532,7 +540,6 @@ public function render(
$sessionData['notify_me'] = $notify;
}
$session->setSessionData($sessionData);

return $content;
}
}
14 changes: 7 additions & 7 deletions Configuration/TypoScript/Default/constants.typoscript
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ plugin.tt_board {
# cat=plugin.board; type=int+; label= Page Id of forum: Only set this if the BACKLINK does not work.
PIDforum =

# cat=plugin.board/email; type=boolean; label= Email check: If you want to verify the validity of an entered email address
# cat=plugin.board/email; type=boolean; label= Email check: If you want to verify the validity of an entered email address by trying to connect to the mail gateway
emailCheck = 0

# cat=plugin.board/captcha; type=string; label= Captcha check: If you want to display the captcha view and field. freecap or captcha are supported.
Expand All @@ -46,11 +46,11 @@ plugin.tt_board_list {
file.templateFile = EXT:tt_board/Resources/Private/Templates/board_template1.tmpl

# cat=plugin.board/typo; type=wrap; label= List-style, Wrap 1: This wrap is used in the template-file.
wrap1 =
wrap1 =
# cat=plugin.board/typo; type=wrap; label= List-style, Wrap 2: This wrap is used in the template-file.
wrap2 =
wrap2 =
# cat=plugin.board/typo; type=wrap; label= List-style, Wrap 3: This wrap is used in the template-file.
wrap3 =
wrap3 =

# cat=plugin.board/color; type=color; label= List-style, Color 1: This bgcolor is marker ###GC4### used in the template-file.
color1 = #cae8f5
Expand All @@ -68,11 +68,11 @@ plugin.tt_board_tree {
file.templateFile = EXT:tt_board/Resources/Private/Templates/board_template2.tmpl

# cat=plugin.board/typo; type=wrap; label= Tree-style, Wrap 1: This wrap is used in the template-file.
wrap1 =
wrap1 =
# cat=plugin.board/typo; type=wrap; label= Tree-style, Wrap 2: This wrap is used in the template-file.
wrap2 =
wrap2 =
# cat=plugin.board/typo; type=wrap; label= Tree-style, Wrap 3: This wrap is used in the template-file.
wrap3 =
wrap3 =

# cat=plugin.board/color; type=color; label= Tree-style, Color 1: This bgcolor is used in the template-file.
color1 = #cae8f5
Expand Down
2 changes: 1 addition & 1 deletion ext_emconf.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
'title' => 'Message board, twin mode',
'description' => 'Simple threaded (tree) or list message board (forum).',
'category' => 'plugin',
'version' => '1.14.0',
'version' => '1.14.1',
'state' => 'stable',
'author' => 'Franz Holzinger',
'author_email' => '[email protected]',
Expand Down

0 comments on commit d3a8676

Please sign in to comment.