function mobile_tools_goto in Mobile Tools 6
Same name and namespace in other branches
- 5 mobile_tools.module \mobile_tools_goto()
- 6.3 mobile_tools.module \mobile_tools_goto()
- 6.2 mobile_tools.module \mobile_tools_goto()
copy of drupal_goto, since this is called in hook_boot, while the function is not yet available
1 call to mobile_tools_goto()
- mobile_tools_device_redirect in ./
mobile_tools.module - Being called in the hook_boot() implementation This function is in charge of redirection or displaying a notification
File
- ./
mobile_tools.module, line 633 - Mobile Tools provides a range of functionality assisting in creating a mobile Drupal site . this functionality contains:
Code
function mobile_tools_goto($path = '', $query = NULL, $fragment = NULL, $http_response_code = 302) {
$url = $path;
// Make the given path or URL absolute
if (!preg_match('/^[a-z]+:\\/\\//', $url)) {
global $base_url;
$url = $base_url . '/' . $url;
}
$url .= empty($query) ? '' : '?' . $query;
$url .= empty($fragment) ? '' : '#' . $fragment;
// Remove newlines from the URL to avoid header injection attacks.
$url = str_replace(array(
"\n",
"\r",
), '', $url);
// Before the redirect, allow modules to react to the end of the page request.
bootstrap_invoke_all('exit');
// Even though session_write_close() is registered as a shutdown function, we
// need all session data written to the database before redirecting.
session_write_close();
header('Location: ' . $url, TRUE, $http_response_code);
// The "Location" header sends a REDIRECT status code to the http
// daemon. In some cases this can go wrong, so we make sure none
// of the code below the drupal_goto() call gets executed when we redirect.
exit;
}