MyBB Community Forums

Full Version: Spamalyzer modifications
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
So I've been using Spamalyzer since I converted to MyBB last year and it's done a pretty good job of keeping spam out. However there are a few tweaks I'd love to see made to enhance it's effectiveness... But I have no idea what I'd need to change in order to make them myself. 

What I'd love to see is the option to check plain text for keywords too. This way spambots who maybe only post one link (thus bypassing the check for links) but use a considerable number of the keywords anyway would still get caught.


So what would I need to add, and where in the plugin would I need to put it, to make this function work?



Also, with the change by Google to make the language detection API a paid only feature, would changing what we see under line 296 of sp_main.php from:
		$gdata = fetch_remote_file('http://www.google.com/uds/GlangDetect?v=1.0&q='.urlencode($msg));

		unset($msg);

		if(function_exists('json_decode')) // only available PHP >= 5.2.0

			$gdata = json_decode($gdata, true);

		// this is somewhat less reliable (cos I'm too lazy to write a more proper parser)

		elseif(preg_match('~\{"language"\:"([a-zA-Z]+)","isReliable"\:(true|false),"confidence"\:([0-9.]+)\}~i', $gdata, $gm)) {

			$gdata = array('responseData' => array(

				'language' => $gm[1],

				'isReliable' => (bool)$gm[2],

				'confidence' => (float)$gm[3]

to:

// $api would be the API key entered into settings, it'd have to be a new part for settings though. 		

$gdata = fetch_remote_file('http://ws.detectlanguage.com/0.2/detect?q='.urlencode($msg).$api);

		unset($msg);

		if(function_exists('json_decode')) // only available PHP >= 5.2.0

			$gdata = json_decode($gdata, true);

		// this is somewhat less reliable (cos I'm too lazy to write a more proper parser)

		elseif(preg_match('~\{"language"\:"([a-zA-Z]+)","isReliable"\:(true|false),"confidence"\:([0-9.]+)\}~i', $gdata, $gm)) {

			$gdata = array('responseData' => array(

				'language' => $gm[1],

				'isReliable' => (bool)$gm[2],

				'confidence' => (float)$gm[3]

make it so that the lookup would work with the new service (offhand)? Or would there be other changes that would have to be made too? (Aside from the adding a spot in the install for the API key to be entered into the database and then pulled on lookup?)