1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-23 06:33:22 +02:00

Error 403/404 templates;

Not Found redirect - set 404 error code;
404/403 actions - send proper HTTP status code;
Front controller now sets render mode to
module-controller-action by default (override from within individual
actions via setRenderMod() still possible)
This commit is contained in:
SecretR
2013-10-23 17:39:44 +03:00
parent c3f9d98898
commit f60b8f6e81
3 changed files with 110 additions and 20 deletions

View File

@@ -808,7 +808,7 @@ class eRouter
* TODO - user friendly URL ('/system/404') when system config is ready ('/system/404')
* @var string
*/
public $notFoundUrl = 'system/error/notfound?type=routeError';
public $notFoundUrl = 'system/error/404?type=routeError';
public function __construct()
{
@@ -1723,7 +1723,7 @@ class eRouter
{
$redirect = $this->assemble($this->notFoundUrl, '', 'encode=0&full=1');
//echo $redirect; exit;
e107::getRedirect()->redirect($redirect);
e107::getRedirect()->redirect($redirect, true, 404);
}
}
}
@@ -2972,6 +2972,9 @@ class eControllerFront extends eController
// _GET input validation
$this->validateInput();
// Set Render mode to module-controller-action, override possible within the action
$this->getResponse()->setRenderMod(str_replace('/', '-', $this->getRequest()->getRoute()));
}
/**
@@ -3706,6 +3709,9 @@ class eResponse
$this->_content_type = $typeName;
}
/**
* @return eResponse
*/
public function sendContentType()
{
$ctypeStr = $this->getContentMediaType($this->getContentType());
@@ -3716,6 +3722,15 @@ class eResponse
return $this;
}
/**
* @return eResponse
*/
public function addHeader($header, $override = false, $responseCode = null)
{
header($header, $override, $responseCode);
return $this;
}
/**
* Append content
* @param str $body