Use Request object

This commit is contained in:
llaumgui
2025-04-30 09:30:35 +02:00
parent 8772504b76
commit d485b728e7
+7 -1
View File
@@ -49,6 +49,11 @@ class Application extends App implements IBootstrap
*/
protected $user;
/**
* @var Request
*/
protected $request;
public function __construct(array $urlParams = [])
{
parent::__construct(self::APP_ID, $urlParams);
@@ -96,6 +101,7 @@ class Application extends App implements IBootstrap
$this->config = \OC::$server->getConfig();
$this->cspnm = \OC::$server->getContentSecurityPolicyNonceManager();
$this->user = \OC::$server[IUserSession::class]->getUser();
$this->request = \OC::$server->getRequest();
if (!$this->isEnabled()) {
return;
@@ -106,7 +112,7 @@ class Application extends App implements IBootstrap
protected function isEnabled(): bool
{
if (isset($_SERVER["HTTP_USER_AGENT"]) && preg_match('/MemoriesNative/', $_SERVER['HTTP_USER_AGENT'])) {
if (isset($this->request->server['HTTP_USER_AGENT']) && preg_match('/MemoriesNative/', $this->request->server['HTTP_USER_AGENT'])) {
return false;
}