Commit d3302c6c authored by Eric Rasmussen's avatar Eric Rasmussen
Browse files

[gh-582] Remove mobile redirect stuff from unl bootstrap

parent 6b896f70
<?php
/**
* Do so special setup for UNL specific features.
* Special setup for UNL specific features.
*/
function unl_bootstrap() {
unl_bootstrap_short_hostname_redirect();
unl_bootstrap_multisite_without_symlinks();
unl_bootstrap_proxy_pass_support();
unl_bootstrap_mobile_internal_redirect();
}
/**
......@@ -96,58 +95,6 @@ function unl_bootstrap_proxy_pass_support() {
}
}
/**
* If this site should be served with a mobile theme, do an internal redirect
* so that the page cache can store this mobile themed page separate from
* the normally themed page.
*/
function unl_bootstrap_mobile_internal_redirect() {
if (unl_bootstrap_is_mobile_user() && !isset($_GET['format'])) {
$_GET['format'] = 'mobile';
$_SERVER['QUERY_STRING'] = http_build_query($_GET);
$_SERVER['REQUEST_URI'] = $_SERVER['SCRIPT_URL'] . '?' . $_SERVER['QUERY_STRING'];
}
}
/**
* Check if the user is using a "supported" mobile user agent
*
* @return bool
*/
function unl_bootstrap_is_mobile_user() {
if (isset($_SERVER['X-UNL-Mobile'])) {
// If Varnish set the X-UNL-Mobile header, use it instead of checking again.
return $_SERVER['X-UNL-Mobile'] == 'Yes';
}
if (!isset($_SERVER['HTTP_ACCEPT'], $_SERVER['HTTP_USER_AGENT'])) {
// We have no vars to check
return false;
}
if (isset($_COOKIE['wdn_mobile'])
&& $_COOKIE['wdn_mobile'] == 'no') {
// The user has a cookie set, requesting no mobile views
return false;
}
if ( // Check the http_accept and user agent and see
preg_match('/text\/vnd\.wap\.wml|application\/vnd\.wap\.xhtml\+xml/i', $_SERVER['HTTP_ACCEPT'])
||
(preg_match('/'.
'sony|symbian|nokia|samsung|mobile|windows ce|epoc|opera mini|' .
'nitro|j2me|midp-|cldc-|netfront|mot|up\.browser|up\.link|audiovox|' .
'blackberry|ericsson,|panasonic|philips|sanyo|sharp|sie-|' .
'portalmmm|blazer|avantgo|danger|palm|series60|palmsource|pocketpc|' .
'smartphone|rover|ipaq|au-mic|alcatel|ericy|vodafone\/|wap1\.|wap2\.|iPhone|Android' .
'/i', $_SERVER['HTTP_USER_AGENT'])
) && !preg_match('/ipad/i', $_SERVER['HTTP_USER_AGENT'])) {
return true;
}
return false;
}
/**
* This will be called during update.php's bootstrap to remove any
* shared table prefixes from the database config.
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment