You are here

function securesite_admin_settings in Secure Site 5

Same name and namespace in other branches
  1. 6.2 securesite.admin.inc \securesite_admin_settings()
  2. 6 securesite.admin.inc \securesite_admin_settings()
  3. 7.2 securesite.admin.inc \securesite_admin_settings()

FAPI definition for Secure Site admin settings form

See also

system_settings_form()

1 string reference to 'securesite_admin_settings'
securesite_menu in ./securesite.module
Implementation of hook_menu()

File

./securesite.module, line 77
Secure Site contrib module

Code

function securesite_admin_settings() {
  global $base_url;

  // Authentication settings
  $form['authentication'] = array(
    '#type' => 'fieldset',
    '#title' => t('Authentication'),
    '#description' => t('Enable Secure Site below.  Users must have the <a href="!access">"access secured pages" permission</a> in order to access the site once the following setting is enabled.', array(
      '!access' => url('admin/user/access', NULL, 'module-securesite'),
    )),
  );
  $form['authentication']['securesite_enabled'] = array(
    '#type' => 'radios',
    '#title' => t('Forced authentication'),
    '#default_value' => variable_get('securesite_enabled', SECURESITE_DISABLED),
    '#options' => array(
      SECURESITE_DISABLED => t('Disabled'),
      SECURESITE_AUTH => t('Use HTTP Auth'),
      SECURESITE_FORM => t('Use HTML login form'),
    ),
    '#description' => t('HTTP Auth requires extra configuration if PHP is not installed as an Apache module.  See the Known Issues section of the README.txt included with Secure Site for details.'),
  );
  $form['authentication']['securesite_realm'] = array(
    '#type' => 'textfield',
    '#title' => t('Authentication realm'),
    '#default_value' => variable_get('securesite_realm', variable_get('site_name', 'Drupal')),
    '#length' => 30,
    '#maxlength' => 40,
    '#description' => t('Name to identify login area in HTTP Auth dialog'),
  );

  // Guest access
  $form['guest'] = array(
    '#type' => 'fieldset',
    '#title' => t('Guest access'),
    '#description' => t('Guest access allows unregistered (anonymous) users to view secure pages, though a username and password are still required.  You can set the username and password for all anonymous users below. If left blank, guest user access will be disabled.'),
  );
  $form['guest']['securesite_guest_name'] = array(
    '#type' => 'textfield',
    '#title' => t('Guest user'),
    '#default_value' => variable_get('securesite_guest_name', ''),
    '#length' => 30,
    '#maxlength' => 40,
    '#description' => t('Leave empty to disable guest access'),
  );
  $form['guest']['securesite_guest_pass'] = array(
    '#type' => 'textfield',
    '#title' => t('Guest password'),
    '#default_value' => variable_get('securesite_guest_pass', ''),
    '#length' => 30,
    '#maxlength' => 40,
    '#description' => t('Leave empty to disable guest access'),
  );

  // HTML login form settings
  $form['login_form'] = array(
    '#type' => 'fieldset',
    '#title' => t('Customize HTML forms'),
    '#description' => t('Configure the message displayed on the HTML login form (if enabled) and password reset form below.'),
  );
  $form['login_form']['securesite_login_form'] = array(
    '#type' => 'textarea',
    '#title' => t('Custom message for HTML login form'),
    '#default_value' => variable_get('securesite_login_form', t('<p>Enter your username and password:</p>')),
    '#length' => 60,
    '#height' => 3,
  );
  $form['login_form']['securesite_request_form'] = array(
    '#type' => 'textarea',
    '#title' => t('Custom message for password reset form'),
    '#default_value' => variable_get('securesite_request_form', t('<p>Enter your username or e-mail address:</p>')),
    '#length' => 60,
    '#height' => 3,
    '#description' => t('Leave empty to disable Secure Site\'s password reset form.'),
  );

  // Bypass login settings
  $form['filter_pages'] = array(
    '#type' => 'fieldset',
    '#title' => t('Bypass login'),
    '#description' => t('Some sites may wish to only use Secure Site for certain pages.  Use the settings below to configure which pages force authentication via Secure Site.  Select "On every page except the listed pages" and leave the "Pages" list empty to force authentication for all pages (this is the default configuration).  The cron page is always accessible.'),
  );
  $form['filter_pages']['securesite_filter_pages_type'] = array(
    '#type' => 'radios',
    '#title' => t('Force authentication'),
    '#default_value' => variable_get('securesite_filter_pages_type', SECURESITE_WHITELIST),
    '#options' => array(
      SECURESITE_WHITELIST => t('On every page except the listed pages.  Use this setting to restrict access of your entire site.'),
      SECURESITE_BLACKLIST => t('Only on the listed pages.  Use this setting only if you want to restrict access to certain pages, not your entire site.'),
    ),
  );
  $form['filter_pages']['securesite_filter_pages'] = array(
    '#type' => 'textarea',
    '#title' => t('Pages'),
    '#default_value' => variable_get('securesite_filter_pages', ''),
    '#length' => 60,
    '#height' => 3,
    '#description' => t("Enter one path per line.  Enter <em>&lt;front&gt;</em> for your site's front page.  \"*\" acts as a wildcard.  For example, enter <em>blog</em> for the blog page and <em>blog/*</em> for every personal blog."),
  );
  return system_settings_form($form);
}