fe_user) * @deprecated since TYPO3 v9.4, will be removed in TYPO3 v10.0. Use the FrontendUserAuthenticator PSR-15 middleware to set up the Frontend User. */ public static function initFeUser() { trigger_error('EidUtility::initFeUser() will be removed in TYPO3 v10.0. Use a PSR-15 middleware instead.', E_USER_DEPRECATED); // Get TSFE instance. It knows how to initialize the user. $tsfe = self::getTSFE(); $tsfe->fe_user = GeneralUtility::makeInstance(FrontendUserAuthentication::class); // List of pid's acceptable $pid = GeneralUtility::_GP('pid'); $tsfe->fe_user->checkPid_value = $pid ? implode(',', GeneralUtility::intExplode(',', $pid)) : 0; // Check if a session is transferred: if (GeneralUtility::_GP('FE_SESSION_KEY')) { $fe_sParts = explode('-', GeneralUtility::_GP('FE_SESSION_KEY')); // If the session key hash check is OK: if (md5($fe_sParts[0] . '/' . $GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey']) === (string)$fe_sParts[1]) { $cookieName = FrontendUserAuthentication::getCookieName(); $_COOKIE[$cookieName] = $fe_sParts[0]; if (isset($_SERVER['HTTP_COOKIE'])) { // See http://forge.typo3.org/issues/27740 $_SERVER['HTTP_COOKIE'] .= ';' . $cookieName . '=' . $fe_sParts[0]; } $tsfe->fe_user->forceSetCookie = true; $tsfe->fe_user->dontSetCookie = false; unset($cookieName); } } $tsfe->fe_user->start(); $tsfe->fe_user->unpack_uc(); // Call hook for possible manipulation of frontend user object $_params = ['pObj' => &$tsfe]; foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_fe.php']['initFEuser'] ?? [] as $_funcRef) { GeneralUtility::callUserFunction($_funcRef, $_params, $tsfe); } // Return FE user object: return $tsfe->fe_user; } /** * Initializes $GLOBALS['LANG'] for use in eID scripts. * * @param string $language TYPO3 language code * @deprecated since TYPO3 v9.4, will be removed in TYPO3 v10.0. Instantiate the LanguageService by yourself instead. */ public static function initLanguage($language = 'default') { trigger_error('EidUtility::initLanguage() will be removed in TYPO3 v10.0. Ensure to intantiate the LanguageService by yourself.', E_USER_DEPRECATED); if (!is_object($GLOBALS['LANG'])) { $GLOBALS['LANG'] = GeneralUtility::makeInstance(LanguageService::class); $GLOBALS['LANG']->init($language); } } /** * Makes TCA available inside eID * @deprecated since TYPO3 v9.4, will be removed in TYPO3 v10.0. Is not needed anymore within eID scripts as TCA is now available at any time */ public static function initTCA() { trigger_error('EidUtility::initTCA() will be removed in TYPO3 v10.0. Is not needed anymore within eID scripts as TCA is now available at any time.', E_USER_DEPRECATED); // Some badly made extensions attempt to manipulate TCA in a wrong way // (inside ext_localconf.php). Therefore $GLOBALS['TCA'] may become an array // but in fact it is not loaded. The check below ensure that // TCA is still loaded if such bad extensions are installed if (!is_array($GLOBALS['TCA']) || !isset($GLOBALS['TCA']['pages'])) { ExtensionManagementUtility::loadBaseTca(); } } /** * Makes TCA for the extension available inside eID. Use this function if * you need not to include the whole $GLOBALS['TCA']. * * @param string $extensionKey Extension key * @deprecated since TYPO3 v9.4, will be removed in TYPO3 v10.0. */ public static function initExtensionTCA($extensionKey) { trigger_error('EidUtility::initExtensionTCA() will be removed in TYPO3 v10.0 as it is discouraged to only load ext_tables.php of one extension. Use ExtensionManagementUtility instead.', E_USER_DEPRECATED); $extTablesPath = ExtensionManagementUtility::extPath($extensionKey, 'ext_tables.php'); if (file_exists($extTablesPath)) { $GLOBALS['_EXTKEY'] = $extensionKey; require_once $extTablesPath; // We do not need to save restore the value of $GLOBALS['_EXTKEY'] // because it is not defined to anything real outside of // ext_tables.php or ext_localconf.php scope. unset($GLOBALS['_EXTKEY']); } } /** * Creating a single static cached instance of TSFE to use with this class. * * @return TypoScriptFrontendController */ private static function getTSFE(): TypoScriptFrontendController { $runtimeCache = GeneralUtility::makeInstance(CacheManager::class)->getCache('cache_runtime'); $tsfe = $runtimeCache->get('eidUtilityTsfe') ?: null; if ($tsfe === null) { $tsfe = GeneralUtility::makeInstance(TypoScriptFrontendController::class, null, 0, 0); $runtimeCache->set('eidUtilityTsfe', $tsfe); } return $tsfe; } }