ban.module

Allows to ban individual IP addresses.

File

drupal/core/modules/ban/ban.module
View source
<?php

/**
 * @file
 * Allows to ban individual IP addresses.
 */

/**
 * Implements hook_help().
 */
function ban_help($path, $arg) {
  switch ($path) {
    case 'admin/help#ban':
      $output = '';
      $output .= '<h3>' . t('About') . '</h3>';
      $output .= '<p>' . t('The Ban module allows administrators to ban visits to their site from individual IP addresses.') . '</p>';
      $output .= '<h3>' . t('Uses') . '</h3>';
      $output .= '<dl>';
      $output .= '<dt>' . t('Banning IP addresses') . '</dt>';
      $output .= '<dd>' . t('Administrators can enter IP addresses to ban on the <a href="@bans">IP address bans</a> page.', array(
        '@bans' => url('admin/config/people/ban'),
      )) . '</dd>';
      $output .= '</dl>';
      return $output;
    case 'admin/config/people/ban':
      return '<p>' . t('IP addresses listed here are banned from your site. Banned addresses are completely forbidden from accessing the site and instead see a brief message explaining the situation.') . '</p>';
  }
}

/**
 * Implements hook_permission().
 */
function ban_permission() {
  return array(
    'ban IP addresses' => array(
      'title' => t('Ban IP addresses'),
    ),
  );
}

/**
 * Implements hook_menu().
 */
function ban_menu() {
  $items['admin/config/people/ban'] = array(
    'title' => 'IP address bans',
    'description' => 'Manage banned IP addresses.',
    'route_name' => 'ban_admin_page',
    'weight' => 10,
  );
  $items['admin/config/people/ban/delete/%'] = array(
    'title' => 'Delete IP address',
    'route_name' => 'ban_delete',
  );
  return $items;
}

Functions

Namesort descending Description
ban_help Implements hook_help().
ban_menu Implements hook_menu().
ban_permission Implements hook_permission().