[01/12/06] Spam Words

All new MODs released in our MOD Database will be announced in here. All support for released MODs needs to take place in here. No new MODs will be accepted into the MOD Database for phpBB2
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

On February 1, 2009 this forum will be set to read only as part of retiring of phpBB2.

Rating:

Excellent!
52
76%
Very Good
9
13%
Good
4
6%
Fair
0
No votes
Poor
3
4%
 
Total votes: 68

yunta1
Registered User
Posts: 14
Joined: Sat Nov 05, 2005 12:59 am

Post by yunta1 » Thu Jan 12, 2006 8:33 pm

An excellent mod. Thank you so much. Doing the job well. :D

Would you be able to highlight the word/s used in the log file.
Sometimes the post can contain thousands of words. Tracking what words were used to block the post takes a lot of reading - short of copy/past and search.
This would allow adjustments to the Word list if required and a better understanding of general word usage by posters.

Thanks.

Joe Belmaati
Registered User
Posts: 2110
Joined: Sun Sep 28, 2003 7:35 pm
Location: Denmark

Post by Joe Belmaati » Thu Jan 12, 2006 10:20 pm

That's an outstanding idea. I will try to think of a way to get that done. Thanks.
Image

Joe Belmaati
Registered User
Posts: 2110
Joined: Sun Sep 28, 2003 7:35 pm
Location: Denmark

Post by Joe Belmaati » Thu Jan 12, 2006 10:52 pm

OK, I submitted a new version to the MODs database last night so that one is going through validation. It does not contain the code for the highlight request above, but to help you out right now,

OPEN admin_spamwords_log.php

FIND

Code: Select all

$sql = "SELECT *
BEFORE, ADD

Code: Select all

/**
 * Obtain list of spam words for highlighting in log entries
 */
$sql = "SELECT spam_word
FROM  " . SPAM_WORDS_TABLE;

if(!($result = $db->sql_query($sql)))
{
	message_die(GENERAL_ERROR, 'Could not get spam words from database', '', __LINE__, __FILE__, $sql);
}

$spamwords = array();
while ($row = $db->sql_fetchrow($result))
{
	$spamwords[] = $row['spam_word'];
}

FIND

Code: Select all

	$row_color = (!($i % 2)) ? $theme['td_color1'] : $theme['td_color2'];
BEFORE, ADD

Code: Select all

	/**
	 * Split the message into single words and highlight the offending words
	 */
	$single_words = explode(' ', $message);
	$words = '';
	for ($j = 0; $j < count($single_words); $j++)
	{
		$words .= (in_array($single_words[$j], $spamwords)) ? '<span style="color: red; font-weight: bold;">' . $single_words[$j] . '</span>' : $single_words[$j];
		$words .= ' ';
	}

	$message = $words;
FIND

Code: Select all

	'MESSAGE' => $log_row[$i]['log_message'],
REPLACE WITH

Code: Select all

	'MESSAGE' => $message,

I will include this feature in the next release which I will delay a bit so as not to keep submitting updates for the MOD team to review. Hope this is something like what you were thinking about.
Last edited by Joe Belmaati on Sat Jan 14, 2006 9:34 am, edited 2 times in total.
Image

yunta1
Registered User
Posts: 14
Joined: Sat Nov 05, 2005 12:59 am

Post by yunta1 » Fri Jan 13, 2006 4:06 am

Thanks for the quick reply.

Could you check that I have this right please :

Code: Select all

/**
 * Obtain list of spam words for highlighting in log entries
 */
$sql = "SELECT spam_word
FROM  " . SPAM_WORDS_TABLE;

if(!($result = $db->sql_query($sql)))
{
   message_die(GENERAL_ERROR, 'Could not get spam words from database', '', __LINE__, __FILE__, $sql);
}

$spamwords = array();
while ($row = $db->sql_fetchrow($result))
{
   $spamwords[] = $row['spam_word'];
}

$sql = "SELECT *
		FROM " . SPAM_WORDS_LOG_TABLE . "
		ORDER BY $order_by";
if (!$result = $db->sql_query($sql))
{
	message_die(GENERAL_ERROR, 'Could not query log information', '', __LINE__, __FILE__, $sql);
}
$log_count = $db->sql_numrows($result);
$log_row = array();
$log_row = $db->sql_fetchrowset($result);

for ($i = 0; $i < $log_count; $i++)

