function rex_generateArticle($id, $refresh = 0)
{
    global $PHP_SELF, $module_id, $FORM, $REX_USER, $REX, $I18N;
    // artikel generieren
    // vorraussetzung: articel steht schon in der datenbank
    //
    // -> infos schreiben -> abhaengig von clang
    // --> artikel infos / einzelartikel metadaten
    // --> artikel content / einzelartikel content
    // --> listen generieren // wenn startpage = 1
    // ---> artikel liste
    // ---> category liste
    // --> cache loeschen
    // --------------------------------------------------- generiere generated/articles/xx.article
    $CL = $REX[CLANG];
    reset($CL);
    for ($i = 0; $i < count($CL); $i++) {
        $clang = key($CL);
        $REX[RC] = true;
        // keine Ausgabe als eval(CONTENT) sondern nur speichern in datei
        $CONT = new article();
        $CONT->setCLang($clang);
        $CONT->setArticleId($id);
        $article_content = "?>" . $CONT->getArticle();
        // --------------------------------------------------- Artikelparameter speichern
        $article = "<?\n" . "\n\$REX[ART][{$id}][article_id][{$clang}] = \"{$id}\";" . "\n\$REX[ART][{$id}][re_id][{$clang}] = \"" . rex_addslashes($CONT->getValue("re_id")) . "\";" . "\n\$REX[ART][{$id}][name][{$clang}] = \"" . rex_addslashes($CONT->getValue("name")) . "\";" . "\n\$REX[ART][{$id}][catname][{$clang}] = \"" . rex_addslashes($CONT->getValue("catname")) . "\";" . "\n\$REX[ART][{$id}][cattype][{$clang}] = \"" . rex_addslashes($CONT->getValue("name")) . "\";" . "\n\$REX[ART][{$id}][alias][{$clang}] = \"" . rex_addslashes($CONT->getValue("name")) . "\";" . "\n\$REX[ART][{$id}][description][{$clang}] = \"" . rex_addslashes($CONT->getValue("description")) . "\";" . "\n\$REX[ART][{$id}][attribute][{$clang}] = \"" . rex_addslashes($CONT->getValue("attribute")) . "\";" . "\n\$REX[ART][{$id}][file][{$clang}] = \"" . rex_addslashes($CONT->getValue("file")) . "\";" . "\n\$REX[ART][{$id}][type_id][{$clang}] = \"" . rex_addslashes($CONT->getValue("type_id")) . "\";" . "\n\$REX[ART][{$id}][teaser][{$clang}] = \"" . rex_addslashes($CONT->getValue("teaser")) . "\";" . "\n\$REX[ART][{$id}][startpage][{$clang}] = \"" . rex_addslashes($CONT->getValue("startpage")) . "\";" . "\n\$REX[ART][{$id}][prior][{$clang}] = \"" . rex_addslashes($CONT->getValue("prior")) . "\";" . "\n\$REX[ART][{$id}][path][{$clang}] = \"" . rex_addslashes($CONT->getValue("path")) . "\";" . "\n\$REX[ART][{$id}][status][{$clang}] = \"" . rex_addslashes($CONT->getValue("status")) . "\";" . "\n\$REX[ART][{$id}][online_from][{$clang}] = \"" . rex_addslashes($CONT->getValue("online_from")) . "\";" . "\n\$REX[ART][{$id}][online_to][{$clang}] = \"" . rex_addslashes($CONT->getValue("online_to")) . "\";" . "\n\$REX[ART][{$id}][createdate][{$clang}] = \"" . rex_addslashes($CONT->getValue("createdate")) . "\";" . "\n\$REX[ART][{$id}][updatedate][{$clang}] = \"" . rex_addslashes($CONT->getValue("updatedate")) . "\";" . "\n\$REX[ART][{$id}][keywords][{$clang}] = \"" . rex_addslashes($CONT->getValue("keywords")) . "\";" . "\n\$REX[ART][{$id}][template_id][{$clang}] = \"" . rex_addslashes($CONT->getValue("template_id")) . "\";" . "\n\$REX[ART][{$id}][createuser][{$clang}] = \"" . rex_addslashes($CONT->getValue("createuser")) . "\";" . "\n\$REX[ART][{$id}][updateuser][{$clang}] = \"" . rex_addslashes($CONT->getValue("updateuser")) . "\";" . "\n\$REX[ART][{$id}][last_update_stamp][{$clang}] = \"" . time() . "\";" . "\n?>";
        if ($fp = @fopen($REX[INCLUDE_PATH] . "/generated/articles/{$id}.{$clang}.article", "w")) {
            fputs($fp, $article);
            fclose($fp);
            @chmod($REX[INCLUDE_PATH] . "/generated/articles/{$id}.{$clang}.article", 0777);
        } else {
            $MSG = $I18N->msg('article_could_not_be_generated') . " " . $I18N->msg('check_rights_in_directory') . $REX[INCLUDE_PATH] . "/generated/articles/";
        }
        // --------------------------------------------------- Artikelcontent speichern
        if ($fp = @fopen($REX[INCLUDE_PATH] . "/generated/articles/{$id}.{$clang}.content", "w")) {
            fputs($fp, $article_content);
            fclose($fp);
            @chmod($REX[INCLUDE_PATH] . "/generated/articles/{$id}.{$clang}.content", 0777);
        } else {
            $MSG = $I18N->msg('article_could_not_be_generated') . " " . $I18N->msg('check_rights_in_directory') . $REX[INCLUDE_PATH] . "/generated/articles/";
        }
        if ($MSG != "") {
            echo "<table border=0 cellpadding=5 cellspacing=1 width=770><tr><td class=warning>{$MSG}</td></tr></table>";
        }
        $REX[RC] = false;
        // --------------------------------------------------- Listen generieren
        if ($CONT->getValue("startpage") == 1) {
            rex_generateLists($id);
            rex_generateLists($CONT->getValue("re_id"));
        } else {
            rex_generateLists($CONT->getValue("re_id"));
        }
        next($CL);
    }
    // --------------------------------------------------- recache all
    $Cache = new Cache();
    $Cache->removeAllCacheFiles();
}
/**
 * Generiert alle *.article u. *.content Dateien eines Artikels/einer Kategorie
 * 
 * @param $id ArtikelId des Artikels, der generiert werden soll 
 * @param $refreshall Boolean Bei True wird der Inhalte auch komplett neu generiert, bei False nur die Metainfos
 */
