diff options
author | Andreas Gohr <andi@splitbrain.org> | 2009-05-26 14:07:48 +0200 |
---|---|---|
committer | Andreas Gohr <andi@splitbrain.org> | 2009-05-26 14:07:48 +0200 |
commit | 6dffa0e0121b02d0258a96b5108dd43dee44c673 (patch) | |
tree | 86da745322b7fbd7348efbc43b9e4b39ab2dcdba | |
parent | 869edd5da60bb4cb912723089751dd56ecc41b98 (diff) | |
download | rpg-6dffa0e0121b02d0258a96b5108dd43dee44c673.tar.gz rpg-6dffa0e0121b02d0258a96b5108dd43dee44c673.tar.bz2 |
fixed a spam check hole FS#1620 and made the wordblock check more flexible
Ignore-this: 74d18220baea88b5826d46c78998fa04
darcs-hash:20090526120748-7ad00-b3a0bddc53ba3c6c3b824cfbed15450cc0ec406e.gz
-rw-r--r-- | inc/common.php | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/inc/common.php b/inc/common.php index fd54b7faf..c056e8f31 100644 --- a/inc/common.php +++ b/inc/common.php @@ -531,17 +531,23 @@ function script($script='doku.php'){ * [name] - real name (if logged in) * * @author Andreas Gohr <andi@splitbrain.org> - * Michael Klier <chi@chimeric.de> + * @author Michael Klier <chi@chimeric.de> + * @param string $text - optional text to check, if not given the globals are used + * @return bool - true if a spam word was found */ -function checkwordblock(){ +function checkwordblock($text=''){ global $TEXT; + global $PRE; + global $SUF; global $conf; global $INFO; if(!$conf['usewordblock']) return false; + if(!$text) $text = "$PRE $TEXT $SUF"; + // we prepare the text a tiny bit to prevent spammers circumventing URL checks - $text = preg_replace('!(\b)(www\.[\w.:?\-;,]+?\.[\w.:?\-;,]+?[\w/\#~:.?+=&%@\!\-.:?\-;,]+?)([.:?\-;,]*[^\w/\#~:.?+=&%@\!\-.:?\-;,])!i','\1http://\2 \2\3',$TEXT); + $text = preg_replace('!(\b)(www\.[\w.:?\-;,]+?\.[\w.:?\-;,]+?[\w/\#~:.?+=&%@\!\-.:?\-;,]+?)([.:?\-;,]*[^\w/\#~:.?+=&%@\!\-.:?\-;,])!i','\1http://\2 \2\3',$text); $wordblocks = getWordblocks(); //how many lines to read at once (to work around some PCRE limits) |