Fixed bug #14989: Use TYPO3_REQUESTTYPE consistently for CLI calls detection
[Packages/TYPO3.CMS.git] / typo3 / init.php
index 6ac65a7..9e795d5 100644 (file)
@@ -233,7 +233,7 @@ if (TYPO3_UseCachingFramework) {
 // *************************
 // CLI dispatch processing
 // *************************
-if (defined('TYPO3_cliMode') && TYPO3_cliMode && basename(PATH_thisScript)=='cli_dispatch.phpsh')      {
+if ((TYPO3_REQUESTTYPE & TYPO3_REQUESTTYPE_CLI) && basename(PATH_thisScript) == 'cli_dispatch.phpsh') {
                // First, take out the first argument (cli-key)
        $temp_cliScriptPath = array_shift($_SERVER['argv']);
        $temp_cliKey = array_shift($_SERVER['argv']);
@@ -266,7 +266,7 @@ if ($TYPO3_CONF_VARS['BE']['adminOnly'] < 0)        {
        t3lib_BEfunc::typo3printError('Backend locked', 'Backend and Install Tool are locked for maintenance. [BE][adminOnly] is set to "' . intval($TYPO3_CONF_VARS['BE']['adminOnly']) . '".');
        exit;
 }
-if (!(defined('TYPO3_cliMode') && TYPO3_cliMode) && @is_file(PATH_typo3conf.'LOCK_BACKEND'))   {
+if (!(TYPO3_REQUESTTYPE & TYPO3_REQUESTTYPE_CLI) && @is_file(PATH_typo3conf . 'LOCK_BACKEND')) {
        if (TYPO3_PROCEED_IF_NO_USER == 2) {
                // ajax poll for login, let him pass
        } else {
@@ -284,7 +284,7 @@ if (!(defined('TYPO3_cliMode') && TYPO3_cliMode) && @is_file(PATH_typo3conf.'LOC
 // **********************
 // Check IP
 // **********************
-if (trim($TYPO3_CONF_VARS['BE']['IPmaskList']) && !(defined('TYPO3_cliMode') && TYPO3_cliMode))        {
+if (trim($TYPO3_CONF_VARS['BE']['IPmaskList']) && !(TYPO3_REQUESTTYPE & TYPO3_REQUESTTYPE_CLI)) {
        if (!t3lib_div::cmpIP(t3lib_div::getIndpEnv('REMOTE_ADDR'), $TYPO3_CONF_VARS['BE']['IPmaskList']))      {
                header('Status: 404 Not Found');        // Send Not Found header - if the webserver can make use of it...
                header('Location: http://');    // Just point us away from here...
@@ -296,7 +296,7 @@ if (trim($TYPO3_CONF_VARS['BE']['IPmaskList']) && !(defined('TYPO3_cliMode') &&
 // **********************
 // Check SSL (https)
 // **********************
-if (intval($TYPO3_CONF_VARS['BE']['lockSSL']) && !(defined('TYPO3_cliMode') && TYPO3_cliMode)) {
+if (intval($TYPO3_CONF_VARS['BE']['lockSSL']) && !(TYPO3_REQUESTTYPE & TYPO3_REQUESTTYPE_CLI)) {
        if(intval($TYPO3_CONF_VARS['BE']['lockSSLPort'])) {
                $sslPortSuffix = ':'.intval($TYPO3_CONF_VARS['BE']['lockSSLPort']);
        } else {
@@ -372,7 +372,7 @@ if ($TYPO3_DB->sql_pconnect(TYPO3_db_host, TYPO3_db_username, TYPO3_db_password)
 // *******************************
 // Checks for proper browser
 // *******************************
-if (!$CLIENT['BROWSER'] && !(defined('TYPO3_cliMode') && TYPO3_cliMode))       {
+if (!$CLIENT['BROWSER'] && !(TYPO3_REQUESTTYPE & TYPO3_REQUESTTYPE_CLI)) {
        t3lib_BEfunc::typo3PrintError ('Browser error','Your browser version looks incompatible with this TYPO3 version!',0);
        exit;
 }
@@ -428,7 +428,7 @@ $GLOBALS['LANG']->init($BE_USER->uc['lang']);
 // ****************
 // CLI processing
 // ****************
-if (defined('TYPO3_cliMode') && TYPO3_cliMode) {
+if (TYPO3_REQUESTTYPE & TYPO3_REQUESTTYPE_CLI) {
                // Status output:
        if (!strcmp($_SERVER['argv'][1],'status'))      {
                echo "Status of TYPO3 CLI script:\n\n";