From 571e8d2b2cddf91337c98f4281d62e77e8ae2f69 Mon Sep 17 00:00:00 2001 From: Sam Minnee Date: Wed, 8 Oct 2008 22:35:22 +0000 Subject: [PATCH] BUGFIX: Prevent misconfigured redirector pages from breaking static publishing git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@63909 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- core/model/RedirectorPage.php | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/core/model/RedirectorPage.php b/core/model/RedirectorPage.php index 5bd025c7c..a5dcab223 100755 --- a/core/model/RedirectorPage.php +++ b/core/model/RedirectorPage.php @@ -111,21 +111,24 @@ class RedirectorPage_Controller extends Page_Controller { if($this->RedirectionType == 'External') { if($this->ExternalURL) { Director::redirect($this->ExternalURL); - } else { - echo "

" . - _t('RedirectorPage.HASBEENSETUP', 'A redirector page has been set up without anywhere to redirect to.') . - "

"; } } else { $linkTo = DataObject::get_by_id("SiteTree", $this->LinkToID); if($linkTo) { Director::redirect($linkTo->Link(), 301); - } else { - echo "

" . _t('RedirectorPage.HASBEENSETUP') . "

"; } } parent::init(); } + + /** + * If we ever get this far, it means that the redirection failed. + */ + function index() { + return "

" . + _t('RedirectorPage.HASBEENSETUP', 'A redirector page has been set up without anywhere to redirect to.') . + "

"; + } } ?> \ No newline at end of file