You are here

function it_cookie_compliance_boot in IT Cookie Compliance 7

@file IT Cookie Compliance module main file.

This module allows to make a website Cookies Compliant with respect to Italian Law Specifications by preemptively blocking cookies.

File

./it_cookie_compliance.module, line 10
IT Cookie Compliance module main file.

Code

function it_cookie_compliance_boot() {

  // Exit if the current script is running in a command-line environment.
  if (drupal_is_cli()) {
    return;
  }
  require_once "includes/path.inc";
  require_once "includes/common.inc";
  $url = request_path();
  $params = drupal_get_query_parameters();
  $acceptance_param = isset($_GET['cookie-blocked']);
  $not_accepted = it_cookie_compliance_are_cookie_not_accepted();
  if ($not_accepted && !$acceptance_param) {
    $params['cookie-blocked'] = 1;
    drupal_goto($url, array(
      'query' => $params,
    ));
  }
  elseif (!$not_accepted && $acceptance_param) {
    unset($params['cookie-blocked']);
    drupal_goto($url, array(
      'query' => $params,
    ));
  }
}