You are not logged in.

#1 2009-06-27 6:54 am

voytechs
Member
Registered: 2009-06-27
Posts: 1

A drupal module?

Thanks for this great site!!!

Does anyone know of any drupal modules that link into to this or other spambot databases? It would be great to provide a check when a new user registers against the latest and greatest database.

Offline

#2 2009-06-27 11:02 am

MysteryFCM
Member
From: Tyneside, UK
Registered: 2008-01-16
Posts: 605
Website

Re: A drupal module?

I'm planning on creating a Drupal mod for my SBST spam filter, but haven't got Drupal at present. In the meantime however, you may want to look at;

http://drupal.org/project/spam


Regards
Steven Burn
Ur I.T. Mate Group / hpHosts
it-mate.co.uk / hosts-file.net

Offline

#3 2011-01-19 2:55 am

fgm
Member
Registered: 2011-01-18
Posts: 3

Re: A drupal module?

EDIT: for Drupal 6, the http://drupal.org/project/spambot module includes SFS support.

ORIGNAL ANSWER:
I have included it in an existing module of mine, since it is very small. All it needs it basically this:

- in some form builder function where you want to display the user status, like a user validation form:

  // Published under the General Public License v2 or later, to be Drupal-compatible
  $sfs = _mymodule_get_sfs_info($account);
  if (!empty($sfs->success)) {
    $header = array('StopForumSpam');
    $data = array();
    foreach (array('username', 'email') as $field) {
      if (!empty($sfs->$field->appears)) {
        $data[] = array(
          'class' => 'error',
          'data' => t('@field seen @count times, last @last.', array(
            '@field'       => $field,
            '@count'       => $sfs->$field->frequency,
            '@last'        => $sfs->$field->lastseen,
          ))
        );
      }
      else {
        $data[] = array(
          'data'  => t('@field never seen.', array('@field' => $field))
        );
      }
    }
    $data = array($data);
    $form['sfs'] = array(
      '#value'       => theme('table', $header, $data),
    );
  }
  else {
    $form['sfs'] = array(
      '#value'       => t('<p class="error">StopForumSpam check failed.</p>'),
    );
  }

and then the checking function itself (here the version it for Drupal 5, change the url() format for later versions):

function _mymodule_get_sfs_info($account) {
  $request= array(
    'email' => $account->init,
    'username' => $account->name,
    'f' => 'json',
  );

  $query = array();
  foreach ($request as $k => $v) {
    $query[] = "$k=$v";
  }

  $url = url('http://www.stopforumspam.com/api',
    implode('&', $query), // Query
    NULL,  // Fragment
    TRUE); // Absolute
  $data = file_get_contents($url);
  $data = json_decode($data);
  return $data;
}

Last edited by fgm (2011-01-19 2:59 am)

Offline

Board footer

Powered by FluxBB