コード例 #1
0
 function getChildrenById($cat_parent_id, $ignore_offlines = false, $clang = false)
 {
     global $REX;
     if ($clang === false) {
         $clang = $REX['CUR_CLANG'];
     }
     $categorylist = $REX['INCLUDE_PATH'] . "/generated/articles/" . $cat_parent_id . "." . $clang . ".clist";
     $catlist = array();
     if (!file_exists($categorylist)) {
         include_once $REX["INCLUDE_PATH"] . "/functions/function_rex_generate.inc.php";
         rex_generateLists($cat_parent_id);
     }
     if (file_exists($categorylist)) {
         include $categorylist;
         if (isset($REX['RE_CAT_ID'][$cat_parent_id]) and is_array($REX['RE_CAT_ID'][$cat_parent_id])) {
             foreach ($REX['RE_CAT_ID'][$cat_parent_id] as $var) {
                 $category = OOCategory::getCategoryById($var, $clang);
                 if ($ignore_offlines) {
                     if ($category->isOnline()) {
                         $catlist[] = $category;
                     }
                 } else {
                     $catlist[] = $category;
                 }
             }
         }
     }
     return $catlist;
 }
コード例 #2
0
 function getArticlesOfCategory($a_category_id, $ignore_offlines = FALSE, $clang = FALSE)
 {
     global $REX;
     if ($clang === FALSE) {
         $clang = $REX['CUR_CLANG'];
     }
     $articlelist = $REX['INCLUDE_PATH'] . "/generated/articles/" . $a_category_id . "." . $clang . ".alist";
     if (!file_exists($articlelist)) {
         include_once $REX['INCLUDE_PATH'] . '/functions/function_rex_generate.inc.php';
         rex_generateLists($a_category_id, $clang);
     }
     $artlist = array();
     if (file_exists($articlelist)) {
         include_once $articlelist;
         if (isset($REX['RE_ID'][$a_category_id])) {
             foreach ($REX['RE_ID'][$a_category_id] as $var) {
                 $article = OOArticle::getArticleById($var, $clang);
                 if ($ignore_offlines) {
                     if ($article->isOnline()) {
                         $artlist[] = $article;
                     }
                 } else {
                     $artlist[] = $article;
                 }
             }
         }
     }
     return $artlist;
 }
コード例 #3
0
 /**
  * CLASS Function:
  * Return a list of articles for a certain category
  */
 static function getArticlesOfCategory($a_category_id, $ignore_offlines = false, $clang = false)
 {
     global $REX;
     if ($clang === false) {
         $clang = $REX['CUR_CLANG'];
     }
     $articlelist = $REX['GENERATED_PATH'] . '/articles/' . $a_category_id . '.' . $clang . '.alist';
     if (!file_exists($articlelist)) {
         include_once $REX['INCLUDE_PATH'] . '/functions/function_rex_generate.inc.php';
         rex_generateLists($a_category_id, $clang);
     }
     $artlist = array();
     if (file_exists($articlelist)) {
         include_once $articlelist;
         if (isset($REX['RE_ID'][$a_category_id])) {
             foreach ($REX['RE_ID'][$a_category_id] as $var) {
                 $article = self::getArticleById($var, $clang);
                 if ($ignore_offlines) {
                     if ($article->isOnline()) {
                         $artlist[] = $article;
                     }
                 } else {
                     $artlist[] = $article;
                 }
             }
         }
     }
     return $artlist;
 }
コード例 #4
0
 static function getChildrenById($cat_parent_id, $ignore_offlines = false, $clang = false)
 {
     global $REX;
     $cat_parent_id = (int) $cat_parent_id;
     if (!is_int($cat_parent_id)) {
         return array();
     }
     if ($clang === false) {
         $clang = $REX['CUR_CLANG'];
     }
     $categorylist = $REX['GENERATED_PATH'] . '/articles/' . $cat_parent_id . '.' . $clang . '.clist';
     $catlist = array();
     if (!file_exists($categorylist)) {
         include_once $REX['INCLUDE_PATH'] . '/functions/function_rex_generate.inc.php';
         rex_generateLists($cat_parent_id);
     }
     if (file_exists($categorylist)) {
         include $categorylist;
         if (isset($REX['RE_CAT_ID'][$cat_parent_id]) and is_array($REX['RE_CAT_ID'][$cat_parent_id])) {
             foreach ($REX['RE_CAT_ID'][$cat_parent_id] as $var) {
                 $category = self::getCategoryById($var, $clang);
                 if ($ignore_offlines) {
                     if ($category->isOnline()) {
                         $catlist[] = $category;
                     }
                 } else {
                     $catlist[] = $category;
                 }
             }
         }
     }
     return $catlist;
 }
コード例 #5
0
/**
 * Berechnet die Prios der Artikel in einer Kategorie neu
 * 
 * @param $re_id    KategorieId der Kategorie, die erneuert werden soll
 * @param $clang    ClangId der Kategorie, die erneuert werden soll
 * @param $new_prio Neue PrioNr der Kategorie 
 * @param $old_prio Alte PrioNr der Kategorie
 */
