//used to show a topic, including answers
//$_GET["forum"] == forum's internal name
//$_GET["index"] == message index to show
//header (login...)
include "header.php";
printHeader ();
include "sub/globals.php";
//
echo ("");
setPageTitle ("-:: show topic ::-");
echo ("
\n");
if (!file_exists ("forums/" . $_GET["forum"] . "." . $_GET["index"]))
{
//the selected topic does not exist !
echo ("
\n");
echo ("
this topic does not exist (any more ?), please ".
"go back :-)
\n");
//open topic for reading
$file = fopen ("forums/" . $_GET["forum"] . "." . $_GET["index"], "r");
//overread last user & date
fgets ($file, 1000); fgets ($file, 1000);
//used to color the table
$count = 0;
//while there are still answers
while (!feof ($file))
{
$user = "\n";
//read username, and chop \n
//there may be some \n *be4* username
while ($user == "\n")
{
$user = fgets ($file, 1000);
}
$user = chop ($user);
if (feof($file)) break;
//read caption, and chop \n (caption is the icon html-show-command :-)
$caption = fgets ($file, 1000); $caption = chop ($caption);
//this is the icon for the current post
$icon = stripIcon ($caption);
//read date and time from file
$date = fgets ($file, 1000); $caption = chop ($caption);
//convert default date to custom user date
$timestamp = strtotime ($date);
$date = date ($g_customDate, $timestamp);
//read message
while (1)
{
//add it to the message text
$message .= $read;
//read stuff
$read = fgets ($file, 1000);
//reached end of answer
if (chop($read) == $g_topicSeperator)
break;
//add html newline, as it does not accept \n
$read .= " ";
}
//different colors for topics
if ($count % 2 == 0)
$color = $g_forumColor1;
else
$color = $g_forumColor2;
//convert special tags to html tags
$message = processMessage ($message);
//print the information we just got !
echo ("
\n");
//show username on the top of the table
echo ("