You are here

function securepages_goto in Secure Pages 6

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

securepage_goto()

Redirects the current page to the secure or insecure version.

Parameters

$secure: Determine which version of the set to move to.

1 call to securepages_goto()
securepages_redirect in ./securepages.module
Check the current page and see if we need to redirect to the secure or insecure version of the page.

File

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

Code

function securepages_goto($secure) {
  global $base_root;
  $_SESSION['securepages_redirect'] = TRUE;
  $path = !empty($_REQUEST['q']) ? $_REQUEST['q'] : '';
  $query = count($_GET) > 1 ? securepages_get_query($_GET) : NULL;
  $url = securepages_url($path, array(
    'query' => $query,
    'secure' => $secure,
  ));
  if (function_exists('module_invoke_all')) {
    foreach (module_implements('exit') as $module) {
      if ($module != 'devel') {
        module_invoke($module, 'exit');
      }
    }
  }
  else {
    bootstrap_invoke_all('exit');
  }
  header('Location: ' . $url);

  // Make sure the cache is clear so that the next page will not pick up a cached version.
  cache_clear_all($base_root . request_uri(), 'cache_page');
  exit;
}