Ich hatte es einfach nur nicht gesehen, aber mit solchen Kommentare hilfst du dir nicht wirklich weiter.
<?php
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 = '<img style="" src="' . $pfadzumBild . '" alt="' . $kat . '">';
} else {
$kategorie = '<b>' . $kat . '</b><br /><br />';
}
return ($kategorie);
}
function getGroupRights(){
$ret = 0;
foreach ($_SESSION['authgrp'] as $id => $bool){
$ret = $ret | pow(2, $id);
}
return $ret;
}
$tn_id = intval(@db_result($news_opts = db_query("SELECT v1 FROM prefix_allg WHERE k = 'news' LIMIT 1"), 0));
//Gruppenrechte
$groups = getGroupRights();
$tpl = new tpl ('news/news.htm');
$abf = "SELECT
a.news_title as title,
a.news_id as id,
DATE_FORMAT(a.news_time,'%d. %m. %Y - %H:%i Uhr') as datum,
DATE_FORMAT(a.news_time,'%W') as dayofweek,
a.news_kat as kate,
a.news_text as text,
b.name as username,
c.name as editorname,
a.html,
a.edit_time,
a.klicks,
b.id as uid
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 (((" . pow(2, abs($_SESSION['authright'])) . " | a.news_recht) = a.news_recht) OR
(a.news_groups != 0 AND ((a.news_groups ^ $groups) != (a.news_groups | $groups)))) AND
a.`show` > 0 AND a.`show` <= UNIX_TIMESTAMP() AND news_id != $tn_id AND a.`archiv` != 1 AND
(a.endtime IS NULL OR a.endtime > UNIX_TIMESTAMP())
ORDER BY a.news_time DESC
LIMIT 5";
// echo '<pre>'.$abf.'</pre>';
$erg = db_query($abf);
while ($row = db_fetch_assoc($erg)) {
$k0m = db_query("SELECT COUNT(ID) FROM `prefix_koms` WHERE uid = " . $row['id'] . " AND cat = 'NEWS'");
$row['kom'] = db_result($k0m, 0);
$row['kate'] = news_find_kat($row['kate']);
$row['datum'] = $lang[$row['dayofweek']] . ' ' . $row['datum'];
if (strpos ($row['text'] , '[PREVIEWENDE]') !== false) {
$a = explode('[PREVIEWENDE]' , $row['text']);
$row['text'] = $a[0];
$row['readwholenews'] = '<a href="index.php?news-' . $row['id'] . '" alt="mehr lesen" title="mehr lesen"><img src="include/images/icons/news/more.gif" alt="mehr lesen" border="0"></a>';
} else {
$row['readwholenews'] = '';
}
$row['klicks'] = '<img src="include/images/icons/news/counter.gif" alt="' . $row['klicks'] . ' mal gelesen" title="' . $row['klicks'] . ' mal gelesen" border="0">';
if (!$row['html']) {
$row['text'] = bbcode($row['text']);
}
$row['edit'] = is_null($row['edit_time']) ? '' : '<br /><i>zuletzt geändert am ' . date('d.m.Y - H:i', strtotime($row['edit_time'])) . ' Uhr';
if (!empty($row['edit']) and $row['editorname'] != $row['username']) {
$row['edit'] .= ' von ' . $row['editorname'] . '</i>';
} elseif (!empty($row['edit'])) {
$row['edit'] .= '</i>';
}
$tpl->set_ar_out($row, 0);
}
unset($tpl);
?>
Zuletzt modifiziert von Mairu am 07.03.2010 - 09:14:39