Example #1
0
function misc_newsfeed()
{
    global $set, $db, $apx;
    $apx->tmpl->loaddesign('blank');
    header('Content-type: application/rss+xml');
    //Baum holen, wenn nur eine bestimmte Kategorie gezeigt werden soll
    $cattree = news_tree($_REQUEST['catid']);
    $data = $db->fetch("SELECT a.id,a.catid,a.title,a.subtitle,a.teaser,a.text,a.starttime,a.top,b.username,b.email,b.pub_hidemail FROM " . PRE . "_news 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 = news_catinfo(get_ids($data, 'catid'));
    if (count($data)) {
        foreach ($data as $res) {
            ++$i;
            //Link
            $link = mklink('news.php?id=' . $res['id'], 'news,id' . $res['id'] . urlformat($res['title']) . '.html');
            //Text
            if ($set['news']['teaser'] && $res['teaser']) {
                $text = $res['teaser'];
            } else {
                $text = $res['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'] = rss_replace($res['username']);
            $tabledata[$i]['EMAIL'] = rss_replace(iif(!$res['pub_hidemail'], $res['email']));
            $tabledata[$i]['EMAIL_ENCRYPTED'] = rss_replace(iif(!$res['pub_hidemail'], cryptMail($res['email'])));
            $tabledata[$i]['TOP'] = $res['top'];
        }
    }
    $apx->tmpl->assign('WEBSITENAME', $set['main']['websitename']);
    $apx->tmpl->assign('NEWS', $tabledata);
    $apx->tmpl->parse('rss', 'news');
}
Example #2
0
//////////////////////////////////////////////////////////////////////////////////////////////////////// NEWS AUFLISTEN
//Titelleiste
headline($apx->lang->get('HEADLINE'), mklink('news.php', 'news.html'));
titlebar($apx->lang->get('HEADLINE'));
//Verwendete Variablen auslesen
$parse = $apx->tmpl->used_vars('index');
//Kategorie-Baum holen
$cattree = news_tree($_REQUEST['catid']);
//Seitenzahlen generieren
list($count) = $db->first("SELECT count(id) FROM " . PRE . "_news WHERE ( " . time() . " BETWEEN starttime AND endtime " . iif(count($cattree), ' AND catid IN (' . @implode(',', $cattree) . ') ') . section_filter() . ")");
pages(mklink('news.php?catid=' . $_REQUEST['catid'], 'news,' . $_REQUEST['catid'] . ',{P}.html'), $count, $set['news']['epp']);
//News ausgeben
$data = $db->fetch("SELECT a.*,IF(a.sticky>=" . time() . ",1,0) AS sticky,b.userid,b.username,b.email,b.pub_hidemail FROM " . PRE . "_news 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 sticky DESC,starttime DESC " . getlimit($set['news']['epp']));
//Kategorien auslesen
if (in_array('NEWS.CATTITLE', $parse) || in_array('NEWS.CATICON', $parse) || in_array('NEWS.CATLINK', $parse)) {
    $catinfo = news_catinfo(get_ids($data, 'catid'));
}
if (count($data)) {
    foreach ($data as $res) {
        ++$i;
        //Link
        $link = mklink('news.php?id=' . $res['id'], 'news,id' . $res['id'] . urlformat($res['title']) . '.html');
        //Newspic
        if (in_array('NEWS.PICTURE', $parse) || in_array('NEWS.PICTURE_POPUP', $parse) || in_array('NEWS.PICTURE_POPUPPATH', $parse)) {
            list($picture, $picture_popup, $picture_popuppath) = news_newspic($res['newspic']);
        }
        //Username + eMail
        if ($res['userid']) {
            $username = $res['username'];
            $email = iif(!$res['pub_hidemail'], $res['email']);
        } else {
Example #3
0
function news_categories($catid = false, $template = 'categories')
{
    global $set, $db, $apx, $user;
    $tmpl = new tengine();
    $catid = (int) $catid;
    //Eine bestimmte Kategorie
    if ($catid && $set['news']['subcats']) {
        require_once BASEDIR . 'lib/class.recursivetree.php';
        $tree = new RecursiveTree(PRE . '_news_cat', 'id');
        $data = $tree->getTree(array('*'), $catid);
    } else {
        $data = news_catinfo();
    }
    foreach ($data as $cat) {
        ++$i;
        //Kategorie-Link
        if (isset($cat['link'])) {
            $link = $cat['link'];
        } else {
            $link = mklink('news.php?catid=' . $res['id'], 'news,' . $res['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, 'news');
}
Example #4
0
        $link = mklink('newsarchive.php?month=' . date('mY', $res['starttime'] - TIMEDIFF), 'newsarchive,' . 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 . "_news 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']);
    }
}
$apx->tmpl->assign('ARCHIVE', $tabledata);
//Suchbox
$data = news_catinfo();
foreach ($data as $id => $cat) {
    ++$i;
    $catdata[$i]['ID'] = $id;
    $catdata[$i]['TITLE'] = $cat['title'];
    $catdata[$i]['LEVEL'] = $cat['level'];
}
$postto = mklink('newsarchive.php', 'newsarchive.html');
$apx->tmpl->assign('SEARCH_POSTTO', $postto);
$apx->tmpl->assign('SEARCH_CATEGORY', $catdata);
$apx->tmpl->parse('archive');
////////////////////////////////////////////////////////////////////////////////////////////////////////
require 'lib/_end.php';
/////////////////////////////////////////////////////////// SCRIPT BEENDEN ///
////////////////////////////////////////////////////////////////////////////////////////////////////////