isSpecialUser(S_MODERATOR) ||
$logged_in_user->isSpecialUser(S_ADMIN) ||
$logged_in_user->isSpecialUser(S_DEV);
$postid = get_int("id");
$post = new Post($postid);
$thread = $post->getThread();
// Check some prerequisits for editting the post
if (!$is_spec && (time() > $post->getTimestamp() + MAXIMUM_EDIT_TIME)){
error_page ("You can no longer edit this post.
Posts can only be edited at most ".(MAXIMUM_EDIT_TIME/60)." minutes after they have been created.");
}
$post_owner = $post->getOwner();
if (($logged_in_user->getID() != $post_owner->getID()) || (can_reply($thread, $logged_in_user) == false)) {
error_page ("You are not authorized to edit this post.");
}
$thread_owner = $thread->getOwner();
$can_edit_title = ($post->getParentPostID()==0 and $thread_owner->getID()==$logged_in_user->getID());
$content = post_str("content", true);
$preview = post_str("preview", true);
if (post_str('submit',true) && (!$preview)) {
check_tokens($logged_in_user->getAuthenticator());
if (post_str('add_signature', true) == "1"){
$add_signature = true;
} else {
$add_signature = false;
}
$post->setSignature($add_signature);
$post->setContent($content);
// If this post belongs to the creator of the thread and is at top-level
// (ie. not a response to another post) allow the user to modify the thread title
if ($can_edit_title){
$thread->setTitle(post_str('title'));
}
header('Location: forum_thread.php?id='.$thread->getID());
}
page_head('Forum');
$forum = $thread->getForum();
$category = $forum->getCategory();
show_forum_title($forum, $thread);
if ($preview == tra("Preview")) {
$options = new output_options;
echo "