NoSpam - Prevent spam before it happens

The goal of this project is to obliterate spam. Even though it is far from perfect at the moment. I have already noticed a significant decrease in the spam I received at a particular website, on which it runs live at the moment, simultaniously significantly decreasing the amount of manual work I put in spam prevention.

The reason I started this project was because I manage a website where 75% of the messages placed are spam messages, while other modules have failed me, I feel very confident that thanks to this module there will be no spam at all placed on my website.

The ultimate goal of this module is to put all-in-one, IP-checking, username/e-mail checking, node validation etc, but above all, (intelligent, configurable and transparant) auto-banning. My greatest issue with the other modules was that it was great and all that they could identify so much for me, but I had to manually manage it all anyway, thus only slightly decreasing the amount of work I have to put in spam prevention.
Besides, spammers will always be coming to you, so you should have always-on defence, and not just during the daytime.

Screenshots and more information can be found on the project page.

Flow of module

  1. A user visits the site
  2. There is n chance his IP is placed in a queue to be validated
  3. In hook_cron a given amount of the queue is send to the webservice
  4. The results are evaluated and when the configurable conditions are met, the address is marked as a spam address
  5. The results are stored for n months in the database, to be permanently deleted during a cron run some time in the future
  6. If 'safe mode' is turned off, the address is also added to the block list and will be removed when the status has expired
  7. The user might return, and the process will start again.

The results of the verification can be viewn, see the screenshots on the project page.

GIT

I'm not sure that my git branches are set up 'the drupal way'.

git clone http://git.drupal.org/sandbox/AmazingDreams/2089117.git nospam

Sandbox

https://drupal.org/sandbox/AmazingDreams/2089117

Other reviews

  1. https://drupal.org/node/2089695#comment-7882971

Comments

AmazingDreams’s picture

Issue summary: View changes

Added module workflow

PA robot’s picture

Status: Needs review » Needs work

There are some errors reported by automated review tools, did you already check them? See http://pareview.sh/pareview/httpgitdrupalorgsandboxAmazingDreams2089117git

We are currently quite busy with all the project applications and we prefer projects with a review bonus. Please help reviewing and put yourself on the high priority list, then we will take a look at your project right away :-)

Also, you should get your friends, colleagues or other community members involved to review this application. Let them go through the review checklist and post a comment that sets this issue to "needs work" (they found some problems with the project) or "reviewed & tested by the community" (they found no major flaws).

I'm a robot and this is an automated message from Project Applications Scraper.

AmazingDreams’s picture

Status: Needs work » Needs review

I checked those issues reported by pareview and fixed the major part of them, some I left in as I thought 'fixing them' would only make the code hard to read.

abghosh82’s picture

Hi AmazingDreams,

I checked your module code and ran the pareview.sh on your module. As you have mentioned there are a number of issues reported. I would like to suggest that you should probably fix these as much as possible.

I also did a manual review of your module and would like to suggest the following:

On file 'nosmap.module' for 'nospam_form_admin', as I pick from your code the form is meant for module configuration, so would be better if you use return system_settings_form($form)instead of just retrurn $form, this would save you from implementing the corresponding form submit hook, which drupal already provides for such forms.
Please have a look at the following URL:
https://drupal.org/node/206761

Also as per the convention use variable names in lower case. An implementation example would be as below:

$form['enqueue_chance'] = array(
  '#type'          => 'textfield',
  '#title'         => t('Enqueue chance (%)'),
  '#description'   => t('The chance a users IP has to be enqueued, use this to limit the amount of IP addresses enqueued'),
  '#default_value' => variable_get('enqueue_chance', 10),
);

You can add a default value if you like, the would guide the user trying to do the settings.

On file 'nosmap.module' typo on line 208.

On file 'nospam.module' line no. 274, the API URL is hard-coded, what if it changes?, please consider putting it to module configuration settings, and use variable for it.

On file 'nosmap.module' function 'nospam_set_ip_verified' line no. 344 there is no issue with the 'switch-case' used but for a boolen condition it is better to use 'if'.

On file 'nosmap.module' for function 'nospam_build_query_string' please consider using a combination of array_map and explode, the for loop can be avoided.

Hope this helps.

abghosh82’s picture

Status: Needs review » Needs work

With the above comments setting it to needs work.

AmazingDreams’s picture

Status: Needs work » Needs review

Hi abghosh82,

Thanks for the review, I fixed almost all issues generated by pareview though I don't know what to do with these:

23 | WARNING | Hook implementations should not duplicate @return
| | documentation

Should I just delete all the documentation stuff on hooks?

Had I known the convention for using variables is lowercase I would've done that immediately, I'm very glad I use vim so getting them all to lowercase proved very easy :)

I also went through all of your comments, I believe I fixed the typo on line 208 but after lines being added and removed I'm not sure if I found the typo (had it something to do with adress missing a 'd'?.

Thanks again

abghosh82’s picture

No you do not need to delete the doc block you can just use 'Implements '. Please go through the following link.
https://drupal.org/node/1354

Perignon’s picture

A quick question. How does this module differ from https://drupal.org/project/spambot that also implements the same web service you have used for this module?

The spambot module (I am actually using) provides a lot of the same functions of frequency checks, cron job with configuration of the number of people to check per cron hit, etc.. If you haven't duplicated work it might be best to try and contribute to the spambot module so there is only one module for stopforumspam.com's service.

t14’s picture

Status: Needs review » Needs work

Hi

You possibly do not need to use variable_set in your implementation of hook_install. You are already calling system_settings_form($form) on line 88 of the .module file. This will create all the system variables for you and you can set the defaults within the the form.

Also you will need to implement a hook_unistall() in your .install file to remove these variables. you can call variable_del to get this done https://api.drupal.org/api/drupal/includes%21bootstrap.inc/function/vari....

Thanks
T

AmazingDreams’s picture

Status: Needs work » Postponed

I have not noticed that module at all! Thanks. I'll consider contributing to their module.

And @t14, I do that to make sure I don't get NULL values as my module starts working rightaway. Otherwise I'd have to litter my code with default values through e.g. global variables which would be the same thing. Or I'd have to create an extra 'enable' in the system_settings_form which would be kind of like reinventing the wheel as the user has already enabled the module.
Unless the values modified in system_settings_form also get set during enabling of a module, which I am not aware of.

My module still needs some work but I have not yet found the time as I am also busy with other stuff. I have marked the issue as postponed as I do not feel my code is ready for the world yet. I am running it in a live environment though and the code that exists works fine :)

AmazingDreams’s picture

Issue summary: View changes

Did not properly close

    tag
PA robot’s picture

Issue summary: View changes
Status: Postponed » Closed (won't fix)

Closing due to lack of activity. Feel free to reopen if you are still working on this application (see also the project application workflow).

I'm a robot and this is an automated message from Project Applications Scraper.