2015-07-28 22:44:53 +02:00
|
|
|
|
# Copyright (C) 2008–2015 Alex Schroeder <alex@gu.org>
|
|
|
|
|
|
# Copyright (C) 2004–2005 Fletcher T. Penney <fletcher@freeshell.org>
|
2005-04-05 21:18:57 +00:00
|
|
|
|
#
|
|
|
|
|
|
# This program is free software; you can redistribute it and/or modify
|
|
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
2008-10-15 22:17:47 +00:00
|
|
|
|
# the Free Software Foundation; either version 3 of the License, or
|
2005-04-05 21:18:57 +00:00
|
|
|
|
# (at your option) any later version.
|
|
|
|
|
|
#
|
|
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
|
|
#
|
|
|
|
|
|
# You should have received a copy of the GNU General Public License
|
2008-10-15 22:17:47 +00:00
|
|
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2005-04-05 21:18:57 +00:00
|
|
|
|
|
2015-03-29 15:17:13 +02:00
|
|
|
|
use strict;
|
2015-08-18 10:48:03 +02:00
|
|
|
|
use v5.10;
|
2015-03-27 03:01:01 +02:00
|
|
|
|
|
2014-08-21 22:23:23 +02:00
|
|
|
|
AddModuleDescription('logbannedcontent.pl', 'LogBannedContent Module');
|
2005-04-05 21:18:57 +00:00
|
|
|
|
|
2015-08-15 10:32:11 +02:00
|
|
|
|
our ($q, $OpenPageName, $Now, $DataDir, $BannedContent);
|
2015-04-10 13:31:28 +03:00
|
|
|
|
our ($BannedFile);
|
2005-04-05 21:18:57 +00:00
|
|
|
|
|
|
|
|
|
|
$BannedFile = "$DataDir/spammer.log" unless defined $BannedFile;
|
|
|
|
|
|
|
2015-03-30 09:58:33 +03:00
|
|
|
|
*LogOldBannedContent = \&BannedContent;
|
|
|
|
|
|
*BannedContent = \&LogNewBannedContent;
|
2005-04-05 21:18:57 +00:00
|
|
|
|
|
2013-01-31 09:21:54 +01:00
|
|
|
|
sub LogNewBannedContent {
|
2008-10-15 22:18:48 +00:00
|
|
|
|
my $str = shift;
|
2013-01-31 09:21:54 +01:00
|
|
|
|
my $rule = LogOldBannedContent($str);
|
|
|
|
|
|
LogWrite($rule) if $rule;
|
2008-10-15 22:18:48 +00:00
|
|
|
|
return $rule;
|
2008-10-15 22:17:47 +00:00
|
|
|
|
}
|
2013-01-31 09:21:54 +01:00
|
|
|
|
|
2015-04-11 23:41:33 +03:00
|
|
|
|
*LogOldUserIsBanned = \&UserIsBanned;
|
|
|
|
|
|
*UserIsBanned = \&LogNewUserIsBanned;
|
2013-01-31 09:21:54 +01:00
|
|
|
|
|
|
|
|
|
|
sub LogNewUserIsBanned {
|
|
|
|
|
|
my $str = shift;
|
|
|
|
|
|
my $rule = LogOldUserIsBanned($str);
|
2014-08-24 08:45:14 +02:00
|
|
|
|
LogWrite(Ts('IP number matched %s', $rule)) if $rule;
|
2013-01-31 09:21:54 +01:00
|
|
|
|
return $rule;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
sub LogWrite {
|
|
|
|
|
|
my $rule = shift;
|
|
|
|
|
|
my $id = $OpenPageName || GetId();
|
|
|
|
|
|
AppendStringToFile($BannedFile,
|
2015-07-31 09:35:51 +02:00
|
|
|
|
join("\t", TimeToW3($Now), $q->remote_addr(), $id, $rule)
|
2013-01-31 09:21:54 +01:00
|
|
|
|
. "\n");
|
|
|
|
|
|
}
|