mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-26 09:53:20 +01:00
change cli detection to use php_sapi_name()
This commit is contained in:
parent
b3806e3e8e
commit
71134ce29a
@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
chdir(dirname(__FILE__)); // to enable our relative pathes to work
|
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>');
|
die('<h1>admin-cli.php must NOT be called as web-page --> exiting !!!</h1>');
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
* @version $Id$
|
* @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>');
|
die('<h1>fix_depricated.php must NOT be called as web-page --> exiting !!!</h1>');
|
||||||
}
|
}
|
||||||
@ -119,7 +119,7 @@ function fix_depricated($file,$replace_file=false)
|
|||||||
|
|
||||||
// fix call to not longer existing PDO method $result->fetchSingle()
|
// fix call to not longer existing PDO method $result->fetchSingle()
|
||||||
$lines = str_replace('->fetchSingle(','->fetchColumn(',$lines);
|
$lines = str_replace('->fetchSingle(','->fetchColumn(',$lines);
|
||||||
|
|
||||||
// fix calls to deprecated call_user_method(_array)?(method,object[,args])
|
// fix calls to deprecated call_user_method(_array)?(method,object[,args])
|
||||||
if (preg_match('/call_user_method(_array)?\(/',$lines,$matches))
|
if (preg_match('/call_user_method(_array)?\(/',$lines,$matches))
|
||||||
{
|
{
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
* @version $Id$
|
* @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>');
|
die('<h1>checkout-build-archives.php must NOT be called as web-page --> exiting !!!</h1>');
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
* @version $Id$
|
* @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>');
|
die('<h1>rpm_post_install.php must NOT be called as web-page --> exiting !!!</h1>');
|
||||||
}
|
}
|
||||||
|
@ -40,7 +40,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// protect from being called via HTTP
|
// 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
|
// uncomment to write to log-file, otherwise errors go to stderr
|
||||||
//$log = '/var/log/dovecot_checkpassword.log';
|
//$log = '/var/log/dovecot_checkpassword.log';
|
||||||
|
@ -71,7 +71,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// protect from being called via HTTP
|
// 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
|
// our defaults
|
||||||
$default_host = 'localhost';
|
$default_host = 'localhost';
|
||||||
|
@ -17,7 +17,7 @@ chdir(dirname(__FILE__)); // to enable our relative pathes to work
|
|||||||
|
|
||||||
error_reporting(error_reporting() & ~E_NOTICE);
|
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>');
|
die('<h1>'.basename(__FILE__).' must NOT be called as web-page --> exiting !!!</h1>');
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
chdir(dirname(__FILE__)); // to enable our relative pathes to work
|
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>');
|
die('<h1>setup/doc/chown.php must NOT be called as web-page --> exiting !!!</h1>');
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
chdir(dirname(__FILE__)); // to enable our relative pathes to work
|
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>');
|
die('<h1>setup-cli.php must NOT be called as web-page --> exiting !!!</h1>');
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
* @version $Id$
|
* @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('
|
if ($_SERVER['argc'] <= 1) die('
|
||||||
Usage: ./svn-helper.php <svn-arguments>
|
Usage: ./svn-helper.php <svn-arguments>
|
||||||
|
Loading…
Reference in New Issue
Block a user