2003-07-18 21:38:51 +00:00
|
|
|
<?php
|
|
|
|
require_once('../include.php');
|
|
|
|
require_once('forum.inc');
|
2003-07-26 00:19:21 +00:00
|
|
|
//require_once('thread.php');
|
2003-07-25 20:27:34 +00:00
|
|
|
require_once('subscribe.inc');
|
2003-07-18 21:38:51 +00:00
|
|
|
require_once('../util.inc');
|
|
|
|
|
2003-07-24 22:56:20 +00:00
|
|
|
if (!empty($_GET['thread']) && !empty($_POST['content'])) {
|
|
|
|
$_GET['thread'] = stripslashes(strip_tags($_GET['thread']));
|
|
|
|
|
|
|
|
if (!empty($_GET['post'])) {
|
|
|
|
$parent_post = $_GET['post'];
|
|
|
|
} else {
|
|
|
|
$parent_post = NULL;
|
|
|
|
}
|
2003-07-18 21:38:51 +00:00
|
|
|
|
2003-07-26 00:19:21 +00:00
|
|
|
$user = get_logged_in_user(true, '../');
|
2003-07-18 21:38:51 +00:00
|
|
|
|
2003-07-24 22:56:20 +00:00
|
|
|
$thread = getThread($_GET['thread']);
|
|
|
|
$thread->reply($user->id, $_POST['content'], $parent_post);
|
2003-07-25 20:27:34 +00:00
|
|
|
|
|
|
|
notify_subscribers($thread);
|
|
|
|
|
2003-07-18 21:38:51 +00:00
|
|
|
header('Location: thread.php?id='.$thread->id);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (empty($_SESSION['authenticator']))
|
2003-07-24 22:56:20 +00:00
|
|
|
get_logged_in_user(true, '../');
|
2003-07-18 21:38:51 +00:00
|
|
|
|
2003-07-24 22:56:20 +00:00
|
|
|
|
2003-07-18 21:38:51 +00:00
|
|
|
doHeader('Forum');
|
|
|
|
|
2003-07-24 22:56:20 +00:00
|
|
|
if (!empty($_GET['post'])) {
|
2003-07-26 00:19:21 +00:00
|
|
|
$post = getPost($_GET['post']);
|
|
|
|
}
|
2003-07-24 22:56:20 +00:00
|
|
|
$thread = getThread($_GET['thread']);
|
2003-07-18 21:38:51 +00:00
|
|
|
$forum = getForum($thread->forum);
|
2003-07-24 22:56:20 +00:00
|
|
|
|
|
|
|
$logged_in_user = get_logged_in_user(true);
|
|
|
|
|
2003-07-18 21:38:51 +00:00
|
|
|
?>
|
|
|
|
|
|
|
|
<p>
|
|
|
|
<span class="title"><?php echo $thread->title ?></span>
|
|
|
|
<br><a href="index.php"><?php echo $cfg['sitename'] ?> Forum</a> -> <a href="forum.php?id=<?php echo $forum->id ?>"><?php echo $forum->title ?></a>
|
|
|
|
</p>
|
|
|
|
|
|
|
|
<p style="text-align:center">
|
|
|
|
<table class="content" border="0" cellpadding="5" cellspacing="0" width="100%">
|
|
|
|
<tr>
|
|
|
|
<th style="width: 150px">Author</th>
|
|
|
|
<th>Message</th>
|
|
|
|
</tr>
|
2003-07-26 00:19:21 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
show_posts($thread, false, false);
|
|
|
|
show_message_row($thread, $post);
|
|
|
|
?>
|
|
|
|
|
|
|
|
</table>
|
|
|
|
</p>
|
2003-07-18 21:38:51 +00:00
|
|
|
|
|
|
|
<?php
|
|
|
|
doFooter();
|
|
|
|
?>
|
2003-07-24 22:56:20 +00:00
|
|
|
|
|
|
|
<?php
|
|
|
|
|
2003-07-29 01:15:00 +00:00
|
|
|
function show_message_row($thread, $post=NULL) {
|
2003-07-24 22:56:20 +00:00
|
|
|
global $logged_in_user;
|
|
|
|
|
|
|
|
echo "
|
|
|
|
<tr class = \"row1\" style=\"vertical-align:top\">
|
|
|
|
<td>
|
2003-07-25 20:27:34 +00:00
|
|
|
<a name=\"input\"></a>
|
2003-07-24 22:56:20 +00:00
|
|
|
<p style=\"font-weight:bold\">
|
|
|
|
";
|
|
|
|
|
|
|
|
if ($logged_in_user->has_profile) {
|
|
|
|
echo "<a href=\"../view_profile.php?userid=", $logged_in_user->id, "\">", $logged_in_user->name, "</a>";
|
|
|
|
} else {
|
|
|
|
echo $logged_in_user->name;
|
|
|
|
}
|
|
|
|
|
|
|
|
echo "
|
|
|
|
</p>
|
|
|
|
<p style=\"font-size:8pt\">
|
|
|
|
Joined: ", date('M j, Y', $logged_in_user->create_time), "
|
|
|
|
</p>
|
|
|
|
</td>
|
|
|
|
<td>
|
2003-07-26 00:19:21 +00:00
|
|
|
<p style=\"font-size:8pt\">Your Message";
|
|
|
|
if ($post) echo " in response to <a href=#$post->id>Message ID $post->id</a>";
|
|
|
|
echo "</p>
|
2003-07-24 22:56:20 +00:00
|
|
|
<form action='reply.php?thread=", $thread->id;
|
|
|
|
|
|
|
|
if ($post) {
|
|
|
|
echo "&post=", $post->id;
|
|
|
|
}
|
2003-07-26 00:19:21 +00:00
|
|
|
|
2003-07-24 22:56:20 +00:00
|
|
|
echo "' method=\"post\">
|
2003-07-28 22:17:16 +00:00
|
|
|
<textarea name=\"content\" rows=\"18\" cols=\"80\">";
|
|
|
|
if ($post) echo quote_text($post->content, 80);
|
2003-07-26 00:19:21 +00:00
|
|
|
echo "</textarea><p>
|
2003-07-24 22:56:20 +00:00
|
|
|
<input type=\"submit\" value=\"Post reply\"></p>
|
|
|
|
</form>
|
|
|
|
";
|
|
|
|
|
|
|
|
echo "</td></tr>";
|
|
|
|
}
|
|
|
|
|
2003-07-26 00:19:21 +00:00
|
|
|
function quote_text($text, $cols) {
|
2003-07-28 22:17:16 +00:00
|
|
|
$quoteChar = ">";
|
|
|
|
|
|
|
|
$lines = explode("\n", $text);
|
2003-07-26 00:19:21 +00:00
|
|
|
|
2003-07-28 22:17:16 +00:00
|
|
|
$lineChars = strlen($quoteChar);
|
|
|
|
$final = $quoteChar;
|
|
|
|
|
|
|
|
for ($i = 0; $i < count($lines); $i++) {
|
|
|
|
$words = explode(" ", $lines[$i]);
|
|
|
|
|
|
|
|
for ($j = 0; $j < count($words); $j++) {
|
|
|
|
$wordLen = strlen($words[$j]);
|
|
|
|
|
|
|
|
if (($lineChars + $wordLen) >= $cols) {
|
|
|
|
$final = $final . "\n" . $quoteChar;
|
|
|
|
$lineChars = strlen($quoteChar);
|
|
|
|
}
|
|
|
|
$final = $final . " " . $words[$j];
|
|
|
|
$lineChars += $wordLen + 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
$final = $final . "\n" . $quoteChar;
|
|
|
|
$lineChars = strlen($quoteChar);
|
2003-07-26 00:19:21 +00:00
|
|
|
}
|
|
|
|
|
2003-07-28 22:17:16 +00:00
|
|
|
return $final;
|
2003-07-26 00:19:21 +00:00
|
|
|
}
|
2003-07-24 22:56:20 +00:00
|
|
|
?>
|