[!!!][TASK] Bootstrap: Central constants and path handling
[Packages/TYPO3.CMS.git] / typo3 / sysext / cms / tslib / index_ts.php
index 74badfa..ac78e7d 100644 (file)
 // *******************************
 // Checking PHP version
 // *******************************
-if (version_compare(phpversion(), '5.2', '<')) die ('TYPO3 requires PHP 5.2.0 or higher.');
-
-// *******************************
-// Set error reporting
-// *******************************
-error_reporting(E_ALL ^ E_NOTICE ^ E_DEPRECATED);
+if (version_compare(phpversion(), '5.3', '<')) die ('TYPO3 requires PHP 5.3.0 or higher.');
 
 
 // ******************
 // Constants defined
 // ******************
 $TYPO3_MISC['microtime_start'] = microtime(TRUE);
-define('TYPO3_OS', stristr(PHP_OS,'win')&&!stristr(PHP_OS,'darwin')?'WIN':'');
 define('TYPO3_MODE','FE');
 
-if(!defined('PATH_thisScript')) {
-       define('PATH_thisScript', str_replace('//', '/', str_replace('\\', '/',
-               (PHP_SAPI == 'fpm-fcgi' || PHP_SAPI == 'cgi' || PHP_SAPI == 'isapi' || PHP_SAPI == 'cgi-fcgi') &&
-               ($_SERVER['ORIG_PATH_TRANSLATED'] ? $_SERVER['ORIG_PATH_TRANSLATED'] : $_SERVER['PATH_TRANSLATED']) ?
-               ($_SERVER['ORIG_PATH_TRANSLATED'] ? $_SERVER['ORIG_PATH_TRANSLATED'] : $_SERVER['PATH_TRANSLATED']) :
-               ($_SERVER['ORIG_SCRIPT_FILENAME'] ? $_SERVER['ORIG_SCRIPT_FILENAME'] : $_SERVER['SCRIPT_FILENAME']))));
-}
-
-if (!defined('PATH_site'))                     define('PATH_site', dirname(PATH_thisScript).'/');
-if (!defined('PATH_t3lib'))            define('PATH_t3lib', PATH_site.'t3lib/');
-
-define('TYPO3_mainDir', 'typo3/');             // This is the directory of the backend administration for the sites of this TYPO3 installation.
-define('PATH_typo3', PATH_site.TYPO3_mainDir);
-define('PATH_typo3conf', PATH_site.'typo3conf/');
-
-if (!defined('PATH_tslib')) {
-       if (@is_dir(PATH_site.TYPO3_mainDir.'sysext/cms/tslib/')) {
-               define('PATH_tslib', PATH_site.TYPO3_mainDir.'sysext/cms/tslib/');
-       } elseif (@is_dir(PATH_site.'tslib/')) {
-               define('PATH_tslib', PATH_site.'tslib/');
-       }
-}
-
-if (!@is_dir(PATH_typo3conf))  die('Cannot find configuration. This file is probably executed from the wrong location.');
-
 // *********************
 // Unset variable(s) in global scope (fixes #13959)
 // *********************
@@ -91,53 +60,34 @@ unset($error);
 // *********************
 ob_start();
 
-// *********************
-// Timetracking started
-// *********************
-if ($_SESSION['TYPO3-TT-start']) {
-       require_once(PATH_t3lib.'class.t3lib_timetrack.php');
-       $TT = new t3lib_timeTrack;
-} else {
-       require_once(PATH_t3lib.'class.t3lib_timetracknull.php');
-       $TT = new t3lib_timeTrackNull;
-}
-
-$TT->start();
-$TT->push('','Script start');
-
 
 // *********************
 // Mandatory libraries included
 // *********************
-$TT->push('Include class t3lib_db, t3lib_div, t3lib_extmgm','');
-       require_once(PATH_t3lib.'class.t3lib_div.php');
-       require_once(PATH_t3lib.'class.t3lib_extmgm.php');
-$TT->pull();
-
+require_once(PATH_t3lib . 'class.t3lib_div.php');
+require_once(PATH_t3lib . 'class.t3lib_extmgm.php');
 
 
 // **********************
 // Include configuration
 // **********************
-$TT->push('Include config files','');
 require(PATH_t3lib.'config_default.php');
 if (!defined ('TYPO3_db'))     die ('The configuration file was not included.');       // the name of the TYPO3 database is stored in this constant. Here the inclusion of the config-file is verified by checking if this var is set.
 if (!t3lib_extMgm::isLoaded('cms'))    die('<strong>Error:</strong> The main frontend extension "cms" was not loaded. Enable it in the extension manager in the backend.');
 
