Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
41 lines (34 sloc) 1.91 KB
// This is your basic, run of the mill appcast feed
require 'includes/';
$app = new Application($_GET['id']);
if(!$app->ok()) die('Application not found');
$db = Database::getDatabase();
// This table format is crap, but it future proofs us against Sparkle format changes
$dt = date("Y-m-d H:i:s");
$db->query("INSERT INTO shine_sparkle_reports (ip, dt) VALUES (:ip, :dt)", array('ip' => $ip, 'dt' => $dt));
$id = $db->insertId();
foreach($_GET as $k => $v)
$db->query("INSERT INTO shine_sparkle_data (sparkle_id, `key`, data) VALUES (:id, :k, :v)", array('id' => $id, 'k' => $k, 'v' => $v));
$versions = DBObject::glob('Version', "SELECT * FROM shine_versions WHERE app_id = '{$app->id}' ORDER BY dt DESC LIMIT 10");
$db->query("UPDATE shine_versions SET updates = updates + 1 WHERE app_id = '{$app->id}' ORDER BY dt DESC LIMIT 1");
header("Content-type: application/xml");
<?PHP echo '<'; ?>?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:sparkle="" xmlns:dc="">
<title><?PHP echo $app->name; ?> Changelog</title>
<link><?PHP echo $app->link; ?></link>
<description>Most recent changes with links to updates.</description>
<?PHP foreach($versions as $v) : ?>
<title><?PHP echo $app->name; ?> <?PHP echo $v->human_version; ?></title>
<description><![CDATA[ <?PHP echo $v->release_notes; ?> ]]></description>
<pubDate><?PHP echo dater('D, d M Y H:i:s O', $v->dt); ?></pubDate>
<enclosure url="<?PHP echo $v->url; ?>" sparkle:shortVersionString="<?PHP echo $v->human_version; ?>" sparkle:version="<?PHP echo $v->version_number; ?>" length="<?PHP echo $v->filesize; ?>" type="application/octet-stream" sparkle:dsaSignature="<?PHP echo $v->signature; ?>" />
<?PHP endforeach; ?>