From 5b330d38c40eefb2a79e47a363d880515ca93c9c Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Sun, 16 Sep 2007 16:14:01 +0000 Subject: [PATCH] bfojcapell: If we are visiting a multilingual site Translatable::get_one should be used (merged from branches/gsoc) git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@42116 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- core/control/ModelAsController.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/core/control/ModelAsController.php b/core/control/ModelAsController.php index 8b7ea8f04..e7a047e94 100644 --- a/core/control/ModelAsController.php +++ b/core/control/ModelAsController.php @@ -24,8 +24,14 @@ class ModelAsController extends Controller implements NestedController { public function getNestedController() { if($this->urlParams['URLSegment']) { - $child = DataObject::get_one("SiteTree", "URLSegment = '" . addslashes($this->urlParams['URLSegment']) . "'"); + $SQL_URLSegment = Convert::raw2sql($this->urlParams['URLSegment']); + if (Translatable::is_enabled()) { + $child = Translatable::get_one("SiteTree", "URLSegment = '$SQL_URLSegment'"); + } else { + $child = DataObject::get_one("SiteTree", "URLSegment = '$SQL_URLSegment'"); + } if(!$child) { + header("HTTP/1.0 404 Not Found"); $child = $this->get404Page(); }