You are here

function securepages_is_secure in Secure Pages 6

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

Check if the current page is SSL

7 calls to securepages_is_secure()
SecurePagesTestCase::_testMatch in ./securepages.test
Tests the securepages_match() function.
securepages_boot in ./securepages.module
Implementation of hook_boot().
securepages_form_alter in ./securepages.module
Implementation of hook_form_alter().
securepages_link_alter in ./securepages.module
Implementation of hook_link_alter().
securepages_match in ./securepages.module
securepages_match()

... See full list

File

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

Code

function securepages_is_secure() {
  foreach (variable_get('securepages_ssl_checks', array(
    'HTTPS' => array(
      'on',
      '1',
    ),
    'HTTP_X_FORWARDED_PROTO' => 'https',
  )) as $key => $value) {
    if (isset($_SERVER[$key]) && is_array($value) && in_array($_SERVER[$key], $value)) {
      return TRUE;
    }
    elseif (isset($_SERVER[$key]) && $_SERVER[$key] == $value) {
      return TRUE;
    }
  }
  return FALSE;
}