mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
Make double-redirects a warning rather than an error, since they are usually benign.
Don't redirect from /home to / if you've already called a redirection. git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.2.2@53059 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
6edc1b6f99
commit
1ccaefaf16
@ -84,7 +84,9 @@ class ContentController extends Controller {
|
|||||||
Statistics::collect();
|
Statistics::collect();
|
||||||
|
|
||||||
// If we've accessed the homepage as /home/, then we should redirect to /.
|
// If we've accessed the homepage as /home/, then we should redirect to /.
|
||||||
if($this->dataRecord && $this->dataRecord instanceof SiteTree && RootURLController::should_be_on_root($this->dataRecord) && !$this->urlParams['Action'] && !$_POST && !$_FILES) {
|
if($this->dataRecord && $this->dataRecord instanceof SiteTree
|
||||||
|
&& RootURLController::should_be_on_root($this->dataRecord) && !$this->urlParams['Action']
|
||||||
|
&& !$_POST && !$_FILES && !Director::redirected_to() ) {
|
||||||
$getVars = $_GET;
|
$getVars = $_GET;
|
||||||
unset($getVars['url']);
|
unset($getVars['url']);
|
||||||
if($getVars) $url = "?" . http_build_query($getVars);
|
if($getVars) $url = "?" . http_build_query($getVars);
|
||||||
|
@ -484,7 +484,8 @@ class Controller extends ViewableData {
|
|||||||
*/
|
*/
|
||||||
function redirect($url) {
|
function redirect($url) {
|
||||||
if($this->response->getHeader('Location')) {
|
if($this->response->getHeader('Location')) {
|
||||||
user_error("Already directed to " . $this->response->getHeader('Location') . "; now trying to direct to $url", E_USER_ERROR);
|
user_error("Already directed to " . $this->response->getHeader('Location') . "; now trying to direct to $url", E_USER_WARNING);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attach site-root to relative links, if they have a slash in them
|
// Attach site-root to relative links, if they have a slash in them
|
||||||
|
Loading…
x
Reference in New Issue
Block a user