prefs->privilege(S_MODERATOR) || $logged_in_user->prefs->privilege(S_ADMIN) || $logged_in_user->prefs->privilege(S_DEV); $postid = get_int("id"); $post = BoincPost::lookup_id($postid); $thread = BoincThread::lookup_id($post->thread); // Check some prerequisites for editing the post // if (!$is_spec && (time() > $post->timestamp + 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 = BoincUser::lookup_id($post->user); if (($logged_in_user->id != $post_owner->id) || (can_reply($thread, $logged_in_user) == false)) { error_page ("You are not authorized to edit this post."); } $thread_owner = BoincUser::lookup_id($thread->owner); $can_edit_title = ($post->parent_post==0 and $thread_owner->id==$logged_in_user->id); $content = post_str("content", true); $preview = post_str("preview", true); if (post_str('submit',true) && (!$preview)) { check_tokens($logged_in_user->authenticator); if (post_str('add_signature', true) == "1") { $add_signature = 1; } else { $add_signature = 0; } $content = substr($content, 0, 64000); $content = BoincDb::escape_string($content); $post->update("signature=$add_signature, content='$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){ $t = post_str('title'); $t = trim($t); $t = strip_tags($ts); $t = BoincDb::escape_string($t); $thread->update("title='$t'"); } header("Location: forum_thread.php?id=$thread->id"); } page_head('Forum'); $forum = BoincForum::lookup_id($thread->forum); $category = BoincCategory::lookup_id($forum->category); show_forum_title($logged_in_user, $category, $forum, $thread, true); if ($preview == tra("Preview")) { $options = null; echo "
\n"; echo "
".tra("Preview")."
\n"; echo output_transform($content, $options); echo "
\n"; } echo "
id."\" method=\"POST\">\n"; echo form_tokens($logged_in_user->authenticator); 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( tra("Title").html_info(), "" ); } else { row2( tra("Title").html_info(), '' ); } }; if ($preview) { row2( tra("Message").html_info().post_warning(), "" ); } else { row2( tra("Message").html_info().post_warning(), '' ); } if ($post->signature) { $enable_signature="checked=\"true\""; } else { $enable_signature=""; } row2("", " "); row2("", "" ); end_table(); echo "
"; page_tail(); $cvs_version_tracker[]="\$Id$"; //Generated automatically - do not edit ?>