xref: /web-bugs/www/rss/rdf.php (revision 9d47b05f)
1<?php
2
3$desc = "{$bug['package_name']} {$bug['bug_type']}\nReported by ";
4if (preg_match('/@php.net$/i', $bug['email'])) {
5    $desc .= substr($bug['email'], 0, strpos($bug['email'], '@')) ."\n";
6} else {
7    $desc .= substr($bug['email'], 0, strpos($bug['email'], '@')) . "@...\n";
8}
9$desc .= date(DATE_ATOM, $bug['submitted']) . "\n";
10$desc .= "PHP: {$bug['php_version']}, OS: {$bug['php_os']}\n\n";
11$desc .= $bug['ldesc'];
12$desc = '<pre>' . clean($desc) . '</pre>';
13
14$state = 'http://xmlns.com/baetle/#Open';
15switch ($bug['status']) {
16    case 'Closed':
17        $state = 'http://xmlns.com/baetle/#Closed';
18        break;
19    case 'Wont fix':
20        $state = 'http://xmlns.com/baetle/#WontFix';
21        break;
22    case 'No Feedback':
23        $state = 'http://xmlns.com/baetle/#Incomplete';
24        break;
25    case 'Not a bug':
26        $state = 'http://xmlns.com/baetle/#WorksForMe';
27        break;
28    case 'Duplicate':
29        $state = 'http://xmlns.com/baetle/#Duplicate';
30        break;
31    case 'Suspended':
32        $state = 'http://xmlns.com/baetle/#Later';
33        break;
34    case 'Assigned':
35        $state = 'http://xmlns.com/baetle/#Started';
36        break;
37    case 'Open':
38        $state = 'http://xmlns.com/baetle/#Open';
39        break;
40    case 'Analyzed':
41    case 'Verified':
42        $state = 'http://xmlns.com/baetle/#Verified';
43        break;
44    case 'Feedback':
45        $state = 'http://xmlns.com/baetle/#NotReproducable';
46        break;
47}
48
49print '<?xml version="1.0"?>';
50?>
51<rdf:RDF
52    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
53    xmlns="http://purl.org/rss/1.0/"
54    xmlns:dc="http://purl.org/dc/elements/1.1/"
55    xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
56    xmlns:admin="http://webns.net/mvcb/"
57    xmlns:btl="http://xmlns.com/baetle/#"
58    xmlns:wf="http://www.w3.org/2005/01/wf/flow#"
59    xmlns:sioc="http://rdfs.org/sioc/ns#"
60    xmlns:foaf="http://xmlns.com/foaf/0.1/"
61    xmlns:content="http://purl.org/rss/1.0/modules/content/"
62>
63    <channel rdf:about="<?php echo $uri; ?>">
64        <title><?php echo $bug['package_name']; ?> Bug #<?php echo intval($bug['id']); ?></title>
65        <link><?php echo $uri; ?></link>
66        <description><?php echo clean("[{$bug['status']}] {$bug['sdesc']}"); ?></description>
67
68        <dc:language>en-us</dc:language>
69        <dc:creator><?php echo $site; ?>-webmaster@lists.php.net</dc:creator>
70        <dc:publisher><?php echo $site; ?>-webmaster@lists.php.net</dc:publisher>
71
72        <admin:generatorAgent rdf:resource="<?php echo $site_method?>://<?php echo $site_url, $basedir; ?>" />
73        <sy:updatePeriod>hourly</sy:updatePeriod>
74        <sy:updateFrequency>1</sy:updateFrequency>
75        <sy:updateBase>2000-01-01T12:00+00:00</sy:updateBase>
76
77        <items>
78            <rdf:Seq>
79                <rdf:li rdf:resource="<?php echo $uri; ?>" />
80<?php foreach ($comments as $comment) { ?>
81                <rdf:li rdf:resource="<?php echo $uri; ?>#<?php echo $comment['added']; ?>"/>
82<?php } ?>
83            </rdf:Seq>
84        </items>
85    </channel>
86
87    <btl:Bug rdf:about="<?php echo $uri; ?>">
88        <btl:summary><?php echo clean($bug['sdesc']); ?></btl:summary>
89        <btl:description><?php echo clean($bug['ldesc']); ?></btl:description>
90        <wf:state rdf:resource="<?php echo $state; ?>" />
91    </btl:Bug>
92
93    <item rdf:about="<?php echo $uri; ?>">
94        <title><?php echo clean(substr($bug['email'], 0, strpos($bug['email'], '@'))), "@... [{$bug['ts1']}]"; ?></title>
95        <link><?php echo $uri; ?></link>
96        <description><![CDATA[<?php echo $desc; ?>]]></description>
97        <content:encoded><![CDATA[<?php echo $desc; ?>]]></content:encoded>
98        <dc:date><?php echo date(DATE_ATOM, $bug['submitted']); ?></dc:date>
99    </item>
100
101<?php
102    foreach ($comments as $comment) {
103        if (empty($comment['registered'])) { continue; }
104
105        $ts = urlencode($comment['ts']);
106        $displayts = date('Y-m-d H:i', $comment['added'] - date('Z', $comment['added']));
107
108?>
109        <item rdf:about="<?php echo $uri; ?>#<?php echo $comment['added']; ?>">
110            <title>
111<?php
112        if ($comment['handle']) {
113            echo clean($comment['handle']) . " [$displayts]";
114        } else {
115            echo clean(substr($comment['email'], 0, strpos($comment['email'], '@'))), "@... [$displayts]";
116        }
117?>
118            </title>
119
120            <link><?php echo $uri; ?>#<?php echo $comment['added']; ?></link>
121
122            <description><![CDATA[<pre><?php echo clean($comment['comment']); ?></pre>]]></description>
123            <content:encoded><![CDATA[<pre><?php echo clean($comment['comment']); ?></pre>]]></content:encoded>
124            <dc:date><?php echo date(DATE_ATOM, $comment['added']); ?></dc:date>
125        </item>
126<?php } ?>
127
128</rdf:RDF>
129