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-07-31 18:26:02 (GMT)
committer Aleksey Lim <alsroot@member.fsf.org>2009-07-31 18:26:02 (GMT)
commit70644395c7b42801eb4b2d1436a8b195b4334abc (patch)
tree9c86bc770351d92b6374e99adbab98bc7d511a92
parenteefda2b0de8e048a1e44280d38b8e7656b6fa3a3 (diff)
Identify 0.82-0.84 SP version
-rw-r--r--site/app/models/file.php14
-rw-r--r--site/app/models/version.php14
-rw-r--r--site/app/webroot/js/amo2009/addons.js19
3 files changed, 32 insertions, 15 deletions
diff --git a/site/app/models/file.php b/site/app/models/file.php
index 859bb69..4a49f97 100644
--- a/site/app/models/file.php
+++ b/site/app/models/file.php
@@ -85,11 +85,15 @@ class File extends AppModel
// Platform WHERE if necessary
$platform = !empty($platform_id) ? " AND (File.platform_id = ".PLATFORM_ALL." OR File.platform_id = {$platform_id})" : '';
- preg_match('/Sugar Labs\/([^\s]*)/', $_SERVER['HTTP_USER_AGENT'], $matches);
- if (isset($matches[1]))
- $sp = floatval($matches[1]);
- else
- $sp = 0;
+ 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]))
+ $sp = floatval($matches[1]);
+ else
+ $sp = 0.84;
+ }
$sql = "
SELECT
diff --git a/site/app/models/version.php b/site/app/models/version.php
index c7aaf97..17f9c44 100644
--- a/site/app/models/version.php
+++ b/site/app/models/version.php
@@ -137,11 +137,15 @@ class Version extends AppModel
if (!is_array($status)) $status = array($status);
$status_sql = implode(',',$status);
- preg_match('/Sugar Labs\/([^\s]*)/', $_SERVER['HTTP_USER_AGENT'], $matches);
- if (isset($matches[1]))
- $sp = floatval($matches[1]);
- else
- $sp = 0;
+ 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]))
+ $sp = floatval($matches[1]);
+ else
+ $sp = 0.84;
+ }
$sql = "
SELECT
diff --git a/site/app/webroot/js/amo2009/addons.js b/site/app/webroot/js/amo2009/addons.js
index ca2050c..4d71ad0 100644
--- a/site/app/webroot/js/amo2009/addons.js
+++ b/site/app/webroot/js/amo2009/addons.js
@@ -213,14 +213,23 @@ 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 = /Sugar Labs\/([^\s]*).*$/;
- var ua = navigator.userAgent;
- var uamatch = uapattern.exec(ua);
- if (!uamatch || uamatch.length < 2) return true;
+ var uapattern_olpc = /OLPC\//;
+ var uamatch_olpc = uapattern_olpc.exec(navigator.userAgent);
+ if (uamatch_olpc) {
+ var version = "0.82";
+ } else {
+ var uapattern = /Sugar Labs\/([^\s]*).*$/;
+ var ua = navigator.userAgent;
+ var uamatch = uapattern.exec(ua);
+ if (!uamatch || uamatch.length < 2) {
+ var version = "0.84";
+ } else {
+ var version = uamatch[1];
+ }
+ }
var outer = $("#install-"+ versionID);
- var version = uamatch[1];
var vc = new VersionCompare();
if (vc.compareVersions(version, fromVer)<0)
var needUpgrade = true;