From 1bc00f4b2dad02e7c30c366e886e610382d30f44 Mon Sep 17 00:00:00 2001 From: Sam Minnee Date: Sat, 26 Apr 2008 06:53:13 +0000 Subject: [PATCH] Merged revisions 53066 via svnmerge from http://svn.silverstripe.com/open/modules/sapphire/branches/2.2.2 ........ r53066 | sminnee | 2008-04-21 10:14:48 +1200 (Mon, 21 Apr 2008) | 2 lines 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/trunk@53521 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- core/control/ContentController.php | 4 +++- core/control/Controller.php | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/core/control/ContentController.php b/core/control/ContentController.php index f932bd307..d2a4ee693 100644 --- a/core/control/ContentController.php +++ b/core/control/ContentController.php @@ -83,7 +83,9 @@ class ContentController extends Controller { parent::init(); // 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; unset($getVars['url']); if($getVars) $url = "?" . http_build_query($getVars); diff --git a/core/control/Controller.php b/core/control/Controller.php index 584970218..26c9d7396 100644 --- a/core/control/Controller.php +++ b/core/control/Controller.php @@ -511,7 +511,8 @@ class Controller extends ViewableData { */ function redirect($url, $code=302) { 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