Compare commits
1 Commits
master
...
ca4052740c
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ca4052740c |
@@ -17,19 +17,11 @@ use Cjel\TemplatesAide\Traits\ValidationTrait;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
use TYPO3\CMS\Core\Cache\CacheManager;
|
||||
use TYPO3\CMS\Core\Context\Context;
|
||||
use TYPO3\CMS\Core\Database\ConnectionPool;
|
||||
use TYPO3\CMS\Core\Database\Query\Restriction\DefaultRestrictionContainer;
|
||||
use TYPO3\CMS\Core\Http\Response;
|
||||
use TYPO3\CMS\Core\Http\ServerRequestFactory;
|
||||
use TYPO3\CMS\Core\Localization\LanguageService;
|
||||
use TYPO3\CMS\Core\Localization\LanguageServiceFactory;
|
||||
use TYPO3\CMS\Core\Log\LogManager;
|
||||
use TYPO3\CMS\Core\Routing\SiteMatcher;
|
||||
use TYPO3\CMS\Core\Site\SiteFinder;
|
||||
use TYPO3\CMS\Core\TypoScript\TemplateService;
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
use TYPO3\CMS\Core\Utility\RootlineUtility;
|
||||
use TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface;
|
||||
use TYPO3\CMS\Extbase\Object\ObjectManager;
|
||||
use TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapper;
|
||||
@@ -156,26 +148,15 @@ class AbstractEIDController
|
||||
$this->importLogger = $this->logManager->getLogger(
|
||||
'importLogger'
|
||||
);
|
||||
if (version_compare(TYPO3_branch, '10.0', '>=')) {
|
||||
$this->reflectionService = GeneralUtility::makeInstance(
|
||||
ReflectionService::class
|
||||
);
|
||||
} else {
|
||||
$this->reflectionService = GeneralUtility::makeInstance(
|
||||
ReflectionService::class, GeneralUtility::makeInstance(
|
||||
CacheManager::class
|
||||
)
|
||||
);
|
||||
}
|
||||
$classInfo = $this->reflectionService->getClassSchema(
|
||||
get_class($this)
|
||||
);
|
||||
foreach ($classInfo->getInjectMethods() as $method => $className) {
|
||||
if (version_compare(TYPO3_branch, '10.0', '>=')) {
|
||||
$className = $className
|
||||
->getFirstParameter()
|
||||
->getDependency();
|
||||
}
|
||||
$class = $this->objectManager->get(
|
||||
$className
|
||||
);
|
||||
@@ -188,37 +169,47 @@ class AbstractEIDController
|
||||
*/
|
||||
private function initFrontendController()
|
||||
{
|
||||
$request = ServerRequestFactory::fromGlobals();
|
||||
$context = GeneralUtility::makeInstance(Context::class);
|
||||
$siteFinder = GeneralUtility::makeInstance(SiteFinder::class);
|
||||
$siteMatcher = GeneralUtility::makeInstance(SiteMatcher::class);
|
||||
$site = $siteMatcher->matchRequest($request);
|
||||
$pageId = $site->getSite()->getRootPageId();
|
||||
$template = GeneralUtility::makeInstance(TemplateService::class);
|
||||
$template->tt_track = false;
|
||||
$rootline = GeneralUtility::makeInstance(
|
||||
RootlineUtility::class, $pageId
|
||||
)->get();
|
||||
$template->runThroughTemplates($rootline, 0);
|
||||
$template->generateConfig();
|
||||
$setup = $template->setup;
|
||||
$setup = GeneralUtility::removeDotsFromTS($setup);
|
||||
$extKey = 'tx_' . $this->getExtensionKey();
|
||||
if (array_key_exists('plugin', $setup)
|
||||
&& array_key_exists($extKey, $setup['plugin'])
|
||||
&& array_key_exists('persistence', $setup['plugin'][$extKey])
|
||||
&& array_key_exists('storagePid', $setup['plugin'][$extKey]['persistence'])
|
||||
) {
|
||||
$storagePids = $setup['plugin'][$extKey]['persistence']['storagePid'];
|
||||
$this->storagePids = GeneralUtility::trimExplode(
|
||||
',',
|
||||
$storagePids
|
||||
$currentDomain = strtok(GeneralUtility::getIndpEnv('HTTP_HOST'), ':');
|
||||
$queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)
|
||||
->getQueryBuilderForTable('sys_domain');
|
||||
$queryBuilder->setRestrictions(
|
||||
GeneralUtility::makeInstance(DefaultRestrictionContainer::class)
|
||||
);
|
||||
}
|
||||
$languageServiceFactory = GeneralUtility::makeInstance(
|
||||
LanguageServiceFactory::class
|
||||
$result = $queryBuilder
|
||||
->select('uid', 'pid', 'domainName')
|
||||
->from('sys_domain')
|
||||
->where(
|
||||
$queryBuilder->expr()->eq(
|
||||
'domainName',
|
||||
$queryBuilder->createNamedParameter(
|
||||
$currentDomain,
|
||||
\PDO::PARAM_STR
|
||||
)
|
||||
)
|
||||
)
|
||||
->orderBy('sorting', 'ASC')
|
||||
->execute()
|
||||
->fetchAll();
|
||||
//if (count($result) < 1) {
|
||||
// throw new \Exception('Domain not configured');
|
||||
//}
|
||||
$frontendController = GeneralUtility::makeInstance(
|
||||
\TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController::class,
|
||||
$GLOBALS['TYPO3_CONF_VARS'],
|
||||
null,
|
||||
0,
|
||||
true
|
||||
);
|
||||
$GLOBALS['LANG'] = $languageServiceFactory->create('default');
|
||||
$GLOBALS['LANG'] = GeneralUtility::makeInstance(LanguageService::class);
|
||||
$GLOBALS['LANG']->init('default');
|
||||
$GLOBALS['TSFE'] = $frontendController;
|
||||
$frontendController->connectToDB();
|
||||
$frontendController->fe_user = EidUtility::initFeUser();
|
||||
$frontendController->id = $result[0]['pid'];
|
||||
$frontendController->determineId();
|
||||
$frontendController->initTemplate();
|
||||
$frontendController->getConfigArray();
|
||||
EidUtility::initTCA();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -280,7 +271,6 @@ class AbstractEIDController
|
||||
. 'Request';
|
||||
}
|
||||
}
|
||||
$response = new Response();
|
||||
if (method_exists($this, $requestMethod)) {
|
||||
$responseData = $this->$requestMethod($request, $response);
|
||||
$response = $response->withHeader(
|
||||
|
||||
@@ -27,8 +27,8 @@ use TYPO3\CMS\Extbase\Property\PropertyMappingConfigurationBuilder;
|
||||
use TYPO3\CMS\Extbase\Service\EnvironmentService;
|
||||
use TYPO3\CMS\Extbase\Service\ExtensionService;
|
||||
use TYPO3\CMS\Extbase\Utility\LocalizationUtility;
|
||||
use Blueways\BwCaptcha\Validation\Validator\CaptchaValidator;
|
||||
use TYPO3\CMS\Frontend\Authentication\FrontendUserAuthentication;
|
||||
use TYPO3\CMS\Core\Utility\DebugUtility;
|
||||
|
||||
class ActionController extends BaseController
|
||||
{
|
||||
@@ -838,8 +838,8 @@ class ActionController extends BaseController
|
||||
}
|
||||
}
|
||||
/** **/
|
||||
protected function valideCaptcha($value
|
||||
): void {
|
||||
protected function valideCaptcha($captchaId, $value
|
||||
) {
|
||||
$captchaPhrases = $this->getFeUser()->getKey('ses', 'captchaPhrases');
|
||||
if (!$captchaPhrases || !is_array($captchaPhrases) || !is_string($value)) {
|
||||
$this->addValidationError(
|
||||
@@ -863,7 +863,7 @@ class ActionController extends BaseController
|
||||
unset($captchaPhrases[$lifetime]);
|
||||
$this->getFeUser()->setKey('ses', 'captchaPhrases', $captchaPhrases);
|
||||
$this->getFeUser()->storeSessionData();
|
||||
return ;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
$this->addValidationError(
|
||||
|
||||
@@ -46,18 +46,18 @@ class TranslationController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionCont
|
||||
} else {
|
||||
$language = $GLOBALS['TYPO3_REQUEST']->getAttribute('language');
|
||||
}
|
||||
$language = $language->getTypo3language();
|
||||
$locale = $language->getLocale();
|
||||
//\TYPO3\CMS\Extbase\Utility\DebuggerUtility::var_dump(
|
||||
// $locale, '$locale', 3, true, false
|
||||
//);
|
||||
$langfileContent = $languageFactory->getParsedData(
|
||||
$langfilePath,
|
||||
$language
|
||||
$locale
|
||||
);
|
||||
$langfileResult = [];
|
||||
foreach (reset($langfileContent) as $key => $row) {
|
||||
$langfileResult[$key] = reset($row)['target'];
|
||||
}
|
||||
foreach ($langfileContent[$language] as $key => $row) {
|
||||
$langfileResult[$key] = reset($row)['target'];
|
||||
}
|
||||
$result[$extension] = $langfileResult;
|
||||
}
|
||||
$GLOBALS['TSFE']->setContentType('application/json');
|
||||
|
||||
@@ -44,8 +44,7 @@ class ApiUtility
|
||||
$queryResult,
|
||||
$additionalAttributes = [],
|
||||
$mapping = [],
|
||||
$rootRowClass = null,
|
||||
$options = []
|
||||
$rootRowClass = null
|
||||
) {
|
||||
$this->objectManager = GeneralUtility::makeInstance(
|
||||
ObjectManager::class
|
||||
@@ -131,8 +130,7 @@ class ApiUtility
|
||||
$methodResult,
|
||||
$additionalAttributes[$attributeName],
|
||||
$mapping,
|
||||
$nextLevelClass,
|
||||
$options
|
||||
$nextLevelClass
|
||||
);
|
||||
if ($imageStorage) {
|
||||
foreach ($attributeResult as &$attributeResultRow) {
|
||||
@@ -169,8 +167,7 @@ class ApiUtility
|
||||
[$methodResult],
|
||||
$additionalAttributes[$attributeName],
|
||||
$mapping,
|
||||
$nextLevelClass,
|
||||
$options
|
||||
$nextLevelClass
|
||||
)[0];
|
||||
$rowResult[$attributeName . 'Uid']
|
||||
= $rowResult[$attributeName]['uid'];
|
||||
@@ -221,10 +218,6 @@ class ApiUtility
|
||||
}
|
||||
}
|
||||
}
|
||||
if (($options['clearIds'] ?? '' ) === true) {
|
||||
unset($rowResult['uid']);
|
||||
unset($rowResult['pid']);
|
||||
}
|
||||
$result[] = $rowResult;
|
||||
}
|
||||
return $result;
|
||||
|
||||
@@ -37,22 +37,4 @@ class InterfaceUtility
|
||||
}, ARRAY_FILTER_USE_KEY);
|
||||
return array_values($constants);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all interface constants per prefix
|
||||
*/
|
||||
public static function parseInterfaceConstantsAssoc(
|
||||
$interfaceClass, $prefix
|
||||
) {
|
||||
$constants = (new \ReflectionClass($interfaceClass))
|
||||
->getConstants();
|
||||
$constants = array_filter($constants, function($key) use ($prefix) {
|
||||
if (substr($key, 0, strlen($prefix) + 1)
|
||||
== strtoupper($prefix) . '_'
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
}, ARRAY_FILTER_USE_KEY);
|
||||
return $constants;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ use TYPO3\CMS\Fluid\View\StandaloneView;
|
||||
use TYPO3\CMS\Fluid\View\TemplatePaths;
|
||||
use TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface;
|
||||
use Symfony\Component\Mime\Address;
|
||||
use TYPO3\CMS\Core\Domain\Repository\PageRepository;
|
||||
use TYPO3\CMS\Frontend\Page\PageRepository;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -65,13 +65,12 @@ class TranslationUtility
|
||||
if (!$extensionKey) {
|
||||
$extensionKey = 'site_templates';
|
||||
}
|
||||
$translation = LocalizationUtility::translate(
|
||||
'LLL:EXT:'
|
||||
. $extensionKey
|
||||
. '/Resources/Private/Language/locallang_db.xlf:'
|
||||
. $key
|
||||
);
|
||||
return $translation;
|
||||
return implode([
|
||||
'LLL:EXT:',
|
||||
$extensionKey,
|
||||
'/Resources/Private/Language/locallang_db.xlf:',
|
||||
$key
|
||||
]);
|
||||
} else {
|
||||
if ($extensionKey) {
|
||||
$translation = LocalizationUtility::translate(
|
||||
|
||||
Reference in New Issue
Block a user