summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog1
-rw-r--r--lib/VNDB/DB/Discussions.pm4
-rw-r--r--lib/VNDB/Handler/Discussions.pm4
-rw-r--r--lib/VNDB/Util/FormHTML.pm1
4 files changed, 9 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index a3116f26..0e293f8b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -10,6 +10,7 @@
- Tag cache regenerated daily rather than hourly
- Added OpenSearch plugin + autodetection
- Converted font size units to px in the css
+ - Added double-post prevention
2.5 - 2009-07-09
- Hide NSFW images in diff viewer (unless NSFW warnings are disabled)
diff --git a/lib/VNDB/DB/Discussions.pm b/lib/VNDB/DB/Discussions.pm
index 58cc5f61..5e371fbc 100644
--- a/lib/VNDB/DB/Discussions.pm
+++ b/lib/VNDB/DB/Discussions.pm
@@ -153,7 +153,7 @@ sub dbThreadCount {
}
-# Options: tid, num, what, order, uid, hide, page, results
+# Options: tid, num, what, order, uid, mindate, hide, page, results
# what: user thread
sub dbPostGet {
my($self, %o) = @_;
@@ -169,6 +169,8 @@ sub dbPostGet {
'tp.num = ?' => $o{num} ) : (),
$o{uid} ? (
'tp.uid = ?' => $o{uid} ) : (),
+ $o{mindate} ? (
+ 'tp.date > ?' => $o{mindate} ) : (),
$o{hide} ? (
'tp.hidden = FALSE' => 1 ) : (),
$o{hide} && $o{what} =~ /thread/ ? (
diff --git a/lib/VNDB/Handler/Discussions.pm b/lib/VNDB/Handler/Discussions.pm
index 1ec79c18..d8aa2f63 100644
--- a/lib/VNDB/Handler/Discussions.pm
+++ b/lib/VNDB/Handler/Discussions.pm
@@ -166,6 +166,10 @@ sub edit {
{ name => 'msg', maxlenght => 5000 },
);
+ # check for double-posting
+ push @{$frm->{_err}}, 'doublepost' if $self->dbPostGet(
+ uid => $self->authInfo->{id}, tid => $tid, mindate => time - 30, results => 1, $tid ? () : (num => 1))->[0]{num};
+
# parse and validate the boards
my @boards;
if(!$frm->{_err} && $frm->{boards}) {
diff --git a/lib/VNDB/Util/FormHTML.pm b/lib/VNDB/Util/FormHTML.pm
index dfb9a91f..f8047c4c 100644
--- a/lib/VNDB/Util/FormHTML.pm
+++ b/lib/VNDB/Util/FormHTML.pm
@@ -54,6 +54,7 @@ my %formerr_exeptions = (
toolarge => 'Image is too large, only 500kB allowed',
oneaday => 'You can only register one account from the same IP within 24 hours',
nochanges => 'No changes, please don\'t create an entry that is fully -identical- to another',
+ doublepost => 'Please wait 30 seconds before making another post',
);