function securepages_redirect in Secure Pages 6.2
Same name and namespace in other branches
- 6 securepages.module \securepages_redirect()
- 7 securepages.module \securepages_redirect()
Checks the current page and see if we need to redirect to the secure or insecure version of the page.
1 call to securepages_redirect()
- securepages_init in ./
securepages.module - Implements hook_init().
File
- ./
securepages.module, line 112 - Provide method of creating allowing certain pages to only viewable from https pages
Code
function securepages_redirect() {
$is_https = securepages_is_secure();
global $base_url, $user;
$path = isset($_GET['q']) ? $_GET['q'] : '';
$page_match = securepages_match($path);
$role_match = securepages_roles($user);
if ($_POST) {
// If something has been posted to here then ignore the rules.
}
elseif ($role_match && !$is_https) {
securepages_goto(TRUE);
}
elseif ($page_match && !$is_https) {
securepages_goto(TRUE);
}
elseif ($page_match === 0 && $is_https && variable_get('securepages_switch', FALSE) && !$role_match) {
securepages_goto(FALSE);
}
// Correct the base_url so that everything comes from HTTPS.
if ($is_https) {
$base_url = securepages_baseurl();
}
}