You are here

function securepages_init in Secure Pages 6

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

Implementation of hook_init().

File

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

Code

function securepages_init() {
  if (!variable_get('securepages_enable', 0) || basename($_SERVER['PHP_SELF']) != 'index.php' || php_sapi_name() == 'cli') {
    return;
  }

  /**
   * If we have redirected in the hook_boot(). Then don't try to redirect
   * again. This will prevent a loop
   */
  if (!isset($_SESSION['securepages_redirect'])) {
    securepages_redirect();
  }
  else {
    unset($_SESSION['securepages_redirect']);
  }
}