I have been working on a full mod version of Smap words + Akismet Hack (also included a couple of patches posted here) with config and pre-register support for Akismet.
I think it is finished but I will test a couple of days in my live board to see if any other problem arises.
I found a couple of glitches, the first is the mass add feature that after the suggested patch it splitted the words in weird chunks without meaning I just use as separators what it is explained in the description (comma, semi-colon, or line-break). So in admin_spamwords.php:
[ FIND ]
Code: Select all
$list = preg_split("#[^A-Za-z-]#", $HTTP_POST_VARS['massad']);
[ REPLACE ]
Code: Select all
$list = preg_split("#[,;\n]#", $HTTP_POST_VARS['massad']);
Also in the hack you made to add checks during registration, the checks are inserted just in the middle of the file so it is called every time the register page is loaded (3 times during register process). So the fixed instrucions should be:
Code: Select all
#
## ADDED FOR CHECK UPON REGISTERING
#-----[ OPEN ]------------------------------------------
#
includes/usercp_register.php
#
#-----[ FIND ]------------------------------------------
#
$error = FALSE;
$error_msg = '';
#
#-----[ BEFORE, ADD ]------------------------------------------
#
function spamcheck($param)
{
global $db;
$sql = "SELECT * FROM " . SPAM_WORDS_TABLE;
if (!($result = $db->sql_query($sql)))
{
message_die(GENERAL_ERROR, 'Could not get spam words from database', '', __LINE__, __FILE__, $sql);
}
$param = preg_replace("#\[.{12,16}\]#i", '', $param);
$param = preg_replace('/\[url\]|\[\/url\]/si', '', $param);
$param = preg_replace('#\[url=|\]|\[/url\]#si', '', $param);
if ($row = $db->sql_fetchrow($result))
{
do
{
if (preg_match('#\b(' . str_replace('\*', '\w*?', phpbb_preg_quote($row['spam_word'], '#')) . ')\b#i', $param))
{
message_die(GENERAL_ERROR, 'Not allowed. Spam detected.');
}
}
while ($row = $db->sql_fetchrow($result));
}
}
#
#-----[ FIND ]------------------------------------------
#
$avatar_sql = user_avatar_gallery($mode, $error, $error_msg, $user_avatar_local, $user_avatar_category);
}
if ( !$error )
{
#
#-----[ AFTER, ADD ]------------------------------------------
#
if($mode == 'register')
{
$check_fields = array($username, $email, $icq, $aim, $msn, $yim, $website, $location, $occupation, $interests, $signature);
array_map('spamcheck', $check_fields);
}
#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM
I hope this will help others.