function rex_newArtPrio($re_id, $clang, $new_prio, $old_prio)
{
    global $REX;
    if ($new_prio != $old_prio) {
        if ($new_prio < $old_prio) {
            $addsql = "desc";
        } else {
            $addsql = "asc";
        }
        $gu = new sql();
        $gr = new sql();
        $gr->setQuery("select * from " . $REX['TABLE_PREFIX'] . "article where clang='{$clang}' and ((startpage<>1 and re_id='{$re_id}') or (startpage=1 and id={$re_id}))order by prior,updatedate {$addsql}");
        for ($i = 0; $i < $gr->getRows(); $i++) {
            // echo "<br>".$gr->getValue("pid")." ".$gr->getValue("id")." ".$gr->getValue("name");
            $ipid = $gr->getValue("pid");
            $iprior = $i + 1;
            $gu->query("update " . $REX['TABLE_PREFIX'] . "article set prior={$iprior} where pid='{$ipid}'");
            $gr->next();
        }
        rex_generateLists($re_id);
    }
}
コード例 #6
0
/**
 * Löscht einen Artikel
 *
 * @param $id ArtikelId des Artikels, der gelöscht werden soll
 *
 * @return TRUE wenn der Artikel gelöscht wurde, sonst eine Fehlermeldung
 */
function _rex_deleteArticle($id)
{
    global $REX, $I18N;
    // artikel loeschen
    //
    // kontrolle ob erlaubnis nicht hier.. muss vorher geschehen
    //
    // -> startpage = 0
    // --> artikelfiles löschen
    // ---> article
    // ---> content
    // ---> clist
    // ---> alist
    // -> startpage = 1
    // --> rekursiv aufrufen
    $return = array();
    $return['state'] = false;
    if ($id == $REX['START_ARTICLE_ID']) {
        $return['message'] = $I18N->msg('cant_delete_sitestartarticle');
        return $return;
    }
    if ($id == $REX['NOTFOUND_ARTICLE_ID']) {
        $return['message'] = $I18N->msg('cant_delete_notfoundarticle');
        return $return;
    }
    $ART = rex_sql::factory();
    $ART->setQuery('select * from ' . $REX['TABLE_PREFIX'] . 'article where id=' . $id . ' and clang=0');
    if ($ART->getRows() > 0) {
        $re_id = $ART->getValue('re_id');
        $return['state'] = true;
        $return = rex_register_extension_point('ART_PRE_DELETED', $return, array('id' => $id, 're_id' => $re_id, 'name' => $ART->getValue('name'), 'status' => $ART->getValue('status'), 'prior' => $ART->getValue('prior'), 'path' => $ART->getValue('path'), 'template_id' => $ART->getValue('template_id')));
        if (!$return['state']) {
            return $return;
        }
        if ($ART->getValue('startpage') == 1) {
            $return['message'] = $I18N->msg('category_deleted');
            $SART = rex_sql::factory();
            $SART->setQuery('select * from ' . $REX['TABLE_PREFIX'] . 'article where re_id=' . $id . ' and clang=0');
            for ($i = 0; $i < $SART->getRows(); $i++) {
                $return['state'] = _rex_deleteArticle($id);
                $SART->next();
            }
        } else {
            $return['message'] = $I18N->msg('article_deleted');
        }
        // Rekursion über alle Kindkategorien ergab keine Fehler
        // => löschen erlaubt
        if ($return['state'] === true) {
            rex_deleteCacheArticle($id);
            $ART->setQuery('delete from ' . $REX['TABLE_PREFIX'] . 'article where id=' . $id);
            $ART->setQuery('delete from ' . $REX['TABLE_PREFIX'] . 'article_slice where article_id=' . $id);
            // --------------------------------------------------- Listen generieren
            rex_generateLists($re_id);
        }
        return $return;
    } else {
        $return['message'] = $I18N->msg('category_doesnt_exist');
        return $return;
    }
}
コード例 #7
0
/**
 * Berechnet die Prios der Artikel in einer Kategorie neu
 *
 * @param $re_id    KategorieId der Kategorie, die erneuert werden soll
 * @param $clang    ClangId der Kategorie, die erneuert werden soll
 * @param $new_prio Neue PrioNr der Kategorie
 * @param $old_prio Alte PrioNr der Kategorie
 *
 * @deprecated 4.1 - 26.03.2008
 * Besser die rex_organize_priorities() Funktion verwenden!
 */
function rex_newArtPrio($re_id, $clang, $new_prio, $old_prio)
{
    global $REX;
    if ($new_prio != $old_prio) {
        if ($new_prio < $old_prio) {
            $addsql = "desc";
        } else {
            $addsql = "asc";
        }
        rex_organize_priorities($REX['TABLE_PREFIX'] . 'article', 'prior', 'clang=' . $clang . ' AND ((startpage<>1 AND re_id=' . $re_id . ') OR (startpage=1 AND id=' . $re_id . '))', 'prior,updatedate ' . $addsql);
        //    $gu = new rex_sql;
        //    $gr = new rex_sql;
        //    $gr->setQuery("select * from ".$REX['TABLE_PREFIX']."article where clang='$clang' and ((startpage<>1 and re_id='$re_id') or (startpage=1 and id=$re_id))order by prior,updatedate $addsql");
        //    for ($i = 0; $i < $gr->getRows(); $i ++)
        //    {
        //      // echo "<br>".$gr->getValue("pid")." ".$gr->getValue("id")." ".$gr->getValue("name");
        //      $ipid = $gr->getValue("pid");
        //      $iprior = $i +1;
        //      $gu->setQuery("update ".$REX['TABLE_PREFIX']."article set prior=$iprior where pid='$ipid'");
        //      $gr->next();
        //    }
        rex_generateLists($re_id);
    }
}