diff --git a/core/cron.php b/core/cron.php index 32a1d98..2ea2bf5 100644 --- a/core/cron.php +++ b/core/cron.php @@ -2,6 +2,9 @@ @ignore_user_abort(true); set_time_limit(0); + if (empty($_SERVER['DOCUMENT_ROOT'])) { + $_SERVER['DOCUMENT_ROOT'] = __DIR__ . '/..'; + } require_once __DIR__ . '/bootstrap.php'; use Core\Helpers\SystemFunctions; diff --git a/core/lib/Core/Helpers/SystemFunctions.class.php b/core/lib/Core/Helpers/SystemFunctions.class.php index 1ce7902..2ef5e3c 100644 --- a/core/lib/Core/Helpers/SystemFunctions.class.php +++ b/core/lib/Core/Helpers/SystemFunctions.class.php @@ -65,7 +65,12 @@ */ public static function getOS(): string { - $userAgent = $_SERVER['HTTP_USER_AGENT']; + $undefinedOS = 'Unknown OS'; + + if(empty($_SERVER['HTTP_USER_AGENT'])) { + return $undefinedOS; + } + $oses = [ 'iOS' => '/(iPhone)|(iPad)/i', 'Windows 3.11' => '/Win16/i', @@ -93,11 +98,11 @@ ]; foreach ($oses as $os => $pattern) { - if (preg_match($pattern, $userAgent)) { + if (preg_match($pattern, $_SERVER['HTTP_USER_AGENT'])) { return $os; } } - return 'Unknown OS'; + return $undefinedOS; } /**