locked && !$logged_in_user->prefs->privilege(S_MODERATOR)
&& !$logged_in_user->prefs->privilege(S_ADMIN)) {
error_page("This thread is locked. Only forum moderators and administrators are allowed to post there.");
}
$forum = BoincForum::lookup_id($thread->forum);
$category = BoincCategory::lookup_id($forum->category);
$sort_style = get_str('sort', true);
$filter = get_str('filter', true);
$content = post_str('content', true);
$preview = post_str("preview", true);
$parent_post_id = get_int('post', true);
$parent_post = null;
if ($parent_post_id) {
$parent_post = BoincPost::lookup_id($parent_post_id);
if ($parent_post->thread != $thread->id) {
error_page("wrong thread");
}
} else {
$parent_post_id = 0;
}
if ($filter != "false"){
$filter = true;
} else {
$filter = false;
}
if ($thread->hidden) {
//If the thread has been hidden, do not display it, or allow people to continue to post
//to it.
error_page(
"This thread has been hidden for administrative purposes."
);
}
if (!$logged_in_user->prefs->privilege(S_MODERATOR) && ($logged_in_user->total_credit<$forum->post_min_total_credit || $logged_in_user->expavg_credit<$forum->post_min_expavg_credit)) {
//If user haven't got enough credit (according to forum regulations)
//We do not tell the (ab)user how much this is - no need to make it easy for them to break the system.
error_page(
"In order to reply to a post in ".$forum->title." you must have a certain amount of credit.
This is to prevent and protect against abuse of the system."
);
}
if (time()-$logged_in_user->prefs->last_post <$forum->post_min_interval){
// If the user is posting faster than forum regulations allow
// Tell the user to wait a while before creating any more posts
error_page(
"You cannot reply to any more posts right now. Please wait a while before trying again.
This delay has been enforced to protect against abuse of the system."
);
}
if (!$sort_style) {
$sort_style = $logged_in_user->prefs->thread_sorting;
} else {
$logged_in_user->prefs->update("thread_sorting=$sort_style");
}
if ($content && (!$preview)){
if (post_str('add_signature',true)=="add_it"){
$add_signature=true; // set a flag and concatenate later
} else {
$add_signature=false;
}
check_tokens($logged_in_user->authenticator);
akismet_check($logged_in_user, $content);
create_post($content, $parent_post_id, $logged_in_user, $forum, $thread, $add_signature);
header('Location: forum_thread.php?id='.$thread->id);
}
page_head(tra("Message boards"));
show_forum_title($logged_in_user, $category, $forum, $thread, true);
if ($preview == tra("Preview")) {
$options = new output_options;
echo "