]> src.bluestatic.org Git - bugdar.git/blob - syndicate.php
Set up templating in the admin/ section using hoplite\views.
[bugdar.git] / syndicate.php
1 <?php
2 /*=====================================================================*\
3 || ###################################################################
4 || # Bugdar
5 || # Copyright (c)2002-2007 Blue Static
6 || #
7 || # This program is free software; you can redistribute it and/or modify
8 || # it under the terms of the GNU General Public License as published by
9 || # the Free Software Foundation; version 2 of the License.
10 || #
11 || # This program is distributed in the hope that it will be useful, but
12 || # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 || # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 || # more details.
15 || #
16 || # You should have received a copy of the GNU General Public License along
17 || # with this program; if not, write to the Free Software Foundation, Inc.,
18 || # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
19 || ###################################################################
20 \*=====================================================================*/
21
22 define('NO_TEMPLATES', 1);
23
24 require_once('./global.php');
25
26 if (!can_perform('canviewbugs'))
27 {
28 $message->errorPermission();
29 }
30
31 // ###################################################################
32
33 header('Content-type: application/xml');
34
35 $syndicate = '';
36 $timestamp = (can_perform('canviewhidden', 0, fetch_guest_user()) ? 'lastposttime' : 'hiddenlastposttime');
37 $lastupdated = 0;
38 $buglist = array();
39 $bugs_fetch = $db->query("
40 SELECT bug.*, comment.comment_parsed
41 FROM " . TABLE_PREFIX . "bug AS bug
42 LEFT JOIN " . TABLE_PREFIX . "comment AS comment
43 ON (bug.initialreport = comment.commentid)
44 WHERE bug.product IN (" . fetch_on_bits('canviewbugs', fetch_guest_user()) . ")
45 AND (!bug.hidden OR (bug.hidden AND bug.product IN (" . fetch_on_bits('canviewhidden', fetch_guest_user()) . ")))
46 ORDER BY " . (can_perform('canviewhidden', 0, fetch_guest_user()) ? "bug.lastposttime" : "bug.hiddenlastposttime") . " DESC
47 LIMIT " . $bugsys->options['syndicateditems']
48 );
49 while ($bug = $db->fetch_array($bugs_fetch))
50 {
51 $syndicate .= '
52 <entry>
53 <id>bug://report/' . $bug['bugid'] . '</id>
54 <title>' . $bug['summary'] . '</title>
55 <updated>' . gmdate('Y-m-d\TH:i:s\Z', $bug["$timestamp"]) . '</updated>
56 <author>
57 <name>' . $bug['username'] . '</name>
58 </author>
59 <content type="html">
60 ' . htmlspecialchars('<table cellspacing="0" cellpadding="3" border="0">
61 <tr>
62 <td><strong>' . T('Bug ID') . ':</strong></td>
63 <td>' . $bug['bugid'] . '</td>
64 </tr>
65 <tr>
66 <td><strong>' . T('Summary') . ':</strong></td>
67 <td>' . $bug['summary'] . '</td>
68 </tr>
69 <tr>
70 <td><strong>' . T('Product/Component/Version') . ':</strong></td>
71 <td>' . Bugdar::$datastore['product']["$bug[product]"]['title'] . '/' . (($bug['component']) ? Bugdar::$datastore['product']["$bug[component]"]['title'] . '/' : '') . Bugdar::$datastore['version']["$bug[version]"]['version'] . '</td>
72 </tr>
73 <tr>
74 <td><strong>' . T('Status') . ':</strong></td>
75 <td>' . Bugdar::$datastore['status']["$bug[status]"]['status'] . '</td>
76 </tr>
77 <tr>
78 <td><strong>' . T('Severity') . ':</strong></td>
79 <td>' . Bugdar::$datastore['severity']["$bug[severity]"]['severity'] . '</td>
80 </table>
81
82 <p>' . $bug['comment_parsed'] . '</p>') . '
83 </content>
84 <summary type="text">' . htmlspecialchars($bug['comment_parsed']) . '</summary>
85 <link rel="alternate" href="' . $bugsys->options['trackerurl'] . '/showreport.php?bugid=' . $bug['bugid'] . '"/>
86 </entry>';
87
88 $lastupdated = $bug["$timestamp"];
89 }
90
91 echo '<?xml version="1.0" encoding="' . $language['charset'] . '"?>
92 <feed xmlns="http://www.w3.org/2005/Atom">
93
94 <title>' . sprintf(T('%1$s Syndication Feed'), $bugsys->options['trackertitle']) . '</title>
95 <link href="' . $bugsys->options['trackerurl'] . '"/>
96 <updated>' . gmdate('Y-m-d\TH:i:s\Z', $lastupdated) . '</updated>
97
98 <!-- entries -->
99 ';
100
101 echo $syndicate;
102
103 echo '
104 <!-- / entries -->
105
106 </feed>';
107