@@ -30,13 +30,13 @@ |
||
| 30 | 30 | */ |
| 31 | 31 | class NotFoundResponse extends TemplateResponse { |
| 32 | 32 | |
| 33 | - /** |
|
| 34 | - * @since 8.1.0 |
|
| 35 | - */ |
|
| 36 | - public function __construct() { |
|
| 37 | - parent::__construct('core', '404', [], 'guest'); |
|
| 33 | + /** |
|
| 34 | + * @since 8.1.0 |
|
| 35 | + */ |
|
| 36 | + public function __construct() { |
|
| 37 | + parent::__construct('core', '404', [], 'guest'); |
|
| 38 | 38 | |
| 39 | - $this->setContentSecurityPolicy(new ContentSecurityPolicy()); |
|
| 40 | - $this->setStatus(404); |
|
| 41 | - } |
|
| 39 | + $this->setContentSecurityPolicy(new ContentSecurityPolicy()); |
|
| 40 | + $this->setStatus(404); |
|
| 41 | + } |
|
| 42 | 42 | } |
@@ -39,40 +39,40 @@ |
||
| 39 | 39 | use Symfony\Component\EventDispatcher\EventDispatcherInterface; |
| 40 | 40 | |
| 41 | 41 | class AdditionalScriptsMiddleware extends Middleware { |
| 42 | - /** @var EventDispatcherInterface */ |
|
| 43 | - private $legacyDispatcher; |
|
| 44 | - /** @var IUserSession */ |
|
| 45 | - private $userSession; |
|
| 46 | - /** @var IEventDispatcher */ |
|
| 47 | - private $dispatcher; |
|
| 42 | + /** @var EventDispatcherInterface */ |
|
| 43 | + private $legacyDispatcher; |
|
| 44 | + /** @var IUserSession */ |
|
| 45 | + private $userSession; |
|
| 46 | + /** @var IEventDispatcher */ |
|
| 47 | + private $dispatcher; |
|
| 48 | 48 | |
| 49 | - public function __construct(EventDispatcherInterface $legacyDispatcher, IUserSession $userSession, IEventDispatcher $dispatcher) { |
|
| 50 | - $this->legacyDispatcher = $legacyDispatcher; |
|
| 51 | - $this->userSession = $userSession; |
|
| 52 | - $this->dispatcher = $dispatcher; |
|
| 53 | - } |
|
| 49 | + public function __construct(EventDispatcherInterface $legacyDispatcher, IUserSession $userSession, IEventDispatcher $dispatcher) { |
|
| 50 | + $this->legacyDispatcher = $legacyDispatcher; |
|
| 51 | + $this->userSession = $userSession; |
|
| 52 | + $this->dispatcher = $dispatcher; |
|
| 53 | + } |
|
| 54 | 54 | |
| 55 | - public function afterController($controller, $methodName, Response $response): Response { |
|
| 56 | - if ($response instanceof TemplateResponse) { |
|
| 57 | - if (!$controller instanceof PublicShareController) { |
|
| 58 | - /* |
|
| 55 | + public function afterController($controller, $methodName, Response $response): Response { |
|
| 56 | + if ($response instanceof TemplateResponse) { |
|
| 57 | + if (!$controller instanceof PublicShareController) { |
|
| 58 | + /* |
|
| 59 | 59 | * The old event was not dispatched on the public share controller as there was |
| 60 | 60 | * OCA\Files_Sharing::loadAdditionalScripts for that. This is kept for compatibility reasons |
| 61 | 61 | * only for the old event as this is now also included in BeforeTemplateRenderedEvent |
| 62 | 62 | */ |
| 63 | - $this->legacyDispatcher->dispatch(TemplateResponse::EVENT_LOAD_ADDITIONAL_SCRIPTS, new GenericEvent()); |
|
| 64 | - } |
|
| 63 | + $this->legacyDispatcher->dispatch(TemplateResponse::EVENT_LOAD_ADDITIONAL_SCRIPTS, new GenericEvent()); |
|
| 64 | + } |
|
| 65 | 65 | |
| 66 | - if (!($response instanceof StandaloneTemplateResponse) && $this->userSession->isLoggedIn()) { |
|
| 67 | - $this->legacyDispatcher->dispatch(TemplateResponse::EVENT_LOAD_ADDITIONAL_SCRIPTS_LOGGEDIN, new GenericEvent()); |
|
| 68 | - $isLoggedIn = true; |
|
| 69 | - } else { |
|
| 70 | - $isLoggedIn = false; |
|
| 71 | - } |
|
| 66 | + if (!($response instanceof StandaloneTemplateResponse) && $this->userSession->isLoggedIn()) { |
|
| 67 | + $this->legacyDispatcher->dispatch(TemplateResponse::EVENT_LOAD_ADDITIONAL_SCRIPTS_LOGGEDIN, new GenericEvent()); |
|
| 68 | + $isLoggedIn = true; |
|
| 69 | + } else { |
|
| 70 | + $isLoggedIn = false; |
|
| 71 | + } |
|
| 72 | 72 | |
| 73 | - $this->dispatcher->dispatchTyped(new BeforeTemplateRenderedEvent($isLoggedIn)); |
|
| 74 | - } |
|
| 73 | + $this->dispatcher->dispatchTyped(new BeforeTemplateRenderedEvent($isLoggedIn)); |
|
| 74 | + } |
|
| 75 | 75 | |
| 76 | - return $response; |
|
| 77 | - } |
|
| 76 | + return $response; |
|
| 77 | + } |
|
| 78 | 78 | } |