in['type'], array('rss', 'atom')))
{
define('SYND_TYPE', $bugsys->in['type']);
}
if (!defined('SYND_TYPE'))
{
define('SYND_TYPE', 'atom');
}
if (!can_perform('canviewbugs'))
{
$message->error_permission();
}
// ###################################################################
// get the syndicated items and prepare their content
$timestamp = (can_perform('canviewhidden', 0, fetch_guest_user()) ? 'lastposttime' : 'hiddenlastposttime');
$lastupdated = 0;
$buglist = array();
$bugs_fetch = $db->query("
SELECT * FROM " . TABLE_PREFIX . "bug
WHERE productid IN (" . fetch_on_bits('canviewbugs', fetch_guest_user()) . ")
AND (!hidden OR (hidden AND productid IN (" . fetch_on_bits('canviewhidden', fetch_guest_user()) . ")))
ORDER BY " . (can_perform('canviewhidden', 0, fetch_guest_user()) ? "lastposttime" : "hiddenlastposttime") . " DESC
LIMIT " . $bugsys->options['syndicateditems']
);
while ($bug = $db->fetch_array($bugs_fetch))
{
$bug['storytext'] = sprintf($lang->string('
Bug ID: %1$s
Summary: %2$s
Product/Component/Version: %3$s
Status: %4$s
Severity: %5$s
'),
$bug['bugid'],
$bug['summary'],
$bugsys->datastore['product']["$bug[productid]"]['title'] . '/' . (($bug['componentid']) ? $bugsys->datastore['product']["$bug[componentid]"]['title'] . '/' : '') . $bugsys->datastore['version']["$bug[versionid]"]['version'],
$bugsys->datastore['status']["$bug[status]"]['status'],
$bugsys->datastore['severity']["$bug[severity]"]['severity']
);
$buglist["$bug[bugid]"] = $bug;
$lastupdated = $bug["$timestamp"];
}
// ###################################################################
// ATOM
if (SYND_TYPE == 'atom')
{
$feed = '
' . sprintf($lang->string('%1$s Syndication Feed'), $bugsys->options['trackertitle']) . '
' . gmdate('Y-m-d\TH:i:s\Z', $lastupdated) . '
';
foreach ($buglist AS $bug)
{
$feed .= '
' . $bugsys->options['trackertitle'] . '/showreport.php?bugid=' . $bug['bugid'] . '
' . $bug['summary'] . '
' . gmdate('Y-m-d\TH:i:s\Z', $bug["$timestamp"]) . '
' . $bug['username'] . '
' . $bug['storytext'] . '
';
}
$feed .= '
';
header('Content-type: application/xml');
echo $feed;
exit;
}
// ###################################################################
// RSS
else if (SYND_TYPE == 'rss')
{
// not going to be implemented in 1.1 because I don't want to clutter the templates with multiple feed icons and such...
}
/*=====================================================================*\
|| ###################################################################
|| # $HeadURL$
|| # $Id$
|| ###################################################################
\*=====================================================================*/
?>