/** * Routes the given eID action to the related ExtDirect method with the necessary * ajax object. * * @return void */ public function routeAction() { \TYPO3\CMS\Frontend\Utility\EidUtility::initLanguage(); $ajaxID = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('action'); $ajaxScript = $GLOBALS['TYPO3_CONF_VARS']['BE']['AJAX']['ExtDirect::' . $ajaxID]['callbackMethod']; $this->ajaxObject = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Http\\AjaxRequestHandler', 'ExtDirect::' . $ajaxID); $parameters = array(); \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($ajaxScript, $parameters, $this->ajaxObject, FALSE, TRUE); }
/** * Initialize the TSFE. * * @param integer $pageUid The page UID * @param boolean $overrule * @return void */ public function initTSFE($pageUid = -1, $overrule = FALSE) { $rootLine = NULL; $typo3confVariables = $GLOBALS['TYPO3_CONF_VARS']; if ($pageUid == -1 && GeneralUtility::_GP('pid') !== NULL) { $pageUid = intval(GeneralUtility::_GP('pid')); } if ($pageUid === -1) { $pageUid = 0; } // begin if (!is_object($GLOBALS['TT']) || $overrule === TRUE) { $GLOBALS['TT'] = new \TYPO3\CMS\Core\TimeTracker\TimeTracker(); $GLOBALS['TT']->start(); } if ((!is_object($GLOBALS['TSFE']) || $GLOBALS['TSFE'] instanceof \stdClass || $overrule === TRUE) && is_int($pageUid)) { // builds TSFE object $GLOBALS['TSFE'] = $typoScriptFrontendController = new \TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController($typo3confVariables, $pageUid, 0, 0, '', '', '', ''); $typoScriptFrontendController->initTemplate(); // builds a cObj if (is_array($typoScriptFrontendController->page) === FALSE) { $typoScriptFrontendController->page = array(); } $typoScriptFrontendController->newCObj(); // Add the FE user $typoScriptFrontendController->fe_user = EidUtility::initFeUser(); $typoScriptFrontendController->determineId(); $typoScriptFrontendController->getConfigArray(); $this->setRequestedLanguage($typoScriptFrontendController); $typoScriptFrontendController->settingLanguage(); $typoScriptFrontendController->settingLocale(); } }
/** * Initialize frontend environment */ public function __construct() { if (empty($_POST['tx_ajaxexample_piexample']['action'])) { $_POST['tx_ajaxexample_piexample']['action'] = 'hello'; } $_POST['tx_ajaxexample_piexample']['controller'] = 'Example'; $this->bootstrap = GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Core\\Bootstrap'); $feUserObj = EidUtility::initFeUser(); $pageId = GeneralUtility::_GET('id') ?: 1; /** @var TypoScriptFrontendController $typoScriptFrontendController */ $typoScriptFrontendController = GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\Controller\\TypoScriptFrontendController', $GLOBALS['TYPO3_CONF_VARS'], $pageId, 0, TRUE); $GLOBALS['TSFE'] = $typoScriptFrontendController; $typoScriptFrontendController->connectToDB(); $typoScriptFrontendController->fe_user = $feUserObj; $typoScriptFrontendController->id = $pageId; $typoScriptFrontendController->determineId(); $typoScriptFrontendController->getCompressedTCarray(); $typoScriptFrontendController->initTemplate(); $typoScriptFrontendController->getConfigArray(); $typoScriptFrontendController->includeTCA(); /** @var TypoScriptService $typoScriptService */ $typoScriptService = GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Service\\TypoScriptService'); $pluginConfiguration = $typoScriptService->convertTypoScriptArrayToPlainArray($typoScriptFrontendController->tmpl->setup['plugin.']['tx_ajaxexample.']); // Set configuration to call the plugin $this->pluginConfiguration = array('pluginName' => 'PiExample', 'vendorName' => 'Helhum', 'extensionName' => 'AjaxExample', 'controller' => 'Example', 'action' => $_POST['tx_ajaxexample_piexample']['action'], 'mvc' => array('requestHandlers' => array('TYPO3\\CMS\\Extbase\\Mvc\\Web\\FrontendRequestHandler' => 'TYPO3\\CMS\\Extbase\\Mvc\\Web\\FrontendRequestHandler')), 'settings' => $pluginConfiguration['settings'], 'persistence' => array('storagePid' => $pluginConfiguration['persistence']['storagePid'])); }
/** * 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 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); } }
/** * Handles a frontend request based on the _GP "eID" variable. * * @return void */ public function handleRequest() { // Timetracking started $configuredCookieName = trim($GLOBALS['TYPO3_CONF_VARS']['BE']['cookieName']); if (empty($configuredCookieName)) { $configuredCookieName = 'be_typo_user'; } if ($_COOKIE[$configuredCookieName]) { $GLOBALS['TT'] = new TimeTracker(); } else { $GLOBALS['TT'] = new NullTimeTracker(); } $GLOBALS['TT']->start(); // Hook to preprocess the current request if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/index_ts.php']['preprocessRequest'])) { foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/index_ts.php']['preprocessRequest'] as $hookFunction) { $hookParameters = array(); GeneralUtility::callUserFunction($hookFunction, $hookParameters, $hookParameters); } unset($hookFunction); unset($hookParameters); } // Remove any output produced until now $this->bootstrap->endOutputBufferingAndCleanPreviousOutput(); require EidUtility::getEidScriptPath(); $this->bootstrap->shutdown(); exit; }
public function initialize() { $feUserObj = EidUtility::initFeUser(); $pageId = GeneralUtility::_GET('id') ?: 1; /** @var TypoScriptFrontendController $typoScriptFrontendController */ $typoScriptFrontendController = GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\Controller\\TypoScriptFrontendController', $GLOBALS['TYPO3_CONF_VARS'], $pageId, 0, TRUE); $GLOBALS['TSFE'] = $typoScriptFrontendController; $typoScriptFrontendController->connectToDB(); $typoScriptFrontendController->fe_user = $feUserObj; $typoScriptFrontendController->id = 2653; $typoScriptFrontendController->determineId(); $typoScriptFrontendController->getCompressedTCarray(); $typoScriptFrontendController->initTemplate(); $typoScriptFrontendController->getConfigArray(); $typoScriptFrontendController->includeTCA(); /** @var TypoScriptService $typoScriptService */ $typoScriptService = GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Service\\TypoScriptService'); $pluginTyposcript = $typoScriptFrontendController->tmpl->setup['plugin.'][$this->extensionConfiguration['extensionKey'] . '.']; $this->pluginConfiguration = $typoScriptService->convertTypoScriptArrayToPlainArray($pluginTyposcript); // Set configuration to call the plugin $extensionConfiguration['settings'] = $this->pluginConfiguration['settings']; $extensionConfiguration['persistence'] = $this->pluginConfiguration['persistence']; $this->extensionConfiguration = array_merge($extensionConfiguration, $this->extensionConfiguration); $this->bootstrap = GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Core\\Bootstrap'); $this->bootstrap->initialize($this->extensionConfiguration); }
/** * Routes the given eID action to the related ExtDirect method with the necessary * ajax object. * * @param string $ajaxID * @return void */ protected function routeAction($ajaxID) { EidUtility::initLanguage(); $ajaxScript = $GLOBALS['TYPO3_CONF_VARS']['BE']['AJAX']['ExtDirect::' . $ajaxID]['callbackMethod']; $this->ajaxObject = GeneralUtility::makeInstance(AjaxRequestHandler::class, 'ExtDirect::' . $ajaxID); $parameters = array(); GeneralUtility::callUserFunction($ajaxScript, $parameters, $this->ajaxObject, false, true); }
/** * @return FrontendUserAuthentication */ protected function getFrontendUserAuthentication() { if ($this->frontendUserAuthentication === null) { if ($this->getTypoScriptFrontendController() !== null) { $this->frontendUserAuthentication = $this->getTypoScriptFrontendController()->fe_user; } else { $this->frontendUserAuthentication = EidUtility::initFeUser(); } } return $this->frontendUserAuthentication; }
/** * 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(); }
/** * Processes eID request. * * @return void */ public function main() { // Due to the nature of OpenID (redrections, etc) we need to force user // session fetching if there is no session around. This ensures that // our service is called even if there is no login data in the request. // Inside the service we will process OpenID response and authenticate // the user. $GLOBALS['TYPO3_CONF_VARS']['SVCONF']['auth']['FE_fetchUserIfNoSession'] = TRUE; // Initialize Frontend user \TYPO3\CMS\Frontend\Utility\EidUtility::connectDB(); \TYPO3\CMS\Frontend\Utility\EidUtility::initFeUser(); // Redirect to the original location in any case (authenticated or not) @ob_end_clean(); \TYPO3\CMS\Core\Utility\HttpUtility::redirect(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('tx_openid_location'), \TYPO3\CMS\Core\Utility\HttpUtility::HTTP_STATUS_303); }
/** * Initialize Extbase * * @param array $typo3ConfVars */ public function __construct($typo3ConfVars) { $this->configuration = ['pluginName' => 'Pi2', 'vendorName' => 'Gigabonus', 'extensionName' => 'Gbfemanager', 'controller' => 'Validation', 'action' => 'validate']; $_POST['tx_gbpartner_categorylisting']['action'] = 'validate'; $_POST['tx_gbpartner_categorylisting']['controller'] = 'Validation'; $this->bootstrap = new Bootstrap(); $userObj = EidUtility::initFeUser(); $pid = GeneralUtility::_GP('id') ? GeneralUtility::_GP('id') : 1; $GLOBALS['TSFE'] = GeneralUtility::makeInstance(TypoScriptFrontendController::class, $typo3ConfVars, $pid, 0, true); $GLOBALS['TSFE']->connectToDB(); $GLOBALS['TSFE']->fe_user = $userObj; $GLOBALS['TSFE']->id = $pid; $GLOBALS['TSFE']->determineId(); $GLOBALS['TSFE']->initTemplate(); $GLOBALS['TSFE']->getConfigArray(); }
/** * Check FE Session * * @return bool */ public function render() { // settings $userObj = EidUtility::initFeUser(); $GLOBALS['TSFE'] = GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\Controller\\TypoScriptFrontendController', $GLOBALS['TYPO3_CONF_VARS'], GeneralUtility::_GET('id'), 0, true); $GLOBALS['TSFE']->fe_user = $userObj; // random value for session storing $value = md5(time()); // store in session $GLOBALS['TSFE']->fe_user->setKey('ses', $this->sessionKey, $value); $GLOBALS['TSFE']->storeSessionData(); if ($GLOBALS['TSFE']->fe_user->getKey('ses', $this->sessionKey) === $value) { return true; } return false; }
/** * Initialize Extbase * * @param array $typo3ConfVars */ public function __construct($typo3ConfVars) { $this->configuration = ['pluginName' => 'Pi1', 'vendorName' => 'In2code', 'extensionName' => 'Femanager', 'controller' => 'User', 'action' => 'fileDelete', 'mvc' => ['requestHandlers' => ['TYPO3\\CMS\\Extbase\\Mvc\\Web\\FrontendRequestHandler' => 'TYPO3\\CMS\\Extbase\\Mvc\\Web\\FrontendRequestHandler']], 'settings' => []]; $_POST['tx_femanager_pi1']['action'] = 'fileDelete'; $_POST['tx_femanager_pi1']['controller'] = 'User'; $this->bootstrap = new Bootstrap(); $userObj = EidUtility::initFeUser(); $pid = GeneralUtility::_GET('id') ? GeneralUtility::_GET('id') : 1; $GLOBALS['TSFE'] = GeneralUtility::makeInstance(TypoScriptFrontendController::class, $typo3ConfVars, $pid, 0, true); $GLOBALS['TSFE']->connectToDB(); $GLOBALS['TSFE']->fe_user = $userObj; $GLOBALS['TSFE']->id = $pid; $GLOBALS['TSFE']->determineId(); $GLOBALS['TSFE']->initTemplate(); $GLOBALS['TSFE']->getConfigArray(); }
/** * @return \TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController */ protected function getConfiguredTSFE($TYPO3_CONF_VARS = array(), $id = 1, $type = 0) { /** @var $TSFE \TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController */ $TSFE = GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\Controller\\TypoScriptFrontendController', $TYPO3_CONF_VARS, $id, $type); \TYPO3\CMS\Frontend\Utility\EidUtility::initLanguage(); $TSFE->initFEuser(); $TSFE->set_no_cache(); $TSFE->checkAlternativeIdMethods(); $TSFE->determineId(); $TSFE->initTemplate(); $TSFE->getConfigArray(); \TYPO3\CMS\Core\Core\Bootstrap::getInstance(); $TSFE->settingLanguage(); $TSFE->settingLocale(); return $TSFE; }
/** * Initialize Extbase * * @param array $TYPO3_CONF_VARS */ public function __construct($TYPO3_CONF_VARS) { $this->configuration = array('pluginName' => 'Pi1', 'vendorName' => 'In2', 'extensionName' => 'Femanager', 'controller' => 'User', 'action' => 'fileUpload', 'mvc' => array('requestHandlers' => array('TYPO3\\CMS\\Extbase\\Mvc\\Web\\FrontendRequestHandler' => 'TYPO3\\CMS\\Extbase\\Mvc\\Web\\FrontendRequestHandler')), 'settings' => array()); $_POST['tx_femanager_pi1']['action'] = 'fileUpload'; $_POST['tx_femanager_pi1']['controller'] = 'User'; $this->bootstrap = new Bootstrap(); $userObj = EidUtility::initFeUser(); $pid = GeneralUtility::_GET('id') ? GeneralUtility::_GET('id') : 1; $GLOBALS['TSFE'] = GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\Controller\\TypoScriptFrontendController', $TYPO3_CONF_VARS, $pid, 0, TRUE); $GLOBALS['TSFE']->connectToDB(); $GLOBALS['TSFE']->fe_user = $userObj; $GLOBALS['TSFE']->id = $pid; $GLOBALS['TSFE']->determineId(); $GLOBALS['TSFE']->initTemplate(); $GLOBALS['TSFE']->getConfigArray(); }
/** * 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(); }
/** * Processes eID request. * * @return void */ public function main() { // Due to the nature of OpenID (redrections, etc) we need to force user // session fetching if there is no session around. This ensures that // our service is called even if there is no login data in the request. // Inside the service we will process OpenID response and authenticate // the user. $GLOBALS['TYPO3_CONF_VARS']['SVCONF']['auth']['FE_fetchUserIfNoSession'] = true; // Initialize Frontend user EidUtility::initFeUser(); // Redirect to the original location in any case (authenticated or not) @ob_end_clean(); $location = GeneralUtility::_GP('tx_openid_location'); $signature = GeneralUtility::hmac($location, 'openid'); if ($signature === GeneralUtility::_GP('tx_openid_location_signature')) { HttpUtility::redirect($location, HttpUtility::HTTP_STATUS_303); } }
/** * Build up the TSFE */ public function buildFrontend() { global $TSFE; EidUtility::initLanguage(); /** @var TypoScriptFrontendController $TSFE */ $TSFE = GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\Controller\\TypoScriptFrontendController', $GLOBALS['TYPO3_CONF_VARS'], 0, 0); EidUtility::initLanguage(); // Get FE User Information $TSFE->initFEuser(); // Important: no Cache for Ajax stuff $TSFE->set_no_cache(); $TSFE->initTemplate(); // $TSFE->getConfigArray(); Bootstrap::getInstance()->loadCachedTca(); $TSFE->cObj = GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\ContentObject\\ContentObjectRenderer'); $TSFE->settingLanguage(); $TSFE->settingLocale(); }
/** * Initialize Extbase * * @param \array $TYPO3_CONF_VARS The global array. Will be set internally */ public function __construct($TYPO3_CONF_VARS) { $this->configuration = array('pluginName' => 'Pi1', 'vendorName' => 'In2code', 'extensionName' => 'Powermail', 'controller' => 'Form', 'action' => 'validateAjax', 'mvc' => array('requestHandlers' => array('TYPO3\\CMS\\Extbase\\Mvc\\Web\\FrontendRequestHandler' => 'TYPO3\\CMS\\Extbase\\Mvc\\Web\\FrontendRequestHandler')), 'settings' => array()); $_POST['tx_powermail_pi1']['action'] = 'validateAjax'; $_POST['tx_powermail_pi1']['controller'] = 'Form'; $this->bootstrap = new \TYPO3\CMS\Extbase\Core\Bootstrap(); $userObj = \TYPO3\CMS\Frontend\Utility\EidUtility::initFeUser(); $pid = GeneralUtility::_GET('id') ? GeneralUtility::_GET('id') : 1; $GLOBALS['TSFE'] = GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\Controller\\TypoScriptFrontendController', $TYPO3_CONF_VARS, $pid, 0, TRUE); $GLOBALS['TSFE']->connectToDB(); $GLOBALS['TSFE']->fe_user = $userObj; $GLOBALS['TSFE']->id = $pid; $GLOBALS['TSFE']->determineId(); $GLOBALS['TSFE']->getCompressedTCarray(); $GLOBALS['TSFE']->initTemplate(); $GLOBALS['TSFE']->getConfigArray(); $GLOBALS['TSFE']->includeTCA(); }
/** * 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(); }
function main() { # $this->initTSFE(); $reference = $_GET['reference']; $langKey = $_GET['lang']; $feUserObj = \TYPO3\CMS\Frontend\Utility\EidUtility::initFeUser(); // Initialize FE user object // tslib_eidtools::connectDB(); //Connect to database // ... #var_dump($feUserObj); if ($feUserObj->user === FALSE) { ##var_dump($feUserObj->user); return false; } else { $data = array(); $data['user'] = $feUserObj->user; $data['lang'] = $langKey; $data['time'] = date('c'); $url = 'http://www.tracepartsonline.net/ws/Winkel/reference.aspx?reference=' . $reference . '&r_country=' . $langKey . '&r_email=' . rawurlencode($feUserObj->user['email']) . '&r_phone=' . rawurlencode($feUserObj->user['telephone']) . '&r_name=' . rawurlencode($feUserObj->user['name']) . '&r_company=' . rawurlencode($feUserObj->user['company']); #$data['htmlCode'] = '<a href="' . $url. '" class="rollen fancyboxmin" data-feuser="******" ><img src="/fileadmin/template/images/cad.jpg"></a> <!-- TEST -->'; return json_encode($data); } }
/** * 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; } }
/** * 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]); }
/** * 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; }
/** * Initialise feUser */ protected function initializeUserAuthentication() { if ($this->feUser === null) { $this->feUser = \TYPO3\CMS\Frontend\Utility\EidUtility::initFeUser(); $this->feUser->fetchGroupData(); } }
/** * Initialize frontend environment * * @return void */ public function __construct() { $this->bootstrap = GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Core\\Bootstrap'); $feUserObj = EidUtility::initFeUser(); $pageId = GeneralUtility::_GET('id') ?: 1; $pageType = GeneralUtility::_GET('type') ?: 0; /** @var TypoScriptFrontendController $typoScriptFrontendController */ $this->typoScriptFrontendController = GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\Controller\\TypoScriptFrontendController', $GLOBALS['TYPO3_CONF_VARS'], $pageId, $pageType, true); $GLOBALS['TSFE'] = $this->typoScriptFrontendController; $this->typoScriptFrontendController->connectToDB(); $this->typoScriptFrontendController->fe_user = $feUserObj; $this->typoScriptFrontendController->id = $pageId; $this->typoScriptFrontendController->determineId(); $this->typoScriptFrontendController->checkAlternativeIdMethods(); $this->typoScriptFrontendController->getCompressedTCarray(); $this->typoScriptFrontendController->initTemplate(); $this->typoScriptFrontendController->getConfigArray(); $this->typoScriptFrontendController->includeTCA(); $this->typoScriptFrontendController->settingLanguage(); $this->typoScriptFrontendController->settingLocale(); }
/** * Initialize the TSFE. * * @param integer $pageUid The page UID * @param boolean $overrule * @return void */ public function initTSFE($pageUid = -1, $overrule = FALSE) { $rootLine = NULL; $typo3confVariables = $GLOBALS['TYPO3_CONF_VARS']; if ($pageUid == -1 && GeneralUtility::_GP('pid') !== NULL) { $pageUid = intval(GeneralUtility::_GP('pid')); } if ($pageUid === -1) { $pageUid = 0; } #$typo3confVariables['EXT']['extList'] = str_replace('tq_seo', '', $typo3confVariables['EXT']['extList']); #$typo3confVariables['EXT']['extList_FE'] = str_replace('tq_seo', '', $typo3confVariables['EXT']['extList_FE']); // declare //$temp_TSFEclassName = t3lib_div::makeInstance('tslib_fe'); // begin if (!is_object($GLOBALS['TT']) || $overrule === TRUE) { $GLOBALS['TT'] = new \TYPO3\CMS\Core\TimeTracker\TimeTracker(); $GLOBALS['TT']->start(); } if ((!is_object($GLOBALS['TSFE']) || $GLOBALS['TSFE'] instanceof \stdClass || $overrule === TRUE) && is_int($pageUid)) { // builds TSFE object $GLOBALS['TSFE'] = new \TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController($typo3confVariables, $pageUid, 0, 0, '', '', '', ''); // $start = microtime(TRUE); // builds rootline if ($pageUid > 0) { $GLOBALS['TSFE']->sys_page = GeneralUtility::makeInstance('t3lib_pageSelect'); //$rootLine = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Utility\\RootlineUtility', 0, '', $this); /** @var RootlineUtility $rootLine */ $rootLineUtility = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Utility\\RootlineUtility', $pageUid); $rootLine = $rootLineUtility->get(); // $rootLine = $GLOBALS['TSFE']->sys_page->getRootLine($pageUid); $GLOBALS['TSFE']->rootLine = $rootLine; } // Init template $GLOBALS['TSFE']->tmpl = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\TypoScript\\ExtendedTemplateService'); $GLOBALS['TSFE']->tmpl->tt_track = 0; // Do not log time-performance information $GLOBALS['TSFE']->tmpl->init(); // this generates the constants/config + hierarchy info for the template. if ($rootLine && $pageUid > 0) { $GLOBALS['TSFE']->tmpl->runThroughTemplates($rootLine, 0); } $GLOBALS['TSFE']->tmpl->generateConfig(); $GLOBALS['TSFE']->tmpl->loaded = 1; // builds a cObj $GLOBALS['TSFE']->newCObj(); // Add the FE user $GLOBALS['TSFE']->fe_user = EidUtility::initFeUser(); // $start = microtime(TRUE); $GLOBALS['TSFE']->determineId(); $GLOBALS['TSFE']->getConfigArray(); // echo 'Time: ' . (microtime(TRUE) - $start); } }
/** * */ public function __construct() { \TYPO3\CMS\Frontend\Utility\EidUtility::initFeUser(); \TYPO3\CMS\Frontend\Utility\EidUtility::initLanguage(); \TYPO3\CMS\Frontend\Utility\EidUtility::initTCA(); }