Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

MDL-34446 Fix bugs in previous commit

  • Loading branch information...
commit 007bf47f1070be56fdaa50daa1fefd6c0d219ca5 1 parent 1b2bd97
@sammarshallou sammarshallou authored danpoltawski committed
Showing with 11 additions and 4 deletions.
  1. +11 −4 lib/moodlelib.php
View
15 lib/moodlelib.php
@@ -8394,7 +8394,14 @@ function check_browser_version($brand, $version = null) {
if (empty($version)) {
return true; // no version specified
}
- if (preg_match("/Opera\/([0-9\.]+)/i", $agent, $match)) {
+ // Recent Opera useragents have Version/ with the actual version, e.g.:
+ // Opera/9.80 (Windows NT 6.1; WOW64; U; en) Presto/2.10.289 Version/12.01
+ // That's Opera 12.01, not 9.8.
+ if (preg_match("/Version\/([0-9\.]+)/i", $agent, $match)) {
+ if (version_compare($match[1], $version) >= 0) {
+ return true;
+ }
+ } else if (preg_match("/Opera\/([0-9\.]+)/i", $agent, $match)) {
if (version_compare($match[1], $version) >= 0) {
return true;
}
@@ -8409,7 +8416,7 @@ function check_browser_version($brand, $version = null) {
if (empty($version)) {
return true; // no version specified
}
- if (preg_match("/AppleWebKit\/([0-9]+)/i", $agent, $match)) {
+ if (preg_match("/AppleWebKit\/([0-9.]+)/i", $agent, $match)) {
if (version_compare($match[1], $version) >= 0) {
return true;
}
@@ -8445,7 +8452,7 @@ function check_browser_version($brand, $version = null) {
if (empty($version)) {
return true; // no version specified
}
- if (preg_match("/AppleWebKit\/([0-9]+)/i", $agent, $match)) {
+ if (preg_match("/AppleWebKit\/([0-9.]+)/i", $agent, $match)) {
if (version_compare($match[1], $version) >= 0) {
return true;
}
@@ -8695,7 +8702,7 @@ function get_browser_version_classes() {
function can_use_rotated_text() {
global $USER;
return (check_browser_version('MSIE', 9) || check_browser_version('Firefox', 2) ||
- check_browser_version('Chrome', 21) || check_browser_version('Safari', 536.26) ||
+ check_browser_version('Chrome', 21) || check_browser_version('Safari', 536.25) ||
check_browser_version('Opera', 12) || check_browser_version('Safari iOS', 533)) &&
!$USER->screenreader;
}
Please sign in to comment.
Something went wrong with that request. Please try again.