From 1e8bc553b8edefc22a6fc12ce63a5d2ff76c7962 Mon Sep 17 00:00:00 2001 From: Daniel Reichelt Date: Sun, 19 Jun 2016 23:43:42 +0200 Subject: [PATCH] fix/add SAPI checks to prevent execution via webserver --- install/scripts/language-check.php | 5 +---- install/scripts/switch-server-ip.php | 5 +++++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/install/scripts/language-check.php b/install/scripts/language-check.php index 17c8463a..872609c5 100644 --- a/install/scripts/language-check.php +++ b/install/scripts/language-check.php @@ -19,10 +19,7 @@ $baseLanguage = 'english.lng.php'; // Check if we're in the CLI -if(@php_sapi_name() != 'cli' - && @php_sapi_name() != 'cgi' - && @php_sapi_name() != 'cgi-fcgi' -) { +if(@php_sapi_name() !== 'cli') { die('This script will only work in the shell.'); } diff --git a/install/scripts/switch-server-ip.php b/install/scripts/switch-server-ip.php index 506cca9f..d8f098f9 100644 --- a/install/scripts/switch-server-ip.php +++ b/install/scripts/switch-server-ip.php @@ -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 try { CmdLineHandler::processParameters($argc, $argv);