Ejemplo n.º 1
0
            $label = $redirectlink->getExternalLink();
            $redirectlink->setTarget('_blank');
            $redirect = $redirectlink->getHTML(io::ellipsis($label, '80'), MOD_STANDARD_CODENAME, RESOURCE_DATA_LOCATION_EDITED);
        }
    } else {
        $label = $cms_language->getMessage(MESSAGE_PAGE_PAGE) . ' "' . $page->getTitle() . '" (' . $page->getID() . ')';
        $redirect = '<a href="' . $page->getURL(false, false, PATH_RELATIVETO_WEBROOT, true) . '">' . io::htmlspecialchars($label) . '</a>';
    }
    $content = '
	<div id="atm-center">
		<div class="atm-alert">' . $cms_language->getMessage(MESSAGE_PAGE_REDIRECT, array($redirect)) . '</div>
	</div>';
} else {
    if (isset($_GET['url'])) {
        $url = urldecode($_GET['url']);
        if ($page = CMS_tree::analyseURL($url)) {
            $label = $cms_language->getMessage(MESSAGE_PAGE_PAGE) . ' "' . $page->getTitle() . '" (' . $page->getID() . ')';
            $redirect = '<a href="' . $page->getURL(false, false, PATH_RELATIVETO_WEBROOT, true) . '">' . io::htmlspecialchars($label) . '</a>';
        } else {
            $redirect = '<a href="' . $url . '" target="_blank">' . io::htmlspecialchars($url) . '</a>';
        }
        $content = '
	<div id="atm-center">
		<div class="atm-alert">' . $cms_language->getMessage(MESSAGE_PAGE_REDIRECT, array($redirect)) . '</div>
	</div>';
    } else {
        $content = '
	<div id="atm-center">
		<div class="atm-alert">' . $cms_language->getMessage(MESSAGE_PAGE_PAGE_REDIRECT_ERROR) . '</div>
	</div>';
    }
Ejemplo n.º 2
0
} elseif (!$fromtab) {
    $fromtab = 'public';
}
if (!$pageUrl && !$pageId && !$from) {
    CMS_grandFather::raiseError('Missing page parameter ...');
    $view->show();
} elseif (!$pageUrl && !$pageId) {
    $pageId = $from;
}
$jscontent = '';
$isAutomne = $querystring = false;
//current http host
$httpHost = @parse_url($_SERVER['HTTP_HOST'], PHP_URL_HOST) ? @parse_url($_SERVER['HTTP_HOST'], PHP_URL_HOST) : $_SERVER['HTTP_HOST'];
if ($pageUrl && !$pageId) {
    //get page from requested url
    if ($cms_page = CMS_tree::analyseURL($pageUrl)) {
        $pageId = $cms_page->getID();
        $isAutomne = true;
    }
} elseif ($pageId) {
    //try to instanciate the requested page
    $cms_page = CMS_tree::getPageByID($pageId);
    $isAutomne = true;
}
if (!isset($cms_page) || !$cms_page || !is_object($cms_page) || $cms_page->hasError() || $cms_page->getID() != APPLICATION_ROOT_PAGE_ID && !CMS_tree::hasAncestor($cms_page->getID())) {
    if ($pageUrl && !$isAutomne) {
        if ($pageUrl == PATH_REALROOT_WR . '/' && $httpHost != @parse_url(CMS_websitesCatalog::getMainURL(), PHP_URL_HOST)) {
            //Website domain is not properly set
            if ($cms_user->hasAdminClearance(CLEARANCE_ADMINISTRATION_EDITVALIDATEALL)) {
                $jscontent = "\n\t\t\t\t\tAutomne.message.popup({\n\t\t\t\t\t\ttitle: \t\t'" . $cms_language->getJSMessage(MESSAGE_PAGE_INCORRECT_DOMAIN) . "', \n\t\t\t\t\t\tmsg: \t\t'" . $cms_language->getJSMessage(MESSAGE_PAGE_INCORRECT_WEBSITE_CONFIG, array($httpHost, @parse_url(CMS_websitesCatalog::getMainURL(), PHP_URL_HOST))) . "',\n\t\t\t\t\t\tbuttons:\tExt.MessageBox.OK,\n\t\t\t\t\t\ticon: \t\tExt.MessageBox.WARNING,\n\t\t\t\t\t\tfn: \t\tfunction (button) {\n\t\t\t\t\t\t\t\t\t\tvar window = new Automne.frameWindow({\n\t\t\t\t\t\t\t\t\t\t\tid:\t\t\t\t'websitesWindow',\n\t\t\t\t\t\t\t\t\t\t\tframeURL:\t\t'" . PATH_MAIN_WR . "/admin-v3/websites.php',\n\t\t\t\t\t\t\t\t\t\t\tallowFrameNav:\ttrue,\n\t\t\t\t\t\t\t\t\t\t\twidth:\t\t\t750,\n\t\t\t\t\t\t\t\t\t\t\theight:\t\t\t580\n\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\twindow.show();\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t";
            } else {
Ejemplo n.º 3
0
     $csvDatas = $csvFile->readContent('csv', 'trim', array('delimiter' => ';', 'enclosure' => '"', 'strict' => true));
     $rules = array();
     foreach ($csvDatas as $line => $csvData) {
         if (isset($csvData[0]) && $csvData[0] && isset($csvData[1]) && $csvData[1]) {
             $rules[$csvData[0]] = $csvData[1];
         }
     }
     if (isset($rules[$_SERVER['REQUEST_URI']]) && io::isPositiveInteger($rules[$_SERVER['REQUEST_URI']])) {
         $page = CMS_tree::getPageById($rules[$_SERVER['REQUEST_URI']]);
     } elseif (isset($rules[parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH)]) && io::isPositiveInteger($rules[parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH)])) {
         $page = CMS_tree::getPageById($rules[parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH)]);
     }
 }
 if (!isset($page)) {
     //get page from requested url
     $page = CMS_tree::analyseURL($_SERVER['REQUEST_URI'], false);
 }
 //get redirection URL for page
 if (isset($page) && is_object($page) && !$page->hasError() && $page->getStatus()->getLocation() != RESOURCE_LOCATION_DELETED) {
     //get page file
     $pageURL = $page->getURL(substr($basename, 0, 5) == 'print' ? true : false, false, PATH_RELATIVETO_FILESYSTEM);
     if (file_exists($pageURL)) {
         $redirectTo = $page->getURL(substr($basename, 0, 5) == 'print' ? true : false);
     } else {
         //try to regenerate page
         if ($page->regenerate(true)) {
             clearstatcache();
             if (file_exists($pageURL)) {
                 $redirectTo = $page->getURL(substr($basename, 0, 5) == 'print' ? true : false);
             }
         }
Ejemplo n.º 4
0
/**
 * Force page regeneration for given URL (need to be logged and to have regen rights)
 */
function atm_regen()
{
    global $cms_user;
    if (isset($_SERVER['REQUEST_URI']) && isset($_REQUEST['atm-regen']) && isset($cms_user) && is_object($cms_user) && $cms_user->hasAdminClearance(CLEARANCE_ADMINISTRATION_REGENERATEPAGES)) {
        $p = CMS_tree::analyseURL($_SERVER['REQUEST_URI']);
        if ($p && is_object($p) && !$p->hasError()) {
            $p->regenerate(true);
        }
    }
}
Ejemplo n.º 5
0
 /**
  * Redirect page to another one
  * Take care of redirections inside Automne administration
  *
  * @param string $url : the url to redirect to
  * @param boolean $exit : does the script must exit now ? (default : true)
  * @param integer $type : the http redirection code to use. Accept 302 and 301 (default : 302)
  * @return boolean
  * @access public
  * @static
  */
 static function redirect($url, $exit = true, $type = 302)
 {
     $url = trim($url);
     if (!$url || !@parse_url($url)) {
         CMS_grandFather::raiseError('Try to make a redirection to an empty or invalid url: ' . $url);
         return false;
     }
     if (headers_sent()) {
         CMS_grandFather::raiseError('Try to make a redirection to ' . $url . ' while content already sent to browser.');
         return false;
     }
     if ($type == 301) {
         header('HTTP/1.x 301 Moved Permanently', true, 301);
     } elseif ($type == 302) {
         header('HTTP/1.x 302 Found', true, 302);
     } elseif ($type == 303) {
         header('HTTP/1.x 303 See Other', true, 303);
     }
     //in case of redirect in an admin frame, send to information page
     if (isset($_REQUEST['atm-context']) && $_REQUEST['atm-context'] == 'adminframe') {
         if (strpos($url, PATH_FORBIDDEN_WR) === 0 || strpos($url, PATH_SPECIAL_PAGE_NOT_FOUND_WR) === 0) {
             header('Location: ' . $url);
         } else {
             $page = CMS_tree::analyseURL($url);
             if ($page && is_object($page) && !$page->hasError()) {
                 header('Location: ' . PATH_ADMIN_WR . '/page-redirect-info.php?pageId=' . $page->getID());
             } else {
                 header('Location: ' . PATH_ADMIN_WR . '/page-redirect-info.php?url=' . $url);
             }
         }
     } else {
         header('Location: ' . $url);
     }
     if ($exit) {
         exit;
     }
     return true;
 }