{
/**
	* Split the message into single words and highlight the offending words
	*/
	$single_words = explode(' ', $message);
	$words = '';
	for ($j = 0; $j < count($single_words); $j++)
	{
		$words .= (in_array($single_words[$j], $spamwords)) ? '<span style="color: red; font-weight: bold;">' . $single_words[$j] . '</span>' : $single_words[$j];
		$words .= ' ';
	}

	$message = $words;
	$row_color = (!($i % 2)) ? $theme['td_color1'] : $theme['td_color2'];
	$row_class = (!($i % 2)) ? $theme['td_class1'] : $theme['td_class2'];
	$flagged = ($log_row[$i]['log_flagged']) ? $lang['Yes'] : $lang['No'];
It does not change any words to red. Using 2.0.19 with CH 2.1.4 .

Thanks

Joe Belmaati
Registered User
Posts: 2110
Joined: Sun Sep 28, 2003 7:35 pm
Location: Denmark

Post by Joe Belmaati » Fri Jan 13, 2006 7:12 am

You've got it right, but I missed an edit:

FIND

Code: Select all

	'MESSAGE' => $log_row[$i]['log_message'],
REPLACE WITH

Code: Select all

	'MESSAGE' => $message,
I have corrected the first post as well.
Last edited by Joe Belmaati on Sat Jan 14, 2006 9:32 am, edited 1 time in total.
Image

yunta1
Registered User
Posts: 14
Joined: Sat Nov 05, 2005 12:59 am

Post by yunta1 » Sat Jan 14, 2006 8:03 am

The admin panel (left hand side) now shows white with no selective (mouse over select) words in it.

Before your suggested changes to MESSAGE => , I changed the <span style="color.."> to "class=spamlogword" - by adding a new entry into the .css file. The Admin panel also turned white.

Hope this might help a little.

Joe Belmaati
Registered User
Posts: 2110
Joined: Sun Sep 28, 2003 7:35 pm
Location: Denmark

Post by Joe Belmaati » Sat Jan 14, 2006 9:20 am

Well, the code I gave you works. I'm not sure what could have turned your admin pages white...
[EDIT]ooops - looks like I left out a comma after $message.[/EDIT]
Image

yunta1
Registered User
Posts: 14
Joined: Sat Nov 05, 2005 12:59 am

Post by yunta1 » Sat Jan 14, 2006 8:21 pm

Could be because I'm using CH 2.1.4 .

Will let you know if I get it to work under this. Might have to change back to subSilver.

Thank you for all your time and effort

~yunta1~

Joe Belmaati
Registered User
Posts: 2110
Joined: Sun Sep 28, 2003 7:35 pm
Location: Denmark

Post by Joe Belmaati » Sat Jan 14, 2006 10:54 pm

please read my post above. The code should work fine. I just forgot a comma after $message in the last piece of code I gave you.
Image

Millennyum
Registered User
Posts: 88
Joined: Sun Apr 10, 2005 11:19 am
Location: Netherlands
Contact:

Post by Millennyum » Tue Jan 17, 2006 12:42 pm

When your update is validated, could you please publish the code changes you made in a separate document, or post them here? That way I know what and what not to change in the files, because I already installed the previous mod.

Joe Belmaati
Registered User
Posts: 2110
Joined: Sun Sep 28, 2003 7:35 pm
Location: Denmark

Post by Joe Belmaati » Tue Jan 17, 2006 1:58 pm

Millennyum wrote: When your update is validated, could you please publish the code changes you made in a separate document, or post them here? That way I know what and what not to change in the files, because I already installed the previous mod.

The code changes will only affect the files that come with the MOD, so upgrading will be a matter of overwriting the old files.
Image

Millennyum
Registered User
Posts: 88
Joined: Sun Apr 10, 2005 11:19 am
Location: Netherlands
Contact:

Post by Millennyum » Tue Jan 17, 2006 1:59 pm

great :)

Deco20
Registered User
Posts: 97
Joined: Sat Oct 22, 2005 2:57 pm

Post by Deco20 » Sun Jan 22, 2006 5:38 pm

Does this mod censore the words in the url of the links (not only in the text of the links)?

Joe Belmaati
Registered User
Posts: 2110
Joined: Sun Sep 28, 2003 7:35 pm
Location: Denmark

Post by Joe Belmaati » Mon Jan 23, 2006 9:34 pm

Deco20 wrote: Does this mod censore the words in the url of the links (not only in the text of the links)?
I'm not sure what you're talking about. Please elaborate.
Image

Millennyum
Registered User
Posts: 88
Joined: Sun Apr 10, 2005 11:19 am
Location: Netherlands
Contact:

Post by Millennyum » Wed Jan 25, 2006 9:02 am

I have just created a test account, but I am able to register with a website address and signature that contains a spamword. When I later try to change the signature, which then still includes the spamword, it still lets me do this. When I try to post a spamword in a topic with this account, I do get an error message.

Post Reply

Return to “[2.0.x] MOD Database Releases”