Esempio n. 1
0
//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);
if ($pPath) {
    if (file_exists($pPath)) {
        $cms_page_included = true;
        require $pPath;
        exit;
    } elseif ($rootPage->regenerate(true)) {
        clearstatcache();
        if (file_exists($pPath)) {