From 6fca3df0bbb3668e9f1740997e8419a21b82f43b Mon Sep 17 00:00:00 2001 From: real_nowhereman Date: Sat, 8 Mar 2008 14:21:02 +0000 Subject: [PATCH] raised priority, aligned to new conventions: cleaned up --- fp-plugins/qspam/plugin.qspam.php | 35 +++++++++++++------------------ 1 file changed, 15 insertions(+), 20 deletions(-) diff --git a/fp-plugins/qspam/plugin.qspam.php b/fp-plugins/qspam/plugin.qspam.php index f2d61be..4c68352 100755 --- a/fp-plugins/qspam/plugin.qspam.php +++ b/fp-plugins/qspam/plugin.qspam.php @@ -8,36 +8,31 @@ Version: 3.0 Author URI: http://www.nowhereland.it */ -add_action('comment_validate', 'plugin_qspam_validate'); +add_action('comment_validate', 'plugin_qspam_validate', 5, 2); -function plugin_qspam_validate($bool) { +function plugin_qspam_validate(&$bool, $contents) { if (!$bool) return false; $BAN_WORDS = array( - 'href', '[url' + 'href', '[url' // bans links ); - - $txt = isset($_POST['content'])? $_POST['content'] : null; - - if ($txt) { - $txt = strtolower(trim($txt)); - while (($w = array_pop($BAN_WORDS)) - && - (($r = strpos ($txt, $w)) === false)); + $txt = strtolower(trim($contents['content'])); + while (($w = array_pop($BAN_WORDS)) + && + (($r = strpos ($txt, $w)) === false)); - if( strrchr($txt, ':')==':' ) $r=true; + # if( strrchr($txt, ':')==':' ) $r=true; - if ($r!==false) { - global $_FP_SMARTY; - $_FP_SMARTY->assign('error', array('ERROR: The comment contained banned words')); - return false; - } - } - + if ($r!==false) { + global $smarty; + $smarty->assign('error', array('ERROR: The comment contained banned words')); + return false; + } + return true; } -?> \ No newline at end of file +?>