diff options
author | Aleksander Machniak <alec@alec.pl> | 2014-02-03 13:27:36 +0100 |
---|---|---|
committer | Aleksander Machniak <alec@alec.pl> | 2014-02-03 13:27:36 +0100 |
commit | 03f1691d4797267513fb29019bdd96ca28a899a9 (patch) | |
tree | 3fa6a6f98ca1181cabecf73893bd892464ab5cda /program/lib/Roundcube | |
parent | b99aef05b564d3e6060fba50e406fb8453034d9f (diff) |
Fixed Opera > 15 detection (#1489562)
Diffstat (limited to 'program/lib/Roundcube')
-rw-r--r-- | program/lib/Roundcube/rcube_browser.php | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/program/lib/Roundcube/rcube_browser.php b/program/lib/Roundcube/rcube_browser.php index e53e31200..b9642d8f9 100644 --- a/program/lib/Roundcube/rcube_browser.php +++ b/program/lib/Roundcube/rcube_browser.php @@ -34,14 +34,20 @@ class rcube_browser $this->linux = strpos($HTTP_USER_AGENT, 'linux') != false; $this->unix = strpos($HTTP_USER_AGENT, 'unix') != false; - $this->opera = strpos($HTTP_USER_AGENT, 'opera') !== false; + $this->webkit = strpos($HTTP_USER_AGENT, 'applewebkit') !== false; + $this->opera = strpos($HTTP_USER_AGENT, 'opera') !== false || ($this->webkit && strpos($HTTP_USER_AGENT, 'opr/') !== false); $this->ns = strpos($HTTP_USER_AGENT, 'netscape') !== false; - $this->chrome = strpos($HTTP_USER_AGENT, 'chrome') !== false; + $this->chrome = !$this->opera && strpos($HTTP_USER_AGENT, 'chrome') !== false; $this->ie = !$this->opera && (strpos($HTTP_USER_AGENT, 'compatible; msie') !== false || strpos($HTTP_USER_AGENT, 'trident/') !== false); - $this->safari = !$this->chrome && (strpos($HTTP_USER_AGENT, 'safari') !== false || strpos($HTTP_USER_AGENT, 'applewebkit') !== false); - $this->mz = !$this->ie && !$this->safari && !$this->chrome && !$this->ns && strpos($HTTP_USER_AGENT, 'mozilla') !== false; + $this->safari = !$this->opera && !$this->chrome && ($this->webkit || strpos($HTTP_USER_AGENT, 'safari') !== false); + $this->mz = !$this->ie && !$this->safari && !$this->chrome && !$this->ns && !$this->opera && strpos($HTTP_USER_AGENT, 'mozilla') !== false; - if (preg_match('/(chrome|msie|opera|version|khtml)(\s*|\/)([0-9.]+)/', $HTTP_USER_AGENT, $regs)) { + if ($this->opera) { + if (preg_match('/(opera|opr)\/([0-9.]+)/', $HTTP_USER_AGENT, $regs)) { + $this->ver = (float) $regs[2]; + } + } + else if (preg_match('/(chrome|msie|version|khtml)(\s*|\/)([0-9.]+)/', $HTTP_USER_AGENT, $regs)) { $this->ver = (float) $regs[3]; } else if (preg_match('/rv:([0-9.]+)/', $HTTP_USER_AGENT, $regs)) { |