CVS edit link for As If

I want to contribute and maintain a module called "GoAway", which I have already written, tested and deployed on two production sites.

GoAway is a dirt-simple, light-weight "Ban By IP" module for Drupal 6. It works by redirecting offending anonymous users to a page or URL specified by the admin. The module possesses the following features:

- Separate permissions for (1) settings, (2) banning, and (3) unbanning
- Either a local page or a remote URL may be used as the redirect destination
- Adds display of IP address to anonymous comments for easy tracking & copying (only to users with 'ban' permission)

GoAway fills a void in Drupal 6, especially for high-traffic sites which can't (or don't want to) bear the combined load of the Statistics and Tracker modules. The entire purpose was to make IP banning as easy as editing a comment. As simple as the module is, I think it might become fairly popular, since I have already had several clients request this functionality.

I'm ready any time you are ;-)

LVX
TF

Tod Foley
As If Productions
http://www.asifproductions.com

Email: tod@asifproductions.com
Drupal.org: http://drupal.org/user/52428
Portfolio: http://www.asifproductions.com/drupal

CommentFileSizeAuthor
#7 goaway_090912-2.zip16.75 KBAs If
#6 goaway.tar_.gz6.96 KBAs If
#4 goaway_090912.zip2.54 KBAs If
#1 goaway.zip2.64 KBAs If

Comments

As If’s picture

Status: Postponed (maintainer needs more info) » Needs review
StatusFileSize
new2.64 KB
avpaderno’s picture

Issue tags: +Module review

I am adding the review tag.

avpaderno’s picture

Status: Needs review » Needs work
  1.   version = "6.x-1.0"
    

    That line should be removed.

  2. See the Drupal coding standards to understand how a module code should be written.
  3.   if(!$may_cache) {
        $items = array();
    

    $may_cache is not defined.

  4.     '#prefix' => 'Enter a destination for miscreants. If using a remote address, the full URL (including http://) must be used.  For a local destination, simply use the path beginning with a slash.',
    

    The string is not translatable.

  5.   if ($ban_success) {
        $msg = 'Banned IP: %ip';
        $vars = array('%ip' => $banned_ip);
        watchdog('goaway', $msg, $vars, WATCHDOG_INFO);
        drupal_set_message(t('Banned IP: ' . $banned_ip));
      }
      else {
        $msg = 'Failed to ban IP: ' . $ip;
    

    The code should use a placeholder, as the previous call to watchdog() did.

  6.   $schema['goaway'] = array(
        'fields' => array(
          'gid' => array(
            'description' => t('Identifier for a ban.'),
    

    The schema descriptions should not be passed to t() anymore.

As If’s picture

Status: Needs work » Needs review
StatusFileSize
new2.54 KB

Thank you. All suggested changes have been made. Also rewrote the install file. Here's the new version...

avpaderno’s picture

Status: Needs review » Fixed
  1. /**
     * Implements hook_access()
     */
    function goaway_init() {
    
  2. function goaway_banlist_form_validate($form, &$form_state) {
      // TODO: REGEXP FOR IP ADDRESS FORMAT
      $goaway_banlist = $form_state['values']['goaway_banlist'];
      if (isset($goaway_banlist)) {
        if (!is_string($goaway_banlist) || $goaway_banlist == '') {
          form_set_error('goaway_banlist', t('Error while handling data submitted'));
        }
      }
    }
    

    The error message should be something clearer; saying that an error has occurred doesn't help much.

As If’s picture

StatusFileSize
new6.96 KB

1. - I believe the word is DOH!
2. - Good point. Also added a preg_match conditional for IP format.

Here's the result. Heading to CVSland now...

As If’s picture

StatusFileSize
new16.75 KB

Hmm. That underscore (tar_) isn't there on my local copy, but it wrecks the tarball. Ok here is a zip version...

avpaderno’s picture

To complete the information I have given, I will report that base_path() is used when the path is used to build a URL returned to the browser.

The underscore is added by Drupal, as the double extension could be used to hide the true type of the file (especially in Windows where the extension is normally hidden, and the user would see a .jpg, when the extension is really .jpg.exe.

Status: Fixed » Closed (fixed)
Issue tags: -Module review

Automatically closed -- issue fixed for 2 weeks with no activity.

avpaderno’s picture

Component: Miscellaneous » new project application
Assigned: Unassigned » avpaderno
Issue summary: View changes
Status: Closed (fixed) » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.