2016-08-16 13:22:58 +12:00
|
|
|
<?php
|
|
|
|
namespace SilverStripe\CMS\Model;
|
|
|
|
|
|
|
|
use SilverStripe\ORM\DataModel;
|
2016-09-09 11:26:24 +12:00
|
|
|
use SilverStripe\Control\HTTPRequest;
|
|
|
|
use SilverStripe\Control\HTTPResponse;
|
2016-12-30 10:32:04 +13:00
|
|
|
use PageController;
|
2016-08-23 14:36:06 +12:00
|
|
|
|
2016-08-16 13:22:58 +12:00
|
|
|
/**
|
|
|
|
* Controller for ErrorPages.
|
|
|
|
*/
|
2016-12-30 10:32:04 +13:00
|
|
|
class ErrorPageController extends PageController
|
2016-08-16 13:22:58 +12:00
|
|
|
{
|
|
|
|
|
2017-01-26 09:59:25 +13:00
|
|
|
/**
|
|
|
|
* Overload the provided {@link Controller::handleRequest()} to append the
|
|
|
|
* correct status code post request since otherwise permission related error
|
|
|
|
* pages such as 401 and 403 pages won't be rendered due to
|
|
|
|
* {@link HTTPResponse::isFinished() ignoring the response body.
|
|
|
|
*
|
|
|
|
* @param HTTPRequest $request
|
|
|
|
* @param DataModel $model
|
|
|
|
* @return HTTPResponse
|
|
|
|
*/
|
|
|
|
public function handleRequest(HTTPRequest $request, DataModel $model = null)
|
|
|
|
{
|
|
|
|
$response = parent::handleRequest($request, $model);
|
|
|
|
$response->setStatusCode($this->ErrorCode);
|
|
|
|
return $response;
|
|
|
|
}
|
2016-08-16 13:22:58 +12:00
|
|
|
}
|