fix/add SAPI checks to prevent execution via webserver

This commit is contained in:
Daniel Reichelt
2016-06-19 23:43:42 +02:00
parent 6df08f6b9a
commit 1e8bc553b8
2 changed files with 6 additions and 4 deletions

View File

@@ -19,10 +19,7 @@
$baseLanguage = 'english.lng.php'; $baseLanguage = 'english.lng.php';
// Check if we're in the CLI // Check if we're in the CLI
if(@php_sapi_name() != 'cli' if(@php_sapi_name() !== 'cli') {
&& @php_sapi_name() != 'cgi'
&& @php_sapi_name() != 'cgi-fcgi'
) {
die('This script will only work in the shell.'); die('This script will only work in the shell.');
} }

View File

@@ -16,6 +16,11 @@
* *
*/ */
// Check if we're in the CLI
if(@php_sapi_name() !== 'cli') {
die('This script will only work in the shell.');
}
// give control to command line handler // give control to command line handler
try { try {
CmdLineHandler::processParameters($argc, $argv); CmdLineHandler::processParameters($argc, $argv);