Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAleksey Lim <alsroot@member.fsf.org>2009-08-01 05:47:51 (GMT)
committer Aleksey Lim <alsroot@member.fsf.org>2009-08-01 05:47:51 (GMT)
commit278355dc6dedd997577c515eac5bfa80adb8f9b8 (patch)
tree61f4acbc6b172e56bd4dd38a91c170ebe358aa6d
parent70644395c7b42801eb4b2d1436a8b195b4334abc (diff)
Process hulahop version to make SP identification precise on XO
-rw-r--r--site/app/models/file.php12
-rw-r--r--site/app/models/version.php12
-rw-r--r--site/app/webroot/js/amo2009/addons.js10
3 files changed, 20 insertions, 14 deletions
diff --git a/site/app/models/file.php b/site/app/models/file.php
index 4a49f97..64b4e74 100644
--- a/site/app/models/file.php
+++ b/site/app/models/file.php
@@ -85,11 +85,13 @@ class File extends AppModel
// Platform WHERE if necessary
$platform = !empty($platform_id) ? " AND (File.platform_id = ".PLATFORM_ALL." OR File.platform_id = {$platform_id})" : '';
- if (preg_match('/OLPC\//', $_SERVER['HTTP_USER_AGENT']))
- $sp = 0.82;
- else {
- preg_match('/Sugar Labs\/([^\s]*)/', $_SERVER['HTTP_USER_AGENT'], $matches);
- if (isset($matches[1]))
+ if (preg_match('/OLPC\/0\.([^-]*)-/', $_SERVER['HTTP_USER_AGENT'], $matches)) {
+ if (floatval($matches[1]) <= 4.6)
+ $sp = 0.82;
+ else
+ $sp = 0.84;
+ } else {
+ if (preg_match('/Sugar Labs\/([^\s]*)/', $_SERVER['HTTP_USER_AGENT'], $matches))
$sp = floatval($matches[1]);
else
$sp = 0.84;
diff --git a/site/app/models/version.php b/site/app/models/version.php
index 17f9c44..f836e38 100644
--- a/site/app/models/version.php
+++ b/site/app/models/version.php
@@ -137,11 +137,13 @@ class Version extends AppModel
if (!is_array($status)) $status = array($status);
$status_sql = implode(',',$status);
- if (preg_match('/OLPC\//', $_SERVER['HTTP_USER_AGENT']))
- $sp = 0.82;
- else {
- preg_match('/Sugar Labs\/([^\s]*)/', $_SERVER['HTTP_USER_AGENT'], $matches);
- if (isset($matches[1]))
+ if (preg_match('/OLPC\/0\.([^-]*)-/', $_SERVER['HTTP_USER_AGENT'], $matches)) {
+ if (floatval($matches[1]) <= 4.6)
+ $sp = 0.82;
+ else
+ $sp = 0.84;
+ } else {
+ if (preg_match('/Sugar Labs\/([^\s]*)/', $_SERVER['HTTP_USER_AGENT'], $matches))
$sp = floatval($matches[1]);
else
$sp = 0.84;
diff --git a/site/app/webroot/js/amo2009/addons.js b/site/app/webroot/js/amo2009/addons.js
index 4d71ad0..19a8ded 100644
--- a/site/app/webroot/js/amo2009/addons.js
+++ b/site/app/webroot/js/amo2009/addons.js
@@ -213,14 +213,16 @@ function initDownloadPopup(triggerID, popupID)
* @param bool showVersionLink offer a link to the user which will remove the compatibility hint (and allow them to download the add-on)
*/
function addCompatibilityHints(addonID, versionID, fromVer, toVer, showVersionLink) {
- var uapattern_olpc = /OLPC\//;
+ var uapattern_olpc = /OLPC\/0\.([^-]*)-/;
var uamatch_olpc = uapattern_olpc.exec(navigator.userAgent);
if (uamatch_olpc) {
- var version = "0.82";
+ if (vc.compareVersions(uamatch[1], "4.6") <= 0)
+ var version = "0.82";
+ else
+ var version = "0.84";
} else {
var uapattern = /Sugar Labs\/([^\s]*).*$/;
- var ua = navigator.userAgent;
- var uamatch = uapattern.exec(ua);
+ var uamatch = uapattern.exec(navigator.userAgent);
if (!uamatch || uamatch.length < 2) {
var version = "0.84";
} else {