Compare commits
10 Commits
ca4052740c
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0e77b7a75a | ||
|
|
b2f9fa6846 | ||
|
|
a38cc25301 | ||
|
|
52f18c53ea | ||
|
|
115ba55cd5 | ||
|
|
e53cca6393 | ||
|
|
b33989a340 | ||
|
|
8ea39bd09c | ||
| 2b549c7b38 | |||
| 5b0ef1ccdf |
@@ -17,11 +17,19 @@ use Cjel\TemplatesAide\Traits\ValidationTrait;
|
|||||||
use Psr\Http\Message\ResponseInterface;
|
use Psr\Http\Message\ResponseInterface;
|
||||||
use Psr\Http\Message\ServerRequestInterface;
|
use Psr\Http\Message\ServerRequestInterface;
|
||||||
use TYPO3\CMS\Core\Cache\CacheManager;
|
use TYPO3\CMS\Core\Cache\CacheManager;
|
||||||
|
use TYPO3\CMS\Core\Context\Context;
|
||||||
use TYPO3\CMS\Core\Database\ConnectionPool;
|
use TYPO3\CMS\Core\Database\ConnectionPool;
|
||||||
use TYPO3\CMS\Core\Database\Query\Restriction\DefaultRestrictionContainer;
|
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\LanguageService;
|
||||||
|
use TYPO3\CMS\Core\Localization\LanguageServiceFactory;
|
||||||
use TYPO3\CMS\Core\Log\LogManager;
|
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\GeneralUtility;
|
||||||
|
use TYPO3\CMS\Core\Utility\RootlineUtility;
|
||||||
use TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface;
|
use TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface;
|
||||||
use TYPO3\CMS\Extbase\Object\ObjectManager;
|
use TYPO3\CMS\Extbase\Object\ObjectManager;
|
||||||
use TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapper;
|
use TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapper;
|
||||||
@@ -148,15 +156,26 @@ class AbstractEIDController
|
|||||||
$this->importLogger = $this->logManager->getLogger(
|
$this->importLogger = $this->logManager->getLogger(
|
||||||
'importLogger'
|
'importLogger'
|
||||||
);
|
);
|
||||||
$this->reflectionService = GeneralUtility::makeInstance(
|
if (version_compare(TYPO3_branch, '10.0', '>=')) {
|
||||||
ReflectionService::class, GeneralUtility::makeInstance(
|
$this->reflectionService = GeneralUtility::makeInstance(
|
||||||
CacheManager::class
|
ReflectionService::class
|
||||||
)
|
);
|
||||||
);
|
} else {
|
||||||
|
$this->reflectionService = GeneralUtility::makeInstance(
|
||||||
|
ReflectionService::class, GeneralUtility::makeInstance(
|
||||||
|
CacheManager::class
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
$classInfo = $this->reflectionService->getClassSchema(
|
$classInfo = $this->reflectionService->getClassSchema(
|
||||||
get_class($this)
|
get_class($this)
|
||||||
);
|
);
|
||||||
foreach ($classInfo->getInjectMethods() as $method => $className) {
|
foreach ($classInfo->getInjectMethods() as $method => $className) {
|
||||||
|
if (version_compare(TYPO3_branch, '10.0', '>=')) {
|
||||||
|
$className = $className
|
||||||
|
->getFirstParameter()
|
||||||
|
->getDependency();
|
||||||
|
}
|
||||||
$class = $this->objectManager->get(
|
$class = $this->objectManager->get(
|
||||||
$className
|
$className
|
||||||
);
|
);
|
||||||
@@ -169,47 +188,37 @@ class AbstractEIDController
|
|||||||
*/
|
*/
|
||||||
private function initFrontendController()
|
private function initFrontendController()
|
||||||
{
|
{
|
||||||
$currentDomain = strtok(GeneralUtility::getIndpEnv('HTTP_HOST'), ':');
|
$request = ServerRequestFactory::fromGlobals();
|
||||||
$queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)
|
$context = GeneralUtility::makeInstance(Context::class);
|
||||||
->getQueryBuilderForTable('sys_domain');
|
$siteFinder = GeneralUtility::makeInstance(SiteFinder::class);
|
||||||
$queryBuilder->setRestrictions(
|
$siteMatcher = GeneralUtility::makeInstance(SiteMatcher::class);
|
||||||
GeneralUtility::makeInstance(DefaultRestrictionContainer::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
|
||||||
|
);
|
||||||
|
}
|
||||||
|
$languageServiceFactory = GeneralUtility::makeInstance(
|
||||||
|
LanguageServiceFactory::class
|
||||||
);
|
);
|
||||||
$result = $queryBuilder
|
$GLOBALS['LANG'] = $languageServiceFactory->create('default');
|
||||||
->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'] = 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();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -271,6 +280,7 @@ class AbstractEIDController
|
|||||||
. 'Request';
|
. 'Request';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
$response = new Response();
|
||||||
if (method_exists($this, $requestMethod)) {
|
if (method_exists($this, $requestMethod)) {
|
||||||
$responseData = $this->$requestMethod($request, $response);
|
$responseData = $this->$requestMethod($request, $response);
|
||||||
$response = $response->withHeader(
|
$response = $response->withHeader(
|
||||||
|
|||||||
@@ -27,8 +27,8 @@ use TYPO3\CMS\Extbase\Property\PropertyMappingConfigurationBuilder;
|
|||||||
use TYPO3\CMS\Extbase\Service\EnvironmentService;
|
use TYPO3\CMS\Extbase\Service\EnvironmentService;
|
||||||
use TYPO3\CMS\Extbase\Service\ExtensionService;
|
use TYPO3\CMS\Extbase\Service\ExtensionService;
|
||||||
use TYPO3\CMS\Extbase\Utility\LocalizationUtility;
|
use TYPO3\CMS\Extbase\Utility\LocalizationUtility;
|
||||||
use Blueways\BwCaptcha\Validation\Validator\CaptchaValidator;
|
|
||||||
use TYPO3\CMS\Frontend\Authentication\FrontendUserAuthentication;
|
use TYPO3\CMS\Frontend\Authentication\FrontendUserAuthentication;
|
||||||
|
use TYPO3\CMS\Core\Utility\DebugUtility;
|
||||||
|
|
||||||
class ActionController extends BaseController
|
class ActionController extends BaseController
|
||||||
{
|
{
|
||||||
@@ -838,8 +838,8 @@ class ActionController extends BaseController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
/** **/
|
/** **/
|
||||||
protected function valideCaptcha($captchaId, $value
|
protected function valideCaptcha($value
|
||||||
) {
|
): void {
|
||||||
$captchaPhrases = $this->getFeUser()->getKey('ses', 'captchaPhrases');
|
$captchaPhrases = $this->getFeUser()->getKey('ses', 'captchaPhrases');
|
||||||
if (!$captchaPhrases || !is_array($captchaPhrases) || !is_string($value)) {
|
if (!$captchaPhrases || !is_array($captchaPhrases) || !is_string($value)) {
|
||||||
$this->addValidationError(
|
$this->addValidationError(
|
||||||
@@ -863,7 +863,7 @@ class ActionController extends BaseController
|
|||||||
unset($captchaPhrases[$lifetime]);
|
unset($captchaPhrases[$lifetime]);
|
||||||
$this->getFeUser()->setKey('ses', 'captchaPhrases', $captchaPhrases);
|
$this->getFeUser()->setKey('ses', 'captchaPhrases', $captchaPhrases);
|
||||||
$this->getFeUser()->storeSessionData();
|
$this->getFeUser()->storeSessionData();
|
||||||
return true;
|
return ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$this->addValidationError(
|
$this->addValidationError(
|
||||||
|
|||||||
@@ -46,18 +46,18 @@ class TranslationController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionCont
|
|||||||
} else {
|
} else {
|
||||||
$language = $GLOBALS['TYPO3_REQUEST']->getAttribute('language');
|
$language = $GLOBALS['TYPO3_REQUEST']->getAttribute('language');
|
||||||
}
|
}
|
||||||
$locale = $language->getLocale();
|
$language = $language->getTypo3language();
|
||||||
//\TYPO3\CMS\Extbase\Utility\DebuggerUtility::var_dump(
|
|
||||||
// $locale, '$locale', 3, true, false
|
|
||||||
//);
|
|
||||||
$langfileContent = $languageFactory->getParsedData(
|
$langfileContent = $languageFactory->getParsedData(
|
||||||
$langfilePath,
|
$langfilePath,
|
||||||
$locale
|
$language
|
||||||
);
|
);
|
||||||
$langfileResult = [];
|
$langfileResult = [];
|
||||||
foreach (reset($langfileContent) as $key => $row) {
|
foreach (reset($langfileContent) as $key => $row) {
|
||||||
$langfileResult[$key] = reset($row)['target'];
|
$langfileResult[$key] = reset($row)['target'];
|
||||||
}
|
}
|
||||||
|
foreach ($langfileContent[$language] as $key => $row) {
|
||||||
|
$langfileResult[$key] = reset($row)['target'];
|
||||||
|
}
|
||||||
$result[$extension] = $langfileResult;
|
$result[$extension] = $langfileResult;
|
||||||
}
|
}
|
||||||
$GLOBALS['TSFE']->setContentType('application/json');
|
$GLOBALS['TSFE']->setContentType('application/json');
|
||||||
|
|||||||
@@ -44,7 +44,8 @@ class ApiUtility
|
|||||||
$queryResult,
|
$queryResult,
|
||||||
$additionalAttributes = [],
|
$additionalAttributes = [],
|
||||||
$mapping = [],
|
$mapping = [],
|
||||||
$rootRowClass = null
|
$rootRowClass = null,
|
||||||
|
$options = []
|
||||||
) {
|
) {
|
||||||
$this->objectManager = GeneralUtility::makeInstance(
|
$this->objectManager = GeneralUtility::makeInstance(
|
||||||
ObjectManager::class
|
ObjectManager::class
|
||||||
@@ -130,7 +131,8 @@ class ApiUtility
|
|||||||
$methodResult,
|
$methodResult,
|
||||||
$additionalAttributes[$attributeName],
|
$additionalAttributes[$attributeName],
|
||||||
$mapping,
|
$mapping,
|
||||||
$nextLevelClass
|
$nextLevelClass,
|
||||||
|
$options
|
||||||
);
|
);
|
||||||
if ($imageStorage) {
|
if ($imageStorage) {
|
||||||
foreach ($attributeResult as &$attributeResultRow) {
|
foreach ($attributeResult as &$attributeResultRow) {
|
||||||
@@ -167,7 +169,8 @@ class ApiUtility
|
|||||||
[$methodResult],
|
[$methodResult],
|
||||||
$additionalAttributes[$attributeName],
|
$additionalAttributes[$attributeName],
|
||||||
$mapping,
|
$mapping,
|
||||||
$nextLevelClass
|
$nextLevelClass,
|
||||||
|
$options
|
||||||
)[0];
|
)[0];
|
||||||
$rowResult[$attributeName . 'Uid']
|
$rowResult[$attributeName . 'Uid']
|
||||||
= $rowResult[$attributeName]['uid'];
|
= $rowResult[$attributeName]['uid'];
|
||||||
@@ -218,6 +221,10 @@ class ApiUtility
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (($options['clearIds'] ?? '' ) === true) {
|
||||||
|
unset($rowResult['uid']);
|
||||||
|
unset($rowResult['pid']);
|
||||||
|
}
|
||||||
$result[] = $rowResult;
|
$result[] = $rowResult;
|
||||||
}
|
}
|
||||||
return $result;
|
return $result;
|
||||||
|
|||||||
@@ -37,4 +37,22 @@ class InterfaceUtility
|
|||||||
}, ARRAY_FILTER_USE_KEY);
|
}, ARRAY_FILTER_USE_KEY);
|
||||||
return array_values($constants);
|
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\Fluid\View\TemplatePaths;
|
||||||
use TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface;
|
use TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface;
|
||||||
use Symfony\Component\Mime\Address;
|
use Symfony\Component\Mime\Address;
|
||||||
use TYPO3\CMS\Frontend\Page\PageRepository;
|
use TYPO3\CMS\Core\Domain\Repository\PageRepository;
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -65,12 +65,13 @@ class TranslationUtility
|
|||||||
if (!$extensionKey) {
|
if (!$extensionKey) {
|
||||||
$extensionKey = 'site_templates';
|
$extensionKey = 'site_templates';
|
||||||
}
|
}
|
||||||
return implode([
|
$translation = LocalizationUtility::translate(
|
||||||
'LLL:EXT:',
|
'LLL:EXT:'
|
||||||
$extensionKey,
|
. $extensionKey
|
||||||
'/Resources/Private/Language/locallang_db.xlf:',
|
. '/Resources/Private/Language/locallang_db.xlf:'
|
||||||
$key
|
. $key
|
||||||
]);
|
);
|
||||||
|
return $translation;
|
||||||
} else {
|
} else {
|
||||||
if ($extensionKey) {
|
if ($extensionKey) {
|
||||||
$translation = LocalizationUtility::translate(
|
$translation = LocalizationUtility::translate(
|
||||||
|
|||||||
Reference in New Issue
Block a user