2 header ("Content-type: text/xml");
3 include 'Library/CouchDb/Couch.php';
4 include 'Library/Shrink.php';
5 $couch = new Couch('localhost', 'bugshrink');
7 if(!$couch->running() ||
!$couch->db_exists()) {
12 $bugs = $couch->get_all('allfull', $options = array('reverse' => 'true'));
13 if(($bugs !== false) && (count($bugs) > 0)) {
16 foreach($bugs AS $id => $bug) {
17 if(strlen($bug->get('Subject')) == 0) {continue;}
20 if($bug->get('CreationDate') > $lastUpdate) {
21 $lastUpdate = $bug->get('CreationDate');
26 function get_iso_8601_date($int_date) {
27 //$int_date: current date in UNIX timestamp
28 $date_mod = date('Y-m-d\TH:i:s', $int_date);
29 $pre_timezone = date('O', $int_date);
30 $time_zone = substr($pre_timezone, 0, 3).":".substr($pre_timezone, 3, 2);
31 $date_mod .= $time_zone;
34 //var_dump( strtotime(str_replace(':', '', $lastUpdate)));
35 $lastUpdate = get_iso_8601_date(strtotime(str_replace(':', '', $lastUpdate)));
37 echo '<?xml version="1.0" encoding="utf-8"?>';
38 ?
><feed xmlns
="http://www.w3.org/2005/Atom">
40 <title
>BugShrink Feed
</title
>
41 <link href
="http://demos.couchdb.com/BugShrink2/"/>
42 <updated
><?
=$lastUpdate?
></updated
>
44 <name
>BugShrink Bug Tracking Demo
for CouchDb
</name
>
46 <id
>urn
:uuid
:<?
=md5('http://demos.couchdb.com/BugShrink2/')?
></id
>
49 foreach($bugs AS $id => $bug) {
50 if(strlen($bug->get('Subject')) == 0) {continue;}
51 $Subject = $bug->get('Subject');
52 $Link = 'http://demos.couchdb.com/BugShrink2/?id='.$id;
53 $updated = get_iso_8601_date(strtotime(str_replace(':', '', $bug->get('CreationDate'))));
54 $Body = shrink_format_body($bug->get('Body'));
55 $By = $bug->get('Author');
58 <title>$Subject</title>
62 <updated>$updated</updated>
63 <published>$updated</published>
64 <content type="xhtml">$Body</content>