change cli detection to use php_sapi_name()

This commit is contained in:
Ralf Becker 2013-09-10 17:31:15 +00:00
parent b3806e3e8e
commit 71134ce29a
10 changed files with 11 additions and 11 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

@ -40,7 +40,7 @@
*/
// protect from being called via HTTP
if (isset($_SERVER['HTTP_HOST'])) die('This is a command line only script!');
if (php_sapi_name() !== 'cli') die('This is a command line only script!');
// uncomment to write to log-file, otherwise errors go to stderr
//$log = '/var/log/dovecot_checkpassword.log';

View File

@ -71,7 +71,7 @@
*/
// protect from being called via HTTP
if (isset($_SERVER['HTTP_HOST'])) die('This is a command line only script!');
if (php_sapi_name() !== 'cli') die('This is a command line only script!');
// our defaults
$default_host = 'localhost';

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

@ -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>