getRouter(); $requestedPath = $router->getRequestedContextPath($request); if ($requestedPath === 'index' || $requestedPath === '') { // No journal requested. Check how many journals the site has. $journalDao = DAORegistry::getDAO('JournalDAO'); /* @var $journalDao JournalDAO */ $journals = $journalDao->getAll(true); $journalsCount = $journals->getCount(); $journal = null; if ($journalsCount === 1) { // Return the unique journal. $journal = $journals->next(); } if (!$journal && $journalsCount > 1) { // Get the site redirect. $journal = $this->getSiteRedirectContext($request); } } else { // Return the requested journal. $journal = $router->getContext($request); } if (is_a($journal, 'Journal')) { return $journal; } return null; } } ?>