#! /usr/bin/perl


print "Content-type: text/html\n\n";


$Daten = $ENV{'QUERY_STRING'};
@Felder = split(/&/, $Daten);
$view = "0";

$threadRoot = 0;
foreach $Feld (@Felder)
{
  ($name, $value) = split(/=/, $Feld);
  $value =~ tr/+/ /;
  $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
  $value =~ s/<!--(.|\n)*-->//g;

  if ($name eq "threadRoot")
  {
    $threadRoot = $value;
  }
  if ($name eq "view")
  {
    $view = $value;
  }
}

open(FH, "<msgtemplate_1.html") or die "Template nicht gefunden";
while (<FH>)
{
  print $_;
}
close (FH);

print "<table width = \"90%\"><tr><th><a href = \"addforumentryform.pl?thread=0&parent=0\">Add Message</a></th>";
print "</table>";


do "subforum.pl";

print "<table width = \"90%\"><tr><th><a href = \"addforumentryform.pl?thread=0&parent=0\">Add Message</a></th>";
print "</table>";

open(FH, "<msgtemplate_2.html") or die "Template nicht gefunden";
while (<FH>)
{
  print $_;
}
close (FH);

