raised priority, aligned to new conventions: cleaned up
This commit is contained in:
parent
27e209bb29
commit
6fca3df0bb
@ -8,32 +8,27 @@ Version: 3.0
|
|||||||
Author URI: http://www.nowhereland.it
|
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;
|
if (!$bool) return false;
|
||||||
|
|
||||||
$BAN_WORDS = array(
|
$BAN_WORDS = array(
|
||||||
'href', '[url'
|
'href', '[url' // bans links
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$txt = strtolower(trim($contents['content']));
|
||||||
|
while (($w = array_pop($BAN_WORDS))
|
||||||
|
&&
|
||||||
|
(($r = strpos ($txt, $w)) === false));
|
||||||
|
|
||||||
$txt = isset($_POST['content'])? $_POST['content'] : null;
|
# if( strrchr($txt, ':')==':' ) $r=true;
|
||||||
|
|
||||||
if ($txt) {
|
if ($r!==false) {
|
||||||
$txt = strtolower(trim($txt));
|
global $smarty;
|
||||||
while (($w = array_pop($BAN_WORDS))
|
$smarty->assign('error', array('ERROR: The comment contained banned words'));
|
||||||
&&
|
return false;
|
||||||
(($r = strpos ($txt, $w)) === false));
|
|
||||||
|
|
||||||
if( strrchr($txt, ':')==':' ) $r=true;
|
|
||||||
|
|
||||||
if ($r!==false) {
|
|
||||||
global $_FP_SMARTY;
|
|
||||||
$_FP_SMARTY->assign('error', array('ERROR: The comment contained banned words'));
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user