61 static public function run($relativePathPart =
'') {
62 self::defineBaseConstants();
63 self::definePaths($relativePathPart);
64 self::checkMainPathsExist();
65 self::handleMagicQuotesGpc();
66 self::addCorePearPathToIncludePath();
67 self::initializeGlobalVariables();
68 self::initializeGlobalTimeTrackingVariables();
69 self::initializeBasicErrorReporting();
79 define(
'TYPO3_version',
'6.2.32-dev');
80 define(
'TYPO3_branch',
'6.2');
81 define(
'TYPO3_copyright_year',
'1998-2017');
84 define(
'TYPO3_URL_GENERAL',
'http://typo3.org/');
85 define(
'TYPO3_URL_ORG',
'http://typo3.org/');
86 define(
'TYPO3_URL_LICENSE',
'http://typo3.org/licenses');
87 define(
'TYPO3_URL_EXCEPTION',
'http://typo3.org/go/exception/CMS/');
88 define(
'TYPO3_URL_MAILINGLISTS',
'http://lists.typo3.org/cgi-bin/mailman/listinfo');
89 define(
'TYPO3_URL_DOCUMENTATION',
'http://typo3.org/documentation/');
90 define(
'TYPO3_URL_DOCUMENTATION_TSREF',
'https://docs.typo3.org/typo3cms/TyposcriptReference/');
91 define(
'TYPO3_URL_DOCUMENTATION_TSCONFIG',
'https://docs.typo3.org/typo3cms/TSconfigReference/');
92 define(
'TYPO3_URL_CONSULTANCY',
'http://typo3.org/support/professional-services/');
93 define(
'TYPO3_URL_CONTRIBUTE',
'http://typo3.org/contribute/');
94 define(
'TYPO3_URL_SECURITY',
'http://typo3.org/teams/security/');
95 define(
'TYPO3_URL_DOWNLOAD',
'http://typo3.org/download/');
96 define(
'TYPO3_URL_SYSTEMREQUIREMENTS',
'http://typo3.org/typo3-cms/overview/requirements/');
97 define(
'TYPO3_URL_DONATE',
'http://typo3.org/donate/online-donation/');
98 define(
'TYPO3_URL_WIKI_OPCODECACHE',
'http://wiki.typo3.org/Opcode_Cache');
101 define(
'TAB', chr(9));
102 define(
'LF', chr(10));
103 define(
'CR', chr(13));
104 define(
'CRLF', CR . LF);
107 define(
'FILE_DENY_PATTERN_DEFAULT',
'\\.(php[3-6]?|phpsh|phtml)(\\..*)?$|^\\.htaccess$');
109 define(
'PHP_EXTENSIONS_DEFAULT',
'php,php3,php4,php5,php6,phpsh,inc,phtml');
113 define(
'TYPO3_OS', self::getTypo3Os());
117 define(
'T3_ERR_SV_GENERAL', -1);
119 define(
'T3_ERR_SV_NOT_AVAIL', -2);
121 define(
'T3_ERR_SV_WRONG_SUBTYPE', -3);
123 define(
'T3_ERR_SV_NO_INPUT', -4);
125 define(
'T3_ERR_SV_FILE_NOT_FOUND', -20);
127 define(
'T3_ERR_SV_FILE_READ', -21);
129 define(
'T3_ERR_SV_FILE_WRITE', -22);
131 define(
'T3_ERR_SV_PROG_NOT_FOUND', -40);
133 define(
'T3_ERR_SV_PROG_FAILED', -41);
145 define(
'TYPO3_mainDir',
'typo3/');
150 if (!defined(
'PATH_thisScript')) {
151 define(
'PATH_thisScript', self::getPathThisScript());
155 if (!defined(
'PATH_site')) {
156 define(
'PATH_site', self::getPathSite($relativePathPart));
160 define(
'PATH_typo3', PATH_site . TYPO3_mainDir);
165 define(
'PATH_typo3_mod', defined(
'TYPO3_MOD_PATH') ?
TYPO3_MOD_PATH :
'');
168 define(
'PATH_typo3conf', PATH_site .
'typo3conf/');
171 define(
'PATH_tslib', PATH_typo3 .
'sysext/cms/tslib/');
180 if (!is_file(PATH_thisScript)) {
181 static::dieWithMessage(
'Unable to determine path to entry script.');
183 if (!is_dir(PATH_tslib)) {
184 static::dieWithMessage(
'Calculated absolute path to tslib directory does not exist.' . LF . LF
185 .
'Something in the main file, folder and link structure is wrong and must be fixed! A typical document root contains a couple of symbolic links:' . LF
186 .
'* A symlink "typo3_src" pointing to the TYPO3 CMS core.' . LF
187 .
'* A symlink "typo3" - the backend entry point - pointing to "typo3_src/typo3"' . LF
188 .
'* A symlink "index.php" - the frontend entry point - points to "typo3_src/index.php"');
198 if (!get_magic_quotes_gpc()) {
202 $GLOBALS[
'HTTP_POST_VARS'] = $_POST;
222 set_include_path(PATH_typo3 .
'contrib/pear/' . PATH_SEPARATOR . get_include_path());
250 $GLOBALS[
'TYPO3_MISC'][
'microtime_start'] = microtime(TRUE);
274 error_reporting(E_ALL & ~(E_STRICT | E_NOTICE | E_DEPRECATED));
284 if (!stristr(PHP_OS,
'darwin') && stristr(PHP_OS,
'win')) {
305 if (defined(
'TYPO3_cliMode') && TYPO3_cliMode === TRUE) {
306 return self::getPathThisScriptCli();
308 return self::getPathThisScriptNonCli();
321 if (isset($_SERVER[
'ORIG_PATH_TRANSLATED'])) {
322 $cgiPath = $_SERVER[
'ORIG_PATH_TRANSLATED'];
323 } elseif (isset($_SERVER[
'PATH_TRANSLATED'])) {
324 $cgiPath = $_SERVER[
'PATH_TRANSLATED'];
326 if ($cgiPath && in_array(PHP_SAPI, self::$supportedCgiServerApis, TRUE)) {
327 $scriptPath = $cgiPath;
329 if (isset($_SERVER[
'ORIG_SCRIPT_FILENAME'])) {
330 $scriptPath = $_SERVER[
'ORIG_SCRIPT_FILENAME'];
332 $scriptPath = $_SERVER[
'SCRIPT_FILENAME'];
336 $scriptPath = str_replace(
'\\',
'/', $scriptPath);
338 $scriptPath = str_replace(
'//',
'/', $scriptPath);
352 if (isset($_SERVER[
'argv'][0])) {
353 $scriptPath = $_SERVER[
'argv'][0];
354 } elseif (isset($_ENV[
'_'])) {
355 $scriptPath = $_ENV[
'_'];
357 $scriptPath = $_SERVER[
'_'];
360 $isRelativePath = FALSE;
361 if (TYPO3_OS ===
'WIN') {
362 if (!preg_match(
'/^([a-zA-Z]:)?\\\\/', $scriptPath)) {
363 $isRelativePath = TRUE;
366 if ($scriptPath[0] !==
'/') {
367 $isRelativePath = TRUE;
371 if ($isRelativePath) {
372 if (isset($_SERVER[
'PWD'])) {
373 $workingDirectory = $_SERVER[
'PWD'];
375 $workingDirectory = getcwd();
377 $scriptPath = $workingDirectory .
'/' . preg_replace(
'/\\.\\//',
'', $scriptPath);
410 if (defined(
'TYPO3_MOD_PATH')) {
411 return self::getPathSiteByTypo3ModulePath();
413 return self::getPathSiteByRelativePathPart($relativePathPart);
433 } elseif (substr(
TYPO3_MOD_PATH, 0, strlen(
'../typo3conf/')) ===
'../typo3conf/') {
436 static::dieWithMessage(
'Unable to determine TYPO3 document root.');
438 $entryScriptDirectory = self::getUnifiedDirectoryNameWithTrailingSlash(PATH_thisScript);
439 return substr($entryScriptDirectory, 0, -strlen($pathPartRelativeToDocumentRoot));
449 $entryScriptDirectory = self::getUnifiedDirectoryNameWithTrailingSlash(PATH_thisScript);
450 if (strlen($relativePathPart) > 0) {
451 $pathSite = substr($entryScriptDirectory, 0, -strlen($relativePathPart));
453 $pathSite = $entryScriptDirectory;
465 $directory = dirname($absolutePath);
466 if (TYPO3_OS ===
'WIN') {
467 $directory = str_replace(
'\\',
'/', $directory);
469 return $directory .
'/';
478 header(
'Content-type: text/plain');
static getPathThisScriptNonCli()
static checkMainPathsExist()
static getUnifiedDirectoryNameWithTrailingSlash($absolutePath)
static initializeGlobalVariables()
static getPathThisScript()
static getPathSiteByTypo3ModulePath()
static getPathSite($relativePathPart)
static definePaths($relativePathPart='')
static getPathThisScriptCli()
static addSlashesOnArray(array &$theArray)
static dieWithMessage($message)
static addCorePearPathToIncludePath()
static run($relativePathPart='')
if(!defined('TYPO3_MODE')) $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_pre_processing'][]
static getPathSiteByRelativePathPart($relativePathPart)
static initializeBasicErrorReporting()
static initializeGlobalTimeTrackingVariables()
static $supportedCgiServerApis
static handleMagicQuotesGpc()
static clientInfo($useragent='')
static defineBaseConstants()