//show_thema($th_id); show_posting(); } else { show_missing($missing); maske_posting($mode); } } else { echo $t[schreibrechte]; forum_liste(); } break; case "show_posting": // Falsch, die Leserechte anhand der $th_id die übergeben wurde zu überprüfen // $leserechte=pruefe_leserechte($th_id); // Richtig, die $th_id anhand der $po_id zu bestimmen und zu prüfen $leserechte = pruefe_leserechte(hole_themen_id_anhand_posting_id($po_id)); if ($leserechte) { show_posting(); markiere_als_gelesen($po_id, $u_id, $th_id); } else { print $t[leserechte]; } break; case "reply": $schreibrechte = pruefe_schreibrechte($th_id); if ($schreibrechte) { maske_posting("reply"); } else { echo $t[schreibrechte]; forum_liste(); }
function such_ergebnis() { global $id, $http_host, $eingabe_breite, $PHP_SELF, $f1, $f2, $f3, $f4, $conn, $dbase, $check_name, $u_id; global $farbe_text, $farbe_tabelle_kopf2, $farbe_tabelle_zeile1, $farbe_tabelle_zeile2, $farbe_hervorhebung_forum, $farbe_link; global $suche, $o_js, $farbe_neuesposting_forum, $t, $u_level; $eingabe_breite = 50; $select_breite = 250; $maxpostingsprosuche = 1000; $titel = $t['ergebnis1']; $sql = "select u_gelesene_postings from user where u_id=" . intval($u_id); $query = mysql_query($sql, $conn); if (mysql_num_rows($query) > 0) { $gelesene = mysql_result($query, 0, "u_gelesene_postings"); } $u_gelesene = unserialize($gelesene); $fehler = ""; if ($suche['username'] != coreCheckName($suche['username'], $check_name)) { $fehler .= $t['fehler1']; } $suche['username'] = coreCheckName($suche['username'], $check_name); unset($suche['u_id']); if (strlen($fehler) == 0 && $suche['username'] != "") { $sql = "SELECT u_id FROM user where u_nick = '" . mysql_real_escape_string($suche['username']) . "'"; $query = mysql_query($sql, $conn); if (mysql_num_rows($query) == 1) { $suche['u_id'] = mysql_result($query, 0, "u_id"); } else { $fehler .= 'Username unbekannt<br>'; } } if (trim($suche['username']) == "" && trim($suche['text']) == "" && !($suche['zeit'] == "B1" || $suche['zeit'] == "B7" || $suche['zeit'] == "B14")) { $fehler .= $t['fehler2']; } if ($suche['modus'] != "A" && $suche['modus'] != "O") { $fehler .= $t['fehler3']; } if ($suche['ort'] != "V" && $suche['ort'] != "B" && $suche['ort'] != "T") { $fehler .= $t['fehler4']; } if (!$suche['thema'] == "ALL" && !preg_match("/^B([0-9])+T([0-9])+\$/i", $suche['thema']) && !preg_match("/^B([0-9])+\$/i", $suche['thema'])) { $fehler .= $t['fehler5']; } if (strlen($fehler) > 0) { echo "<p><center><b><font color=\"{$farbe_hervorhebung_forum}\">{$fehler}</font></b></center></p>"; } else { $querytext = ""; $querybetreff = ""; if (trim($suche['text']) != "") { $suche['text'] = htmlspecialchars($suche['text']); $suchetext = explode(" ", $suche['text']); for ($i = 0; $i < count($suchetext); $i++) { if (strlen($querytext) == 0) { $querytext = "po_text LIKE \"%" . mysql_real_escape_string($suchetext[$i]) . "%\""; } else { if ($suche['modus'] == "O") { $querytext .= " OR po_text LIKE \"%" . mysql_real_escape_string($suchetext[$i]) . "%\""; } else { $querytext .= " AND po_text LIKE \"%" . mysql_real_escape_string($suchetext[$i]) . "%\""; } } if (strlen($querybetreff) == 0) { $querybetreff = "po_titel LIKE \"%" . mysql_real_escape_string($suchetext[$i]) . "%\""; } else { if ($suche['modus'] == "O") { $querybetreff .= " OR po_titel LIKE \"%" . mysql_real_escape_string($suchetext[$i]) . "%\""; } else { $querybetreff .= " AND po_titel LIKE \"%" . mysql_real_escape_string($suchetext[$i]) . "%\""; } } } $querytext = " (" . $querytext . ") "; $querybetreff = " (" . $querybetreff . ") "; } $sql = "SELECT posting.*, date_format(from_unixtime(po_ts), '%d.%m.%Y, %H:%i:%s') as po_zeit, u_id, u_nick, u_level, u_punkte_gesamt, u_punkte_gruppe, u_chathomepage FROM posting left join user on po_u_id = u_id WHERE "; $abfrage = ""; if ($suche['ort'] == "V" && $querybetreff != "") { $abfrage = " (" . $querybetreff . " or " . $querytext . ") "; } else { if ($suche['ort'] == "B" && $querybetreff != "") { $abfrage = " " . $querybetreff . " "; } else { if ($suche['ort'] == "T" && $querytext != "") { $abfrage = " " . $querytext . " "; } } } if (isset($suche['u_id']) && $suche['u_id']) { if ($abfrage == "") { $abfrage = " (po_u_id = {$suche['u_id']}) "; } else { $abfrage .= " AND (po_u_id = {$suche['u_id']}) "; } } $boards = ""; $sql2 = "SELECT fo_id, fo_admin, fo_name, th_id, th_name FROM forum left join thema on fo_id = th_fo_id " . "WHERE th_anzthreads <> 0 " . "ORDER BY fo_order, th_order "; $query2 = mysql_query($sql2, $conn); while ($thema = mysql_fetch_array($query2, MYSQL_ASSOC)) { if (pruefe_leserechte($thema['th_id'])) { if ($suche['thema'] == "ALL") { if (strlen($boards) == 0) { $boards = "po_th_id = " . intval($thema[th_id]); } else { $boards .= " OR po_th_id = " . intval($thema[th_id]); } } else { if (preg_match("/^B([0-9])+T([0-9])+\$/i", $suche['thema'])) { $tempthema = substr($suche['thema'], -1 * strpos($suche['thema'], "T"), 4); if ($thema['th_id'] = $tempthema) { $boards = "po_th_id = {$thema['th_id']}"; } } else { if (preg_match("/^B([0-9])+\$/i", $suche['thema'])) { $tempboard = substr($suche['thema'], 1, 4); if ($thema['fo_id'] == $tempboard) { if (strlen($boards) == 0) { $boards = "po_th_id = " . intval($thema[th_id]); } else { $boards .= " OR po_th_id = " . intval($thema[th_id]); } } } } } } } @mysql_free_result($query2); if (strlen(trim($boards)) == 0) { $boards = " 1 = 2 "; } if (strlen(trim($abfrage)) == 0) { $abfrage .= " (" . $boards . ") "; } else { $abfrage .= " AND (" . $boards . ") "; } $sucheab = 0; if ($suche['zeit'] == "B1") { $sucheab = mktime(0, 0, 0, date("m"), date("d") - 1, date("Y")); } else { if ($suche['zeit'] == "B7") { $sucheab = mktime(0, 0, 0, date("m"), date("d") - 7, date("Y")); } else { if ($suche['zeit'] == "B14") { $sucheab = mktime(0, 0, 0, date("m"), date("d") - 14, date("Y")); } else { if ($suche['zeit'] == "B30") { $sucheab = mktime(0, 0, 0, date("m") - 1, date("d"), date("Y")); } else { if ($suche['zeit'] == "B90") { $sucheab = mktime(0, 0, 0, date("m") - 3, date("d"), date("Y")); } else { if ($suche['zeit'] == "B180") { $sucheab = mktime(0, 0, 0, date("m") - 6, date("d"), date("Y")); } else { if ($suche['zeit'] == "B365") { $sucheab = mktime(0, 0, 0, date("m"), date("d"), date("Y") - 1); } } } } } } } if ($sucheab > 0) { $abfrage .= " AND (po_ts >= {$sucheab}) "; } if ($u_level != "S" and $u_level != "C") { $abfrage .= " AND po_gesperrt = 'N' "; } if ($suche['sort'] == "SZD") { $abfrage .= " ORDER BY po_ts DESC"; } else { if ($suche['sort'] == "SZA") { $abfrage .= " ORDER BY po_ts ASC"; } else { if ($suche['sort'] == "SBD") { $abfrage .= " ORDER BY po_titel DESC, po_ts DESC"; } else { if ($suche['sort'] == "SBA") { $abfrage .= " ORDER BY po_titel ASC, po_ts ASC"; } else { if ($suche['sort'] == "SAD") { $abfrage .= " ORDER BY u_nick DESC, po_ts DESC"; } else { if ($suche['sort'] == "SAA") { $abfrage .= " ORDER BY u_nick ASC, po_ts ASC"; } else { $abfrage .= " ORDER BY po_ts DESC"; } } } } } } echo "<IMG SRC=\"pics/fuell.gif\" ALT=\"\" WIDTH=4 HEIGHT=4><BR>\n"; echo "<TABLE WIDTH=100% BORDER=0 CELLPADDING=3 CELLSPACING=0>"; echo "<TR BGCOLOR=\"{$farbe_tabelle_kopf2}\"><TD COLSPAN=3><DIV style=\"color:{$farbe_text};\"><B>{$titel}</B></DIV></TD></TR>\n"; flush(); $sql = $sql . " " . $abfrage; $query = mysql_query($sql, $conn); $anzahl = mysql_num_rows($query); echo "<TR BGCOLOR=\"{$farbe_tabelle_kopf2}\"><TD COLSPAN=3><DIV style=\"color:{$farbe_text};\">{$f1}<B>{$t['ergebnis2']} {$anzahl}</B>"; if ($anzahl > $maxpostingsprosuche) { echo "<font color=\"red\"><b> (Ausgabe wird auf {$maxpostingsprosuche} begrenzt.)</b></font>"; } echo "{$f2}</DIV></TD></TR>\n"; if ($anzahl > 0) { echo "<TR BGCOLOR=\"{$farbe_tabelle_kopf2}\"><TD>" . $f1 . "<B>{$t['ergebnis3']}<BR>{$t['ergebnis4']}</B>" . $f2 . "</TD>"; echo "<TD>" . $f1 . "<B>{$t['ergebnis6']}</B>" . $f2 . "</TD>"; echo "<TD>" . $f1 . "<B>{$t['ergebnis7']}</B>" . $f2 . "</TD>"; echo "</TR>"; $i = 0; while ($fund = mysql_fetch_array($query, MYSQL_ASSOC)) { $i++; if ($i > $maxpostingsprosuche) { break; } if ($i % 2 > 0) { $bgcolor = $farbe_tabelle_zeile1; } else { $bgcolor = $farbe_tabelle_zeile2; } if (!@in_array($fund['po_id'], $u_gelesene[$fund['po_th_id']])) { $col = $farbe_neuesposting_forum; } else { $col = $farbe_link; } echo "<TR BGCOLOR=\"{$bgcolor}\"><TD>" . show_pfad_posting2($fund['po_th_id']) . "<BR>"; $thread = vater_rekursiv($fund['po_id']); echo $f1 . "<b><a href=\"#\" onClick=\"opener_reload('forum.php?id={$id}&http_host={$http_host}&th_id=" . $fund['po_th_id'] . "&po_id=" . $fund['po_id'] . "&thread=" . $thread . "&aktion=show_posting&seite=1',1); return(false);\"><font size=-1 color=\"{$col}\">" . $fund['po_titel'] . "</font></a>"; if ($fund['po_gesperrt'] == 'Y') { echo " <font color=\"red\">(gesperrt)</font>"; } echo $f2 . "</b></TD>"; echo "<TD>" . $f1 . $fund['po_zeit'] . $f2 . "</TD>"; if (!$fund['u_nick']) { echo "<td>{$f3}<b>Nobody</b>{$f4}</td>\n"; } else { $userdata = array(); $userdata['u_id'] = $fund['po_u_id']; $userdata['u_nick'] = $fund['u_nick']; $userdata['u_level'] = $fund['u_level']; $userdata['u_punkte_gesamt'] = $fund['u_punkte_gesamt']; $userdata['u_punkte_gruppe'] = $fund['u_punkte_gruppe']; $userdata['u_chathomepage'] = $fund['u_chathomepage']; $userlink = user($fund['po_u_id'], $userdata, $o_js, FALSE, " ", "", "", TRUE, FALSE, 29); if ($fund['u_level'] == 'Z') { echo "<td>{$f1} {$userdata['u_nick']} {$f2}</td>\n"; } else { echo "<td>{$f1} {$userlink} {$f2}</td>\n"; } } echo "</TR>"; } @mysql_free_result($query); } echo "</TABLE>\n"; echo "<IMG SRC=\"pics/fuell.gif\" ALT=\"\" WIDTH=4 HEIGHT=4><BR>\n"; } }
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"; }