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