* Doron Rosenberg * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /// config bits: $db_server = ""; $db_user = ""; $db_pass = ""; $db_name = ""; // error handling function bail ($errstr) { die("Error: " . $errstr); } // major.minor.release.build[+] // make sure this is a valid version function expandversion ($vstr) { $v = explode('.', $vstr); if ($vstr == '' || count($v) == 0 || count($v) > 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"; ?>