You are here

function restrict_ip_settings in Restrict IP 7

Same name and namespace in other branches
  1. 6 restrict_ip.module \restrict_ip_settings()
  2. 7.2 includes/restrict_ip.pages.inc \restrict_ip_settings()

Page callback function for admin/config/people/restrict_ip

1 string reference to 'restrict_ip_settings'
restrict_ip_menu in ./restrict_ip.module
Implementation of hook_menu()

File

./restrict_ip.module, line 46

Code

function restrict_ip_settings() {
  $form['restrict_ip_address_description'] = array(
    '#markup' => '<h2>' . t('Enter the list of allowed IP addresses below') . '</h2><p><strong style="color:red">' . t("Warning: If you don't enter your current IP address into the list, you will immediately be locked out of the system upon save, and will not be able to access the system until you are in a location with an allowed IP address.") . '</strong></p><p><strong>' . t('Your current IP address is: !ip_address', array(
      '!ip_address' => '<em>' . ip_address() . '</em>',
    )) . '</strong></p>',
  );
  $form['restrict_ip_address_list'] = array(
    '#title' => t('Allowed IP Address List'),
    '#description' => t('Enter the list of IP Addresses that are allowed to access the site. If this field is left empty, all IP addresses will be able to access the site. Enter one IP address per line. You may also enter a range of IP addresses in the format AAA.BBB.CCC.XXX - AAA.BBB.CCC.YYY'),
    '#type' => 'textarea',
    '#default_value' => variable_get('restrict_ip_address_list', ''),
  );
  $form['restrict_ip_mail_address'] = array(
    '#title' => t('Email Address'),
    '#type' => 'textfield',
    '#description' => t('If you would like to include a contact email address in the error message that is shown to users that do not have an allowed IP address, enter the email address here.'),
    '#default_value' => trim(variable_get('restrict_ip_mail_address', '')),
  );
  return system_settings_form($form);
}