From 79bedca43bd3ef8b3254c691764f70bc9f68ce85 Mon Sep 17 00:00:00 2001 From: Saophalkun Ponlu Date: Tue, 6 Oct 2009 02:53:32 +0000 Subject: [PATCH] BUGFIX: session error when ErrorPage is viewed in the front --- code/ErrorPageSubsite.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/code/ErrorPageSubsite.php b/code/ErrorPageSubsite.php index 5f06a5e..676f97f 100644 --- a/code/ErrorPageSubsite.php +++ b/code/ErrorPageSubsite.php @@ -12,8 +12,18 @@ class ErrorPageSubsite extends DataObjectDecorator { function alternateFilepathForErrorcode($statusCode, $locale = null) { $static_filepath = Object::get_static($this->owner->ClassName, 'static_filepath'); $subdomainPart = ""; - - if($subsite = Subsite::currentSubsite(false)) { + + // when there's a controller get it subsite from session + if (Controller::curr()) { + $subsite = Subsite::currentSubsite(false); + } + // since this function is called from Page class before the controller is created, we have to get subsite from domain instead + else { + $subsiteID = Subsite::getSubsiteIDForDomain(); + if($subsiteID != 0) $subsite = DataObject::get_by_id("Subsite", $subsiteID); + } + + if($subsite) { $subdomain = $subsite->Subdomain; $subdomainPart = "-{$subdomain}"; }