TYPO3 CMS  TYPO3_6-2
EidUtility.php
Go to the documentation of this file.
1 <?php
3 
29 class EidUtility {
30 
37  static public function initFeUser() {
38  // Get TSFE instance. It knows how to initialize the user. We also
39  // need TCA because services may need extra tables!
40  self::initTCA();
42  $tsfe = self::getTSFE();
43  $tsfe->initFEuser();
44  // Return FE user object:
45  return $tsfe->fe_user;
46  }
47 
55  static public function connectDB() {
57  return TRUE;
58  }
59 
66  static public function initLanguage($language = 'default') {
67  if (!is_object($GLOBALS['LANG'])) {
68  $GLOBALS['LANG'] = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Lang\\LanguageService');
69  $GLOBALS['LANG']->init($language);
70  }
71  }
72 
78  static public function initTCA() {
79  // Some badly made extensions attempt to manipulate TCA in a wrong way
80  // (inside ext_localconf.php). Therefore $GLOBALS['TCA'] may become an array
81  // but in fact it is not loaded. The check below ensure that
82  // TCA is still loaded if such bad extensions are installed
83  if (!is_array($GLOBALS['TCA']) || !isset($GLOBALS['TCA']['pages'])) {
85  }
86  }
87 
95  static public function initExtensionTCA($extensionKey) {
96  $extTablesPath = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($extensionKey, 'ext_tables.php');
97  if (file_exists($extTablesPath)) {
98  $GLOBALS['_EXTKEY'] = $extensionKey;
99  require_once $extTablesPath;
100  // We do not need to save restore the value of $GLOBALS['_EXTKEY']
101  // because it is not defined to anything real outside of
102  // ext_tables.php or ext_localconf.php scope.
103  unset($GLOBALS['_EXTKEY']);
104  }
105  }
106 
112  static private function getTSFE() {
113  // Cached instance
114  static $tsfe = NULL;
115  if (is_null($tsfe)) {
116  $tsfe = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\Controller\\TypoScriptFrontendController', $GLOBALS['TYPO3_CONF_VARS'], 0, 0);
117  }
118  return $tsfe;
119  }
120 
121 }
static initExtensionTCA($extensionKey)
Definition: EidUtility.php:95
if(!defined('TYPO3_MODE')) $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_pre_processing'][]
static initLanguage($language='default')
Definition: EidUtility.php:66