Commit dc00dbc1 authored by Kevin Ditscheid's avatar Kevin Ditscheid
Browse files

[TASK] Remove legacy code

parent cfaa2ac4
......@@ -33,7 +33,6 @@ use TYPO3\CMS\Backend\Template\Components\DocHeaderComponent;
use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Core\Messaging\FlashMessage;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Utility\VersionNumberUtility;
use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
use TYPO3\CMS\Extbase\Mvc\Exception\StopActionException;
use TYPO3\CMS\Extbase\Mvc\Exception\UnsupportedRequestTypeException;
......@@ -129,7 +128,6 @@ class ConfigurationController extends ActionController {
'docHeader' => $this->docHeaderComponent->docHeaderContent(),
'selectedTemplateFilter' => $filters['filterTemplate'],
'selectedExtensionFilter' => $filters['filterExtension'],
'typo3Version' => VersionNumberUtility::convertVersionNumberToInteger(TYPO3_version),
'selectedTemplateKey' => $selectedTemplate,
'selectedExtensionKey' => $selectedExtension,
'mode' => 'editor'
......
......@@ -32,9 +32,7 @@ use SGalinski\SgMail\Session\PhpSession;
use TYPO3\CMS\Backend\Clipboard\Clipboard;
use TYPO3\CMS\Backend\Template\Components\DocHeaderComponent;
use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Core\Page\PageRenderer;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Utility\VersionNumberUtility;
use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
use TYPO3\CMS\Extbase\Mvc\Exception\NoSuchArgumentException;
use TYPO3\CMS\Extbase\Mvc\View\ViewInterface;
......@@ -104,15 +102,6 @@ class LayoutController extends ActionController {
*/
public function initializeView(ViewInterface $view) {
parent::initializeView($view);
$pageRenderer = GeneralUtility::makeInstance(PageRenderer::class);
$pageRenderer->addJsInlineCode(
'typo3_version', 'TYPO3.version='
. VersionNumberUtility::convertVersionNumberToInteger(VersionNumberUtility::getCurrentTypo3Version())
. ';'
);
if (version_compare(VersionNumberUtility::getCurrentTypo3Version(), '9.0.0', '<')) {
$pageRenderer->loadExtJS();
}
$this->initClipboard();
$view->assign('controller', 'Layout');
}
......@@ -158,7 +147,6 @@ class LayoutController extends ActionController {
BackendService::makeButtons($this->docHeaderComponent, $this->request);
$this->view->assign('pageUid', $pageUid);
$this->view->assign('docHeader', $this->docHeaderComponent->docHeaderContent());
$this->view->assign('typo3Version', VersionNumberUtility::convertVersionNumberToInteger(TYPO3_version));
}
/**
......
......@@ -36,9 +36,7 @@ use SGalinski\SgMail\Session\PhpSession;
use TYPO3\CMS\Backend\Template\Components\DocHeaderComponent;
use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Core\Messaging\FlashMessage;
use TYPO3\CMS\Core\Page\PageRenderer;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Utility\VersionNumberUtility;
use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
use TYPO3\CMS\Extbase\Mvc\View\ViewInterface;
use TYPO3\CMS\Extbase\Object\ObjectManager;
......@@ -93,15 +91,6 @@ class MailController extends ActionController {
*/
public function initializeView(ViewInterface $view) {
parent::initializeView($view);
$pageRenderer = GeneralUtility::makeInstance(PageRenderer::class);
$pageRenderer->addJsInlineCode(
'typo3_version', 'TYPO3.version='
. VersionNumberUtility::convertVersionNumberToInteger(VersionNumberUtility::getCurrentTypo3Version())
. ';'
);
if (version_compare(VersionNumberUtility::getCurrentTypo3Version(), '9.0.0', '<')) {
$pageRenderer->loadExtJS();
}
$view->assign('controller', 'Mail');
}
......@@ -283,21 +272,14 @@ class MailController extends ActionController {
BackendService::makeButtons($this->docHeaderComponent, $this->request);
$this->view->assign('docHeader', $this->docHeaderComponent->docHeaderContent());
$this->view->assign('typo3Version', VersionNumberUtility::convertVersionNumberToInteger(TYPO3_version));
/** @noinspection PhpInternalEntityUsedInspection */
$this->view->assign('beUserMail', $GLOBALS['BE_USER']->user['email']);
// get the default language label and pass it to the view
$pageTsConfig = BackendUtility::getPagesTSconfig($pageUid);
if (VersionNumberUtility::convertVersionNumberToInteger(TYPO3_version) >= 8000000) {
$defaultLanguageLabel = LocalizationUtility::translate(
'LLL:EXT:lang/Resources/Private/Language/locallang_mod_web_list.xlf:defaultLanguage'
);
} else {
$defaultLanguageLabel = LocalizationUtility::translate(
'lll:EXT:lang/locallang_mod_web_list.xlf:defaultLanguage'
);
}
$defaultLanguageLabel = LocalizationUtility::translate(
'LLL:EXT:core/Resources/Private/Language/locallang_mod_web_list.xlf:defaultLanguage'
);
if (isset($pageTsConfig['mod.']['SHARED.']['defaultLanguageLabel'])) {
$defaultLanguageLabel = $pageTsConfig['mod.']['SHARED.']['defaultLanguageLabel'];
......
......@@ -37,9 +37,7 @@ use SGalinski\SgMail\Session\PhpSession;
use TYPO3\CMS\Backend\Template\Components\DocHeaderComponent;
use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Core\Messaging\FlashMessage;
use TYPO3\CMS\Core\Page\PageRenderer;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Utility\VersionNumberUtility;
use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
use TYPO3\CMS\Extbase\Mvc\View\ViewInterface;
use TYPO3\CMS\Extbase\Object\ObjectManager;
......@@ -108,15 +106,6 @@ class NewsletterController extends ActionController {
*/
public function initializeView(ViewInterface $view) {
parent::initializeView($view);
$pageRenderer = GeneralUtility::makeInstance(PageRenderer::class);
$pageRenderer->addJsInlineCode(
'typo3_version', 'TYPO3.version='
. VersionNumberUtility::convertVersionNumberToInteger(VersionNumberUtility::getCurrentTypo3Version())
. ';'
);
if (version_compare(VersionNumberUtility::getCurrentTypo3Version(), '9.0.0', '<')) {
$pageRenderer->loadExtJS();
}
$view->assign('controller', 'Newsletter');
}
......@@ -329,23 +318,15 @@ class NewsletterController extends ActionController {
BackendService::makeButtons($this->docHeaderComponent, $this->request);
$this->view->assign('docHeader', $this->docHeaderComponent->docHeaderContent());
$this->view->assign('typo3Version', VersionNumberUtility::convertVersionNumberToInteger(TYPO3_version));
/** @noinspection PhpInternalEntityUsedInspection */
$beUserMail = (!empty($arguments['emailAddress'])?$arguments['emailAddress']:$GLOBALS['BE_USER']->user['email']);
$this->view->assign('beUserMail', $beUserMail);
// get the default language label and pass it to the view
$pageTsConfig = BackendUtility::getPagesTSconfig($pageUid);
if (VersionNumberUtility::convertVersionNumberToInteger(TYPO3_version) >= 8000000) {
$defaultLanguageLabel = LocalizationUtility::translate(
'LLL:EXT:lang/Resources/Private/Language/locallang_mod_web_list.xlf:defaultLanguage'
);
} else {
$defaultLanguageLabel = LocalizationUtility::translate(
'lll:EXT:lang/locallang_mod_web_list.xlf:defaultLanguage'
);
}
$defaultLanguageLabel = LocalizationUtility::translate(
'LLL:EXT:core/Resources/Private/Language/locallang_mod_web_list.xlf:defaultLanguage'
);
if (isset($pageTsConfig['mod.']['SHARED.']['defaultLanguageLabel'])) {
$defaultLanguageLabel = $pageTsConfig['mod.']['SHARED.']['defaultLanguageLabel'];
}
......
......@@ -33,9 +33,7 @@ use SGalinski\SgMail\Session\PhpSession;
use TYPO3\CMS\Backend\Template\Components\DocHeaderComponent;
use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Core\Messaging\FlashMessage;
use TYPO3\CMS\Core\Page\PageRenderer;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Utility\VersionNumberUtility;
use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
use TYPO3\CMS\Extbase\Mvc\View\ViewInterface;
use TYPO3\CMS\Extbase\Utility\LocalizationUtility;
......@@ -75,15 +73,6 @@ class QueueController extends ActionController {
*/
public function initializeView(ViewInterface $view) {
parent::initializeView($view);
$pageRenderer = GeneralUtility::makeInstance(PageRenderer::class);
$pageRenderer->addJsInlineCode(
'typo3_version', 'TYPO3.version='
. VersionNumberUtility::convertVersionNumberToInteger(VersionNumberUtility::getCurrentTypo3Version())
. ';'
);
if (version_compare(VersionNumberUtility::getCurrentTypo3Version(), '9.0.0', '<')) {
$pageRenderer->loadExtJS();
}
$view->assign('controller', 'Queue');
}
......@@ -161,7 +150,6 @@ class QueueController extends ActionController {
$this->docHeaderComponent->setMetaInformation($pageInfo);
BackendService::makeButtons($this->docHeaderComponent, $this->request);
$this->view->assign('docHeader', $this->docHeaderComponent->docHeaderContent());
$this->view->assign('typo3Version', VersionNumberUtility::convertVersionNumberToInteger(TYPO3_version));
}
......
......@@ -26,14 +26,11 @@ namespace SGalinski\SgMail\Service;
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
use Doctrine\DBAL\Driver\Mysqli\MysqliStatement;
use Doctrine\DBAL\Statement;
use SGalinski\SgMail\Domain\Model\Template;
use SGalinski\SgMail\Domain\Repository\FrontendUserGroupRepository;
use SGalinski\SgMail\Domain\Repository\MailRepository;
use SGalinski\SgMail\Domain\Repository\TemplateRepository;
use SGalinski\SgMail\Utility\ExtensionUtility;
use Symfony\Component\HttpFoundation\StreamedResponse;
use TYPO3\CMS\Backend\Template\Components\ButtonBar;
use TYPO3\CMS\Backend\Template\Components\DocHeaderComponent;
use TYPO3\CMS\Backend\Utility\BackendUtility;
......@@ -42,7 +39,6 @@ use TYPO3\CMS\Core\Database\Query\Restriction\DeletedRestriction;
use TYPO3\CMS\Core\Imaging\Icon;
use TYPO3\CMS\Core\Imaging\IconFactory;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Utility\VersionNumberUtility;
use TYPO3\CMS\Extbase\Mvc\Request;
use TYPO3\CMS\Extbase\Object\ObjectManager;
use TYPO3\CMS\Extbase\Persistence\Generic\PersistenceManager;
......@@ -93,16 +89,6 @@ class BackendService {
1
)
);
if (!version_compare(VersionNumberUtility::getCurrentTypo3Version(), '9.0.0', '<')) {
$queryBuilder->andWhere(
$queryBuilder->expr()->eq(
'sys_language_uid',
0
)
);
}
$rows = $queryBuilder->execute()->fetchAll();
foreach ($rows as $row) {
......@@ -132,16 +118,9 @@ class BackendService {
public static function makeButtons($docHeaderComponent, $request) {
/** @var ButtonBar $buttonBar */
$buttonBar = $docHeaderComponent->getButtonBar();
/** @var IconFactory $iconFactory */
$iconFactory = GeneralUtility::makeInstance(IconFactory::class);
if (version_compare(VersionNumberUtility::getCurrentTypo3Version(), '9.0.0', '<')) {
$locallangPath = 'LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:';
} else {
$locallangPath = 'LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:';
}
$locallangPath = 'LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:';
// Refresh
$refreshButton = $buttonBar->makeLinkButton()
->setHref(GeneralUtility::getIndpEnv('REQUEST_URI'))
......@@ -423,7 +402,7 @@ class BackendService {
$row[] = '"' . ($label ?: $field) . '"';
}
}
fwrite(
$handle, trim(
preg_replace(
......@@ -434,7 +413,7 @@ class BackendService {
)
);
}
$row = [];
foreach ($mail as $field => $value) {
if (!\in_array($field, $ignoreFields, TRUE)) {
......@@ -445,7 +424,7 @@ class BackendService {
}
}
}
fwrite(
$handle, trim(
preg_replace(
......@@ -456,7 +435,7 @@ class BackendService {
)
);
}
$offset += self::CSV_EXPORT_BATCH_SIZE;
}
}
......@@ -475,7 +454,7 @@ class BackendService {
$registerService = GeneralUtility::makeInstance(RegisterService::class);
$registerArray = $registerService->getRegisterArray();
$extensionConfiguration = ExtensionUtility::getExtensionConfiguration();
$extensionConfiguration = $GLOBALS['TYPO3_CONF_VARS']['EXTENSIONS']['sg_mail'] ?? [];
if (isset($extensionConfiguration['excludeTemplates']) && $extensionConfiguration['excludeTemplates'] !== '') {
$excludedTemplatesWithSiteId = GeneralUtility::trimExplode(
';', $extensionConfiguration['excludeTemplates'], TRUE
......
<?php
namespace SGalinski\SgMail\UserFunc;
/***************************************************************
* 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 3 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 SGalinski\SgMail\Service\RegisterService;
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
use TYPO3\CMS\Core\Utility\GeneralUtility;
/**
* Class ExtensionConfiguration
*
* @package SGalinski\SgMail\UserFunc
*/
class ExtensionConfiguration {
/**
* Displays all registered sg mail templates for easy use with the blacklist feature
*
* @return string
*/
public function displayTemplates(): string {
$result = '';
try {
// These are internal methods that can vanish at any moment
// TODO: We need to change this whole TypoScript fetching at these early stages
ExtensionManagementUtility::loadExtLocalconf();
ExtensionManagementUtility::loadBaseTca();
$registerService = GeneralUtility::makeInstance(RegisterService::class);
$registerArray = $registerService->getRegisterArray();
foreach ($registerArray as $extensionKey => $extension) {
/** @var array $extension */
foreach ($extension as $templateKey => $template) {
$result .= $extensionKey . '.' . $templateKey . '<br>';
}
}
} catch (\Exception $exception) {
return 'The template list could not be loaded!';
}
return $result;
}
}
<?php
namespace SGalinski\SgMail\Utility;
/**
*
* 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 3 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\Core\Utility\VersionNumberUtility;
/**
* Class ExtensionUtility
*
* @package SGalinski\SgMail\Utility
* @author Kevin Ditscheid <kevin.ditscheid@sgalinski.de>
*/
class ExtensionUtility {
/**
* Get the extension configuration
*
* @return array
*/
public static function getExtensionConfiguration(): array {
if (version_compare(VersionNumberUtility::getCurrentTypo3Version(), '9.0.0', '<')) {
$extConf = \unserialize(
$GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['sg_mail'], ['allowed_classes' => FALSE]
);
return is_array($extConf) ? $extConf : [];
}
return $GLOBALS['TYPO3_CONF_VARS']['EXTENSIONS']['sg_mail'] ?? [];
}
}
......@@ -28,6 +28,7 @@ namespace SGalinski\SgMail\XClass\Form;
use SGalinski\SgMail\Service\MailTemplateService;
use SGalinski\SgMail\Service\RegisterService;
use Symfony\Component\Yaml\Yaml;
use TYPO3\CMS\Core\Core\Environment;
use TYPO3\CMS\Core\Resource\ResourceStorage;
use TYPO3\CMS\Core\Resource\StorageRepository;
use TYPO3\CMS\Core\Utility\GeneralUtility;
......@@ -106,7 +107,7 @@ class FormEditorController extends \TYPO3\CMS\Form\Controller\FormEditorControll
if (strpos($formPersistenceIdentifier, 'EXT:') === 0) {
$absoluteFilePath = GeneralUtility::getFileAbsFileName($formPersistenceIdentifier);
} else {
list($storageUid, $fileIdentifier) = explode(':', $formPersistenceIdentifier, 2);
[$storageUid, $fileIdentifier] = explode(':', $formPersistenceIdentifier, 2);
$storageRepository = $this->objectManager->get(StorageRepository::class);
$storage = $storageRepository->findByUid($storageUid);
if (!$storage instanceof ResourceStorage || !$storage->isBrowsable()) {
......@@ -114,7 +115,7 @@ class FormEditorController extends \TYPO3\CMS\Form\Controller\FormEditorControll
sprintf('Could not access storage with uid "%d".', $storageUid)
);
}
$absoluteFilePath = PATH_site . $storage->getFile($fileIdentifier)->getPublicUrl();
$absoluteFilePath = Environment::getPublicPath() . '/' . $storage->getFile($fileIdentifier)->getPublicUrl();
}
try {
......
......@@ -11,7 +11,7 @@
<f:render
partial="Module/DocHeader"
section="main"
arguments="{docHeader: docHeader, pages: pages, selectedTemplateKey: selectedTemplateKey, selectedExtensionKey: selectedExtensionKey,typo3Version: typo3Version}" />
arguments="{docHeader: docHeader, pages: pages, selectedTemplateKey: selectedTemplateKey, selectedExtensionKey: selectedExtensionKey}" />
<f:if condition="{pages}">
<f:then></f:then>
<f:else>
......
......@@ -19,7 +19,7 @@
<f:render
partial="Module/DocHeader"
section="main"
arguments="{docHeader: docHeader, pages: pages, selectedTemplateKey: selectedTemplateKey, selectedExtensionKey: selectedExtensionKey,typo3Version: typo3Version}" />
arguments="{docHeader: docHeader, pages: pages, selectedTemplateKey: selectedTemplateKey, selectedExtensionKey: selectedExtensionKey}" />
<f:if condition="{pages}">
<f:then></f:then>
<f:else>
......
......@@ -37,21 +37,14 @@
<f:render
partial="Module/DocHeader"
section="path"
arguments="{docHeader: docHeader, typo3Version: typo3Version}" />
arguments="{docHeader: docHeader}" />
</div>
</f:section>
<f:section name="path">
<div class="module-docheader-bar-column-right">
<span class="typo3-docheader-pagePath">
<f:if condition="{typo3Version} < 9000000">
<f:then>
<f:translate key="LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.path" />: <f:format.raw>{docHeader.metaInformation.path}</f:format.raw>
</f:then>
<f:else>
<f:translate key="LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.path" />: <f:format.raw>{docHeader.metaInformation.path}</f:format.raw>
</f:else>
</f:if>
<f:translate key="LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.path" />: <f:format.raw>{docHeader.metaInformation.path}</f:format.raw>
</span>
<f:format.raw>{docHeader.metaInformation.recordInformation}</f:format.raw>
</div>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment