change cli detection to use php_sapi_name()

This commit is contained in:
Ralf Becker 2013-09-10 17:29:58 +00:00
parent 8105242434
commit 892500fee3
9 changed files with 10 additions and 10 deletions

View File

@ -13,7 +13,7 @@
chdir(dirname(__FILE__)); // to enable our relative pathes to work
if (isset($_SERVER['HTTP_HOST'])) // security precaution: forbit calling admin-cli as web-page
if (php_sapi_name() !== 'cli') // security precaution: forbit calling admin-cli as web-page
{
die('<h1>admin-cli.php must NOT be called as web-page --> exiting !!!</h1>');
}

View File

@ -14,7 +14,7 @@
* @version $Id$
*/
if (isset($_SERVER['HTTP_HOST'])) // security precaution: forbit calling as web-page
if (php_sapi_name() !== 'cli') // security precaution: forbit calling as web-page
{
die('<h1>fix_depricated.php must NOT be called as web-page --> exiting !!!</h1>');
}

View File

@ -9,7 +9,7 @@
* @version $Id$
*/
if (isset($_SERVER['HTTP_HOST'])) // security precaution: forbit calling setup-cli as web-page
if (php_sapi_name() !== 'cli') // security precaution: forbit calling setup-cli as web-page
{
die('<h1>checkout-build-archives.php must NOT be called as web-page --> exiting !!!</h1>');
}

View File

@ -9,7 +9,7 @@
* @version $Id$
*/
if (isset($_SERVER['HTTP_HOST'])) // security precaution: forbit calling post_install as web-page
if (php_sapi_name() !== 'cli') // security precaution: forbit calling post_install as web-page
{
die('<h1>rpm_post_install.php must NOT be called as web-page --> exiting !!!</h1>');
}

View File

@ -17,7 +17,7 @@ chdir(dirname(__FILE__)); // to enable our relative pathes to work
error_reporting(error_reporting() & ~E_NOTICE);
if (isset($_SERVER['HTTP_HOST'])) // security precaution: forbit calling ls as web-page
if (php_sapi_name() !== 'cli') // security precaution: forbit calling filemanager/cli.php as web-page
{
die('<h1>'.basename(__FILE__).' must NOT be called as web-page --> exiting !!!</h1>');
}

View File

@ -12,7 +12,7 @@
* @version $Id$
*/
if (isset($_SERVER['HTTP_HOST'])) die("This is a commandline ONLY tool!\n");
if (php_sapi_name() !== 'cli') die("This is a commandline ONLY tool!\n");
/**
* iSchedule command line client, primary for testing and development purpose

View File

@ -13,7 +13,7 @@
chdir(dirname(__FILE__)); // to enable our relative pathes to work
if (isset($_SERVER['HTTP_HOST'])) // security precaution: forbit calling as web-page
if (php_sapi_name() !== 'cli') // security precaution: forbit calling as web-page
{
die('<h1>setup/doc/chown.php must NOT be called as web-page --> exiting !!!</h1>');
}

View File

@ -13,7 +13,7 @@
chdir(dirname(__FILE__)); // to enable our relative pathes to work
if (isset($_SERVER['HTTP_HOST'])) // security precaution: forbit calling setup-cli as web-page
if (php_sapi_name() !== 'cli') // security precaution: forbit calling setup-cli as web-page
{
die('<h1>setup-cli.php must NOT be called as web-page --> exiting !!!</h1>');
}

View File

@ -10,7 +10,7 @@
* @version $Id$
*/
if (isset($_SERVER['HTTP_HOST'])) die("This is a commandline ONLY tool!\n");
if (php_sapi_name() !== 'cli') die("This is a commandline ONLY tool!\n");
if ($_SERVER['argc'] <= 1) die('
Usage: ./svn-helper.php <svn-arguments>