示例#1
0
function misc_articlesfeed()
{
    global $set, $db, $apx;
    $apx->tmpl->loaddesign('blank');
    header('Content-type: application/rss+xml');
    //Verwendete Variablen
    $parse = $apx->tmpl->used_vars('rss', 'articles');
    //Baum holen, wenn nur eine bestimmte Kategorie gezeigt werden soll
    $cattree = articles_tree($_REQUEST['catid']);
    $data = $db->fetch("SELECT a.id,a.type,a.catid,a.title,a.subtitle,a.teaser,a.starttime,a.top,b.username,b.email,b.pub_hidemail FROM " . PRE . "_articles AS a LEFT JOIN " . PRE . "_user AS b USING (userid) WHERE ( " . time() . " BETWEEN starttime AND endtime " . iif(count($cattree), "AND catid IN (" . @implode(',', $cattree) . ")") . " " . section_filter() . " ) ORDER BY starttime DESC LIMIT 20");
    //Kategorien auslesen
    $catinfo = articles_catinfo(get_ids($data, 'catid'));
    if (count($data)) {
        foreach ($data as $res) {
            ++$i;
            //Wohin soll verlinkt werden?
            if ($res['type'] == 'normal') {
                $link2file = 'articles';
            } else {
                $link2file = $res['type'] . 's';
            }
            //Link
            $link = mklink($link2file . '.php?id=' . $res['id'], $link2file . ',id' . $res['id'] . ',0' . urlformat($res['title']) . '.html');
            //Text: Teaser oder Artikelseite
            if ($res['teaser'] && $set['articles']['teaser']) {
                $text = $res['teaser'];
            } else {
                list($text) = $db->first("SELECT text FROM " . PRE . "_articles_pages WHERE artid='" . $res['id'] . "' ORDER BY ord ASC LIMIT 1");
                $text = $text;
            }
            $tabledata[$i]['ID'] = $res['id'];
            $tabledata[$i]['TITLE'] = rss_replace($res['title']);
            $tabledata[$i]['SUBTITLE'] = rss_replace($res['subtitle']);
            $tabledata[$i]['TIME'] = date('r', $res['starttime']);
            //Kein TIMEDIFF weil Zeitverschiebung mit angegeben!
            $tabledata[$i]['TEXT'] = rss_replace(preg_replace('#{IMAGE\\(([0-9]+)\\)}#s', '', $text));
            $tabledata[$i]['CATTITLE'] = rss_replace($catinfo[$res['catid']]['title']);
            $tabledata[$i]['LINK'] = HTTP_HOST . $link;
            $tabledata[$i]['USERNAME'] = replace($res['username']);
            $tabledata[$i]['EMAIL'] = replace(iif(!$res['pub_hidemail'], $res['email']));
            $tabledata[$i]['EMAIL_ENCRYPTED'] = replace(iif(!$res['pub_hidemail'], cryptMail($res['email'])));
            $tabledata[$i]['TOP'] = $res['top'];
        }
    }
    $apx->tmpl->assign('WEBSITENAME', $set['main']['websitename']);
    $apx->tmpl->assign('ARTICLE', $tabledata);
    $apx->tmpl->parse('rss', 'articles');
}
示例#2
0
     $tagid = getTagId($_REQUEST['tag']);
     if ($tagid) {
         $data = $db->fetch("SELECT id FROM " . PRE . "_articles_tags WHERE tagid='" . $tagid . "'");
         $ids = get_ids($data, 'id');
         if ($ids) {
             $where .= iif($where, ' AND ') . ' a.id IN (' . implode(',', $ids) . ') ';
         } else {
             $where .= iif($where, ' AND ') . ' 0 ';
         }
     } else {
         $where .= iif($where, ' AND ') . ' 0 ';
     }
 }
 //Kategorie
 if ($_REQUEST['catid']) {
     $cattree = articles_tree($_REQUEST['catid']);
     if (count($cattree)) {
         $where .= iif($where, ' AND ') . ' a.catid IN (' . @implode(',', $cattree) . ')';
     }
 }
 //Artikeltyp
 $arttypes = array();
 foreach ($_REQUEST['type'] as $type) {
     if (in_array($type, array('normal', 'preview', 'review'))) {
         $arttypes[] = "'" . $type . "'";
     }
 }
 if (count($arttypes) > 0 && count($arttypes) < 3) {
     $where .= iif($where, ' AND ') . ' a.type IN (' . implode(',', $arttypes) . ')';
 }
 //Zeitperiode
示例#3
0
function articles_product($prodid = 0, $count = 5, $start = 0, $catid = false, $type = false, $template = 'productarticles')
{
    global $set, $db, $apx, $user;
    $prodid = (int) $prodid;
    $count = (int) $count;
    $start = (int) $start;
    $catid = (int) $catid;
    if (!$prodid) {
        return;
    }
    if (!in_array($type, array(false, 'normal', 'preview', 'review'))) {
        $type = false;
    }
    $cattree = articles_tree($catid);
    $data = $db->fetch("SELECT a.*,b.userid,b.username,b.email,b.pub_hidemail FROM " . PRE . "_articles AS a LEFT JOIN " . PRE . "_user AS b USING(userid) WHERE ( " . time() . " BETWEEN starttime AND endtime AND prodid='" . $prodid . "' " . iif($type, "AND type='" . $type . "'") . " " . iif(count($cattree), ' AND catid IN (' . @implode(',', $cattree) . ') ') . " " . section_filter() . " ) ORDER BY starttime DESC LIMIT " . iif($start, $start . ',') . $count);
    articles_print($data, 'functions/' . $template);
}