Пример #1
0
 /**
  * Returns the link to the given article.
  *
  * @param integer $articleId
  * @param integer $variation
  */
 function getLink($articleId, $variation = 0)
 {
     global $c, $cds;
     if ($variation == 0) {
         $variation = $this->variation;
     }
     if ($cds->is_development) {
         // dev url
         $category = getDBCell("channel_articles", "CH_CAT_ID", "ARTICLE_ID=" . $articleId);
         $spid = getDBCell("channel_categories", "PAGE_ID", "CH_CAT_ID=" . $category);
         $spm = getDBCell("sitepage", "SPM_ID", "SPID=" . $spid);
         $template = getDBCell("sitepage_master", "TEMPLATE_PATH", "SPM_ID=" . $spm);
         $result = $c['devdocroot'] . $template . "?page={$spid}&v={$variation}&article={$articleId}";
     } else {
         // live url.
         $result = $c['livedocroot'] . getArticleURL($articleId, $variation);
     }
     return $result;
 }
Пример #2
0
/**
 * Clear the page with URL-Path
 * 
 * @param integer SitepageId of the page
 * @param integer VariationId of the page
 */
function clearArticleURL($articleId, $variation)
{
    global $c;
    $short = getArticleURL($articleId, $variation);
    $cat = getDBCell('channel_articles', 'CH_CAT_ID', "ARTICLE_ID = " . $articleId);
    $spid0 = getDBCell('channel_categories', 'PAGE_ID', 'CH_CAT_ID=' . $cat);
    $spid = getDBCell("state_translation", "OUT_ID", "IN_ID={$spid0} AND LEVEL=10");
    if (substr($short, 0, 1) == "/") {
        $short = substr($short, 1);
    }
    $allDir = $c["livepath"];
    // ensure that path exists
    $directories = explode("/", $short);
    if (count($directories) > 0) {
        for ($i = 0; $i < count($directories); $i++) {
            $thisDir = $directories[$i];
            if ($thisDir != "") {
                $allDir = $allDir . $thisDir . "/";
            }
        }
        // delete old index file
        if (file_exists($allDir . "index.php")) {
            nxDelete($allDir, "index.php");
        }
        // create new index-file...
        global $c;
        $index = 'html>';
        $index .= '<head>';
        $index .= '<title>Page does not exist</title>';
        $index .= '<meta name="generator" content="N/X WCMS">';
        $index .= '</head>';
        $index .= '<body text="#000000" bgcolor="#FFFFFF" link="#FF0000" alink="#FF0000" vlink="#FF0000">';
        $index .= '<center>';
        $index .= '<font face="VERDANA" size="2">';
        $index .= 'The URL you entered is not available at present.<br>';
        $index .= 'Please try again later or go to <a href="' . $c["livedocroot"] . '">Startpage</a>.';
        $index .= '</font>';
        $index .= '</center>';
        $index .= '</body>';
        $index .= '</html>';
        // write to disk
        $index_file = fopen($allDir . "index.php", "w");
        fwrite($index_file, $index);
        fclose($index_file);
    }
}
<?php

if ($auth->checkAccessToFunction("CHANNEL_EDIT")) {
    $cond = "ARTICLE_ID = {$oid}";
    $oname = new TextInput($lang->get("name"), "channel_articles", "TITLE", $cond, "type:text,width:300,size:64", "MANDATORY");
    $propPanel->add($oname);
    $propPanel->add(new PositionInput($lang->get("position", "Position"), "channel_articles", "POSITION", $cond, "<chcat> AND VERSION=0", "size:4,width:50"));
    $propPanel->add(new SelectOneInput($lang->get("category"), "channel_articles", "CH_CAT_ID", "channel_categories", "NAME", "CH_CAT_ID", "CHID = {$chid}", $cond, "type:dropdown", "MANDATORY"));
    $propPanel->add(new DateTimeInput($lang->get("ch_article_date", "Article Date"), "channel_articles", "ARTICLE_DATE", $cond));
    $propPanel->add(new SubTitle("st", $lang->get("sp_launchdates"), 3));
    $propPanel->add(new DateTimeInput($lang->get("sp_launchdate"), "channel_articles", "LAUNCH_DATE", $cond));
    $propPanel->add(new DateTimeInput($lang->get("sp_expiredate"), "channel_articles", "EXPIRE_DATE", $cond));
    $propPanel->add(new SubTitle('st', $lang->get('art_url', 'Article URL')));
    $propPanel->add(new Label('lbl', $lang->get('url', 'URL'), 'standard', 1));
    $uri = getArticleURL($oid, $variation);
    if (file_exists($c["livepath"] . $uri)) {
        $propPanel->add(new Label('lbl', '<a href="' . $c["host"] . $c["livedocroot"] . $uri . '" target="_blank">' . $c["host"] . $c["livedocroot"] . $uri . '</a>', 'standardlight', 2));
    } else {
        $propPanel->add(new Label('lbl', $c["host"] . $c["livedocroot"] . $uri, 'standardlight', 2));
    }
}
$propPanel->add(new FormButtons());