Advertisement
Guest User

Untitled

a guest
Mar 17th, 2013
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.66 KB | None | 0 0
  1. <?php
  2. namespace DMF\Intranet\Service;
  3.  
  4. use TYPO3\CMS\Core\SingletonInterface;
  5. use TYPO3\CMS\Core\TimeTracker\TimeTracker;
  6. use TYPO3\CMS\Core\Utility\GeneralUtility;
  7. use TYPO3\CMS\Extbase\Object\ObjectManager;
  8.  
  9. require_once(PATH_tslib . 'class.tslib_fe.php');
  10. require_once(PATH_t3lib . 'class.t3lib_userauth.php');
  11. require_once(PATH_tslib . 'class.tslib_feuserauth.php');
  12. require_once(PATH_t3lib . 'class.t3lib_cs.php');
  13. require_once(PATH_tslib . 'class.tslib_content.php');
  14. require_once(PATH_t3lib . 'class.t3lib_tstemplate.php');
  15. require_once(PATH_t3lib . 'class.t3lib_page.php');
  16.  
  17. /**
  18.  * Class BuildTsfeService
  19.  *
  20.  * @package DMF\Intranet\Service
  21.  */
  22. class BuildTsfeService implements SingletonInterface {
  23.  
  24.     /**
  25.      * @var ObjectManager
  26.      */
  27.     protected $objectManager;
  28.  
  29.     /**
  30.      * @param ObjectManager $objectManager
  31.      */
  32.     public function injectObjectManager(ObjectManager $objectManager) {
  33.         $this->objectManager = $objectManager;
  34.     }
  35.  
  36.     /**
  37.      *
  38.      */
  39.     public function buildTSFE($pid = 1) {
  40.         if (!is_object($GLOBALS['TT'])) {
  41.             $GLOBALS['TT'] = new TimeTracker();
  42.  
  43.             $GLOBALS['TT']->start();
  44.         }
  45.  
  46.         $TSFEclassName = $this->objectManager->get('TYPO3\\CMS\\Frontend\\Controller\\TypoScriptFrontendController');
  47.  
  48.         $GLOBALS['TSFE'] = new $TSFEclassName($GLOBALS['TYPO3_CONF_VARS'], $pid, '0', 1, '', '', '', '');
  49.         $GLOBALS['TSFE']->connectToDB();
  50.         $GLOBALS['TSFE']->initFEuser();
  51.         $GLOBALS['TSFE']->fetch_the_id();
  52.         $GLOBALS['TSFE']->getPageAndRootline();
  53.         $GLOBALS['TSFE']->initTemplate();
  54.         $GLOBALS['TSFE']->tmpl->getFileName_backPath = PATH_site;
  55.         $GLOBALS['TSFE']->forceTemplateParsing = 1;
  56.         $GLOBALS['TSFE']->getConfigArray();
  57.     }
  58. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement