include/contents/forum/show_forum.php:
<?php
# Copyright by: Manuel Staechele
# 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 ();
}
if ($_SESSION['authright']<=-8) {
# delete
if ($menu->getA(1) == 'd' AND is_numeric($menu->getE(1))) {
db_query("DELETE FROM prefix_shoutbox WHERE id = ".$menu->getE(1));
}
# delete all
if ($menu->get(1) == 'delall') {
if (is_numeric($menu->get(2))) {
$anz = db_result(db_query("SELECT COUNT(*) FROM `prefix_shoutbox`"),0) - $menu->get(2);
if ($anz > 0) {
db_query("DELETE FROM `prefix_shoutbox` LIMIT $anz");
}
} else {
db_query("DELETE FROM `prefix_shoutbox`");
}
}
}
// Dumme Shoutbox 4 U
if(loggedin())
{
$shoutbox_VALUE_name2 = getenv("REMOTE_ADDR");
$zeit=date(" d.m.Y - H:i ");
$name = $_SESSION['authname'];
if ( !empty($_POST['shoutbox_submit_x']) ) {
$shoutbox_textarea = substr(escape($_POST['txt'], 'textarea'),0,200);
if (!empty($shoutbox_textarea) ) {
db_query('INSERT INTO `prefix_shoutbox` VALUES ( "" , "'.$zeit.''.$name.'" , "'.$shoutbox_textarea.'" ) ' );
}
}
$shoutbox = '<br />
<div align="center">
<table cellpadding="0" border="0" width="1000" style="border-collapse: collapse" id="table5">
<tr>
<td> </td>
</tr>
<tr>
<td class="fhead">
<table border="0" width="1000" id="table7" cellpadding="0" style="border-collapse: collapse">
<tr>
<td width="20"> </td>
<td width="980"><font color="#FFFFFF" size="1" face="Verdana"><b>Shoutbox</b></font></td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="fnorm">
<div align="center">
';
$color = "#FFFFFF";
$shoutbox .= '<br /><a name="shoutbox"></a><form name="form" action="index.php'.strrchr($_SERVER['REQUEST_URI'],'?').'#shoutbox" method="POST"><table border="0" width="900"><tr><td width="100" height="200" rowspan="2">';
$shoutbox .= getsmilies();
$shoutbox .= '</td><td height="160">
<table border="2" width="100%" id="table55" cellpadding="0" style="border-collapse: collapse"><tr><td>
<div id="Shoutbox" style="overflow:scroll; width:800; height:160;">
<table border="0" width="100%" id="table55" cellpadding="0" style="border-collapse: collapse">';
$erg = db_query('SELECT * FROM `prefix_shoutbox` ORDER BY id DESC LIMIT 15');
while ($row = db_fetch_object($erg) ) {
$color = ($color == "#FFFFFF"?"#DADADA":"#FFFFFF");
if ($_SESSION['authright']<=-8) {
$shoutbox .= '<tr><td style="background-color:'.$color.'"><a href="index.php?forum-d'.$row->id.'"><img border="0" src="include/images/icons/del.gif"></a> <b>'.$row->nickname.':</b> '.bbcode($row->textarea).'<br/></td></tr>';
} else {
$shoutbox .= '<tr><td style="background-color:'.$color.'"><b>'.$row->nickname.':</b> '.bbcode($row->textarea).'<br /></td></tr>';
}
}
$shoutbox .= '</table></div></td></tr></table></td></tr><tr><td><center><table border="0"><tr><td valign="middle"><input type="submit" value="Refresh" name="refresh"></td><td valign="middle"><textarea cols="100" rows="1" name="txt"></textarea></td><td valign="middle"><input type="submit" value="'.$lang['formsub'].'" name="shoutbox_submit"></td></tr></table></center>';
$shoutbox .= '</td></tr></table></form>';
$shoutbox .= '
</div>
</td></tr><tr>
<td class="fdown"> </td></tr><tr>
<td> </td>
</tr>
</table>
</div>
';
}
else {$shoutbox = '';}
# statistic #
$abf = 'SELECT avatar FROM prefix_user WHERE name = "'.$_SESSION['authname'].'"';
$erg = db_query($abf);
$row = db_fetch_object($erg);
if ( file_exists($row->avatar)) {
$avatar = '<img src="'.$row->avatar.'" border="1" bordercolor="#000000">';
}else{
$avatar = '';
}
$gebcount = 0;
$geburtstag = "Heute hat kein User Geburtstag.";
$gebtext = "";
$erg = db_query('SELECT id, name,(YEAR(NOW()) - YEAR(gebdatum)) as alter_in_Jahre FROM prefix_user WHERE DAYOFMONTH(gebdatum) = '.date("d").' AND MONTH(gebdatum) = '.date("m").'');
while($row = db_fetch_object($erg)) {
$gebcount ++;
$gebtext .= '<a href="index.php?user-details-'.$row->id.'" title="'.$row->name.'">'.$row->name.'</a> ('.$row->alter_in_Jahre.') ';
}
if($gebcount > 0)
{
if($gebcount == 1)
{
$geburtstag = "Heute hat ".$gebtext."Geburtstag.";
} else {
$geburtstag = "Heute haben ".$gebtext."Geburtstag.";
}
}
if ( $allgAr['Fpmf'] == 1 && loggedin()) {
$erg = db_query("SELECT COUNT(id) FROM `prefix_pm` WHERE gelesen = 0 AND status < 1 AND eid = ".$_SESSION['authid']);
$check_pm = db_result($erg,0);
$nachrichten_link = '<a class="box" href="index.php?forum-privmsg">'.$lang['messages'].'</a> ('.$check_pm.')<br /><br />';
} else {
$nachrichten_link = '';
}
$ges_online_user = ges_online();
$stats_array = array (
'name' => $_SESSION['authname'],
'avatar' => $avatar,
'date' => date("d. M Y"),
'time' => date("H:i"),
'pm' => $nachrichten_link,
'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(1),
'usertagesliste' => user_tages_liste(1),
'tonline' => user_tages_online(),
'shoutbox' => $shoutbox,
'geburtstag' => $geburtstag
);
$tpl = new tpl ( 'forum/showforum' );
$tpl->set_ar_out($stats_array,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, c.erstid
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']);
$time = $r['time'];
$r['datum'] = date('d.m.y', $r['time']);
$r['datum'] = ($r['datum'] == date('d.m.y')?"<b>Heute</b>":$r['datum']);
$r['time'] = date('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'];
}
if ($time != "") $tpl->set_ar_out($r,3);
else $tpl->set_ar_out($r,5);
}
$tpl->set_ar_out($stats_array,4);
$design->footer();
?>