Exemple #1
0
 protected function initializeSite()
 {
     $request = $this->getRequest();
     $currentDirectory = $request->getRequestedPageDirectory();
     $currentDomain = $request->getHttpHost(false);
     $site = SiteTable::getByDomainAndPath($currentDomain, $currentDirectory);
     if ($site === false) {
         $siteList = SiteTable::getList(array('filter' => array('ACTIVE' => 'Y'), 'order' => array('DEF' => 'DESC', 'SORT' => 'ASC'), 'select' => array('*', 'ID' => 'LID')));
         $site = $siteList->fetch();
     }
     if ($site === false) {
         throw new SystemException("Site not found");
     }
     $culture = Context\Culture::wakeUp($site["CULTURE_ID"]);
     if ($culture === null) {
         $culture = new Context\Culture();
     }
     $this->site = new Context\Site($site);
     $this->site->setCulture($culture);
     $this->setContextCulture($culture, $this->site->getLanguage());
 }