function rex_generateArticle($id, $refreshall = true)
{
    global $PHP_SELF, $module_id, $FORM, $REX_USER, $REX, $I18N;
    // artikel generieren
    // vorraussetzung: articel steht schon in der datenbank
    //
    // -> infos schreiben -> abhaengig von clang
    // --> artikel infos / einzelartikel metadaten
    // --> artikel content / einzelartikel content
    // --> listen generieren // wenn startpage = 1
    // ---> artikel liste
    // ---> category liste
    // --------------------------------------------------- generiere generated/articles/xx.article
    $CL = $REX['CLANG'];
    reset($CL);
    for ($i = 0; $i < count($CL); $i++) {
        $clang = key($CL);
        $REX['RC'] = true;
        // keine Ausgabe als eval(CONTENT) sondern nur speichern in datei
        $CONT = new article();
        $CONT->setCLang($clang);
        $CONT->setArticleId($id);
        // --------------------------------------------------- Artikelparameter speichern
        $article = "<?php\n" . "\n\$REX['ART']['{$id}']['article_id']['{$clang}'] = \"{$id}\";" . "\n\$REX['ART']['{$id}']['re_id']['{$clang}'] = \"" . rex_addslashes($CONT->getValue("re_id")) . "\";" . "\n\$REX['ART']['{$id}']['name']['{$clang}'] = \"" . rex_addslashes($CONT->getValue("name")) . "\";" . "\n\$REX['ART']['{$id}']['catname']['{$clang}'] = \"" . rex_addslashes($CONT->getValue("catname")) . "\";" . "\n\$REX['ART']['{$id}']['cattype']['{$clang}'] = \"" . rex_addslashes($CONT->getValue("name")) . "\";" . "\n\$REX['ART']['{$id}']['alias']['{$clang}'] = \"" . rex_addslashes($CONT->getValue("name")) . "\";" . "\n\$REX['ART']['{$id}']['description']['{$clang}'] = \"" . rex_addslashes($CONT->getValue("description")) . "\";" . "\n\$REX['ART']['{$id}']['attribute']['{$clang}'] = \"" . rex_addslashes($CONT->getValue("attribute")) . "\";" . "\n\$REX['ART']['{$id}']['file']['{$clang}'] = \"" . rex_addslashes($CONT->getValue("file")) . "\";" . "\n\$REX['ART']['{$id}']['type_id']['{$clang}'] = \"" . rex_addslashes($CONT->getValue("type_id")) . "\";" . "\n\$REX['ART']['{$id}']['teaser']['{$clang}'] = \"" . rex_addslashes($CONT->getValue("teaser")) . "\";" . "\n\$REX['ART']['{$id}']['startpage']['{$clang}'] = \"" . rex_addslashes($CONT->getValue("startpage")) . "\";" . "\n\$REX['ART']['{$id}']['prior']['{$clang}'] = \"" . rex_addslashes($CONT->getValue("prior")) . "\";" . "\n\$REX['ART']['{$id}']['path']['{$clang}'] = \"" . rex_addslashes($CONT->getValue("path")) . "\";" . "\n\$REX['ART']['{$id}']['status']['{$clang}'] = \"" . rex_addslashes($CONT->getValue("status")) . "\";" . "\n\$REX['ART']['{$id}']['online_from']['{$clang}'] = \"" . rex_addslashes($CONT->getValue("online_from")) . "\";" . "\n\$REX['ART']['{$id}']['online_to']['{$clang}'] = \"" . rex_addslashes($CONT->getValue("online_to")) . "\";" . "\n\$REX['ART']['{$id}']['createdate']['{$clang}'] = \"" . rex_addslashes($CONT->getValue("createdate")) . "\";" . "\n\$REX['ART']['{$id}']['updatedate']['{$clang}'] = \"" . rex_addslashes($CONT->getValue("updatedate")) . "\";" . "\n\$REX['ART']['{$id}']['keywords']['{$clang}'] = \"" . rex_addslashes($CONT->getValue("keywords")) . "\";" . "\n\$REX['ART']['{$id}']['template_id']['{$clang}'] = \"" . rex_addslashes($CONT->getValue("template_id")) . "\";" . "\n\$REX['ART']['{$id}']['createuser']['{$clang}'] = \"" . rex_addslashes($CONT->getValue("createuser")) . "\";" . "\n\$REX['ART']['{$id}']['updateuser']['{$clang}'] = \"" . rex_addslashes($CONT->getValue("updateuser")) . "\";" . "\n\$REX['ART']['{$id}']['last_update_stamp']['{$clang}'] = \"" . time() . "\";" . "\n?>";
        if ($fp = @fopen($REX['INCLUDE_PATH'] . "/generated/articles/{$id}.{$clang}.article", "w")) {
            fputs($fp, $article);
            fclose($fp);
            @chmod($REX['INCLUDE_PATH'] . "/generated/articles/{$id}.{$clang}.article", 0777);
        } else {
            $MSG = $I18N->msg('article_could_not_be_generated') . " " . $I18N->msg('check_rights_in_directory') . $REX['INCLUDE_PATH'] . "/generated/articles/";
        }
        // --------------------------------------------------- Artikelcontent speichern
        if ($refreshall) {
            if ($fp = @fopen($REX['INCLUDE_PATH'] . "/generated/articles/{$id}.{$clang}.content", "w")) {
                $article_content = "?>" . $CONT->getArticle();
                fputs($fp, $article_content);
                fclose($fp);
                @chmod($REX['INCLUDE_PATH'] . "/generated/articles/{$id}.{$clang}.content", 0777);
            } else {
                $MSG = $I18N->msg('article_could_not_be_generated') . " " . $I18N->msg('check_rights_in_directory') . $REX['INCLUDE_PATH'] . "/generated/articles/";
            }
        }
        if (isset($MSG) and $MSG != "") {
            echo "<table border=0 cellpadding=5 cellspacing=1 width=770><tr><td class=warning>{$MSG}</td></tr></table>";
        }
        $REX['RC'] = false;
        // --------------------------------------------------- Listen generieren
        if ($CONT->getValue("startpage") == 1) {
            rex_generateLists($id);
            rex_generateLists($CONT->getValue("re_id"));
        } else {
            rex_generateLists($CONT->getValue("re_id"));
        }
        next($CL);
    }
}
Example #3
0
     if (!isset($slice_id)) {
         $slice_id = '';
     }
     if (!isset($function)) {
         $function = '';
     }
     // ------------------------------------------ START: MODULE EDITIEREN/ADDEN ETC.
     $CONT = new article();
     $CONT->setArticleId($article_id);
     $CONT->setSliceId($slice_id);
     $CONT->setMode($mode);
     $CONT->setCLang($clang);
     $CONT->setCType($ctype);
     $CONT->setEval(TRUE);
     $CONT->setFunction($function);
     eval("?>" . $CONT->getArticle());
     // ------------------------------------------ END: MODULE EDITIEREN/ADDEN ETC.
 } elseif ($mode == "meta") {
     // ------------------------------------------ START: META VIEW
     $extens = "";
     if (isset($save) and $save == "1") {
         $meta_sql = new sql();
         $meta_sql->setTable($REX['TABLE_PREFIX'] . "article");
         // $meta_sql->debugsql = 1;
         $meta_sql->where("id='{$article_id}' and clang={$clang}");
         $meta_sql->setValue("online_from", mktime(0, 0, 0, $monat_von, $tag_von, $jahr_von));
         $meta_sql->setValue("online_to", mktime(0, 0, 0, $monat_bis, $tag_bis, $jahr_bis));
         $meta_sql->setValue("keywords", $meta_keywords);
         $meta_sql->setValue("description", $meta_description);
         $meta_sql->setValue("name", $meta_article_name);
         $meta_sql->setValue("type_id", $type_id);
function generateArticle($id)
{
    global $PHP_SELF, $module_id, $FORM, $REX_USER, $REX, $I18N;
    // --------------------------------------------------- generiere generated/articles/xx.article
    $REX[RC] = true;
    // Generiere Content
    $CONT = new article();
    $CONT->setArticleId($id);
    $REX[TEMP] = $REX[BF];
    $REX[BF] = false;
    $article_content = "?>" . $CONT->getArticle();
    $REX[BF] = true;
    $article_bcontent = "?>" . $CONT->getArticle();
    $REX[BF] = $REX[TEMP];
    $article = "<?\r\n\r\n\$REX[ART][{$id}][name] = \"" . addslashes($CONT->getValue("name")) . "\";\r\n\$REX[ART][{$id}][beschreibung] = \"" . addslashes($CONT->getValue("beschreibung")) . "\";\r\n\$REX[ART][{$id}][suchbegriffe] = \"" . addslashes($CONT->getValue("suchbegriffe")) . "\";\r\n\$REX[ART][{$id}][category_id] = \"" . addslashes($CONT->getValue("category_id")) . "\";\r\n\$REX[ART][{$id}][article_id] = \"{$id}\";\r\n\$REX[ART][{$id}][type_id] = \"" . addslashes($CONT->getValue("type_id")) . "\";\r\n\$REX[ART][{$id}][file] = \"" . addslashes($CONT->getValue("file")) . "\";\r\n\$REX[ART][{$id}][startpage] = \"" . addslashes($CONT->getValue("startpage")) . "\";\r\n\$REX[ART][{$id}][prio] = \"" . addslashes($CONT->getValue("prio")) . "\";\r\n\$REX[ART][{$id}][path] = \"" . addslashes($CONT->getValue("path")) . "\";\r\n\$REX[ART][{$id}][online_von] = \"" . addslashes($CONT->getValue("online_von")) . "\";\r\n\$REX[ART][{$id}][online_bis] = \"" . addslashes($CONT->getValue("online_bis")) . "\";\r\n\$REX[ART][{$id}][erstelldatum] = \"" . addslashes($CONT->getValue("erstelldatum")) . "\";\r\n\$REX[ART][{$id}][template_id] = \"" . addslashes($CONT->getValue("template_id")) . "\";\r\n\$REX[ART][{$id}][status] = \"" . addslashes($CONT->getValue("status")) . "\";\r\n\r\n?>";
    // Artikelparameter speichern
    if ($fp = @fopen($REX[INCLUDE_PATH] . "/generated/articles/" . $id . ".article", "w")) {
        fputs($fp, $article);
        fclose($fp);
    } else {
        $MSG = $I18N->msg('article_could_not_be_generated') . " " . $I18N->msg('check_rights_in_directory') . $REX[INCLUDE_PATH] . "/generated/articles/";
    }
    // Artikelcontent speichern
    if ($fp = @fopen($REX[INCLUDE_PATH] . "/generated/articles/" . $id . ".content", "w")) {
        fputs($fp, $article_content);
        fclose($fp);
    } else {
        $MSG = $I18N->msg('article_could_not_be_generated') . " " . $I18N->msg('check_rights_in_directory') . $REX[INCLUDE_PATH] . "/generated/articles/";
    }
    // Artikel B content speichern [BARRIEREFREI]
    if ($fp = @fopen($REX[INCLUDE_PATH] . "/generated/articles/" . $id . ".bcontent", "w")) {
        fputs($fp, $article_bcontent);
        fclose($fp);
    } else {
        $MSG = $I18N->msg('article_could_not_be_generated') . " " . $I18N->msg('check_rights_in_directory') . $REX[INCLUDE_PATH] . "generated/articles/";
    }
    if ($MSG != "") {
        echo "\t<table border=0 cellpadding=5 cellspacing=1 width=770>\r\n\t\t\t<tr><td class=warning>{$MSG}</td></tr>\r\n\t\t\t</table>";
    }
    $REX[RC] = false;
}
<?php

/*
 * removeArticle.php
 * 负责删除文章逻辑
 * Created By C860 at 2014-2-28
 */
include_once '../conf/config.php';
//引入相关模型类
include_once '../Models/article.php';
include_once '../Models/user_info.php';
//检验数据合法性
if (isset($_GET['id']) && is_numeric($_GET['id'])) {
    $id = $_GET['id'];
    $article = article::getArticle($id);
    if (sys::hasLogged() && $article != false && $_SESSION['userId'] == $article['user_id']) {
        if (article::removeArticle($id)) {
            sys::alert('删除成功!');
            sys::redirect('../index.php');
        }
    } else {
        sys::redirect('../index.php');
    }
}
Example #6
0
<?php

session_start();
require_once '../utils/dbconnection.php';
require_once '../model/showArticle.php';
$article = new article();
$row = $article->getArticle($pdo);
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale = 1.0, maximum-scale=1.0, user-scalable=no"/>
    <title>Mon blog sur les séries</title>

    <link type="text/css" rel="stylesheet" href="../style/default.css">
    <link type="text/css" rel="stylesheet" href="../style/style.css">
    <link type="text/css" rel="stylesheet" href="../style/header.css">
    <link type="text/css" rel="stylesheet" href="../style/footer.css">
    <link type="text/css" rel="stylesheet" href="../style/content.css">
    <link type="text/css" rel="stylesheet" href="../style/article.css">
    <link type="text/css" rel="stylesheet" href="../style/menuToggle.css">

    <script src="../js/jquery-2.2.0.min.js"></script>
    <script src="../js/jquery.scrollUp.min.js"></script>
    <script>
        $(function () {
            $.scrollUp({
                scrollName: 'scrollUp',
                scrollDistance: 50,
                scrollFrom: 'top',
    ?>
                </a>
            </li>
        <?php 
}
?>
    </ul>
</nav>
<section>

    <?php 
foreach ($areaArray as $area) {
    ?>

        <?php 
    $articleArray = article::getArticle($area->getID(), $currentPage->getID());
    ?>

        <div id="<?php 
    echo $area->getAlias();
    ?>
">

            <?php 
    foreach ($articleArray as $article) {
        ?>

                <article id="<?php 
        echo $article->getName();
        ?>
">