function securepages_can_alter_url in Secure Pages 5
Same name and namespace in other branches
- 6.2 securepages.module \securepages_can_alter_url()
- 6 securepages.module \securepages_can_alter_url()
- 7 securepages.module \securepages_can_alter_url()
Check the url and make sure that it is a url that you can alter this url.
2 calls to securepages_can_alter_url()
- securepages_form_alter in ./
securepages.module - Implementation of hook_form_alter()
- securepages_link_alter in ./
securepages.module - Implementation of hook_link_alter()
File
- ./
securepages.module, line 395
Code
function securepages_can_alter_url($url) {
global $base_path;
extract(parse_url($url));
// If there is no scheme then it is a relative url and can be altered
if (!isset($scheme) && $base_path == '/') {
return TRUE;
}
// If the host names are not the same then don't allow altering of the path.
if (strtolower($host) != strtolower($_SERVER['HTTP_HOST'])) {
return FALSE;
}
if (strlen($base_path) > 1 && substr($base_url, -1) != substr($path, 1, strlen($base_path))) {
return FALSE;
}
return TRUE;
}