michael@0: 4) { michael@0: bail ('Bogus version.'); michael@0: } michael@0: michael@0: $vlen = count($v); michael@0: $ret = array(); michael@0: $hasplus = 0; michael@0: michael@0: for ($i = 0; $i < 4; $i++) { michael@0: if ($i > $vlen-1) { michael@0: // this version chunk was not specified; give 0 michael@0: $ret[] = 0; michael@0: } else { michael@0: $s = $v[$i]; michael@0: if ($i == 3) { michael@0: // need to check for + michael@0: $slen = strlen($s); michael@0: if ($s{$slen-1} == '+') { michael@0: $s = substr($s, 0, $slen-1); michael@0: $hasplus = 1; michael@0: } michael@0: } michael@0: michael@0: $ret[] = intval($s); michael@0: } michael@0: } michael@0: michael@0: $ret[] = $hasplus; michael@0: michael@0: return $ret; michael@0: } michael@0: michael@0: function vercmp ($a, $b) { michael@0: if ($a == $b) michael@0: return 0; michael@0: michael@0: $va = expandversion($a); michael@0: $vb = expandversion($b); michael@0: michael@0: for ($i = 0; $i < 5; $i++) michael@0: if ($va[$i] != $vb[$i]) michael@0: return ($vb[$i] - $va[$i]); michael@0: michael@0: return 0; michael@0: } michael@0: michael@0: michael@0: // michael@0: // These are passed in the GET string michael@0: // michael@0: michael@0: if (!array_key_exists('mimetype', $_GET)) michael@0: bail ("Invalid request."); michael@0: michael@0: $mimetype = $_GET['mimetype']; michael@0: michael@0: if (!array_key_exists('appID', $_GET) michael@0: || !array_key_exists('appVersion', $_GET) michael@0: || !array_key_exists('clientOS', $_GET)) michael@0: || !array_key_exists('chromeLocale', $_GET)) michael@0: ) michael@0: bail ("Invalid request."); michael@0: michael@0: $reqTargetAppGuid = $_GET['appID']; michael@0: $reqTargetAppVersion = $_GET['appVersion']; michael@0: $clientOS = $_GET['clientOS']; michael@0: $chromeLocale = $_GET['chromeLocale']; michael@0: michael@0: // check args michael@0: if (empty($reqTargetAppVersion) || empty($reqTargetAppGuid)) { michael@0: bail ("Invalid request."); michael@0: } michael@0: michael@0: // michael@0: // Now to spit out the RDF. We hand-generate because the data is pretty simple. michael@0: // michael@0: michael@0: if ($mimetype == "application/x-mtx") { michael@0: $name = "Viewpoint Media Player"; michael@0: $guid = "{03F998B2-0E00-11D3-A498-00104B6EB52E}"; michael@0: $version = "5.0"; michael@0: $iconUrl = ""; michael@0: $XPILocation = "http://www.nexgenmedia.net/flashlinux/invalid.xpi"; michael@0: $InstallerShowsUI = false; michael@0: $manualInstallationURL = "http://www.viewpoint.com/pub/products/vmp.html"; michael@0: $licenseURL = "http://www.viewpoint.com/pub/privacy.html"; michael@0: } else if ($mimetype == "application/x-shockwave-flash") { michael@0: $name = "Flash Player"; michael@0: $guid = "{D27CDB6E-AE6D-11cf-96B8-444553540000}"; michael@0: $version = "7.0.16"; michael@0: $iconUrl = "http://goat.austin.ibm.com:8080/flash.gif"; michael@0: $XPILocation = "http://www.nexgenmedia.net/flashlinux/flash-linux.xpi"; michael@0: $InstallerShowsUI = "false"; michael@0: $manualInstallationURL = "http://www.macromedia.com/go/getflashplayer"; michael@0: $licenseURL = "http://www.macromedia.com/shockwave/download/license/desktop/"; michael@0: } else { michael@0: $name = ""; michael@0: $guid = "-1"; michael@0: $version = ""; michael@0: $iconUrl = ""; michael@0: $XPILocation = ""; michael@0: $InstallerShowsUI = ""; michael@0: $manualInstallationURL = ""; michael@0: $licenseURL = ""; michael@0: } michael@0: michael@0: header("Content-type: application/xml"); michael@0: print "\n"; michael@0: print "\n\n"; michael@0: michael@0: print "\n"; michael@0: michael@0: // output list of matching plugins michael@0: print " \n"; michael@0: print " \n"; michael@0: print " \n"; michael@0: print "\n\n"; michael@0: michael@0: print "\n"; michael@0: print " \n"; michael@0: print " \n"; michael@0: print " \n"; michael@0: print "\n\n"; michael@0: michael@0: print "\n"; michael@0: print " {$name}\n"; michael@0: print " {$mimetype}\n"; michael@0: print " {$guid}\n"; michael@0: print " {$version}\n"; michael@0: print " {$iconUrl}\n"; michael@0: print " {$XPILocation}\n"; michael@0: print " {$InstallerShowsUI}\n"; michael@0: print " {$manualInstallationURL}\n"; michael@0: print " {$licenseURL}\n"; michael@0: print "\n\n"; michael@0: michael@0: print "\n"; michael@0: michael@0: ?> michael@0: