dupe comment blocker

git-svn-id: file:///home/shish/svn/shimmie2/trunk@606 7f39781d-f577-437e-ae19-be835c7a54ca
This commit is contained in:
shish 2007-11-03 05:23:01 +00:00
parent 90c70bf7b3
commit 637712d72c

View File

@ -281,6 +281,11 @@ class CommentList extends Extension {
return ($config->get_bool('comment_anon') || !$user->is_anonymous());
}
private function is_dupe($image_id, $comment) {
global $database;
return ($database->db->GetRow("SELECT * FROM comments WHERE image_id=? AND comment=?", array($image_id, $comment)));
}
private function add_comment_wrapper($image_id, $user, $comment) {
global $database;
global $config;
@ -296,6 +301,10 @@ class CommentList extends Extension {
$this->theme->display_error($page, "Comment Limit Hit",
"You've posted several comments recently; wait a minute and try again...");
}
else if($this->is_dupe($image_id, $comment)) {
$this->theme->display_error($page, "Duplicate Comment",
"Someone already made that comment on that image -- try and be more original?");
}
else if($user->is_anonymous() && $this->is_spam($comment)) {
$this->theme->display_error($page, "Spam Detected",
"Akismet thinks that your comment is spam. Try rewriting the comment, or logging in.");