2016-08-16 03:22:58 +02:00
|
|
|
<?php
|
|
|
|
namespace SilverStripe\CMS\Model;
|
|
|
|
|
|
|
|
use SilverStripe\ORM\DataModel;
|
2016-09-09 01:26:24 +02:00
|
|
|
use SilverStripe\Control\HTTPRequest;
|
|
|
|
use SilverStripe\Control\HTTPResponse;
|
2016-08-23 04:36:06 +02:00
|
|
|
use Page_Controller;
|
|
|
|
|
2016-08-16 03:22:58 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Controller for ErrorPages.
|
|
|
|
*/
|
|
|
|
class ErrorPage_Controller extends Page_Controller
|
|
|
|
{
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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
|
2016-09-09 01:26:24 +02:00
|
|
|
* {@link HTTPResponse::isFinished() ignoring the response body.
|
2016-08-16 03:22:58 +02:00
|
|
|
*
|
2016-09-09 01:26:24 +02:00
|
|
|
* @param HTTPRequest $request
|
2016-08-16 03:22:58 +02:00
|
|
|
* @param DataModel $model
|
2016-09-09 01:26:24 +02:00
|
|
|
* @return HTTPResponse
|
2016-08-16 03:22:58 +02:00
|
|
|
*/
|
2016-09-09 01:26:24 +02:00
|
|
|
public function handleRequest(HTTPRequest $request, DataModel $model = null)
|
2016-08-16 03:22:58 +02:00
|
|
|
{
|
|
|
|
$response = parent::handleRequest($request, $model);
|
|
|
|
$response->setStatusCode($this->ErrorCode);
|
|
|
|
return $response;
|
|
|
|
}
|
|
|
|
}
|