Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Eric Rasmussen
UNL-CMS
Commits
d3302c6c
Commit
d3302c6c
authored
Jan 25, 2013
by
Eric Rasmussen
Browse files
[gh-582] Remove mobile redirect stuff from unl bootstrap
parent
6b896f70
Changes
1
Hide whitespace changes
Inline
Side-by-side
includes/unl_bootstrap.inc
View file @
d3302c6c
<?php
/**
*
Do so s
pecial setup for UNL specific features.
*
S
pecial 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.
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment