summaryrefslogtreecommitdiffstats
path: root/lib/private/request.php
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2014-01-09 13:54:58 +0100
committerRobin Appelman <icewind@owncloud.com>2014-01-09 13:54:58 +0100
commit5d456c7cc21f7640435c4638932984a52b4cdbac (patch)
tree0227a865782fab4895f602a7c118d92e21998cbb /lib/private/request.php
parentd50c7391d8e78c9555b073fb9ccc6a91d5da34bc (diff)
parentd8b8abb429d3d66598a16d25cf55f7dc19e3f996 (diff)
downloadnextcloud-server-5d456c7cc21f7640435c4638932984a52b4cdbac.tar.gz
nextcloud-server-5d456c7cc21f7640435c4638932984a52b4cdbac.zip
Merge branch 'master' into memcache-public
Diffstat (limited to 'lib/private/request.php')
-rwxr-xr-xlib/private/request.php23
1 files changed, 23 insertions, 0 deletions
diff --git a/lib/private/request.php b/lib/private/request.php
index b2afda35922..d9d5ae08e28 100755
--- a/lib/private/request.php
+++ b/lib/private/request.php
@@ -7,6 +7,11 @@
*/
class OC_Request {
+
+ const USER_AGENT_IE = '/MSIE/';
+ // Android Chrome user agent: https://developers.google.com/chrome/mobile/docs/user-agent
+ const USER_AGENT_ANDROID_MOBILE_CHROME = '#Android.*Chrome/[.0-9]*#';
+
/**
* @brief Check overwrite condition
* @param string $type
@@ -210,4 +215,22 @@ class OC_Request {
return false;
}
}
+
+ /**
+ * Checks whether the user agent matches a given regex
+ * @param string|array $agent agent name or array of agent names
+ * @return boolean true if at least one of the given agent matches,
+ * false otherwise
+ */
+ static public function isUserAgent($agent) {
+ if (!is_array($agent)) {
+ $agent = array($agent);
+ }
+ foreach ($agent as $regex) {
+ if (preg_match($regex, $_SERVER['HTTP_USER_AGENT'])) {
+ return true;
+ }
+ }
+ return false;
+ }
}