[pmwiki-users] New Blocklist2 script
Crisses
crisses at kinhost.org
Thu Apr 20 08:15:07 CDT 2006
Hi, everyone --
I've made significant changes to the blocklist script and updates to
the http://www.pmwiki.org/wiki/Cookbook/Blocklist2 documentation.
Upgrade warning:
Change your config.php if needed -- $EnableWhyBlocked = 1; (no quotes)
Behavior change:
When $EnableWhyBlocked = 1; $Blocklisted will contain the number of
matches.
You must $EnableWhyBlocked to get the score/tally from the
$Blocklisted variable (if used for scoring, as in the email subject
line in my example config).
If you use the default $EnableWhyBlocked = 0; then $Blocklisted will
equal 0 or 1. It will break out of the blocklist checks as early as
possible, so not to waste precious server resources for those of us
just looking for simplicity.
If anyone wants a score or reasons for the block, but does not want
to tell the user why it was blocked, I'll take suggestions. You can
hide the class="blocklistmessage" block via CSS, but I don't want to
put another burden on the admins.
I incorporated some of the changes from Hagan Fox's cmsb script into
Blocklist2 -- especially those that bring Blocklist2 up to date with
the 2.1.x PmWiki distros.
I added in PCRE (perl-compatible regex) and tested it out. I added
some sample regexes to the cookbook page. "Reason" for these cases
is the matched text, not the regex used. Requires
$EnableBlocklistRegex = 1; before your include statement, and the
syntax in Site.Blocklist (or other) is "regex:" followed by the FULL
delimited pattern.
PM: I need to know why /^boo$/ won't work -- I don't see any non-
standard line-breaks in $_POST['text'], but I didn't run a deeper
analysis over the line break characters. I figured you might already
know ;)
Hagan Fox: What behavior did you get by running the blocklist when
action="diff"? Since there's no $_POST['text'] on a diff (at least
not to my knowledge) I would be curious as to why you added that. I
can see why we might want an "enable during diff" feature (action
diffblock?) to check diffs for blocked terms, but it would have to
check text that is on the server, not in the $_POST array, and I
think that would be different behavior. Also, many diffs are quite
long and already give my server the willies -- running that and
Blocklist at the same time would probably be a Very Bad Thing on some
of my pages. I decided not to roll that back into Blocklist2, but I
would love to know more about it.
Also:
SDV($BlocklistMessageFmt,
"<h3 class='wikimessage blockmessage'>"
."$[This post has been blocked by the administrator]</h3>");
SDV($BlockIPMessageFmt, "$[Remote host matches blocked IP address: ]");
SDV($BlockTextMessageFmt, "Content matches blocked pattern: ");
Can someone clue me in to the use of the $[]'s on the lines? Is that
for language files? If so, I imagine it should be on the last line
as well? I can add that to a 2.3.1 release. A link to documentation
for it will do. Thanks!
Just realized I left in debug statements -- removed & reuploaded :P
Crisses
--
"I have waited almost two years for a sign from God..."
"Sir, the truth is I talk to god all the time and, no offense, but he
never mentioned you."
--LadyHawke
More information about the pmwiki-users
mailing list