Habe das jetzt auch mal eingebaut,aber habe das Problem das jeder Post Doppelt angezeigt wird...
Hier mal mein Code:
<?php
# Copyright by: Manuel
# Support: www.ilch.de
defined ('main') or die ( 'no direct access' );
$title = $allgAr['title'].' :: Forum';
$hmenu = $extented_forum_menu.'Forum'.$extented_forum_menu_sufix;
$design = new design ( $title , $hmenu, 1);
$design->header();
if ($menu->get(1) == 'markallasread') {
user_markallasread ();
}
$tpl = new tpl ( 'forum/showforum' );
$tpl->out (0);
$category_array = array();
$forum_array = array();
$q = "SELECT
a.id, a.cid, a.name, a.besch,
a.topics, a.posts, b.name as topic,
c.id as pid, c.tid, b.rep, c.erst, c.time,
a.cid, k.name as cname
FROM prefix_forums a
LEFT JOIN prefix_forumcats k ON k.id = a.cid
LEFT JOIN prefix_posts c ON a.last_post_id = c.id
LEFT JOIN prefix_topics b ON c.tid = b.id
LEFT JOIN prefix_groupusers vg ON vg.uid = ".$_SESSION['authid']." AND vg.gid = a.view
LEFT JOIN prefix_groupusers rg ON rg.uid = ".$_SESSION['authid']." AND rg.gid = a.reply
LEFT JOIN prefix_groupusers sg ON sg.uid = ".$_SESSION['authid']." AND sg.gid = a.start
WHERE ((".$_SESSION['authright']." <= a.view AND a.view < 1)
OR (".$_SESSION['authright']." <= a.reply AND a.reply < 1)
OR (".$_SESSION['authright']." <= a.start AND a.start < 1)
OR vg.fid IS NOT NULL
OR rg.fid IS NOT NULL
OR sg.fid IS NOT NULL
OR -9 = ".$_SESSION['authright'].")
AND k.cid = 0
ORDER BY k.pos, a.pos";
$erg1 = db_query($q);
$xcid = 0;
while ($r = db_fetch_assoc($erg1) ) {
$r['topicl'] = $r['topic'];
$r['topic'] = html_enc_substr($r['topic'],0,23);
$r['ORD'] = forum_get_ordner($r['time'],$r['id']);
$r['mods'] = getmods($r['id']);
$r['datum'] = date('d.m.y - H:i', $r['time']);
$r['page'] = ceil ( ($r['rep']+1) / $allgAr['Fpanz'] );
$tpl->set_ar ($r);
if ($r['cid'] <> $xcid) {
$tpl->out(1);
//Unterkategorien
$sql = db_query("SELECT DISTINCT a.name as cname, a.id as cid FROM `prefix_forumcats` a LEFT JOIN `prefix_forums` b ON a.id = b.cid WHERE a.cid = {$r['cid']} AND a.id = b.cid ORDER BY a.pos, a.name");
while ($ucat = db_fetch_assoc($sql)) {
$tpl->set_ar_out($ucat,2);
}
//Unterkategorien - Ende
$xcid = $r['cid'];
}
$tpl->set_ar_out($r,3);
}
# statistic #
$ges_online_user = ges_online();
$stats_array = array (
'privmsgpopup' => check_for_pm_popup (),
'topics' => db_result(db_query("SELECT COUNT(ID) FROM `prefix_topics`"),0),
'posts' => db_result(db_query("SELECT COUNT(ID) FROM `prefix_posts`"),0),
'users' => db_result(db_query("SELECT COUNT(ID) FROM `prefix_user`"),0),
'istsind' => ( $ges_online_user > 1 ? 'sind' : 'ist' ),
'gesonline' => $ges_online_user,
'gastonline' => ges_gast_online(),
'useronline' => ges_user_online(),
'userliste' => user_online_liste()
);
$tpl->set_ar_out($stats_array,4);
echo '<br><br><br>';
$shoutbox_VALUE_name = getenv("REMOTE_ADDR");
$datum=date(" | j.n.Y");
$zeit=date(" | H:i");
if ( $_SESSION['authright'] <= -1 ) {
// registrierte User
if ( loggedin() ) {
$shoutbox_VALUE_name = $_SESSION['authname'];
} else {
$shoutbox_VALUE_name = 'Nickname';
}
if ( !empty($_POST['shoutbox_submit']) ) {
$shoutbox_nickname = escape($_POST['shoutbox_nickname'],'string');
$shoutbox_nickname = substr($shoutbox_nickname, 0, 25);
$shoutbox_textarea = escape($_POST['shoutbox_textarea'],'textarea');
$shoutbox_textarea = preg_replace("/\[.?(url|b|i|u|img|code|quote)[^\]]*?\]/i","",$shoutbox_textarea);
$shoutbox_textarea = strip_tags($shoutbox_textarea);
if ( !empty($shoutbox_nickname) AND !empty($shoutbox_textarea) ) {
db_query('INSERT INTO `prefix_shoutbox` VALUES ( "" , "'.$shoutbox_nickname.''.$zeit.''.$datum.'" , "'.$shoutbox_textarea.'" ) ' );
}
}
echo '<form action="index.php?forum" method="POST">';
echo '<p align="center"><input type="text" size="25" name="shoutbox_nickname" value="'.$shoutbox_VALUE_name.'" onFocus="if (value == \''.$shoutbox_VALUE_name.'\') {value = \'\'}" onBlur="if (value == \'\') {value = \''.$shoutbox_VALUE_name.'\'}" maxlength="25"></p>';
echo '<p align="center"><br /><textarea cols="80" rows="1" name="shoutbox_textarea"></textarea><br /></p>';
echo '<p align="center"><input type="submit" value="'.$lang['formsub'].'" name="shoutbox_submit"></p>';
echo get_antispam ('shoutbox', 0);
}
else {
//Gaeste
echo "<font color=#FFFFFF><b><br>Zum Posten<br>Bitte Einloggen!<p></p></b></font>";
echo "Deine IP:<br><b>$shoutbox_VALUE_name</b><br><br>";
echo '</form><table width="100%" align="center" class="border" cellpadding="2" cellspacing="1" border="1">';
}
echo '</form><table width="100%" class="border" cellpadding="2" cellspacing="1" border="0">';
$erg = db_query('SELECT * FROM `prefix_shoutbox` ORDER BY id DESC LIMIT 5');
$class = 'Cnorm';
while ($row = db_fetch_object($erg) ) {
$class = ( $class == 'Cmite' ? 'Cnorm' : 'Cmite' );
echo '<tr class="'.$class.'"><td><b>'.$row->nickname.':</b> '.preg_replace( '/([^\s]{10})(?=[^\s])/', "$1\n", BBcode($row->textarea)).'</td></tr>';
}
echo '</table>';
$design->footer();
?>
Und so sehen die Posts aus:
Hannibal | 08:56 | 26.10.2007: Thomas
Hannibal: Thomas
Hannibal | 08:56 | 26.10.2007: Test
Hannibal: Test
Hannibal | 08:53 | 26.10.2007: huhu