2003-07-19 00:26:18 +00:00
|
|
|
<?php
|
2003-08-13 22:08:12 +00:00
|
|
|
|
2004-02-02 23:34:39 +00:00
|
|
|
require_once('../inc/forum.inc');
|
|
|
|
require_once('../inc/util.inc');
|
2003-07-19 00:26:18 +00:00
|
|
|
|
2003-08-14 00:56:20 +00:00
|
|
|
if ($_POST['submit']) {
|
2003-12-04 22:42:51 +00:00
|
|
|
|
|
|
|
if (empty($_GET['id'])) {
|
|
|
|
// TODO: Standard error page
|
|
|
|
echo "Invalid post ID.<br>";
|
|
|
|
exit();
|
|
|
|
}
|
|
|
|
|
2003-07-19 00:26:18 +00:00
|
|
|
$post = getPost($_GET['id']);
|
|
|
|
$thread = getThread($post->thread);
|
|
|
|
|
2003-08-14 00:56:20 +00:00
|
|
|
updatePost($post->id, $_POST['content']);
|
|
|
|
|
2003-07-19 00:26:18 +00:00
|
|
|
header('Location: thread.php?id='.$thread->id);
|
|
|
|
}
|
|
|
|
|
2003-08-13 22:08:12 +00:00
|
|
|
$logged_in_user = get_logged_in_user();
|
|
|
|
|
2003-08-22 19:09:32 +00:00
|
|
|
page_head('Forum', $logged_in_user, NULL, 'forum.css');
|
2003-07-19 00:26:18 +00:00
|
|
|
|
2003-08-13 22:08:12 +00:00
|
|
|
if (!empty($_GET['id'])) {
|
2003-12-04 22:42:51 +00:00
|
|
|
$post = getPost($_GET['id']);
|
|
|
|
$thread = getThread($post->thread);
|
|
|
|
$forum = getForum($thread->forum);
|
|
|
|
$category = getCategory($forum->category);
|
2003-08-13 22:08:12 +00:00
|
|
|
} else {
|
2003-12-04 22:42:51 +00:00
|
|
|
// TODO: Standard error page
|
|
|
|
echo "No post was specified.<br>";
|
|
|
|
exit();
|
2003-08-13 22:08:12 +00:00
|
|
|
}
|
|
|
|
|
2003-07-19 00:26:18 +00:00
|
|
|
if ($logged_in_user->id != $post->user) {
|
|
|
|
// Can't edit other's posts.
|
|
|
|
echo "You are not authorized to edit this post.";
|
|
|
|
exit();
|
|
|
|
}
|
|
|
|
|
2003-08-13 22:08:12 +00:00
|
|
|
show_forum_title($forum, $thread, $category->is_helpdesk);
|
2003-07-19 00:26:18 +00:00
|
|
|
|
2003-08-13 22:08:12 +00:00
|
|
|
echo "<form action=\"edit.php?id=", $post->id, "\" method=\"POST\">";
|
|
|
|
|
|
|
|
start_forum_table(array("Edit Your Post"), array(NULL), 2);
|
|
|
|
|
|
|
|
echo "
|
2003-12-04 22:42:51 +00:00
|
|
|
<tr>
|
|
|
|
<td style=\"vertical-align:top\"><b>Message content</b></td>
|
|
|
|
<td><textarea name=\"content\" rows=12 cols=80>", stripslashes($post->content), "</textarea></td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td colspan=2 style=\"text-align:center\">
|
|
|
|
<input type=\"submit\" name=\"submit\" value=\"submit\">
|
|
|
|
</td>
|
|
|
|
</tr>
|
2003-08-13 22:08:12 +00:00
|
|
|
";
|
|
|
|
|
|
|
|
end_forum_table();
|
|
|
|
|
|
|
|
echo "</form>";
|
|
|
|
|
2003-08-15 01:01:00 +00:00
|
|
|
page_tail();
|
2003-07-19 00:26:18 +00:00
|
|
|
|
2003-12-04 22:42:51 +00:00
|
|
|
?>
|