function anzahl_ungelesene2(&$arr_postings, $th_id) { global $u_gelesene; //kein Posting in Gruppe --> keine ungelesenen if (count($arr_postings) == 0) { return 0; } //kein Posting gelesen --> alle ungelesen if (!$u_gelesene[$th_id]) { return count($arr_postings); } // anzahl unterschied zwischen postings im Thread/thema und den gelesenen //postings des users zurueckgeben $sql = "select po_id, po_u_id, po_threadorder\n from posting\n where po_vater_id = 0\n and po_th_id = " . intval($th_id) . "\n order by po_ts desc"; $query = mysql_query($sql); $ungelesene = 0; while ($posting = mysql_fetch_array($query, MYSQL_ASSOC)) { if ($posting[po_threadorder] == "0") { $anzreplys = 0; $arr_postings = array($posting[po_id]); } else { $arr_postings = explode(",", $posting[po_threadorder]); $anzreplys = count($arr_postings); //Erstes Posting mit beruecksichtigen $arr_postings[] = $posting[po_id]; } $ungelesene += anzahl_ungelesene($arr_postings, $th_id); } return $ungelesene; }
function show_thema() { global $conn; global $id, $http_host, $o_js, $forum_admin, $th_id, $show_tree, $seite, $farbe_link; global $t, $f1, $f2, $f3, $f4, $farbe_tabelle_kopf, $farbe_tabelle_kopf2, $farbe_tabellenrahmen; global $farbe_tabelle_zeile1, $farbe_tabelle_zeile2, $anzahl_po_seite, $chat_grafik, $farbe_text; global $admin, $anzahl_po_seite2, $u_id, $u_level; if ($anzahl_po_seite2) { $anzahl_po_seite2 = preg_replace("/[^0-9]/", "", $anzahl_po_seite2); $anzahl_po_seite = $anzahl_po_seite2; $f[u_forum_postingproseite] = $anzahl_po_seite2; if (!schreibe_db("user", $f, $u_id, "u_id")) { echo "Fehler beim Schreiben in DB!"; } } else { $query = "SELECT u_forum_postingproseite FROM user WHERE u_id = '{$u_id}'"; $result = mysql_query($query); $a = mysql_fetch_array($result); $anzahl_po_seite2 = $a['u_forum_postingproseite']; $anzahl_po_seite = $anzahl_po_seite2; } $leserechte = pruefe_leserechte($th_id); if (!$leserechte) { echo $t['leserechte']; exit; } if (!$seite) { $seite = 1; } $offset = ($seite - 1) * $anzahl_po_seite; $sql = "select po_id, po_u_id, date_format(from_unixtime(po_ts), '%d.%m.%y') as po_date,\n date_format(from_unixtime(po_threadts), '%d.%m.%y') as po_date2,\n po_titel, po_threadorder, po_topposting, po_threadgesperrt, po_gesperrt, u_nick,\n\t\tu_level, u_punkte_gesamt, u_punkte_gruppe, u_chathomepage\n from posting\n left join user on po_u_id = u_id\n where po_vater_id = 0\n and po_th_id = " . intval($th_id) . "\n order by po_topposting desc, po_threadts desc, po_ts desc\n limit {$offset}, {$anzahl_po_seite}"; $query = mysql_query($sql, $conn); $th_name = show_pfad($th_id); echo "<table width=\"760\" cellspacing=\"0\" cellpadding=\"1\" border=\"0\" bgcolor=\"{$farbe_tabellenrahmen}\"><tr><td>\n"; echo "<table width=\"100%\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\"><tr bgcolor=\"{$farbe_tabelle_kopf}\">\n"; echo "<td width=\"30\"><img src=\"pics/fuell.gif\" width=\"30\" height=\"1\" border=\"0\"></td>\n"; echo "<td width=\"20\"><img src=\"pics/fuell.gif\" width=\"20\" height=\"1\" border=\"0\"></td>\n"; echo "<td width=\"340\"><img src=\"pics/fuell.gif\" width=\"340\" height=\"1\" border=\"0\"></td>\n"; echo "<td width=\"170\"><img src=\"pics/fuell.gif\" width=\"170\" height=\"1\" border=\"0\"></td>\n"; echo "<td width=\"120\"><img src=\"pics/fuell.gif\" width=\"120\" height=\"1\" border=\"0\"></td>\n"; echo "<td width=\"40\"><img src=\"pics/fuell.gif\" width=\"40\" height=\"1\" border=\"0\"></td>\n"; echo "<td width=\"40\"><img src=\"pics/fuell.gif\" width=\"40\" height=\"1\" border=\"0\"></td></tr>\n"; echo "<tr bgcolor=\"{$farbe_tabelle_kopf}\">\n"; echo "<td colspan=\"3\"><table width=\"390\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\">\n"; echo "<tr><td width=\"3\"><img src=\"pics/fuell.gif\" width=\"3\" height=\"30\" border=\"0\"></td><td ><DIV style=\"color:{$farbe_text}; font-weight:bold;\"> {$th_name}</DIV></td>\n"; $schreibrechte = pruefe_schreibrechte($th_id); if ($schreibrechte) { echo "<td width=\"100\" align=\"center\">{$f3}<a style=\"color:{$farbe_text};\" href=\"forum.php?id={$id}&http_host={$http_host}&th_id={$th_id}&po_vater_id=0&aktion=thread_neu\">{$t['neuer_thread']}</a>{$f4}</td>"; } else { echo "<td width=\"100\" align=\"center\">{$f3}{$t['nur_leserechte']}{$f4}</td>"; } echo "<td width=\"100\" align=\"center\">{$f3}<a style=\"color:{$farbe_text};\" href=\"forum.php?id={$id}&http_host={$http_host}" . "&th_id={$th_id}&aktion=thema_alles_gelesen\">{$t['alles_gelesen']}</a>{$f4}</td>"; echo "</tr></table></td>\n"; echo "<td>{$f3}<DIV style=\"color:{$farbe_text}; \">{$t['autor']}</DIV>{$f4}</td>\n"; echo "<td align=\"center\">{$f3}<DIV style=\"color:{$farbe_text}; \">{$t['datum']}<br>{$t['letztes_posting']}</DIV>{$f4}</td>\n"; echo "<td align=\"center\">{$f3}<DIV style=\"color:{$farbe_text}; \">{$t['anzreplys']}</DIV>{$f4}</td>\n"; echo "<td align=\"center\">{$f3}<DIV style=\"color:{$farbe_text}; \">{$t['anzneue']}</DIV>{$f4}</td></tr>\n"; echo "<tr bgcolor=\"{$farbe_tabellenrahmen}\"><td colspan=\"7\"><img src=\"pics/fuell.gif\" width=\"1\" height=\"1\" border=\"0\"></td></tr>\n"; $zeile = 0; while ($posting = mysql_fetch_array($query, MYSQL_ASSOC)) { set_time_limit(0); if ($zeile % 2) { $farbe = $farbe_tabelle_zeile1; } else { $farbe = $farbe_tabelle_zeile2; } if ($posting['po_threadorder'] == "0") { $anzreplys = 0; $icon = "<img src=\"pics/forum/o.gif\" width=\"20\" height=\"25\" border=\"0\">"; $arr_postings = array($posting['po_id']); } else { $arr_postings = explode(",", $posting['po_threadorder']); $anzreplys = count($arr_postings); //Erstes Posting mit beruecksichtigen $arr_postings[] = $posting['po_id']; if ($show_tree == $posting['po_id']) { $icon = "<a href=\"forum.php?id={$id}&http_host={$http_host}&th_id={$th_id}&aktion=show_thema&seite={$seite}\"><img src=\"pics/forum/m.gif\" width=\"20\" height=\"25\" border=\"0\"></a>"; } else { $icon = "<a href=\"forum.php?id={$id}&http_host={$http_host}&th_id={$th_id}&show_tree={$posting['po_id']}&aktion=show_thema&seite={$seite}\"><img src=\"pics/forum/p.gif\" width=\"20\" height=\"25\" border=\"0\"></a>"; } } $ungelesene = anzahl_ungelesene($arr_postings, $th_id); array_pop($arr_postings); if ($ungelesene === 0) { if ($posting['po_topposting'] == 'Y') { $folder = $chat_grafik['forum_topthema']; } elseif ($posting['po_threadgesperrt'] == 'Y') { $folder = $chat_grafik['forum_threadgeschlossen']; } else { $folder = $chat_grafik['forum_ordnerneu']; } } elseif ($ungelesene < 11) { $folder = $chat_grafik['forum_ordnerblau']; } else { $folder = $chat_grafik['forum_ordnervoll']; } if ($ungelesene != 0) { $coli = "<font color=red>"; $colo = "</font>"; } else { $coli = ""; $colo = ""; } echo "<tr bgcolor=\"{$farbe}\"><td align=\"center\">{$folder}</nobr></td>\n"; echo "<td align=\"center\">{$icon}</td>\n"; if ($posting['po_gesperrt'] == 'Y' and !$forum_admin) { echo "<td> <b><font size=\"-1\" color=\"{$farbe_link}\">" . substr($posting['po_titel'], 0, 40) . "</font> <font size=\"-1\" color=\"red\">(gesperrt)</font></b></td>\n"; } elseif ($posting['po_gesperrt'] == 'Y' and $forum_admin) { echo "<td> {$f1}<b><a href=\"forum.php?id={$id}&http_host={$http_host}&th_id={$th_id}&po_id={$posting['po_id']}&thread={$posting['po_id']}&aktion=show_posting&seite={$seite}\">" . substr($posting['po_titel'], 0, 40) . "</a></b>{$f2} <font size=\"-1\" color=\"red\"><b>(gesperrt)</b></font></td>\n"; } else { echo "<td> {$f1}<b><a href=\"forum.php?id={$id}&http_host={$http_host}&th_id={$th_id}&po_id={$posting['po_id']}&thread={$posting['po_id']}&aktion=show_posting&seite={$seite}\">" . substr($posting['po_titel'], 0, 40) . "</a></b>{$f2}</td>\n"; } if (!$posting['u_nick']) { echo "<td>{$f3}<b>Nobody</b>{$f4}</td>\n"; } else { $userdata = array(); $userdata['u_id'] = $posting['po_u_id']; $userdata['u_nick'] = $posting['u_nick']; $userdata['u_level'] = $posting['u_level']; $userdata['u_punkte_gesamt'] = $posting['u_punkte_gesamt']; $userdata['u_punkte_gruppe'] = $posting['u_punkte_gruppe']; $userdata['u_chathomepage'] = $posting['u_chathomepage']; $userlink = user($posting['po_u_id'], $userdata, $o_js, FALSE, " ", "", "", TRUE, FALSE, 29); if ($posting['u_level'] == 'Z') { echo "<td>{$f1} {$userdata['u_nick']} {$f2}</td>\n"; } else { echo "<td>{$f1} {$userlink} {$f2}</td>\n"; } } if ($posting['po_date2'] == '01.01.70' || $posting['po_date'] == $posting['po_date2']) { $date2 = ""; } else { $date2 = "{$f3}; " . substr($posting['po_date2'], 0, 5) . "{$f4}"; } echo "<td align=\"center\">{$f3}{$posting['po_date']}{$f4}{$date2}</td>\n"; echo "<td align=\"center\">{$f3}{$anzreplys}{$f4}</td>\n"; echo "<td align=\"center\">{$f3}{$coli}{$ungelesene}{$colo}{$f4}</td></tr>\n"; if ($show_tree == $posting['po_id'] && $posting['po_threadorder'] != "0") { echo "<tr bgcolor=\"{$farbe}\"><td> </td><td colspan=\"6\">\n"; zeige_baum($arr_postings, $posting['po_threadorder'], $posting['po_id']); echo "</td></tr>\n"; } $zeile++; } echo "</table></td></tr></table>"; show_pfad($th_id); show_icon_description("thema"); echo "<br><table width=\"760\" cellspacing=\"0\" cellpadding=\"2\" border=\"0\">\n"; echo "<tr><td>"; echo "<form action=\"forum.php\">\n"; echo "{$t['forum_postingsproseite']} <input name=\"anzahl_po_seite2\" size=\"3\" maxlength=\"4\" value=\"{$anzahl_po_seite}\">\n"; echo "<input type=\"hidden\" name=\"http_host\" value=\"{$http_host}\">\n"; echo "<input type=\"hidden\" name=\"id\" value=\"{$id}\">\n"; echo "<input type=\"hidden\" name=\"aktion\" value=\"show_thema\">\n"; echo "<input type=\"hidden\" name=\"th_id\" value=\"{$th_id}\">\n"; echo "<input type=\"submit\" value=\"{$t['speichern']}\">\n"; echo "</form>\n"; echo "</td></tr>\n"; echo "</table>\n"; }