<?php

/**
 * @file
 * Install file for securepages_prevent_hijack.
 */

/**
 * Implementation of hook_enable().
 * Refresh the secure cookie whenever the module is enabled.
 */
function securepages_prevent_hijack_enable() {
  _securepages_prevent_hijack_cookie();
}


/**
 * Implementation of hook_requirements().
 */
function securepages_prevent_hijack_requirements($phase) {
  $requirements = array();

  if ($phase == 'runtime') {
    if (ini_get('session.cookie_secure')) {
      $requirements['securepages_prevent_hijack']['severity'] = REQUIREMENT_WARNING;
      $requirements['securepages_prevent_hijack']['title'] = t('Cookie settings');
      $requirements['securepages_prevent_hijack']['value'] = t('Conflict detected');
      $requirements['securepages_prevent_hijack']['description'] = t(
        'Securepages settings conflict with your PHP configuration. '.
        'When using the Securepages Hijack Prevention module, '.
        'you should disable <a href="@php_manual">session.cookie_secure</a> in your PHP settings. '.
        'This will allow users to stay logged in even as they browse non-secure pages.',
        array('@php_manual' => 'http://php.net/session.configuration'));
    }
  }

  return $requirements;
}
