Commit 026a3542 authored by Francois Marier's avatar Francois Marier Committed by Gerrit Code Review
Browse files

Merge "Stop accidental double posting in forums"

parents 0e91fc6a 4ed6f2a0
......@@ -210,6 +210,13 @@ function addpost_submit(Pieform $form, $values) {
'body' => $values['body'],
'ctime' => db_format_timestamp(time())
);
// See if the same content has been submitted in the last 5 seconds. If so, don't add this post.
$oldpost = get_record_select('interaction_forum_post', 'topic = ? AND poster = ? AND parent = ? AND subject = ? AND body = ? AND ctime > ?',
array($post->topic, $post->poster, $post->parent, $post->subject, $post->body, db_format_timestamp(time() - 5)),
'id');
if ($oldpost) {
redirect('/interaction/forum/topic.php?id=' . $values['topic'] . '#post' . $oldpost->id);
}
$postid = insert_record('interaction_forum_post', $post, 'id', true);
// Rewrite the post id into links in the body
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment