Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'w42_MDL-35469_m21_geckover' of git://github.com/skodak/…

…moodle into MOODLE_21_STABLE
  • Loading branch information...
commit 7837711783b422c53093728970d994138a278317 2 parents c22a355 + 14859c7
@danpoltawski danpoltawski authored
Showing with 36 additions and 9 deletions.
  1. +36 −9 lib/moodlelib.php
View
45 lib/moodlelib.php
@@ -7611,18 +7611,45 @@ function check_browser_version($brand, $version = null) {
case 'Gecko': /// Gecko based browsers
- if (empty($version) and substr_count($agent, 'Camino')) {
- // MacOS X Camino support
- $version = 20041110;
+ // Do not look for dates any more, we expect real Firefox version here.
+ if (empty($version)) {
+ $version = 1;
+ } else if ($version > 20000000) {
+ // This is just a guess, it is not supposed to be 100% accurate!
+ if (preg_match('/^201/', $version)) {
+ $version = 3.6;
+ } else if (preg_match('/^200[7-9]/', $version)) {
+ $version = 3;
+ } else if (preg_match('/^2006/', $version)) {
+ $version = 2;
+ } else {
+ $version = 1.5;
+ }
}
-
- // the proper string - Gecko/CCYYMMDD Vendor/Version
- // Faster version and work-a-round No IDN problem.
- if (preg_match("/Gecko\/([0-9]+)/i", $agent, $match)) {
- if ($match[1] > $version) {
- return true;
+ if (preg_match("/(Iceweasel|Firefox)\/([0-9\.]+)/i", $agent, $match)) {
+ // Use real Firefox version if specified in user agent string.
+ if (version_compare($match[2], $version) >= 0) {
+ return true;
+ }
+ } else if (preg_match("/Gecko\/([0-9\.]+)/i", $agent, $match)) {
+ // Gecko might contain date or Firefox revision, let's just guess the Firefox version from the date.
+ $browserver = $match[1];
+ if ($browserver > 20000000) {
+ // This is just a guess, it is not supposed to be 100% accurate!
+ if (preg_match('/^201/', $browserver)) {
+ $browserver = 3.6;
+ } else if (preg_match('/^200[7-9]/', $browserver)) {
+ $browserver = 3;
+ } else if (preg_match('/^2006/', $version)) {
+ $browserver = 2;
+ } else {
+ $browserver = 1.5;
}
}
+ if (version_compare($browserver, $version) >= 0) {
+ return true;
+ }
+ }
break;
Please sign in to comment.
Something went wrong with that request. Please try again.