I recently installed the wordfilter module and wanted to know if anyone created (or would be willing to create) an importer for IPB's bad word filter list. IPB allows you to export your bad words to an XML file so the importer would not have to touch the database at all, just parse an XML file and insert the data into the database.

The formatting of the XML file is pretty basic and aligns fine with the wordfilter options, here's a glimpse at the simplest and most complex chunks of data in the file.

<code>		<badword>
			<type>PMS</type>
			<swop>personal massage system</swop>
			<m_exact>1</m_exact>
		</badword>

<code>		<badword>
			<type><![CDATA[sh!t]]></type>
			<swop>poo</swop>
			<m_exact>0</m_exact>
		</badword>

The CDATA business shows up on any line (type or swop) that contains '(', ')', or codes for characters (the ! was encoded in the XML, obviously you can see it clearly in this post); I don't imagine that would be too difficult to handle. The m_exact lines up with the "Stand-alone" option given for every filtered word, with 1 matching that it should be checked and 0 that it should not be checked.

I'm not a PHP programmer so I'm inept when it comes to writing even this (seemingly) basic converter. If anybody could whip one up, it would be a valuable resource for anybody who maintains a list of bad words with IPB and it should be added to the module as a contrib. I've got a few hundred bad words in my IPB list, so this converter would be a godsend; I'm not sure I could live through manual porting.

Thanks to anybody who can help,
Nick

Comments

Christefano-oldaccount’s picture

I'm not opposed to your idea, but wouldn't it be much simpler to export the wordfilter table as a file? That's what I've done when building community websites ~ I just import my custom wordfilter.mysql file to the new website's database.

By the way, you may want to edit out the wordfilter_table(); call on line 33 unless you want wordfilter.module to list every single filtered word for all to see in the help file at site.name/filter/tips. I was shocked to discover that wordfilter does this.