function themekey_redirect_callback in ThemeKey 7.3
1 string reference to 'themekey_redirect_callback'
- themekey_redirect_menu in themekey_redirect/
themekey_redirect.module - Implements hook_menu().
File
- themekey_redirect/
themekey_redirect.module, line 207 - Define rules to redirect the user to a different domain. The common use-case is to setup sub-domains for mobile sites. In this case you can configure ThemeKey Redirect to detect mobile clients and redirect the user accordingly. In ThemeKey itself you…
Code
function themekey_redirect_callback() {
// Don't cache this JSON response.
drupal_page_is_cacheable(FALSE);
// Clean-up the URI path for rule matching and response by overriding
// $_GET['q'] and $_SERVER['REQUEST_URI'].
$_GET['q'] = implode('/', func_get_args());
// If the path is empty, we're at the front page.
if (empty($_GET['q'])) {
$_GET['q'] = variable_get('site_frontpage', 'node');
}
// Coder module complains "the use of REQUEST_URI is prone to XSS exploits and
// does not work on IIS; use request_uri() instead [security_12]". But we have
// to override (or set) the REQUEST_URI here which is not an security issue.
// The rule in coder module is about reading $_SERVER['REQUEST_URI'] and not
// about setting it.
// @ignore security_12
$_SERVER['REQUEST_URI'] = str_replace('themekey/redirect_callback/', '', request_uri());
return themekey_redirect_match_rules();
}