diff --git a/Classes/Xclass/Typo3DbBackend.php b/Classes/Xclass/Typo3DbBackend.php deleted file mode 100755 index ece9d35c7e2ddcc038ff1dcb23a1273a579a2b7f..0000000000000000000000000000000000000000 --- a/Classes/Xclass/Typo3DbBackend.php +++ /dev/null @@ -1,176 +0,0 @@ -<?php - -namespace SGalinski\SgNews\Xclass; - -/*************************************************************** - * Copyright notice - * - * (c) sgalinski Internet Services (https://www.sgalinski.de) - * All rights reserved - * - * This script is part of the TYPO3 project. The TYPO3 project is - * free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * The GNU General Public License can be found at - * http://www.gnu.org/copyleft/gpl.html. - * - * This script is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * This copyright notice MUST APPEAR in all copies of the script! - ***************************************************************/ - -use TYPO3\CMS\Backend\Utility\BackendUtility; -use TYPO3\CMS\Core\Utility\ExtensionManagementUtility; -use TYPO3\CMS\Core\Utility\GeneralUtility; -use TYPO3\CMS\Extbase\Persistence\Generic\Qom; -use TYPO3\Languagevisibility\Service\FrontendServices; - -/** - * Xclass for the TYPO3 db backend, which handles, that the l18n_cfg parameters are used for pages in Extbase. - */ -class Typo3DbBackend extends \TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo3DbBackend { - /** - * Performs workspace and language overlay on the given row array. The language and workspace id is automatically - * detected (depending on FE or BE context). You can also explicitly set the language/workspace id. - * - * @param Qom\SourceInterface $source The source (selector od join) - * @param array $rows - * @param \TYPO3\CMS\Extbase\Persistence\Generic\QuerySettingsInterface $querySettings The TYPO3 CMS specific query settings - * @param null|int $workspaceUid - * @return array - */ - protected function doLanguageAndWorkspaceOverlay(Qom\SourceInterface $source, array $rows, \TYPO3\CMS\Extbase\Persistence\Generic\QuerySettingsInterface $querySettings, $workspaceUid = null) - { - if ($source instanceof Qom\SelectorInterface) { - $tableName = $source->getSelectorName(); - } elseif ($source instanceof Qom\JoinInterface) { - $tableName = $source->getRight()->getSelectorName(); - } else { - // No proper source, so we do not have a table name here - // we cannot do an overlay and return the original rows instead. - return $rows; - } - - $pageRepository = $this->getPageRepository(); - if (is_object($GLOBALS['TSFE'])) { - if ($workspaceUid !== null) { - $pageRepository->versioningWorkspaceId = $workspaceUid; - } - } else { - if ($workspaceUid === null) { - $workspaceUid = $GLOBALS['BE_USER']->workspace; - } - $pageRepository->versioningWorkspaceId = $workspaceUid; - } - - // Fetches the move-placeholder in case it is supported - // by the table and if there's only one row in the result set - // (applying this to all rows does not work, since the sorting - // order would be destroyed and possible limits not met anymore) - if (!empty($pageRepository->versioningWorkspaceId) - && BackendUtility::isTableWorkspaceEnabled($tableName) - && count($rows) === 1 - ) { - $movePlaceholder = $this->databaseHandle->exec_SELECTgetSingleRow( - $tableName . '.*', - $tableName, - 't3ver_state=3 AND t3ver_wsid=' . $pageRepository->versioningWorkspaceId - . ' AND t3ver_move_id=' . $rows[0]['uid'] - ); - if (!empty($movePlaceholder)) { - $rows = array($movePlaceholder); - } - } - - $isLanguagevisibilityLoaded = ExtensionManagementUtility::isLoaded('languagevisibility'); - $overlaidRows = array(); - foreach ($rows as $row) { - // If current row is a translation select its parent - if (isset($tableName) && isset($GLOBALS['TCA'][$tableName]) - && isset($GLOBALS['TCA'][$tableName]['ctrl']['languageField']) - && isset($GLOBALS['TCA'][$tableName]['ctrl']['transOrigPointerField']) - && !isset($GLOBALS['TCA'][$tableName]['ctrl']['transOrigPointerTable']) - ) { - if (isset($row[$GLOBALS['TCA'][$tableName]['ctrl']['transOrigPointerField']]) - && $row[$GLOBALS['TCA'][$tableName]['ctrl']['transOrigPointerField']] > 0 - ) { - $row = $this->databaseHandle->exec_SELECTgetSingleRow( - $tableName . '.*', - $tableName, - $tableName . '.uid=' . (int)$row[$GLOBALS['TCA'][$tableName]['ctrl']['transOrigPointerField']] . - ' AND ' . $tableName . '.' . $GLOBALS['TCA'][$tableName]['ctrl']['languageField'] . '=0' - ); - } - } - $pageRepository->versionOL($tableName, $row, true); - if ($tableName == 'pages') { - // Start of the patch - // Applies the language visibility logic. - if ($isLanguagevisibilityLoaded && is_object($GLOBALS['TSFE'])) { - $sysLanguageUid = $GLOBALS['TSFE']->sys_language_uid; - if (!FrontendServices::checkVisiblityForElement((int) $row['uid'], $tableName, $sysLanguageUid)) { - // Page not visible - continue; - } - } - - // End of the patch - - $row = $pageRepository->getPageOverlay($row, $querySettings->getLanguageUid()); - if ($row === null || !is_array($row)) { - continue; - } - - // Start of the patch - $l18nConfiguration = $row['l18n_cfg']; - if ($l18nConfiguration > 0) { - if (is_object($GLOBALS['TSFE'])) { - $sysLanguageUid = $GLOBALS['TSFE']->sys_language_uid; - if ($sysLanguageUid > 0) { - // Request the overlay record for the sys_language_uid: - $pageOverlay = $pageRepository->getPageOverlay($row['uid'], $sysLanguageUid); - if (empty($pageOverlay) && - \TYPO3\CMS\Core\Utility\GeneralUtility::hideIfNotTranslated($l18nConfiguration) - ) { - // Page is not available in default language. - continue; - } - } - - if (!$sysLanguageUid && - \TYPO3\CMS\Core\Utility\GeneralUtility::hideIfDefaultLanguage($l18nConfiguration) - ) { - // Page is not available in default language. - continue; - } - } - } - // End of the patch - - } elseif (isset($GLOBALS['TCA'][$tableName]['ctrl']['languageField']) - && $GLOBALS['TCA'][$tableName]['ctrl']['languageField'] !== '' - && !isset($GLOBALS['TCA'][$tableName]['ctrl']['transOrigPointerTable']) - ) { - if (in_array($row[$GLOBALS['TCA'][$tableName]['ctrl']['languageField']], array(-1, 0))) { - $overlayMode = $querySettings->getLanguageOverlayMode(); - if ($overlayMode !== 'hideNonTranslated' || preg_match('/sys_file_.*/is', $tableName)) { - $overlayMode = $querySettings->getLanguageMode() === 'strict' ? 'hideNonTranslated' : ''; - } - $row = $pageRepository->getRecordOverlay($tableName, $row, $querySettings->getLanguageUid(), $overlayMode); - } - } - if ($row !== null && is_array($row)) { - $overlaidRows[] = $row; - } - } - return $overlaidRows; - } -} - -?> diff --git a/composer.json b/composer.json index f57032ba2136c8e0a91c7d4a9d321be555aa3c79..8040796b2b89f0d7823083f8c0501090cd4e66cc 100644 --- a/composer.json +++ b/composer.json @@ -6,7 +6,7 @@ "license": [ "GPL-2.0+" ], - "version": "3.9.3", + "version": "3.9.4", "support": { }, "repositories": [ @@ -19,6 +19,7 @@ "typo3/cms-core": "7.6.0 - 8.7.99" }, "suggest": { + "sgalinski/languagevisibility": "Minimum version 1.1 required, if multi language is enabled", "sgalinski/sg-ajax": "Needed for the like feature", "sgalinski/sg-comments": "Flexible comments system", "typo3-ter/rx-shariff": "Social Share possibilities" diff --git a/ext_emconf.php b/ext_emconf.php index c7789e6fb0c24d5a372452c6feed79f4976deec5..dac1eb07c71ca4cbc15db9ac1413f1625c252ff2 100644 --- a/ext_emconf.php +++ b/ext_emconf.php @@ -19,7 +19,7 @@ $EM_CONF[$_EXTKEY] = [ 'modify_tables' => '', 'clearCacheOnLoad' => 0, 'lockType' => '', - 'version' => '3.9.3', + 'version' => '3.9.4', 'constraints' => [ 'depends' => [ 'typo3' => '7.6.0-8.7.99', @@ -30,6 +30,7 @@ $EM_CONF[$_EXTKEY] = [ 'sg_comments' => '2.1.0-', 'rx_shariff' => '5.0.1-', 'sg_ajax' => '1.0.6-', + 'languagevisibility' => '1.1.0-', ], ], 'suggests' => [], diff --git a/ext_localconf.php b/ext_localconf.php index 0ed3fdf6bb7dd568a9d2c74200079b2a557f1856..4c878c952f116dbdbb381d7cc6959862d59ab63b 100644 --- a/ext_localconf.php +++ b/ext_localconf.php @@ -77,8 +77,6 @@ $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['proc // Xclasses $GLOBALS['TYPO3_CONF_VARS']['SYS']['Objects']['TYPO3\CMS\Core\Page\PageRenderer'] = ['className' => 'SGalinski\SgNews\Xclass\PageRenderer']; -$GLOBALS['TYPO3_CONF_VARS']['SYS']['Objects']['TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo3DbBackend'] = - ['className' => 'SGalinski\SgNews\Xclass\Typo3DbBackend']; // add realurl configuration if (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('realurl')) {