fixed a problem in the spam system for Post

and added spam prevention in Wiki
This commit is contained in:
JT Smith 2009-04-14 16:47:33 +00:00
parent d2012694dc
commit da8a68efca
2 changed files with 17 additions and 1 deletions

View file

@ -970,6 +970,7 @@ sub postProcess {
my $spamStopWords = $self->session->config->get('spamStopWords');
if (ref $spamStopWords eq 'ARRAY') {
my $spamRegex = join('|',@{$spamStopWords});
$spamRegex =~ s/\s/\\ /g;
if ($data{content} =~ m/$spamRegex/xmsi) {
$data{skipNotification} = 1;
$self->trash;

View file

@ -125,6 +125,22 @@ sub getAutoCommitWorkflowId {
my $self = shift;
my $wiki = $self->getWiki;
if ($wiki->hasBeenCommitted) {
# delete spam
my $spamStopWords = $self->session->config->get('spamStopWords');
if (ref $spamStopWords eq 'ARRAY') {
my $spamRegex = join('|',@{$spamStopWords});
$spamRegex =~ s/\s/\\ /g;
if ($self->get('content') =~ m{$spamRegex}xmsi) {
my $tag = WebGUI::VersionTag->new($self->session, $self->get('tagId'));
$self->purgeRevision;
if ($tag->getAssetCount == 0) {
$tag->rollback;
}
return undef;
}
}
return $wiki->get('approvalWorkflow')
|| $self->session->setting->get('defaultVersionTagWorkflow');
}
@ -276,7 +292,6 @@ sub processPropertiesFromFormPost {
}
}
}
}
#-------------------------------------------------------------------