Been going through the user content module to try to fix some bugs, and I noticed this -- would appreciate if someone can confirm.

First, some background (since I figure I may be the only person that's looked at this stuff in a while, and the API's still not documented): spam uses the filter_fields hook to get what fields should be scanned from each module.

The return value of filter_fields is a two-item array: $filter['main'] and $filter['other'], each of which are themselves arrays of field names.

It looks like right now, spam.module is filtering on ['main'] but not on ['other']. A helper function is in there to scan on ['other'] (spam_get_text, i believe), but it currently looks like it's unimplemented.

This particularly matters to spam_content_user, since the sig is one of the places where spam's most likely to show up (as spam links), but it's in the ['other'] array.

Was torn between classifying this as a "bug" or "feature request;" guess it depends on how important we thing the fields in ['other'] (I think content_comment uses it too) are.

Comments

jeremy’s picture

This is the relevant function definition:

./spam.module:function spam_get_text($content, $type, $fields, $extra = array(), $full = TRUE) {

Note that "$full" is set to TRUE by default, and that within this function if $full is TRUE we append the 'other' fields to the text that is scanned.

Finally, grepping through the spam filter code I see only two places this function is actually called:

./filters/spam_filter_bayesian/spam_filter_bayesian.module:    $string = spam_get_text($content, $type, $fields, $extra);
./filters/spam_filter_custom/spam_filter_custom.module:      $scan .= spam_get_text($content, $type, $fields, $extra);

In both cases, $full is left the default of TRUE.

In other words, filters are able to review the 'other' fields if appropriate, and currently two filters do so.

gnassar’s picture

Thanks, Jeremy. Must've forgotten the -r on my grep. :) I caught spam_get_text, but didn't find it called anywhere.

I guess then all that remains of this is to either tell the URL filter to check on "all" or to promote the sig field in content_comments from 'other' to 'main'.

jeremy’s picture

> all that remains of this is to either tell the URL filter to check on "all"

Right, I think it should be scanning all fields.

gnassar’s picture

Title: scanning on $fields['other'] not implemented » scanning on $fields['other'] not implemented in URL filter
Component: Code » URL Filter