2022-10-14 01:42:25 -04:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
|
|
/**
|
2024-05-27 04:08:53 -04:00
|
|
|
* SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors
|
|
|
|
|
* SPDX-License-Identifier: AGPL-3.0-or-later
|
2022-10-14 01:42:25 -04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
namespace OC\Core\Controller;
|
|
|
|
|
|
|
|
|
|
use OCP\AppFramework\Http;
|
2024-01-10 06:35:44 -05:00
|
|
|
use OCP\AppFramework\Http\Attribute\FrontpageRoute;
|
2024-01-18 04:38:37 -05:00
|
|
|
use OCP\AppFramework\Http\Attribute\OpenAPI;
|
2022-10-14 01:42:25 -04:00
|
|
|
use OCP\AppFramework\Http\TemplateResponse;
|
|
|
|
|
|
2024-01-18 04:38:37 -05:00
|
|
|
#[OpenAPI(scope: OpenAPI::SCOPE_IGNORE)]
|
2022-10-14 01:42:25 -04:00
|
|
|
class ErrorController extends \OCP\AppFramework\Controller {
|
|
|
|
|
/**
|
|
|
|
|
* @PublicPage
|
|
|
|
|
* @NoCSRFRequired
|
|
|
|
|
*/
|
2024-01-10 06:35:44 -05:00
|
|
|
#[FrontpageRoute(verb: 'GET', url: 'error/403')]
|
2022-10-14 01:42:25 -04:00
|
|
|
public function error403(): TemplateResponse {
|
|
|
|
|
$response = new TemplateResponse(
|
|
|
|
|
'core',
|
|
|
|
|
'403',
|
|
|
|
|
[],
|
|
|
|
|
'error'
|
|
|
|
|
);
|
|
|
|
|
$response->setStatus(Http::STATUS_FORBIDDEN);
|
|
|
|
|
return $response;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @PublicPage
|
|
|
|
|
* @NoCSRFRequired
|
|
|
|
|
*/
|
2024-01-10 06:35:44 -05:00
|
|
|
#[FrontpageRoute(verb: 'GET', url: 'error/404')]
|
2022-10-14 01:42:25 -04:00
|
|
|
public function error404(): TemplateResponse {
|
|
|
|
|
$response = new TemplateResponse(
|
|
|
|
|
'core',
|
|
|
|
|
'404',
|
|
|
|
|
[],
|
|
|
|
|
'error'
|
|
|
|
|
);
|
|
|
|
|
$response->setStatus(Http::STATUS_NOT_FOUND);
|
|
|
|
|
return $response;
|
|
|
|
|
}
|
|
|
|
|
}
|