-if (!defined('PATH_tslib')) {
-       define('PATH_tslib', t3lib_extMgm::extPath('cms').'tslib/');
-}
-
-
-// Restart time tracking if BE login exists
-if (!$_SESSION['TYPO3-TT-start'] && $_COOKIE[t3lib_beUserAuth::getCookieName()]) {
-       $_SESSION['TYPO3-TT-start'] = TRUE;
 
-       $TT = new t3lib_timeTrack;
-       $TT->start();
-       $TT->push('', 'Script start (late)');
+// *********************
+// Timetracking started
+// *********************
+if ($_COOKIE[t3lib_beUserAuth::getCookieName()]) {
+       require_once(PATH_t3lib . 'class.t3lib_timetrack.php');
+       $TT = new t3lib_timeTrack();
+} else {
+       require_once(PATH_t3lib . 'class.t3lib_timetracknull.php');
+       $TT = new t3lib_timeTrackNull();
 }
-
+$TT->start();
+$TT->push('', 'Script start');
 
 // *********************
 // Error & Exception handling
@@ -160,7 +110,6 @@ $TYPO3_DB->debugOutput = $TYPO3_CONF_VARS['SYS']['sqlDebug'];
 $CLIENT = t3lib_div::clientInfo();                             // Set to the browser: net / msie if 4+ browsers
 $TT->pull();
 
-
 // *******************************
 // Checking environment
 // *******************************
@@ -226,22 +175,6 @@ if($TYPO3_CONF_VARS['FE']['pageUnavailable_force'] &&
 
 $TSFE->connectToDB();
 
-       // In case of a keyword-authenticated preview, re-initialize the TSFE object:
-if ($temp_previewConfig = $TSFE->ADMCMD_preview())     {
-       $TSFE = t3lib_div::makeInstance('tslib_fe',
-               $TYPO3_CONF_VARS,
-               t3lib_div::_GP('id'),
-               t3lib_div::_GP('type'),
-               t3lib_div::_GP('no_cache'),
-               t3lib_div::_GP('cHash'),
-               t3lib_div::_GP('jumpurl'),
-               t3lib_div::_GP('MP'),
-               t3lib_div::_GP('RDCT')
-       );
-       $TSFE->ADMCMD_preview_postInit($temp_previewConfig);
-}
-
-
 $TSFE->sendRedirect();
 
 
@@ -274,12 +207,6 @@ $TT->pull();
 $BE_USER = $TSFE->initializeBackendUser();
 
 
-// ********************
-// Workspace preview:
-// ********************
-$TSFE->workspacePreviewInit();
-
-
 // *****************************************
 // Process the ID, type and other parameters
 // After this point we have an array, $page in TSFE, which is the page-record of the current page, $id
@@ -318,10 +245,10 @@ if ($TSFE->isBackendUserLoggedIn()) {
        $spriteManager->loadCacheFile();
 
        $BE_USER->initializeFrontendEdit();
-       if ($BE_USER->adminPanel instanceof tslib_AdminPanel) {
+       if ($BE_USER->adminPanel instanceof tslib_AdminPanel) {
                $LANG = t3lib_div::makeInstance('language');
                $LANG->init($BE_USER->uc['lang']);
-       }
+       }
        if ($BE_USER->frontendEdit instanceof t3lib_frontendedit) {
                $BE_USER->frontendEdit->initConfigOptions();
        }
@@ -386,12 +313,6 @@ switch($TSFE->checkDataSubmission())       {
        case 'email':
                $TSFE->sendFormmail();
        break;
-       case 'fe_tce':
-               $TSFE->includeTCA();
-               $TT->push('fe_tce','');
-               $TSFE->fe_tce();
-               $TT->pull();
-       break;
 }
 
 
@@ -439,44 +360,7 @@ $sendTSFEContent = FALSE;
 if ($TSFE->isOutputting())     {
        $TT->push('Print Content','');
        $TSFE->processOutput();
-
-       // ***************************************
-       // Outputs content / Includes EXT scripts
-       // ***************************************
-       if ($TSFE->isEXTincScript())    {
-               $TT->push('External PHP-script','');
-                               // Important global variables here are $EXTiS_*, they must not be overridden in include-scripts!!!
-                       $EXTiS_config = $TSFE->config['EXTincScript'];
-                       $EXTiS_splitC = explode('<!--EXT_SCRIPT.',$TSFE->content);      // Splits content with the key
-
-                               // Special feature: Include libraries
-                       foreach ($EXTiS_config as $EXTiS_cPart) {
-                               if (isset($EXTiS_cPart['conf']['includeLibs']) && $EXTiS_cPart['conf']['includeLibs']) {
-                                       $EXTiS_resourceList = t3lib_div::trimExplode(',',$EXTiS_cPart['conf']['includeLibs'], TRUE);
-                                       $TSFE->includeLibraries($EXTiS_resourceList);
-                               }
-                       }
-
-                       foreach ($EXTiS_splitC as $EXTiS_c => $EXTiS_cPart) {
-                               if (substr($EXTiS_cPart,32,3)=='-->')   {       // If the split had a comment-end after 32 characters it's probably a split-string
-                                       $EXTiS_key = 'EXT_SCRIPT.'.substr($EXTiS_cPart,0,32);
-                                       if (is_array($EXTiS_config[$EXTiS_key]))        {
-                                               $REC = $EXTiS_config[$EXTiS_key]['data'];
-                                               $CONF = $EXTiS_config[$EXTiS_key]['conf'];
-                                               $content = '';
-                                               include($EXTiS_config[$EXTiS_key]['file']);
-                                               echo $content;  // The script MAY return content in $content or the script may just output the result directly!
-                                       }
-                                       echo substr($EXTiS_cPart,35);
-                               } else {
-                                       echo ($c?'<!--EXT_SCRIPT.':'').$EXTiS_cPart;
-                               }
-                       }
-
-               $TT->pull();
-       } else {
-               $sendTSFEContent = TRUE;
-       }
+       $sendTSFEContent = TRUE;
        $TT->pull();
 }
 
@@ -554,4 +438,4 @@ if (TYPO3_DLOG) {
        t3lib_div::devLog('END of FRONTEND session', 'cms', 0, array('_FLUSH' => TRUE));
 }
 
-?>
+?>
\ No newline at end of file