/** * Initializes and runs an extbase controller * * @param string $extensionName Name of extension, in UpperCamelCase * @param string $controller Name of controller, in UpperCamelCase * @param string $action Optional name of action, in lowerCamelCase * @param string $pluginName Optional name of plugin. Default is 'Pi1' * @param array $settings Optional array of settings to use in controller * @param int $pageUid Uid of current page * @param string $vendorName VendorName * @return string output of controller's action */ protected function runExtbaseController($extensionName, $controller, $action = 'index', $pluginName = 'Pi1', $settings = array(), $pageUid = 0, $vendorName = 'PwCommentsTeam') { $GLOBALS['TT'] = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\TimeTracker\\TimeTracker'); $GLOBALS['TSFE'] = GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\Controller\\TypoScriptFrontendController', $GLOBALS['TYPO3_CONF_VARS'], $pageUid, 0); $GLOBALS['TSFE']->sys_page = GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\Page\\PageRepository'); $GLOBALS['TSFE']->initTemplate(); $rootline = $GLOBALS['TSFE']->sys_page->getRootLine($pageUid); $GLOBALS['TSFE']->tmpl->start($rootline); $GLOBALS['TSFE']->getConfigArray(); $pluginSettings = $GLOBALS['TSFE']->tmpl->setup['plugin.']['tx_pwcomments.']; $pwCommentsTypoScript = $pluginSettings['settings.']; \TYPO3\CMS\Frontend\Utility\EidUtility::initLanguage('de'); \TYPO3\CMS\Frontend\Utility\EidUtility::initTCA(); \TYPO3\CMS\Frontend\Utility\EidUtility::initExtensionTCA('pw_comments'); if (unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['pw_comments'])) { $settings = array_merge($settings, unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['pw_comments'])); } $settings = array_merge($settings, $pwCommentsTypoScript); $bootstrap = new \TYPO3\CMS\Extbase\Core\Bootstrap(); $bootstrap->cObj = GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\ContentObject\\ContentObjectRenderer'); $extensionTyposcriptSetup = $this->getExtensionTyposcriptSetup(); $localLangArray = array(); if (is_array($pluginSettings['_LOCAL_LANG.'])) { $typoScriptService = GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Service\\TypoScriptService'); $localLangArray = $typoScriptService->convertTypoScriptArrayToPlainArray($pluginSettings['_LOCAL_LANG.']); } $configuration = array('pluginName' => $pluginName, 'extensionName' => $extensionName, 'controller' => $controller, 'vendorName' => $vendorName, 'controllerConfiguration' => array($controller), 'action' => $action, 'mvc' => array('requestHandlers' => array('TYPO3\\CMS\\Extbase\\Mvc\\Web\\FrontendRequestHandler' => 'TYPO3\\CMS\\Extbase\\Mvc\\Web\\FrontendRequestHandler')), 'settings' => $settings, 'persistence' => $extensionTyposcriptSetup['plugin']['tx_pwcomments']['persistence'], '_LOCAL_LANG' => $localLangArray); return $bootstrap->run('', $configuration); }
/** * Default action. * * @return array * @throws \RuntimeException */ public function main() { $this->init(); $allowedIps = GeneralUtility::trimExplode(',', $this->config['allowedIps'], true); if ($this->config['debug']) { GeneralUtility::sysLog('Connection from ' . GeneralUtility::getIndpEnv('REMOTE_ADDR'), self::$extKey); } if ($this->config['mode'] !== 'M' || count($allowedIps) && !in_array(GeneralUtility::getIndpEnv('REMOTE_ADDR'), $allowedIps)) { $this->denyAccess(); } // Initialize TCA (method handles if not already initialized) if (version_compare(TYPO3_version, '7.6', '>=')) { \TYPO3\CMS\Frontend\Utility\EidUtility::initTCA(); } $this->initTSFE(); if (!empty($this->config['synchronizeDeletedAccounts']) && $this->config['synchronizeDeletedAccounts']) { $additionalFields = ', deleted'; $additionalWhere = ''; } else { $additionalFields = ''; $additionalWhere = ' AND deleted=0'; } $administrators = $this->getDatabaseConnection()->exec_SELECTgetRows('username, admin, disable, realName, email, TSconfig, starttime, endtime, lang, tx_openid_openid' . $additionalFields, 'be_users', 'admin=1 AND tx_openid_openid<>\'\'' . $additionalWhere); if (count($administrators)) { $key = $this->config['preSharedKey']; $data = json_encode($administrators); $encrypted = mcrypt_encrypt(MCRYPT_RIJNDAEL_256, md5($key), $data, MCRYPT_MODE_CBC, md5(md5($key))); $encrypted = base64_encode($encrypted); return $encrypted; } else { throw new \RuntimeException('No administrators found', 1327586994); } }
/** * Get record data from the given table and uid * * @param array $parameter A table 'table', field name 'field' and the value 'value' to find the record * @return tx_caretakerinstance_OperationResult The first found record as an array or FALSE if no record was found */ public function execute($parameter = array()) { $table = $parameter['table']; $field = $parameter['field']; $value = $parameter['value']; $checkEnableFields = $parameter['checkEnableFields'] == TRUE; \TYPO3\CMS\Frontend\Utility\EidUtility::initTCA(); if (!isset($GLOBALS['TCA'][$table])) { return new tx_caretakerinstance_OperationResult(FALSE, 'Table [' . $table . '] not found in the TCA'); } if (!isset($GLOBALS['TCA'][$table]['columns'][$field]) && !in_array($field, $this->implicitFields)) { return new tx_caretakerinstance_OperationResult(FALSE, 'Field [' . $field . '] of table [' . $table . '] not found in the TCA'); } $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', $table, $field . ' = ' . $GLOBALS['TYPO3_DB']->fullQuoteStr($value, $table) . ($checkEnableFields ? $this->enableFields($table) : '')); if ($result) { $record = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result); if ($record !== FALSE) { if (isset($this->protectedFieldsByTable[$table])) { $protectedFields = $this->protectedFieldsByTable[$table]; foreach ($protectedFields as $protectedField) { unset($record[$protectedField]); } } return new tx_caretakerinstance_OperationResult(TRUE, $record); } else { return new tx_caretakerinstance_OperationResult(TRUE, FALSE); } } else { return new tx_caretakerinstance_OperationResult(FALSE, 'Error when executing SQL: [' . $GLOBALS['TYPO3_DB']->sql_error() . ']'); } }
/** * Initializes TSFE and sets $GLOBALS['TSFE'] * * @return void */ protected function initTSFE() { $GLOBALS['TSFE'] = $tsfe = GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\Controller\\TypoScriptFrontendController', $GLOBALS['TYPO3_CONF_VARS'], GeneralUtility::_GP('id'), ''); /** @var \TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController $tsfe */ $tsfe->connectToDB(); $tsfe->initFEuser(); \TYPO3\CMS\Frontend\Utility\EidUtility::initTCA(); $tsfe->determineId(); $tsfe->initTemplate(); $tsfe->getConfigArray(); // Get linkVars, absRefPrefix, etc \TYPO3\CMS\Frontend\Page\PageGenerator::pagegenInit(); }
/** * Initializes TSFE and sets $GLOBALS['TSFE']. * * @return void */ protected function initTSFE() { $pageId = GeneralUtility::_GP('id'); /** @var \TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController $tsfe */ $GLOBALS['TSFE'] = GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\Controller\\TypoScriptFrontendController', $GLOBALS['TYPO3_CONF_VARS'], $pageId, ''); \TYPO3\CMS\Frontend\Utility\EidUtility::initLanguage(); \TYPO3\CMS\Frontend\Utility\EidUtility::initTCA(); $GLOBALS['TSFE']->initFEuser(); // We do not want (nor need) EXT:realurl to be invoked: //$GLOBALS['TSFE']->checkAlternativeIdMethods(); $GLOBALS['TSFE']->determineId(); $GLOBALS['TSFE']->initTemplate(); $GLOBALS['TSFE']->getConfigArray(); if ($pageId > 0) { $GLOBALS['TSFE']->settingLanguage(); } $GLOBALS['TSFE']->settingLocale(); }
/** * Boostrap of Typo3 for eID environment */ public static function initEnvironment() { /* @var $GLOBALS['TSFE'] \TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController */ $GLOBALS['TSFE'] = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController::class, $GLOBALS['TYPO3_CONF_VARS'], null, 0); \TYPO3\CMS\Frontend\Utility\EidUtility::initLanguage(); $GLOBALS['TSFE']->connectToDB(); $GLOBALS['TSFE']->initFEuser(); $GLOBALS['TSFE']->initUserGroups(); \TYPO3\CMS\Frontend\Utility\EidUtility::initTCA(); $GLOBALS['TSFE']->checkAlternativeIdMethods(); $GLOBALS['TSFE']->clear_preview(); $GLOBALS['TSFE']->determineId(); $GLOBALS['TSFE']->initTemplate(); $GLOBALS['TSFE']->getConfigArray(); $GLOBALS['TSFE']->cObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::class); $GLOBALS['TSFE']->settingLanguage(); $GLOBALS['TSFE']->settingLocale(); \TYPO3\CMS\Core\Core\Bootstrap::getInstance()->loadCachedTca(); }
/** * */ public function __construct() { \TYPO3\CMS\Frontend\Utility\EidUtility::initFeUser(); \TYPO3\CMS\Frontend\Utility\EidUtility::initLanguage(); \TYPO3\CMS\Frontend\Utility\EidUtility::initTCA(); }
* 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\GeneralUtility; use TYPO3\CMS\Frontend\Utility\EidUtility; # TSFE initialization $pageId = filter_var(GeneralUtility::_GET('id'), FILTER_SANITIZE_NUMBER_INT); $languageId = filter_var(GeneralUtility::_GET('L'), FILTER_VALIDATE_INT, array('options' => array('default' => 0, 'min_range' => 0))); $GLOBALS['TSFE'] = GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\Controller\\TypoScriptFrontendController', $GLOBALS['TYPO3_CONF_VARS'], $pageId, 0, TRUE); $GLOBALS['TSFE']->initFEuser(); $GLOBALS['TSFE']->initUserGroups(); // load TCA EidUtility::initTCA(); $GLOBALS['TSFE']->sys_page = GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\Page\\PageRepository'); $GLOBALS['TSFE']->rootLine = $GLOBALS['TSFE']->sys_page->getRootLine($pageId, ''); $GLOBALS['TSFE']->initTemplate(); $GLOBALS['TSFE']->getConfigArray(); $GLOBALS['TSFE']->sys_language_uid = $languageId; $solrConfiguration = Tx_Solr_Util::getSolrConfiguration(); #--- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- # Building Suggest Query $q = trim(GeneralUtility::_GP('termLowercase')); $isOpenSearchRequest = FALSE; if ('OpenSearch' == GeneralUtility::_GET('format')) { $isOpenSearchRequest = TRUE; $q = GeneralUtility::_GET('q'); } $allowedSites = Tx_Solr_Util::resolveSiteHashAllowedSites($pageId, $solrConfiguration['search.']['query.']['allowedSites']);
/** * Tx_FeatureFlag_Service_Eid constructor. * @param Tx_FeatureFlag_Service $service */ public function __construct(Tx_FeatureFlag_Service $service, Tx_FeatureFlag_System_Typo3_CacheManager $cacheManager) { $this->featureFlagService = $service; $this->cacheManager = $cacheManager; \TYPO3\CMS\Frontend\Utility\EidUtility::initTCA(); }
/** * Initializes a TypoScript Frontend necessary for using TypoScript and TypoLink functions * * @param int $id * @param int $typeNum * * @return void */ protected function initTSFE($id = 1, $typeNum = 0) { \TYPO3\CMS\Frontend\Utility\EidUtility::initTCA(); if (!is_object($GLOBALS['TT'])) { $GLOBALS['TT'] = new \TYPO3\CMS\Core\TimeTracker\NullTimeTracker(); $GLOBALS['TT']->start(); } $GLOBALS['TSFE'] = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\Controller\\TypoScriptFrontendController', $GLOBALS['TYPO3_CONF_VARS'], $id, $typeNum); $GLOBALS['TSFE']->sys_page = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\Page\\PageRepository'); $GLOBALS['TSFE']->sys_page->init(TRUE); $GLOBALS['TSFE']->connectToDB(); $GLOBALS['TSFE']->initFEuser(); $GLOBALS['TSFE']->determineId(); $GLOBALS['TSFE']->initTemplate(); $GLOBALS['TSFE']->rootLine = $GLOBALS['TSFE']->sys_page->getRootLine($id, ''); $GLOBALS['TSFE']->getConfigArray(); \TYPO3\CMS\Frontend\Page\PageGenerator::pagegenInit(); }
/** * @return $this */ public function initTca() { \TYPO3\CMS\Frontend\Utility\EidUtility::initTCA(); return $this; }
/** * Initializes tslib_fe and sets it to $GLOBALS['TSFE'] * * @return void */ protected function initTSFE() { \TYPO3\CMS\Frontend\Utility\EidUtility::initTCA(); $pid = \TYPO3\CMS\Core\Utility\MathUtility::convertToPositiveInteger(GeneralUtility::_GP('id')); $GLOBALS['TSFE'] = GeneralUtility::makeInstance('tslib_fe', $GLOBALS['TYPO3_CONF_VARS'], $pid, 0, 0, 0); $GLOBALS['TSFE']->connectToDB(); $GLOBALS['TSFE']->initFEuser(); //!TODO first check if already a fe_user session exists - otherwise this line will overwrite the existing one $GLOBALS['TSFE']->checkAlternativeIdMethods(); $GLOBALS['TSFE']->determineId(); $GLOBALS['TSFE']->initTemplate(); $GLOBALS['TSFE']->getConfigArray(); $GLOBALS['TSFE']->cObj = GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\ContentObject\\ContentObjectRenderer'); }
// Make new instance of TSFE //$temp_TSFEclassName = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstanceClassName('tslib_fe'); //$GLOBALS['TSFE'] = new \TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController ( // $GLOBALS['TYPO3_CONF_VARS'], // $id, // \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('type'), // \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('no_cache'), // \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('cHash'), // \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('jumpurl'), // \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('MP'), // \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('RDCT') //); // // $GLOBALS['TSFE'] = GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\Controller\\TypoScriptFrontendController', $GLOBALS['TYPO3_CONF_VARS'], $id, \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('type')); \TYPO3\CMS\Frontend\Utility\EidUtility::initTCA(); // don't cache ajax responses $GLOBALS['TSFE']->no_cache = true; $GLOBALS['TSFE']->connectToDB(); $GLOBALS['TSFE']->initFEuser(); //$GLOBALS['TSFE']->checkAlternativeIdMethods(); //$GLOBALS['TSFE']->clear_preview(); $GLOBALS['TSFE']->determineId(); $GLOBALS['TSFE']->initTemplate(); //$GLOBALS['TSFE']->getConfigArray(); if ($L > 0) { $GLOBALS['TSFE']->settingLanguage(); $GLOBALS['TSFE']->settingLocale(); } // finding the script path from the variable $ajaxID = (string) GeneralUtility::_GP('ajaxID');
/** * Initializes the TCA. * * @return void */ protected function initializeTca() { \TYPO3\CMS\Frontend\Utility\EidUtility::initTCA(); }
/** * Create a TypoScript Frontend Controller * * @return \MAB\MabContact\Eid\ControllerActionDispatcher */ protected function initTypoScriptFrontendController() { // Get page uid and mount point, if any $this->pageUid = GeneralUtility::_GET('id'); if (!isset($this->pageUid)) { $this->pageUid = 0; } $this->pageUid = htmlspecialchars($this->pageUid); $MP = htmlspecialchars(GeneralUtility::_GET('MP')); \TYPO3\CMS\Frontend\Utility\EidUtility::initTCA(); $GLOBALS['TSFE'] = $this->objectManager->get('TYPO3\\CMS\\Frontend\\Controller\\TypoScriptFrontendController', $GLOBALS['TYPO3_CONF_VARS'], $this->pageUid, 0, true, '', '', $MP, ''); $GLOBALS['TSFE']->initFeUser(); $GLOBALS['TSFE']->determineId(); return $this; }
/** * Construct the URL for an internal page * * We need TSFE for that, but this is not available at this point * so we need to call it. * * @return string */ protected function constructUrlForInternalPage() { \TYPO3\CMS\Frontend\Utility\EidUtility::initTCA(); $this->setTypoScriptFrontendController(); return $this->getTypoScriptFrontendController()->cObj->typoLink_URL(['parameter' => $this->internalPage, 'forceAbsoluteUrl' => true, 'additionalParams' => '&L=' . $this->languageUid]); }
/** * Initializes the $GLOBALS['TSFE'] var, useful everywhere when in a * Frontend context. * * @param int $id The id of the rootPage from which you want the controller to be based on. */ private function initializeTSFE($id) { if (TYPO3_MODE == 'FE') { $frontendController = $this->getFrontendController($id); EidUtility::initLanguage(); EidUtility::initTCA(); // No Cache for Ajax stuff. $frontendController->set_no_cache(); $frontendController->initFEuser(); $frontendController->checkAlternativeIdMethods(); $frontendController->determineId(); $frontendController->initTemplate(); $frontendController->getPageAndRootline(); $frontendController->getConfigArray(); $frontendController->connectToDB(); $frontendController->settingLanguage(); } }
/** * initialize the TYPO3 frontend * * @param integer $id * @param integer $typeNum */ protected function initTSFE($id = 1, $typeNum = 0) { EidUtility::initTCA(); if (!is_object($GLOBALS['TT'])) { $GLOBALS['TT'] = new \TYPO3\CMS\Core\TimeTracker\NullTimeTracker(); $GLOBALS['TT']->start(); } $GLOBALS['TSFE'] = GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\Controller\\TypoScriptFrontendController', $GLOBALS['TYPO3_CONF_VARS'], $id, $typeNum); $GLOBALS['TSFE']->connectToDB(); $GLOBALS['TSFE']->initFEuser(); $GLOBALS['TSFE']->determineId(); $GLOBALS['TSFE']->initTemplate(); $GLOBALS['TSFE']->getConfigArray(); if (ExtensionManagementUtility::isLoaded('realurl')) { $rootline = BackendUtility::BEgetRootLine($id); $host = BackendUtility::firstDomainRecord($rootline); $_SERVER['HTTP_HOST'] = $host; } }
/** * Init the TSFE array */ protected function initTSFE() { $GLOBALS['TSFE'] = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\Controller\\TypoScriptFrontendController', $GLOBALS['TYPO3_CONF_VARS'], 0, 0); \TYPO3\CMS\Frontend\Utility\EidUtility::initTCA(); \TYPO3\CMS\Frontend\Utility\EidUtility::initLanguage(); $GLOBALS['TSFE']->initFEuser(); $GLOBALS['TSFE']->set_no_cache(); $GLOBALS['TSFE']->checkAlternativeIdMethods(); $GLOBALS['TSFE']->determineId(); $GLOBALS['TSFE']->initTemplate(); $GLOBALS['TSFE']->getConfigArray(); \TYPO3\CMS\Core\Core\Bootstrap::getInstance()->loadCachedTca(); $GLOBALS['TSFE']->cObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\ContentObject\\ContentObjectRenderer'); $GLOBALS['TSFE']->settingLanguage(); $GLOBALS['TSFE']->settingLocale(); }