Forum

$text=htmlentities($text); $text=str_replace("\n","
",$text); $text=str_replace("\r","",$text); return ($text); } function forumGetVars($myKey) { // Holt Get-Vars if (isset($_GET[$myKey])) { if (get_magic_quotes_gpc()) { return (stripslashes($_GET[$myKey])); } else { return ($_GET[$myKey]); } } else { return (""); } } function forumServerVars($myKey) { // Holt Server-Vars if (isset($_SERVER[$myKey])) { return ($_SERVER[$myKey]); } else { return (""); } } function forumfwritePad($fp,$myVar,$length) { // Schreibt gepadded in Datei fwrite($fp,substr($myVar,0,$length).str_repeat(" ",$length),$length); } function forumfgetPad($fp,$length) { // Liest gepaddete Daten return rtrim(fread($fp,$length)); } function forumformatText($text) { // Ersetzt BB-Formate $text=str_replace("[i]","",$text); $text=str_replace("[/i]","",$text); $text=str_replace("[b]","",$text); $text=str_replace("[/b]","",$text); $text=str_replace(":)"," ",$text); $text=str_replace(";)"," ",$text); $text=str_replace(":eek:"," ",$text); $text=str_replace(":("," ",$text); $text=str_replace(":o"," ",$text); $text=str_replace(":roll:"," ",$text); $text=str_replace(":lol:"," ",$text); $text.=""; return($text); } function forumunformatText($text) { // Entfernt BB-Formate $text=str_replace("
"," ",$text); $text=str_replace("[i]","",$text); $text=str_replace("[/i]","",$text); $text=str_replace("[b]","",$text); $text=str_replace("[/b]","",$text); $text=str_replace(":)"," ",$text); $text=str_replace(";)"," ",$text); $text=str_replace(":eek:"," ",$text); $text=str_replace(":("," ",$text); $text=str_replace(":o"," ",$text); $text=str_replace(":roll:"," ",$text); $text=str_replace(":lol:"," ",$text); return($text); } function forumCreateFile() { // Datei erstellen global $filename; $fp=fopen($filename,"w"); flock ($fp,2); forumfwritePad($fp,0,6); forumfwritePad($fp,0,6); flock ($fp,3); fclose($fp); } function forumAddTopic($topic) { // Topic anhängen global $filename; global $admin; $fp=fopen($filename,"r+"); flock ($fp,2); $pos=forumfgetPad($fp,6); $pos++; if ($pos>=999) die ("Out of Memory Error"); fseek($fp,0); forumfwritePad($fp,$pos,6); // Schreiben fseek($fp,12+($pos-1)*130); if ($admin) { forumfwritePad($fp,0,1); } else { forumfwritePad($fp,1,1); } forumfwritePad($fp,1,1); forumfwritePad($fp,$topic,128); flock ($fp,3); fclose($fp); return $pos; } function forumAddPosting($topic,$nick,$email,$ip,$text) { // Posting anhängen global $filename; global $admin; $fp=fopen($filename,"r+"); flock ($fp,2); fseek($fp,6); $pos=forumfgetPad($fp,6); $pos++; fseek($fp,6); forumfwritePad($fp,$pos,6); // Schreiben fseek($fp,12+1000*130+($pos-1)*4326); if ($admin) { forumfwritePad($fp,0,1); } else { forumfwritePad($fp,1,1); } forumfwritePad($fp,$topic,6); forumfwritePad($fp,$nick,64); forumfwritePad($fp,$email,128); forumfwritePad($fp,$ip,15); forumfwritePad($fp,forumNLBR($text),4096); forumfwritePad($fp,date("d.m.Y H:i"),16); flock ($fp,3); fclose($fp); return $pos; } function forumPrintTopics($offset) { // Die Topics ausgeben global $filename; global $maxpage; $fp=fopen($filename,"r"); flock ($fp,1); $topiccount=forumfgetPad($fp,6); // Topics sammeln for($i=$topiccount;$i>0;$i--) { fseek($fp,12+($i-1)*130); $topics[$i]["visible"]=forumfgetPad($fp,1); $topics[$i]["unlocked"]=forumfgetPad($fp,1); $topics[$i]["caption"]=forumfgetPad($fp,128); $topics[$i]["postcount"]=0; $topics[$i]["totalcount"]=0; } fseek($fp,6); $postcount=forumfgetPad($fp,6); // Je n Postings sammeln for($i=$postcount;$i>0;$i--) { fseek($fp,12+1000*130+($i-1)*4326); $visible=forumfgetPad($fp,1); $topic=forumfgetPad($fp,6); if (($visible==1) && $topics[$topic]["visible"]==1) { $topics[$topic]["totalcount"]++; if ($topics[$topic]["postcount"]<3) { $topics[$topic]["postcount"]++; $post=$topics[$topic]["postcount"]; $topics[$topic][$post]["nick"]=forumfgetPad($fp,64); $topics[$topic][$post]["email"]=forumfgetPad($fp,128); forumfgetPad($fp,15); $text=forumunformatText(forumfgetPad($fp,4096)); if (strlen($text)>64) $text=substr($text,0,64)." ..."; $topics[$topic][$post]["text"]=$text; $topics[$topic][$post]["date"]=forumfgetPad($fp,16); } } } flock ($fp,3); fclose($fp); // Alles ausgeben $displaycount=0; $first=$offset; if ($first==0) { $first=1; }; $last=$first+$maxpage-1; echo("\n"); for($i=$topiccount;$i>0;$i--) { if ($topics[$i]["visible"]==1) { $displaycount++; if ($displaycount>=$first && $displaycount<=$last) { echo (""); echo (""); echo ("\n"); for($j=1;$j<=$topics[$i]["postcount"];$j++) { echo (""); echo (""); echo (""); echo ("\n"); } } } } echo ("
"); echo ($topics[$i]["caption"]); echo (""); if ($topics[$i]["unlocked"]) { echo (" (".$topics[$i]["totalcount"]." Antwort(en) - Antwort schreiben)"); } else { echo (" (gesperrt)"); } echo ("
".$topics[$i][$j]["text"]); echo (" (".$topics[$i][$j]["nick"]." ".$topics[$i][$j]["date"].")"); echo ("
"); echo ("
\n"); // Navigation echo("

\n"); if ($displaycount!=0) { if ($first>1) { print "Zurück "; }; $page=0; if ($displaycount>$maxpage) { for ($i=1;$i<=$displaycount;$i=$i+$maxpage) { $page++; if ($i==$first) { print " $page "; } else { print "$page "; } } } if ($displaycount>$last) { print "Weiter "; } } echo("

\n"); } function forumPrintPostings($showtopic,$offset) { // Die Postings eines Topics ausgeben global $filename; global $maxpage; $fp=fopen($filename,"r"); flock ($fp,1); fseek($fp,12+($showtopic-1)*130); $visible=forumfgetPad($fp,1); $unlocked=forumfgetPad($fp,1); if ($visible==1) { echo ("

"); if ($unlocked) { echo ("Antwort schreiben  "); } echo ("Neues Thema erstellen  "); echo ("Zurück zur Übersicht"); echo ("

\n"); echo("

".forumfgetPad($fp,128).""); if (!$unlocked) { echo (" (gesperrt)"); } echo("

\n"); fseek($fp,6); $count=forumfgetPad($fp,6); if ($offset==-1) { $first=1; } elseif ($offset==0) { $first=1; } else { $first=$offset; } $displaycount=0; $last=$first+$maxpage-1; echo (""); for($i=$count;$i>0;$i--) { fseek($fp,12+1000*130+($i-1)*4326); $visible=forumfgetPad($fp,1); $topic=forumfgetPad($fp,6); if (($visible==1) && $topic==$showtopic) { $displaycount++; if ($displaycount>=$first && $displaycount<=$last) { $nick=forumfgetPad($fp,64); $email=forumfgetPad($fp,128); $ip=forumfgetPad($fp,15); $text=forumfgetPad($fp,4096); $date=forumfgetPad($fp,16); echo (""); echo (""); echo (""); } } } echo ("
"); if ($email=="") { echo ("$nick ($date)
\n"); } else { echo ("$nick ($date):
\n"); } echo (forumformatText($text)); echo ("

"); // Navigation echo("

\n"); if ($displaycount!=0) { if ($first>1) { print "Zurück "; }; $page=0; if ($displaycount>$maxpage) { for ($i=1;$i<=$displaycount;$i=$i+$maxpage) { $page++; if ($i==$first) { print " $page "; } else { print "$page "; } } } if ($displaycount>$last) { print "Weiter "; } } echo("

\n"); } else { echo ("

"); echo ("Zurück zur Übersicht"); echo ("

\n"); } flock ($fp,3); fclose($fp); } function forumPrintForm($topic) { // Die Eingabe-Form darstellen global $forumrepost; ?>
Thema:
Nick:">
E-Mail:">
Antwort:
fett kursiv
Code:
Um das Forum vor Missbrauch zu schützen, geben Sie bitte den oben angezeigten Code ein:
Eingabe:

Neues Thema erstellen

\n"); forumPrintTopics($offset); } if (forumGetVars("action")=="view") { $topic=forumGetVars("topicid"); $offset=forumGetVars("offset"); forumPrintPostings($topic,$offset); } if (forumGetVars("action")=="post") { include ('../assets/w2dcaptcha.php4'); $cap=new captchas(); $cap->datapath='../assets/plugindata/'; if ($cap->checkticket(forumPostVars('forumid'),forumPostVars('forumcode'))) { $topic=forumPostVars("topicid"); if ($topic==0) $topic=forumAddTopic(forumCensor(forumPostVars("caption"))); $ip=forumServerVars("REMOTE_ADDR"); $nick=forumCensor(forumPostVars("nick")); $email=forumPostVars("email"); $text=forumCensor(forumPostVars("message")); forumAddPosting($topic,$nick,$email,$ip,$text); if ($admin) { echo ("

Vielen Dank für Ihren Eintrag in unser Forum. Wir freuen uns über jeden Besucher und jeden Beitrag.

"); echo ("

"); echo ("Zurück zur Übersicht"); echo ("

\n"); } else { forumPrintPostings($topic,-1); } } else { echo("

Der eingegebene Sicherheitscode ist ungültig.

\n"); $forumrepost=true; } } if (forumGetVars("action")=="add" or $forumrepost) { $topic=forumGetVars("topicid"); if (!$topic) { $topic=forumPostVars("topicid"); } if ($topic==0) { echo ("

Zurück zur Übersicht

\n"); } else { echo ("

Zurück zu den Antworten

\n"); } forumPrintForm($topic); } ?>