You are here

function securepages_init in Secure Pages 7

Same name and namespace in other branches
  1. 5 securepages.module \securepages_init()
  2. 6.2 securepages.module \securepages_init()
  3. 6 securepages.module \securepages_init()

Implements hook_init().

File

./securepages.module, line 35
Allows certain pages to be viewable only via HTTPS.

Code

function securepages_init() {
  global $is_https;

  // Special path for verifying SSL status.
  if ($_GET['q'] == 'admin/config/system/securepages/test') {
    if ($is_https) {
      header('HTTP/1.1 200 OK');
    }
    else {
      header('HTTP/1.1 404 Not Found');
    }
    exit;
  }
  if (variable_get('securepages_enable', 0) && basename($_SERVER['PHP_SELF']) == 'index.php' && php_sapi_name() != 'cli') {
    securepages_redirect();
  }
}