';
}
$linkclass = '';
function news_find_kat ($kat) {
$katpfad = 'include/images/news/';
$katjpg = $katpfad.$kat.'.jpg';
$katgif = $katpfad.$kat.'.gif';
$katpng = $katpfad.$kat.'.png';
if ( file_exists( $katjpg ) ) {
$pfadzumBild = $katjpg;
} elseif ( file_exists ( $katgif ) ) {
$pfadzumBild = $katgif;
} elseif ( file_exists ( $katpng ) ) {
$pfadzumBild = $katpng;
}
if ( !empty( $pfadzumBild ) ) {
$kategorie = '';
} else {
$kategorie = ''.$kat.'
';
}
return ( $kategorie );
}
if ( !is_numeric($menu->get(1)) ) {
if($menu->get(1) == 'rss' || $menu->get(1) == 'atom')
{
#ob_clean();
$feed_type = $menu->get(1);
$abf = "SELECT MAX(news_time) AS last_update FROM prefix_news";
$erg = db_query($abf);
$row = db_fetch_assoc($erg);
$last_update = str_replace(' ', 'T', $row['last_update']) . 'Z';
$abf = "SELECT
a.news_title as title,
a.news_id as id,";
$abf .= ($feed_type == 'atom') ? 'a.news_time as datum,' : "DATE_FORMAT(a.news_time,'%a, %e %b %y %H:%i:%s') as datum,";
$abf .=
"a.news_kat as kate,
a.news_text as text,
a.news_html as html,
a.news_tn as tn,
b.name as username,
c.name as editor
FROM prefix_news as a
LEFT JOIN prefix_user as b ON a.user_id = b.id
LEFT JOIN prefix_user as c ON a.editor_id = c.id
WHERE a.news_recht = 0
ORDER BY news_time DESC LIMIT 15";
$erg = db_query($abf);
$tpl = new tpl( 'news_'.$menu->get(1).'.htm' );
header('Content-type: application/' . $menu->get(1) . '+xml');
$tpl->set_ar_out(array('FEEDTITLE' => $allgAr['title'],
'UPDATED' => $last_update), 0);
while ($row = db_fetch_assoc($erg))
{
if($feed_type == 'atom')
{
$row['datum'] = str_replace(' ', 'T', $row['datum']) . 'Z';
}
$text = stripslashes($row['text']);
if($row['html'] == "true"){
$row['text'] = $text;
}
else
{$row['text'] = BBcode($text);}
//$avatar_exists = @db_result(db_query("SELECT avatar FROM prefix_user WHERE name = ".$row['username']),0);
//$row ['AVATA'] = '';
$author = $row['username'];
if (($row['username'] != $row['editor']) AND ($row['editor'] != '')) $author .= ' (Letzte Änderung von '.$row['editor'].')';
$a = explode('[PREVIEWENDE]', $text);
$tpl->set_ar_out(array('TITLE' => $row['title'],
'TXT' => $row['text'],
'LINK' => 'http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']). '/index.php?news-' . $row['id'],
'QUELLE' => $row['quelle'],
'LINK' => $row['link'],
'AUTHOR' => $author,
'DATE' => $row['datum'],
//'AVATA' => $avatar
), 1);
}
$tpl->out(2);
exit;
}
else
{
$design->header();
$limit = $allgAr['Nlimit'];
$page = ( $menu->getA(1) == 'p' ? $menu->getE(1) : 1 );
$MPL = db_make_sites ($page , "WHERE block = 0 AND news_recht >= ".$_SESSION['authright'] , $limit , '?news' , 'news' );
$anfang = ($page - 1) * $limit;
$tpl = new tpl ( 'news.htm' );
$abf = "SELECT
a.news_id as id,
a.news_time as datum,
a.news_title as title,
a.news_quelle as quelle,
a.news_link as link,
DATE_FORMAT(a.news_time,'%d. %m. %Y') as datum,
DATE_FORMAT(a.news_time,'%W') as dayofweek,
a.news_kat as kate,
a.news_text as text,
a.news_html as html,
a.news_tn as tn,
b.name as username,
b.id as uid,
c.name as editor,
c.id as eid
FROM prefix_news as a
LEFT JOIN prefix_user as b ON a.user_id = b.id
LEFT JOIN prefix_user as c ON a.editor_id = c.id
WHERE ".$_SESSION['authright']." <= a.news_recht
AND a.block = 0
ORDER BY news_time DESC
LIMIT ".$anfang.",".$limit;
#echo '
'.$abf.''; $erg = db_query($abf); while ($row = db_fetch_assoc($erg)) { if($row['tn'] == "true"){ $k0m = db_query("SELECT COUNT(ID) FROM `prefix_koms` WHERE uid = ".$row['id']." AND cat = 'NEWS'"); $row['kom'] = db_result($k0m,0); $author = $row['username']; if (($row['username'] != $row['editor']) AND ($row['editor'] != '')) $row['username'] .= ' (Letzte Änderung von '.$row['editor'].')'; $row['title'] = substr($row['title'],0,$allgAr['ntlimit']).'...'; $row['link'] = substr($row['link'],0,20).'...'; $row['quelle'] = substr($row['quelle'],0,30).''; $row['kate'] = news_find_kat($row['kate']); $row['datum'] = $lang[$row['dayofweek']].' '.$row['datum']; $row['readwholenews'] = ''; if ( strpos ( $row['text'] , '[PREVIEWENDE]' ) !== FALSE ) { $a = explode('[PREVIEWENDE]' , $row['text']); $row['text'] = $a[0]; $row['readwholenews'] = '» Artikel weiter lesen «'; } $text = stripslashes($row['text']); if($row['html'] == "true"){ $row['text'] = $text; } else {$row['text'] = bbcode($row['text']);} $tpl->set_ar_out($row,0); } } $ezd = "SELECT a.news_id as id, a.news_time as datum, a.news_title as title, a.news_quelle as quelle, a.news_link as link, DATE_FORMAT(a.news_time,'%d. %m. %Y') as datum, DATE_FORMAT(a.news_time,'%W') as dayofweek, a.news_kat as kate, a.news_text as text, a.news_html as html, a.news_tn as tn, b.name as username, b.id as uid, c.name as editor, c.id as eid FROM prefix_news as a LEFT JOIN prefix_user as b ON a.user_id = b.id LEFT JOIN prefix_user as c ON a.editor_id = c.id WHERE ".$_SESSION['authright']." <= a.news_recht AND a.block = 0 ORDER BY news_time DESC LIMIT ".$anfang.",".$limit; #echo '
'.$abf.''; $erg1 = db_query($ezd); while ($row = db_fetch_assoc($erg1)) { if($row['tn'] == "false"){ $k0m = db_query("SELECT COUNT(ID) FROM `prefix_koms` WHERE uid = ".$row['id']." AND cat = 'NEWS'"); $row['kom'] = db_result($k0m,0); $author = $row['username']; if (($row['username'] != $row['editor']) AND ($row['editor'] != '')) $row['username'] .= ' (Letzte Änderung von '.$row['editor'].')'; $row['title'] = substr($row['title'],0,$allgAr['ntlimit']).'...'; $row['link'] = substr($row['link'],0,20).'...'; $row['quelle'] = substr($row['quelle'],0,30).''; $row['kate'] = news_find_kat($row['kate']); $row['datum'] = $lang[$row['dayofweek']].' '.$row['datum']; $row['readwholenews'] = ''; if ( strpos ( $row['text'] , '[PREVIEWENDE]' ) !== FALSE ) { $a = explode('[PREVIEWENDE]' , $row['text']); $row['text'] = $a[0]; $row['readwholenews'] = '» Artikel weiter lesen «'; } $text = stripslashes($row['text']); if($row['html'] == "true"){ $row['text'] = $text; } else {$row['text'] = bbcode($row['text']);} $tpl->set_ar_out($row,0); } } $tpl->set_out('SITELINK', $MPL,1); unset($tpl); } } else { $design->header(); $nid = escape($menu->get(1), 'integer'); $row = db_fetch_object(db_query("SELECT * FROM `prefix_news` WHERE news_id = '".$nid."'")); if ( has_right(array($row->news_recht)) ) { $komsOK = true; if ( $allgAr['Ngkoms'] == 0 ) { if ( loggedin() ) { $komsOK = true; } else { $komsOK = false; } } if ( $allgAr['Nukoms'] == 0 ) { $komsOK = false; } # kommentar add if ( (loggedin() OR chk_antispam ('newskom')) AND $komsOK AND !empty($_POST['name']) AND !empty($_POST['txt']) ) { $_POST['txt'] = escape($_POST['txt'],'string'); $_POST['name'] = escape($_POST['name'],'string'); db_query("INSERT INTO `prefix_koms` VALUES ('',".$nid.",'NEWS','".$_POST['name']."','".$_POST['txt']."')"); } # kommentar add # kommentar loeschen if ($menu->getA(2) == 'd' AND is_numeric($menu->getE(2)) AND has_right(-7)) { $kommentar_id = escape($menu->getE(2),'integer'); db_query("DELETE FROM prefix_koms WHERE uid = ".$nid." AND cat = 'NEWS' AND id = ".$kommentar_id); } # kommentar loeschen $kategorie = news_find_kat($row->news_kat); $textToShow = $row->news_text; $textToShow = stripslashes($textToShow); if($row->news_html == "false"){ $textToShow = bbcode($textToShow); } $textToShow = str_replace('[PREVIEWENDE]','