diff --git a/backend/zarafa/listfolders.php b/backend/zarafa/listfolders.php index 1b95b7d3..6e31c0d6 100755 --- a/backend/zarafa/listfolders.php +++ b/backend/zarafa/listfolders.php @@ -65,8 +65,8 @@ function main() { function listfolders_configure() { - if (!isset($_SERVER["TERM"]) || !isset($_SERVER["LOGNAME"])) { - echo "This script should not be called in a browser.\n"; + if (php_sapi_name() != "cli") { + printf("This script should not be called in a browser. Called from: %s\n", php_sapi_name()); exit(1); } @@ -181,4 +181,4 @@ function listfolders_getlist ($adminStore, $session, $user) { } } -?> \ No newline at end of file +?> diff --git a/tools/migrate-2.0.x-2.1.0.php b/tools/migrate-2.0.x-2.1.0.php index e9c76067..82985343 100644 --- a/tools/migrate-2.0.x-2.1.0.php +++ b/tools/migrate-2.0.x-2.1.0.php @@ -52,8 +52,8 @@ * MAIN */ try { - if (!isset($_SERVER["TERM"]) || !isset($_SERVER["LOGNAME"])) - die("This script should not be called in a browser."); + if (php_sapi_name() != "cli") + die(sprintf("This script should not be called in a browser. Called from: %s", php_sapi_name())); if (!defined('ZPUSH_BASE_PATH') || !file_exists(ZPUSH_BASE_PATH . "/config.php")) die("ZPUSH_BASE_PATH not set correctly or no config.php file found\n"); @@ -214,4 +214,4 @@ public function DoMigration() { } } -?> \ No newline at end of file +?> diff --git a/z-push-admin.php b/z-push-admin.php index 5da49967..4190a7bc 100755 --- a/z-push-admin.php +++ b/z-push-admin.php @@ -192,8 +192,8 @@ static public function UsageInstructions() { * @access public */ static public function CheckEnv() { - if (!isset($_SERVER["TERM"]) || !isset($_SERVER["LOGNAME"])) - self::$errormessage = "This script should not be called in a browser."; + if (php_sapi_name() != "cli") + self::$errormessage = sprintf("This script should not be called in a browser. Called from: %s", php_sapi_name()); if (!function_exists("getopt")) self::$errormessage = "PHP Function getopt not found. Please check your PHP version and settings."; @@ -903,4 +903,4 @@ static private function printDeviceData($deviceId, $user) { } -?> \ No newline at end of file +?>