Ejemplo n.º 1
0
$post = BoincPost::lookup_id($postid);
if (!$post) {
    error_page("no such post");
}
$thread = BoincThread::lookup_id($post->thread);
if (!$thread) {
    error_page("no such thread");
}
$forum = BoincForum::lookup_id($thread->forum);
if (!is_moderator($logged_in_user, $forum)) {
    if (time() > $post->timestamp + MAXIMUM_EDIT_TIME) {
        error_page(tra("You can no longer edit this post.<br/>Posts can only be edited at most %1 minutes after they have been created.", MAXIMUM_EDIT_TIME / 60));
    }
}
$post_owner = BoincUser::lookup_id($post->user);
if ($logged_in_user->id != $post_owner->id || can_reply($thread, $forum, $logged_in_user) == false) {
    error_page(tra("You are not authorized to edit this post."));
}
$thread_owner = BoincUser::lookup_id($thread->owner);
// 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
//
$can_edit_title = $post->parent_post == 0 && $thread_owner->id == $logged_in_user->id && !is_banished($logged_in_user);
$content = post_str("content", true);
$title = post_str("title", true);
$preview = post_str("preview", true);
if (post_str('submit', true) && !$preview) {
    check_tokens($logged_in_user->authenticator);
    $add_signature = post_str('add_signature', true) == "1" ? 1 : 0;
    $content = substr($content, 0, 64000);
Ejemplo n.º 2
0
                    }
                } else {
                    // and a "I also got this question" to everyone else
                    echo "<p>";
                    show_button("forum_thread_vote.php?id={$thread->id}", tra("I've also got this question"));
                }
            }
        }
    }
}
echo "\n    <p>\n    <form action=\"forum_thread.php\">\n    <table width=\"100%\" cellspacing=0 cellpadding=0>\n    <tr class=\"forum_toplinks\">\n    <td>\n";
$reply_url = "";
if (!$logged_in_user) {
    echo "To post messages, you must <a href=login_form.php>log in</a>.";
} else {
    if (can_reply($thread, $forum, $logged_in_user)) {
        $reply_url = "forum_reply.php?thread=" . $thread->id . "#input";
        show_button($reply_url, tra("Post to thread"), tra("Add a new message to this thread"));
    }
    if ($is_subscribed) {
        $type = NOTIFY_SUBSCRIBED_POST;
        BoincNotify::delete_aux("userid={$logged_in_user->id} and type={$type} and opaque={$thread->id}");
        $url = "forum_subscribe.php?action=unsubscribe&amp;thread=" . $thread->id . "{$tokens}";
        show_button($url, tra("Unsubscribe"), tra("You are subscribed to this thread.  Click here to unsubscribe."));
    } else {
        $url = "forum_subscribe.php?action=subscribe&amp;thread=" . $thread->id . "{$tokens}";
        show_button($url, tra("Subscribe"), tra("Click to get email when there are new posts in this thread"));
    }
    // If logged in user is moderator, enable some extra features
    //
    if (is_moderator($logged_in_user, $forum)) {