xref: /web-bugs/templates/search-rdf.php (revision 9d47b05f)
1<?php
2header('Content-type: text/xml');
3
4echo '<?xml version="1.0"?>
5<?xml-stylesheet
6href="http://www.w3.org/2000/08/w3c-synd/style.css" type="text/css"
7?>
8<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://purl.org/rss/1.0/"
9xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
10xmlns:admin="http://webns.net/mvcb/" xmlns:content="http://purl.org/rss/1.0/modules/content/">';
11echo "\n  <channel rdf:about=\"{$site_method}://{$site_url}{$basedir}/rss/search.php\">\n";
12echo "    <title>{$siteBig} Bug Search Results</title>\n";
13echo "    <link>{$site_method}://{$site_url}{$basedir}/rss/search.php?" , clean(http_build_query($_GET)) , "</link>\n";
14echo "    <description>Search Results</description>\n";
15echo "    <dc:language>en-us</dc:language>\n";
16echo "    <dc:creator>{$site}-webmaster@lists.php.net</dc:creator>\n";
17echo "    <dc:publisher>{$site}-webmaster@lists.php.net</dc:publisher>\n";
18echo "    <admin:generatorAgent rdf:resource=\"{$site_method}://{$site_url}{$basedir}\"/>\n";
19echo "    <sy:updatePeriod>hourly</sy:updatePeriod>\n";
20echo "    <sy:updateFrequency>1</sy:updateFrequency>\n";
21echo "    <sy:updateBase>2000-01-01T12:00+00:00</sy:updateBase>\n";
22echo '    <items>
23     <rdf:Seq>
24';
25
26$items = '';
27if ($total_rows > 0) {
28    foreach ($result as $row) {
29        $desc = "{$row['package_name']} ({$row['bug_type']})\nReported by ";
30        if (preg_match('/@php.net$/i', $row['email'])) {
31            $desc .= substr($row['email'], 0, strpos($row['email'], '@')) ."\n";
32           } else {
33               $desc .= substr($row['email'], 0, strpos($row['email'], '@')) . "@...\n";
34        }
35        $desc .= date(DATE_ATOM, $row['submitted']) . "\n";
36        $desc .= "PHP: {$row['php_version']}, OS: {$row['php_os']}\n\n";
37        $desc .= $row['ldesc'];
38        $desc = '<pre>' . clean($desc) . '</pre>';
39
40        echo "      <rdf:li rdf:resource=\"{$site_method}://{$site_url}{$basedir}/{$row['id']}\" />\n";
41        $items .= "  <item rdf:about=\"{$site_method}://{$site_url}{$basedir}/{$row['id']}\">\n";
42        $items .= '    <title>' . clean("{$row['bug_type']} {$row['id']} [{$row['status']}] {$row['sdesc']}") . "</title>\n";
43        $items .= "    <link>{$site_method}://{$site_url}{$basedir}/{$row['id']}</link>\n";
44        $items .= '    <content:encoded><![CDATA[' .  $desc . "]]></content:encoded>\n";
45        $items .= '    <description><![CDATA[' . $desc . "]]></description>\n";
46        if (!$row['unchanged']) {
47            $items .= '    <dc:date>' . date(DATE_ATOM, $row['submitted']) . "</dc:date>\n";
48        } else {
49            $items .= '    <dc:date>' . date(DATE_ATOM, $row['modified']) . "</dc:date>\n";
50        }
51        $items .= '    <dc:creator>' . clean(spam_protect($row['email'])) . "</dc:creator>\n";
52        $items .= '    <dc:subject>' . clean($row['package_name']) . ' ' . clean($row['bug_type']) . "</dc:subject>\n";
53        $items .= "  </item>\n";
54    }
55} else {
56    $warnings[] = "No bugs matched your criteria";
57}
58
59echo <<< DATA
60     </rdf:Seq>
61    </items>
62  </channel>
63
64  <image rdf:about="{$site_method}://{$site_url}{$basedir}/images/{$site}-logo.gif">
65    <title>{$siteBig} Bugs</title>
66    <url>{$site_method}://{$site_url}{$basedir}/images/{$site}-logo.gif</url>
67    <link>{$site_method}://{$site_url}{$basedir}</link>
68  </image>
69
70{$items}
71DATA;
72?>
73</rdf:RDF>
74