Author: dom Date: 2011-06-03 12:33:36 +0100 (Fri, 03 Jun 2011) New Revision: 1294
Modified: sites/cambridge.openguides.org/lib/OpenGuides/Local/CamGuideSpam.pm Log: new spamcatcher from Kake
Modified: sites/cambridge.openguides.org/lib/OpenGuides/Local/CamGuideSpam.pm =================================================================== --- sites/cambridge.openguides.org/lib/OpenGuides/Local/CamGuideSpam.pm 2011-06-03 11:33:14 UTC (rev 1293) +++ sites/cambridge.openguides.org/lib/OpenGuides/Local/CamGuideSpam.pm 2011-06-03 11:33:36 UTC (rev 1294) @@ -17,45 +17,62 @@ if ( $name eq "Category Board Games" && $content =~ m'http://.*http://.*http://%27is ) { $class->notify_admins( %args, + id => "00001", reason => "Edit to board games page with more than two URLs in." ); return 1; }
if ( $name eq "Station Tandoori" && $host eq "82.6.101.64" ) { $class->notify_admins( %args, + id => "00002", reason => "82.6.101.64 editing Station Tandoori." ); return 1; }
if ( $content =~ /\b(viagra|cialis|supermeganah|tramadol|vicodin|phentermine|zoloft|lolita)\b/is ) { - # $class->notify_admins( %args, reason => "Matches $1" ); + $class->notify_admins( %args, + id => "00003", + reason => "Matches $1" ); return 1; }
foreach my $cat ( @cats ) { if ( $cat =~ m'http://%27i ) { - $class->notify_admins( %args, reason => "URL in category field" ); + $class->notify_admins( %args, + id => "00004", + reason => "URL in category field" ); return 1; } }
foreach my $loc ( @locs ) { if ( $loc =~ m'http://%27i ) { - $class->notify_admins( %args, reason => "URL in locales field" ); + $class->notify_admins( %args, + id => "00005", + reason => "URL in locales field" ); return 1; } } + + if ( ( scalar @cats == 1 ) && ( scalar @locs == 1 ) + && $cats[0] eq $locs[0] ) { + $class->notify_admins( %args, + id => "00006", + reason => "category and locale identical" ); + return 1; + } }
sub notify_admins { my ( $class, %args ) = @_; my $reason = delete $args{reason}; + my $id = delete $args{id}; my $message = MIME::Lite->new( From => 'kake@earth.li', To => 'kake@earth.li', Subject => "Attempted spam edit on OGCam", Data => "Someone just tried to edit OGCam, and I said no because " - . "it looked like spam.\n\nReason: $reason\n\n" + . "it looked like spam.\n\nReason: $reason\n\nID: $id\n\n" . "Here's a dump of the details:\n" . Dumper( %args ), );