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 "
\n"; echo "
".tra("Preview")."
\n"; echo output_transform($content, $options); echo "
\n"; } echo "
getID()."\" method=\"POST\">\n"; echo form_tokens($logged_in_user->getAuthenticator()); start_table(); row1("Edit your post"); if ($can_edit_title) { //If this is the user can edit the thread title display a way of doing so if ($preview) { row2( tr(FORUM_SUBMIT_NEW_TITLE).html_info(), "" ); } else { row2( tr(FORUM_SUBMIT_NEW_TITLE).html_info(), '' ); } }; if ($preview) { row2( tr(FORUM_MESSAGE).html_info().post_warning(), "" ); } else { row2( tr(FORUM_MESSAGE).html_info().post_warning(), '' ); } if ($post->hasSignature()) { $enable_signature="checked=\"true\""; } else { $enable_signature=""; } row2("", " "); row2("", "" ); end_table(); echo "
"; page_tail(); ?>