3 * http://fusionforge.org/
5 * This file is part of FusionForge. FusionForge is free software;
6 * you can redistribute it and/or modify it under the terms of the
7 * GNU General Public License as published by the Free Software
8 * Foundation; either version 2 of the Licence, or (at your option)
11 * FusionForge is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License along
17 * with FusionForge; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21 // export projects release news in RSS 2.0
22 // Author: Scott Grayban <sgrayban@borgnet.us>
25 require_once '../env.inc.php';
26 require_once $gfcommon.'include/pre.php';
27 require_once $gfwww.'export/rss_utils.inc';
29 header("Content-Type: text/xml; charset=utf-8");
30 print '<?xml version="1.0" encoding="UTF-8"?>
33 $group_id = getIntFromRequest('group_id');
34 $limit = getIntFromRequest('limit', 10);
35 if ($limit > 100) $limit = 100;
38 session_require_perm('project_read', $group_id);
40 $res = db_query_params ('SELECT group_name FROM groups WHERE group_id=$1',
43 $row = db_fetch_array($res);
44 $title = ": ".$row['group_name']." - ";
45 $link = "?group_id=$group_id";
46 $description = " of ".$row['group_name'];
48 $admins = RBACEngine::getInstance()->getUsersByAllowedAction ('project_admin', $group_id) ;
49 if (count ($admins)) {
50 $webmaster = $admins[0]->getUnixName()."@".forge_get_config('users_host')." (".$admins[0]->getRealName().")";
52 $webmaster = forge_get_config('admin_email');
58 $webmaster = forge_get_config('admin_email');
61 $rssTitle = forge_get_config ('forge_name')." Project$title News";
62 $rssLink = util_make_url("/news/$link");
66 print " <title>".$rssTitle."</title>\n";
67 print " <link>".$rssLink."</link>\n";
68 print " <description>".forge_get_config ('forge_name')." Project News$description</description>\n";
69 print " <language>en-us</language>\n";
70 print " <copyright>Copyright ".date("Y")." ".forge_get_config ('forge_name')."</copyright>\n";
71 print " <webMaster>$webmaster</webMaster>\n";
72 print " <lastBuildDate>".rss_date(time())."</lastBuildDate>\n";
73 print " <docs>http://blogs.law.harvard.edu/tech/rss</docs>\n";
74 print " <generator>".forge_get_config ('forge_name')." RSS generator</generator>\n";
76 $res = db_query_params ('SELECT forum_id,summary,post_date,details,g.group_id,g.group_name,u.realname,u.user_name
77 FROM news_bytes, groups g,users u
78 WHERE news_bytes.group_id=g.group_id
79 AND u.user_id=news_bytes.submitted_by
81 AND news_bytes.is_approved <> 4
82 AND (g.group_id=$2 OR 1 != $3)
83 AND (is_approved=1 OR 1 != $4)
84 ORDER BY post_date DESC',
92 while ($row = db_fetch_array($res)) {
93 // if news group, link is main page
94 if ($row['group_id'] != forge_get_config('news_group')) {
95 $link = util_make_url("/forum/forum.php?forum_id=".$row['forum_id']);
97 $link = util_make_url('/');
100 print " <title>".htmlspecialchars($row['summary'])."</title>\n";
101 print " <link>$link</link>\n";
102 print " <description>".rss_description($row['details'])."</description>\n";
103 print " <author>".$row['user_name']."@".forge_get_config('users_host')." (".$row['realname'].")</author>\n";
104 print " <pubDate>".rss_date($row['post_date'])."</pubDate>\n";
105 if ($row['group_id'] != forge_get_config('news_group')) {
106 print " <guid>http://".forge_get_config('web_host')."/forum/forum.php?forum_id=".$row['forum_id']."</guid>\n";
108 print " <guid>http://".forge_get_config('web_host')."/</guid>\n";
110 // if news group, comment is main page
111 if ($row['group_id'] != forge_get_config('news_group')) {
112 print " <comments>http://".forge_get_config('web_host')."/forum/forum.php?forum_id=".$row['forum_id']."</comments>\n";
114 print " <comments>http://".forge_get_config('web_host')."/</comments>\n";
119 print " </channel>\n";