'true', ]; if (isset($_GET['altUrl'])) { $url = filter_var($_GET['altUrl'], FILTER_VALIDATE_URL); if ($url !== false) { $host = parse_url($url, PHP_URL_HOST); $scheme = parse_url($url, PHP_URL_SCHEME); if ($host && $scheme === 'https' && ( $host === self::ALLOWED_DOMAIN || str_ends_with($host, '.' . self::ALLOWED_DOMAIN) )) { $params['altUrl'] = $url; } } } putenv('QUERY_STRING=' . http_build_query($params)); } public function execute(): string { // Validate script with all necessary permissions if (!is_file(self::SCRIPT_PATH) || !is_readable(self::SCRIPT_PATH) || !is_executable(self::SCRIPT_PATH)) { throw new RuntimeException('Script not found or not executable'); } $this->setupEnvironment(); $output = []; $command = escapeshellcmd(self::SCRIPT_PATH); if (exec($command, $output) === false) { throw new RuntimeException('Script execution failed'); } return implode("\n", $output); } } // Usage $checker = new UnraidCheckExec(); echo $checker->execute();