2 namespace TYPO3\CMS\Core\Core;
70 public static function run($relativePathPart =
'')
72 self::defineBaseConstants();
73 self::definePaths($relativePathPart);
74 self::checkMainPathsExist();
75 self::initializeGlobalVariables();
76 self::initializeGlobalTimeTrackingVariables();
77 self::initializeBasicErrorReporting();
88 define(
'TYPO3_version',
'7.6.0');
89 define(
'TYPO3_branch',
'7.6');
90 define(
'TYPO3_copyright_year',
'1998-2015');
93 define(
'TYPO3_URL_GENERAL',
'https://typo3.org/');
94 define(
'TYPO3_URL_LICENSE',
'https://typo3.org/typo3-cms/overview/licenses/');
95 define(
'TYPO3_URL_EXCEPTION',
'https://typo3.org/go/exception/CMS/');
96 define(
'TYPO3_URL_MAILINGLISTS',
'http://lists.typo3.org/cgi-bin/mailman/listinfo');
97 define(
'TYPO3_URL_DOCUMENTATION',
'https://typo3.org/documentation/');
98 define(
'TYPO3_URL_DOCUMENTATION_TSREF',
'https://docs.typo3.org/typo3cms/TyposcriptReference/');
99 define(
'TYPO3_URL_DOCUMENTATION_TSCONFIG',
'https://docs.typo3.org/typo3cms/TSconfigReference/');
100 define(
'TYPO3_URL_CONSULTANCY',
'https://typo3.org/support/professional-services/');
101 define(
'TYPO3_URL_CONTRIBUTE',
'https://typo3.org/contribute/');
102 define(
'TYPO3_URL_SECURITY',
'https://typo3.org/teams/security/');
103 define(
'TYPO3_URL_DOWNLOAD',
'https://typo3.org/download/');
104 define(
'TYPO3_URL_SYSTEMREQUIREMENTS',
'https://typo3.org/typo3-cms/overview/requirements/');
105 define(
'TYPO3_URL_DONATE',
'https://typo3.org/donate/online-donation/');
106 define(
'TYPO3_URL_WIKI_OPCODECACHE',
'https://wiki.typo3.org/Opcode_Cache');
109 define(
'NUL', chr(0));
110 define(
'TAB', chr(9));
111 define(
'LF', chr(10));
112 define(
'CR', chr(13));
113 define(
'SUB', chr(26));
114 define(
'CRLF', CR . LF);
117 define(
'FILE_DENY_PATTERN_DEFAULT',
'\\.(php[3-6]?|phpsh|phtml)(\\..*)?$|^\\.htaccess$');
119 define(
'PHP_EXTENSIONS_DEFAULT',
'php,php3,php4,php5,php6,phpsh,inc,phtml');
123 define(
'TYPO3_OS', self::getTypo3Os());
127 define(
'T3_ERR_SV_GENERAL', -1);
129 define(
'T3_ERR_SV_NOT_AVAIL', -2);
131 define(
'T3_ERR_SV_WRONG_SUBTYPE', -3);
133 define(
'T3_ERR_SV_NO_INPUT', -4);
135 define(
'T3_ERR_SV_FILE_NOT_FOUND', -20);
137 define(
'T3_ERR_SV_FILE_READ', -21);
139 define(
'T3_ERR_SV_FILE_WRITE', -22);
141 define(
'T3_ERR_SV_PROG_NOT_FOUND', -40);
143 define(
'T3_ERR_SV_PROG_FAILED', -41);
156 define(
'TYPO3_mainDir',
'typo3/');
161 if (!defined(
'PATH_thisScript')) {
162 define(
'PATH_thisScript', self::getPathThisScript());
166 if (!defined(
'PATH_site')) {
167 define(
'PATH_site', self::getPathSite($relativePathPart));
171 define(
'PATH_typo3', PATH_site . TYPO3_mainDir);
174 define(
'PATH_typo3conf', PATH_site .
'typo3conf/');
184 if (!is_file(PATH_thisScript)) {
185 static::dieWithMessage(
'Unable to determine path to entry script.');
187 if (!is_dir(PATH_typo3 .
'sysext')) {
188 static::dieWithMessage(
'Calculated absolute path to typo3/sysext directory does not exist.' . LF . LF
189 .
'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
190 .
'* A symlink "typo3_src" pointing to the TYPO3 CMS core.' . LF
191 .
'* A symlink "typo3" - the backend entry point - pointing to "typo3_src/typo3"' . LF
192 .
'* A symlink "index.php" - the frontend entry point - points to "typo3_src/index.php"');
221 $GLOBALS[
'TYPO3_MISC'][
'microtime_start'] = microtime(
true);
246 error_reporting(E_ALL & ~(E_STRICT | E_NOTICE | E_DEPRECATED));
257 if (!stristr(PHP_OS,
'darwin') && !stristr(PHP_OS,
'cygwin') && stristr(PHP_OS,
'win')) {
279 if (defined(
'TYPO3_cliMode') && TYPO3_cliMode ===
true) {
280 return self::getPathThisScriptCli();
282 return self::getPathThisScriptNonCli();
296 if (isset($_SERVER[
'ORIG_PATH_TRANSLATED'])) {
297 $cgiPath = $_SERVER[
'ORIG_PATH_TRANSLATED'];
298 }
elseif (isset($_SERVER[
'PATH_TRANSLATED'])) {
299 $cgiPath = $_SERVER[
'PATH_TRANSLATED'];
301 if ($cgiPath && in_array(PHP_SAPI, self::$supportedCgiServerApis,
true)) {
302 $scriptPath = $cgiPath;
304 if (isset($_SERVER[
'ORIG_SCRIPT_FILENAME'])) {
305 $scriptPath = $_SERVER[
'ORIG_SCRIPT_FILENAME'];
307 $scriptPath = $_SERVER[
'SCRIPT_FILENAME'];
311 $scriptPath = str_replace(
'\\',
'/', $scriptPath);
313 $scriptPath = str_replace(
'//',
'/', $scriptPath);
328 if (isset($_SERVER[
'argv'][0])) {
329 $scriptPath = $_SERVER[
'argv'][0];
330 }
elseif (isset($_ENV[
'_'])) {
331 $scriptPath = $_ENV[
'_'];
333 $scriptPath = $_SERVER[
'_'];
336 $isRelativePath =
false;
337 if (TYPO3_OS ===
'WIN') {
338 if (!preg_match(
'/^([a-zA-Z]:)?\\\\/', $scriptPath)) {
339 $isRelativePath =
true;
342 if ($scriptPath[0] !==
'/') {
343 $isRelativePath =
true;
347 if ($isRelativePath) {
348 if (isset($_SERVER[
'PWD'])) {
349 $workingDirectory = $_SERVER[
'PWD'];
351 $workingDirectory = getcwd();
353 $scriptPath = $workingDirectory .
'/' . preg_replace(
'/\\.\\//',
'', $scriptPath);
374 $entryScriptDirectory = self::getUnifiedDirectoryNameWithTrailingSlash(PATH_thisScript);
375 if ($relativePathPart !==
'') {
376 $pathSite = substr($entryScriptDirectory, 0, -strlen($relativePathPart));
378 $pathSite = $entryScriptDirectory;
391 $directory = dirname($absolutePath);
392 if (TYPO3_OS ===
'WIN') {
393 $directory = str_replace(
'\\',
'/', $directory);
395 return $directory .
'/';
405 header(
'Content-type: text/plain');
417 if (static::$disabledFunctions === null) {
420 if (!empty(static::$disabledFunctions)) {
421 return in_array($function, static::$disabledFunctions,
true);