You are here

function securepages_redirect in Secure Pages 6

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

Check the current page and see if we need to redirect to the secure or insecure version of the page.

2 calls to securepages_redirect()
securepages_boot in ./securepages.module
Implementation of hook_boot().
securepages_init in ./securepages.module
Implementation of hook_init().

File

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

Code

function securepages_redirect() {
  global $base_url;
  $path = isset($_GET['q']) ? $_GET['q'] : '';
  $page_match = securepages_match($path);
  if ($_POST) {

    // If something has been posted to here then ignore the rules.
  }
  elseif ($page_match && !securepages_is_secure()) {
    securepages_goto(TRUE);
  }
  elseif ($page_match === 0 && securepages_is_secure() && variable_get('securepages_switch', FALSE)) {
    securepages_goto(FALSE);
  }

  // Correct the base_url so that everything comes from https.
  if (securepages_is_secure()) {
    $base_url = securepages_baseurl();
  }
}