OutputHeader(); $this->OutputBodyXml($clientVersion); $this->OutputFooter(); } private function OutputHeader() { printf(' ', $this->GetVersion()); } protected function OutputUpdates($clientVersion) { $updates = $this->GetUpdates($clientVersion); $lastItemType = null; foreach ($updates as $update) { //Output the closing type tag and open a new type tag for the new update type. if ($update->Type != $lastItemType) { if ($lastItemType !== null) printf(' ' . "\n", $lastItemType); printf(' <%s>' . "\n", $update->Type); $lastItemType = $update->Type; } //Print the download entry. printf(' %s ', htmlentities($update->Name), $update->Version, htmlentities($update->Publisher->Name), $update->Architecture, $update->Filesize, htmlentities($update->GetDisplayedLink())); } if (!empty($lastItemType)) printf(' ' . "\n", $lastItemType); } private function OutputFooter() { printf(''); } } class UpdateList1 extends UpdateListBase { protected function GetVersion() { return "1.0"; } protected function GetUpdates($clientVersion) { //Prepare the list of updates $pdo = new Database(); $statement = $pdo->prepare('SELECT DownloadID FROM downloads WHERE (Superseded = 0) AND (`Type` <> \'build\') AND ( (MinVersion IS NULL AND MaxVersion IS NULL) OR (MinVersion IS NULL AND MaxVersion > :Version) OR (MinVersion <= \'%1$s\' AND MaxVersion IS NULL) OR (MinVersion <= \'%1$s\' AND MaxVersion > :Version) ) ORDER BY `Type` ASC'); $statement->bindParam('Version', $clientVersion); $statement->execute(); $result = array(); $downloadId = null; $statement->bindColumn('DownloadID', $downloadId); while ($statement->fetch()) $result[] = new Download($downloadId); return $result; } private function OutputMirrors() { //Output the list of mirrors $pdo = new Database(); $statement = $pdo->query('SELECT * FROM mirrors ORDER By Continent, Country, City'); echo ' http://downloads.sourceforge.net/eraser/ '; $statement->bindColumn('City', $city); $statement->bindColumn('Country', $country); $statement->bindColumn('URL', $url); while ($statement->fetch()) printf(' %s' . "\n", $city, $country, $url); echo ' ' . "\n"; } protected function OutputBodyXml($clientVersion) { $this->OutputMirrors(); $this->OutputUpdates($clientVersion); } } class UpdateList1_1 extends UpdateListBase { protected function GetVersion() { return "1.1"; } protected function GetUpdates($clientVersion) { //Prepare the list of updates $pdo = new Database(); $statement = $pdo->prepare('SELECT DownloadID FROM downloads WHERE (Superseded = 0) AND ( ( -- Program Updates (`Type` <> \'build\') AND (MinVersion IS NULL AND MaxVersion IS NULL) OR (MinVersion IS NULL AND MaxVersion > :Version) OR (MinVersion <= \'%1$s\' AND MaxVersion IS NULL) OR (MinVersion <= \'%1$s\' AND MaxVersion > :Version) ) OR ( -- Nightly builds greater than our version (`Type` = \'build\') AND (Version > :Version) ) ) ORDER BY `Type` ASC'); $statement->bindParam('Version', $clientVersion); $statement->execute(); $result = array(); $downloadId = null; $statement->bindColumn('DownloadID', $downloadId); while ($statement->fetch()) $result[] = new Download($downloadId); return $result; } protected function OutputBodyXml($clientVersion) { $this->OutputUpdates($clientVersion); } } ?>