<?php
/*=====================================================================*\
|| ###################################################################
-|| # Bugdar [#]version[#]
-|| # Copyright ©2002-[#]year[#] Blue Static
+|| # Bugdar
+|| # Copyright (c)2004-2009 Blue Static
|| #
|| # This program is free software; you can redistribute it and/or modify
|| # it under the terms of the GNU General Public License as published by
-|| # the Free Software Foundation; version [#]gpl[#] of the License.
+|| # the Free Software Foundation; version 2 of the License.
|| #
|| # This program is distributed in the hope that it will be useful, but
|| # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
require_once('./global.php');
-if (in_array($bugsys->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();
+ $message->errorPermission();
}
// ###################################################################
-// get the syndicated items and prepare their content
+header('Content-type: application/xml');
+
+$syndicate = '';
$timestamp = (can_perform('canviewhidden', 0, fetch_guest_user()) ? 'lastposttime' : 'hiddenlastposttime');
$lastupdated = 0;
$buglist = array();
$bugs_fetch = $db->query("
SELECT bug.*, comment.comment_parsed
- FROM " . TABLE_PREFIX . "bug
- LEFT JOIN " . TABLE_PREFIX . "comment
+ FROM " . TABLE_PREFIX . "bug AS bug
+ LEFT JOIN " . TABLE_PREFIX . "comment AS comment
ON (bug.initialreport = comment.commentid)
WHERE bug.product IN (" . fetch_on_bits('canviewbugs', fetch_guest_user()) . ")
AND (!bug.hidden OR (bug.hidden AND bug.product IN (" . fetch_on_bits('canviewhidden', fetch_guest_user()) . ")))
ORDER BY " . (can_perform('canviewhidden', 0, fetch_guest_user()) ? "bug.lastposttime" : "bug.hiddenlastposttime") . " DESC
- LIMIT " . $bugsys->options['syndicateditems']
+ LIMIT " . bugdar::$options['syndicateditems']
);
-while ($bug = $db->fetch_array($bugs_fetch))
+foreach ($bugs_fetch as $bug)
{
- $bug['storytext'] = str_replace(array('<', '>'), array('<', '>'), sprintf(
- $lang->string('<table cellspacing="0" cellpadding="3" border="0">
-<tr>
- <td><strong>Bug ID:</strong></td>
- <td>%1$s</td>
-</tr>
-<tr>
- <td><strong>Summary:</strong></td>
- <td>%2$s</td>
-</tr>
-<tr>
- <td><strong>Product/Component/Version:</strong></td>
- <td>%3$s</td>
-</tr>
-<tr>
- <td><strong>Status:</strong></td>
- <td>%4$s</td>
-</tr>
-<tr>
- <td><strong>Severity:</strong></td>
- <td>%5$s</td>
-</table>
-
-<p>%6$s</p>'),
- $bug['bugid'],
- $bug['summary'],
- $bugsys->datastore['product']["$bug[product]"]['title'] . '/' . (($bug['component']) ? $bugsys->datastore['product']["$bug[component]"]['title'] . '/' : '') . $bugsys->datastore['version']["$bug[version]"]['version'],
- $bugsys->datastore['status']["$bug[status]"]['status'],
- $bugsys->datastore['severity']["$bug[severity]"]['severity'],
- $bug['comment_parsed']
- ));
- $buglist["$bug[bugid]"] = $bug;
+ $syndicate .= '
+ <entry>
+ <id>bug://report/' . $bug['bugid'] . '</id>
+ <title>' . $bug['summary'] . '</title>
+ <updated>' . gmdate('Y-m-d\TH:i:s\Z', $bug["$timestamp"]) . '</updated>
+ <author>
+ <name>' . $bug['username'] . '</name>
+ </author>
+ <content type="html">
+ ' . htmlspecialchars('<table cellspacing="0" cellpadding="3" border="0">
+ <tr>
+ <td><strong>' . T('Bug ID') . ':</strong></td>
+ <td>' . $bug['bugid'] . '</td>
+ </tr>
+ <tr>
+ <td><strong>' . T('Summary') . ':</strong></td>
+ <td>' . $bug['summary'] . '</td>
+ </tr>
+ <tr>
+ <td><strong>' . T('Product/Component/Version') . ':</strong></td>
+ <td>' . bugdar::$datastore['product']["$bug[product]"]['title'] . '/' . (($bug['component']) ? bugdar::$datastore['product']["$bug[component]"]['title'] . '/' : '') . bugdar::$datastore['version']["$bug[version]"]['version'] . '</td>
+ </tr>
+ <tr>
+ <td><strong>' . T('Status') . ':</strong></td>
+ <td>' . bugdar::$datastore['status']["$bug[status]"]['status'] . '</td>
+ </tr>
+ <tr>
+ <td><strong>' . T('Severity') . ':</strong></td>
+ <td>' . bugdar::$datastore['severity']["$bug[severity]"]['severity'] . '</td>
+ </table>
+
+ <p>' . $bug['comment_parsed'] . '</p>') . '
+ </content>
+ <summary type="text">' . htmlspecialchars($bug['comment_parsed']) . '</summary>
+ <link rel="alternate" href="' . bugdar::$options['trackerurl'] . '/showreport.php?bugid=' . $bug['bugid'] . '"/>
+ </entry>';
+
$lastupdated = $bug["$timestamp"];
}
-// ###################################################################
-// ATOM
-
-if (SYND_TYPE == 'atom')
-{
- header('Content-type: application/xml');
-
- echo '<?xml version="1.0" encoding="utf-8"?>
+echo '<?xml version="1.0" encoding="' . $language['charset'] . '"?>
<feed xmlns="http://www.w3.org/2005/Atom">
- <title>' . sprintf($lang->string('%1$s Syndication Feed'), $bugsys->options['trackertitle']) . '</title>
- <link href="' . $bugsys->options['trackerurl'] . '"/>
+ <title>' . sprintf(T('%1$s Syndication Feed'), bugdar::$options['trackertitle']) . '</title>
+ <link href="' . bugdar::$options['trackerurl'] . '"/>
<updated>' . gmdate('Y-m-d\TH:i:s\Z', $lastupdated) . '</updated>
<!-- entries -->
';
+
+echo $syndicate;
- foreach ($buglist AS $bug)
- {
- echo '
- <entry>
- <id>' . $bugsys->options['trackertitle'] . '/showreport.php?bugid=' . $bug['bugid'] . '</id>
- <title>' . $bug['summary'] . '</title>
- <updated>' . gmdate('Y-m-d\TH:i:s\Z', $bug["$timestamp"]) . '</updated>
- <author>
- <name>' . $bug['username'] . '</name>
- </author>
- <content>' . $bug['storytext'] . '</content>
- <link rel="alternate" href="' . $bugsys->options['trackerurl'] . '/showreport.php?bugid=' . $bug['bugid'] . '"/>
- </entry>';
- }
-
- echo '
+echo '
<!-- / entries -->
</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$
-|| ###################################################################
-\*=====================================================================*/
?>
\ No newline at end of file