You are here

function seckit_init in Security Kit 6

Same name and namespace in other branches
  1. 7 seckit.module \seckit_init()

Implements hook_init().

File

./seckit.module, line 61
Allows administrators to improve security of the website.

Code

function seckit_init() {

  // get default/set options
  $options = _seckit_get_options();

  // execute necessary functions
  if ($options['seckit_csrf']['origin']) {
    _seckit_origin();
  }
  if ($options['seckit_xss']['csp']['checkbox']) {
    _seckit_csp();
  }
  if ($options['seckit_xss']['x_xss']['select']) {
    _seckit_x_xss($options['seckit_xss']['x_xss']['select']);
  }
  if ($options['seckit_xss']['x_content_type']['checkbox']) {
    _seckit_x_content_type_options();
  }
  if ($options['seckit_clickjacking']['x_frame']) {
    _seckit_x_frame($options['seckit_clickjacking']['x_frame']);
  }
  if ($options['seckit_clickjacking']['js_css_noscript']) {
    _seckit_js_css_noscript();
  }
  if ($options['seckit_ssl']['hsts']) {
    _seckit_hsts();
  }
  if ($options['seckit_various']['from_origin']) {
    _seckit_from_origin();
  }

  // load jQuery listener
  if ($_GET['q'] == 'admin/settings/seckit') {
    $path = drupal_get_path('module', 'seckit');
    $listener = "{$path}/js/seckit.listener.js";
    drupal_add_js($listener, 'module');
  }
}