You are here

function securepages_init in Secure Pages 6.2

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

Implements hook_init().

File

./securepages.module, line 29
Provide method of creating allowing certain pages to only viewable from https pages

Code

function securepages_init() {
  $is_https = securepages_is_secure();

  // Special path for verifying SSL status.
  if ($_GET['q'] == 'admin/build/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();
  }
}