2 /*=====================================================================*\
3 || ###################################################################
4 || # Bugdar [#]version[#]
5 || # Copyright ©2002-[#]year[#] Blue Static
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 [#]gpl[#] of the License.
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
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 \*=====================================================================*/
22 define('NO_TEMPLATES', 1);
24 require_once('./global.php');
26 if (!can_perform('canviewbugs'))
28 $message->error_permission();
31 // ###################################################################
32 // get the syndicated items and prepare their content
34 $timestamp = (can_perform('canviewhidden', 0, fetch_guest_user()) ?
'lastposttime' : 'hiddenlastposttime');
37 $bugs_fetch = $db->query("
38 SELECT bug.*, comment.comment_parsed
39 FROM " . TABLE_PREFIX
. "bug
40 LEFT JOIN " . TABLE_PREFIX
. "comment
41 ON (bug.initialreport = comment.commentid)
42 WHERE bug.product IN (" . fetch_on_bits('canviewbugs', fetch_guest_user()) . ")
43 AND (!bug.hidden OR (bug.hidden AND bug.product IN (" . fetch_on_bits('canviewhidden', fetch_guest_user()) . ")))
44 ORDER BY " . (can_perform('canviewhidden', 0, fetch_guest_user()) ?
"bug.lastposttime" : "bug.hiddenlastposttime") . " DESC
45 LIMIT " . $bugsys->options
['syndicateditems']
47 while ($bug = $db->fetch_array($bugs_fetch))
49 $bug['storytext'] = htmlspecialchars(sprintf(
50 _('<table cellspacing="0" cellpadding="3" border="0">
52 <td><strong>Bug ID:</strong></td>
56 <td><strong>Summary:</strong></td>
60 <td><strong>Product/Component/Version:</strong></td>
64 <td><strong>Status:</strong></td>
68 <td><strong>Severity:</strong></td>
75 $bugsys->datastore
['product']["$bug[product]"]['title'] . '/' . (($bug['component']) ?
$bugsys->datastore
['product']["$bug[component]"]['title'] . '/' : '') . $bugsys->datastore
['version']["$bug[version]"]['version'],
76 $bugsys->datastore
['status']["$bug[status]"]['status'],
77 $bugsys->datastore
['severity']["$bug[severity]"]['severity'],
78 $bug['comment_parsed']
80 $buglist["$bug[bugid]"] = $bug;
81 $lastupdated = $bug["$timestamp"];
84 // ###################################################################
85 // generate the actual feed
87 header('Content-type: application/xml');
89 echo '<?xml version="1.0" encoding="utf-8"?>
90 <feed xmlns="http://www.w3.org/2005/Atom">
92 <title>' . sprintf(_('%1$s Syndication Feed'), $bugsys->options
['trackertitle']) . '</title>
93 <link href="' . $bugsys->options
['trackerurl'] . '"/>
94 <updated>' . gmdate('Y-m-d\TH:i:s\Z', $lastupdated) . '</updated>
99 foreach ($buglist AS $bug)
103 <id>' . $bugsys->options
['trackertitle'] . '/showreport.php?bugid=' . $bug['bugid'] . '</id>
104 <title>' . $bug['summary'] . '</title>
105 <updated>' . gmdate('Y-m-d\TH:i:s\Z', $bug["$timestamp"]) . '</updated>
107 <name>' . $bug['username'] . '</name>
109 <content type="html">' . $bug['storytext'] . '</content>
110 <summary type="text">' . htmlspecialchars($bug['comment_parsed']) . '</summary>
111 <link rel="alternate" href="' . $bugsys->options
['trackerurl'] . '/showreport.php?bugid=' . $bug['bugid'] . '"/>
120 /*=====================================================================*\
121 || ###################################################################
124 || ###################################################################
125 \*=====================================================================*/