/** * Returns The URL of the main website, the one for the root. Don't produce any error here, or the log will be filled in no time. * Static function. * * @return string The main URL * @access public */ static function getMainURL() { static $mainURL; if (!isset($mainURL)) { $website = CMS_websitesCatalog::getMainWebsite(); $mainURL = $website->getURL(); } return $mainURL; }
* @subpackage frontend * @author Sébastien Pauchet <*****@*****.**> */ require_once dirname(__FILE__) . '/cms_rc_frontend.php'; $httpHost = null; if (isset($_SERVER['HTTP_HOST'])) { $httpHost = @parse_url($_SERVER['HTTP_HOST'], PHP_URL_HOST) ? @parse_url($_SERVER['HTTP_HOST'], PHP_URL_HOST) : $_SERVER['HTTP_HOST']; } //search page id by domain address $website = CMS_websitesCatalog::getWebsiteFromDomain($httpHost, '', $isAlt); //redirect to website main domain if current domain is an altdomain and need redirection if ($website && $isAlt && $website->redirectAltDomain()) { CMS_view::redirect($website->getURL(), true, 301); } if (!$website) { $website = CMS_websitesCatalog::getMainWebsite(); } $rootPage = $website->getRoot(); if ($rootPage->getPublication() == RESOURCE_PUBLICATION_PUBLIC) { //redirect to subpage if any $redirectlink = $rootPage->getRedirectLink(true); while ($redirectlink && $redirectlink->hasValidHREF() && sensitiveIO::IsPositiveInteger($redirectlink->getInternalLink())) { $rootPage = new CMS_page($redirectlink->getInternalLink()); if ($rootPage->getPublication() == RESOURCE_PUBLICATION_PUBLIC) { $redirectlink = $rootPage->getRedirectLink(true); } else { $redirectlink = ''; } } } $pPath = $rootPage->getHTMLURL(false, false, PATH_RELATIVETO_FILESYSTEM);