mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
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
This commit is contained in:
parent
bd1b9e4f73
commit
571e8d2b2c
@ -111,21 +111,24 @@ class RedirectorPage_Controller extends Page_Controller {
|
|||||||
if($this->RedirectionType == 'External') {
|
if($this->RedirectionType == 'External') {
|
||||||
if($this->ExternalURL) {
|
if($this->ExternalURL) {
|
||||||
Director::redirect($this->ExternalURL);
|
Director::redirect($this->ExternalURL);
|
||||||
} else {
|
|
||||||
echo "<p>" .
|
|
||||||
_t('RedirectorPage.HASBEENSETUP', 'A redirector page has been set up without anywhere to redirect to.') .
|
|
||||||
"</p>";
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$linkTo = DataObject::get_by_id("SiteTree", $this->LinkToID);
|
$linkTo = DataObject::get_by_id("SiteTree", $this->LinkToID);
|
||||||
if($linkTo) {
|
if($linkTo) {
|
||||||
Director::redirect($linkTo->Link(), 301);
|
Director::redirect($linkTo->Link(), 301);
|
||||||
} else {
|
|
||||||
echo "<p>" . _t('RedirectorPage.HASBEENSETUP') . "</p>";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
parent::init();
|
parent::init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If we ever get this far, it means that the redirection failed.
|
||||||
|
*/
|
||||||
|
function index() {
|
||||||
|
return "<p>" .
|
||||||
|
_t('RedirectorPage.HASBEENSETUP', 'A redirector page has been set up without anywhere to redirect to.') .
|
||||||
|
"</p>";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
Loading…
x
Reference in New Issue
Block a user