summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2014-02-03 13:27:36 +0100
committerAleksander Machniak <alec@alec.pl>2014-02-03 13:29:25 +0100
commitbd3f5745f06e3d153431776fe279d8534823403a (patch)
tree537cf46624fe54fbd020cd39d75a8b031657ad68
parent59373ce9cddecf13c894387154b3077530e3afa9 (diff)
Fixed Opera > 15 detection (#1489562)
Conflicts: tests/Framework/Browser.php
-rw-r--r--CHANGELOG2
-rw-r--r--program/js/common.js13
-rw-r--r--program/lib/Roundcube/rcube_browser.php16
3 files changed, 21 insertions, 10 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 0f3457225..cc19da6f0 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,8 @@
CHANGELOG Roundcube Webmail
===========================
+- Fixed Opera > 15 detection (#1489562)
+
RELEASE 1.0-rc
--------------
- Small CSS fix with message notice boxes in Larry skin (#1489497)
diff --git a/program/js/common.js b/program/js/common.js
index d320d86ec..722eb3f60 100644
--- a/program/js/common.js
+++ b/program/js/common.js
@@ -49,6 +49,7 @@ function roundcube_browser()
this.dom = document.getElementById ? true : false;
this.dom2 = document.addEventListener && document.removeEventListener;
+ this.webkit = this.agent_lc.indexOf('applewebkit') > 0;
this.ie = (document.all && !window.opera) || (this.win && this.agent_lc.indexOf('trident/') > 0);
if (this.ie) {
@@ -57,20 +58,22 @@ function roundcube_browser()
this.ie8 = this.appver.indexOf('MSIE 8') > 0;
this.ie9 = this.appver.indexOf('MSIE 9') > 0;
}
+ else if (window.opera) {
+ this.opera = true;
+ this.vendver = opera.version();
+ }
else {
this.chrome = this.agent_lc.indexOf('chrome') > 0;
- this.safari = !this.chrome && (this.agent_lc.indexOf('safari') > 0 || this.agent_lc.indexOf('applewebkit') > 0);
+ this.safari = !this.chrome && (this.webkit || this.agent_lc.indexOf('safari') > 0);
this.konq = this.agent_lc.indexOf('konqueror') > 0;
this.mz = this.dom && !this.chrome && !this.safari && !this.konq && this.agent.indexOf('Mozilla') >= 0;
this.iphone = this.safari && (this.agent_lc.indexOf('iphone') > 0 || this.agent_lc.indexOf('ipod') > 0);
this.ipad = this.safari && this.agent_lc.indexOf('ipad') > 0;
- this.opera = window.opera ? true : false;
- this.webkit = this.safari || this.chrome;
}
if (!this.vendver) {
// common version strings
- this.vendver = /(khtml|chrome|safari|applewebkit|opera|msie)(\s|\/)([0-9\.]+)/.test(this.agent_lc) ? parseFloat(RegExp.$3) : 0;
+ this.vendver = /(opera|opr|khtml|chrome|safari|applewebkit|msie)(\s|\/)([0-9\.]+)/.test(this.agent_lc) ? parseFloat(RegExp.$3) : 0;
// any other (Mozilla, Camino, IE>=11)
if (!this.vendver)
@@ -117,7 +120,7 @@ function roundcube_browser()
classname += ' iphone';
else if (this.ipad)
classname += ' ipad';
- else if (this.safari || this.chrome)
+ else if (this.webkit)
classname += ' webkit';
if (this.mobile)
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)) {