Beispiel #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');
}
Beispiel #2
0
    if ($_REQUEST['letter'] == 'spchar') {
        $where = "AND title NOT REGEXP(\"^[a-zA-Z]\")";
    } else {
        $where = "AND title LIKE '" . addslashes($_REQUEST['letter']) . "%'";
    }
}
//Seitenzahlen
list($count) = $db->first("SELECT count(id) FROM " . PRE . "_articles WHERE ( '" . time() . "' BETWEEN starttime AND endtime " . $where . " " . iif(count($cattree), "AND catid IN (" . @implode(',', $cattree) . ")") . " " . $artfilter . " " . section_filter() . " )");
pages(mklink($link2file . '.php?catid=' . $_REQUEST['catid'] . '&letter=' . $_REQUEST['letter'], $link2file . ',' . $_REQUEST['letter'] . ',' . $_REQUEST['catid'] . ',{P}.html'), $count, $set['articles']['epp']);
//Ausgabe erfolgt
$data = $db->fetch("SELECT a.*,IF(a.sticky>=" . time() . ",1,0) AS sticky,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 " . $where . " " . iif(count($cattree), "AND catid IN (" . @implode(',', $cattree) . ")") . " " . $artfilter . " " . section_filter() . " ) ORDER BY sticky DESC,starttime DESC " . getlimit($set['articles']['epp']));
$data = articles_extend_data($data, $parse);
//Datensatz erweitern durch Preview/Review-Daten
//Kategorien auslesen
if (in_array('ARTICLE.CATTITLE', $parse) || in_array('ARTICLE.CATICON', $parse) || in_array('ARTICLE.CATLINK', $parse)) {
    $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');
        //Artikelpic
        if (in_array('ARTICLE.PICTURE', $parse) || in_array('ARTICLE.PICTURE_POPUP', $parse) || in_array('ARTICLE.PICTURE_POPUPPATH', $parse)) {
            list($picture, $picture_popup, $picture_popuppath) = articles_artpic($res['artpic']);
        $link = mklink('articlearchive.php?month=' . date('mY', $res['starttime'] - TIMEDIFF), 'articlearchive,' . date('m,Y', $res['starttime'] - TIMEDIFF) . ',1.html');
        //Links
        if (in_array('ARCHIVE.COUNT', $parse)) {
            $monthStart = mktime(0, 0, 0, date('n', $res['starttime'] - TIMEDIFF), 1, date('Y', $res['starttime'] - TIMEDIFF)) + TIMEDIFF;
            $monthEnd = mktime(0, 0, 0, date('n', $res['starttime'] - TIMEDIFF) + 1, 1, date('Y', $res['starttime'] - TIMEDIFF)) + TIMEDIFF - 1;
            list($count) = $db->first("SELECT count(id) FROM " . PRE . "_articles WHERE ( ( '" . time() . "' BETWEEN starttime AND endtime ) AND ( starttime BETWEEN " . $monthStart . " AND " . $monthEnd . " ) " . $filter . " " . section_filter() . " )");
            $tabledata[$i]['COUNT'] = $count;
        }
        $tabledata[$i]['YEAR'] = date('Y', $res['starttime'] - TIMEDIFF);
        $tabledata[$i]['MONTH'] = $res['starttime'];
        $tabledata[$i]['LINK'] = $link;
        $laststamp = date('Y/m', $res['starttime'] - TIMEDIFF);
    }
}
$apx->tmpl->assign('ARCHIVE', $tabledata);
//Suchbox
$data = articles_catinfo();
foreach ($data as $id => $cat) {
    ++$i;
    $catdata[$i]['ID'] = $id;
    $catdata[$i]['TITLE'] = $cat['title'];
    $catdata[$i]['LEVEL'] = $cat['level'];
}
$postto = mklink('articlearchive.php', 'articlearchive.html');
$apx->tmpl->assign('SEARCH_POSTTO', $postto);
$apx->tmpl->assign('SEARCH_CATEGORY', $catdata);
$apx->tmpl->parse('archive');
////////////////////////////////////////////////////////////////////////////////////////////////////////
require 'lib/_end.php';
/////////////////////////////////////////////////////////// SCRIPT BEENDEN ///
////////////////////////////////////////////////////////////////////////////////////////////////////////
Beispiel #4
0
function articles_categories($catid = false, $template = 'categories')
{
    global $set, $db, $apx, $user;
    $tmpl = new tengine();
    $catid = (int) $catid;
    //Eine bestimmte Kategorie
    if ($catid && $set['articles']['subcats']) {
        require_once BASEDIR . 'lib/class.recursivetree.php';
        $tree = new RecursiveTree(PRE . '_articles_cat', 'id');
        $data = $tree->getTree(array('*'), $catid);
    } else {
        $data = articles_catinfo();
    }
    foreach ($data as $cat) {
        ++$i;
        //Kategorie-Link
        if (isset($cat['link'])) {
            $link = $cat['link'];
        } else {
            $link = mklink('articles.php?catid=' . $cat['id'], 'articles,0,' . $cat['id'] . ',1.html');
        }
        $catdata[$i]['ID'] = $cat['id'];
        $catdata[$i]['TITLE'] = $cat['title'];
        $catdata[$i]['ICON'] = $cat['icon'];
        $catdata[$i]['LINK'] = $link;
        $catdata[$i]['LEVEL'] = $cat['level'];
    }
    $tmpl->assign('CATEGORY', $catdata);
    $tmpl->parse('functions/' . $template, 'articles');
}