34 if (substr(php_sapi_name(), 0, 3) ===
'cgi') {
35 self::initializeCgiCompatibilityLayerOrDie();
36 } elseif (php_sapi_name() !==
'cli') {
37 die(
'Not called from a command line interface (e.g. a shell or scheduler).' . chr(10));
50 if (!isset($_SERVER[
'argv'][1]) || !is_array(
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
'GLOBAL'][
'cliKeys'][$_SERVER[
'argv'][1]])) {
51 if (!isset($_SERVER[
'argv'][1])) {
52 $message =
'This script must have a \'cliKey\' as first argument.';
54 $message =
'The supplied \'cliKey\' is not valid.';
56 $message .=
' Valid keys are: 59 $cliKeys = array_keys(
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
'GLOBAL'][
'cliKeys']);
61 foreach ($cliKeys as $key => $value) {
62 $message .=
' ' . $value . LF;
64 fwrite(STDERR, $message . LF);
67 define(
'TYPO3_cliKey', $_SERVER[
'argv'][1]);
69 $GLOBALS[
'MCONF'][
'name'] =
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
'GLOBAL'][
'cliKeys'][TYPO3_cliKey][1];
71 $GLOBALS[
'temp_cliScriptPath'] = array_shift($_SERVER[
'argv']);
72 $GLOBALS[
'temp_cliKey'] = array_shift($_SERVER[
'argv']);
73 array_unshift($_SERVER[
'argv'],
$GLOBALS[
'temp_cliScriptPath']);
84 $checkEnvVars = array(
'HTTP_USER_AGENT',
'HTTP_HOST',
'SERVER_NAME',
'REMOTE_ADDR',
'REMOTE_PORT',
'SERVER_PROTOCOL');
85 foreach ($checkEnvVars as $var) {
86 if (array_key_exists($var, $_SERVER)) {
87 echo
'SECURITY CHECK FAILED! This script cannot be used within your browser!' . chr(10);
88 echo
'If you are sure that we run in a shell or cronjob, please unset' . chr(10);
89 echo
'environment variable ' . $var .
' (usually using \'unset ' . $var .
'\')
' . chr(10); 90 echo 'before starting
this script.
' . chr(10); 94 // Mimic CLI API in CGI API (you must use the -C/-no-chdir and the -q/--no-header switches!) 95 ini_set('html_errors
', 0); 96 ini_set('implicit_flush
', 1); 97 ini_set('max_execution_time
', 0); 98 define('STDIN
', fopen('php:
99 define(
'STDOUT', fopen(
'php://stdout',
'w'));
100 define(
'STDERR', fopen(
'php://stderr',
'w'));
static checkEnvironmentOrDie()
static initializeCgiCompatibilityLayerOrDie()
static initializeCliKeyOrDie()
if(!defined('TYPO3_MODE')) $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_pre_processing'][]
static getFileAbsFileName($filename, $onlyRelative=TRUE, $relToTYPO3_mainDir=FALSE)