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@42114 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2007-09-16 16:12:07 +00:00
parent 970a453cb8
commit 4ceb428cb5

View File

@ -125,6 +125,7 @@ class Director {
if($_REQUEST['debug'] == 1) Debug::message("Redirecting to $controller");
if(isset($_GET['debug_profile'])) Profiler::unmark("Director","getControllerForURL");
return "redirect:" . Director::absoluteURL(substr($controller,2), true);
} else {
@ -147,6 +148,7 @@ class Director {
if(isset($arguments['URLSegment'])) self::$urlSegment = $arguments['URLSegment'] . "/";
if(isset($_GET['debug_profile'])) Profiler::unmark("Director","getControllerForURL");
return $controllerObj;
}
}
@ -165,7 +167,11 @@ class Director {
static function currentPage() {
if(isset(Director::$urlParams['URLSegment'])) {
$SQL_urlSegment = Convert::raw2sql(Director::$urlParams['URLSegment']);
return DataObject::get_one("SiteTree", "URLSegment = '$SQL_urlSegment'");
if (Translatable::is_enabled()) {
return Translatable::get_one("SiteTree", "URLSegment = '$SQL_urlSegment'");
} else {
return DataObject::get_one("SiteTree", "URLSegment = '$SQL_urlSegment'");
}
} else {
return Controller::currentController();
}