3 * http://fusionforge.org/
5 * This file is part of FusionForge.
7 * FusionForge 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; either version 2 of the License, or
10 * (at your option) any later version.
12 * FusionForge is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with FusionForge; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 // export projects release news in RSS 2.0
23 // Author: Scott Grayban <sgrayban@borgnet.us>
26 require_once '../env.inc.php';
27 require_once $gfcommon.'include/pre.php';
28 require_once $gfwww.'export/rss_utils.inc';
30 header("Content-Type: text/xml; charset=utf-8");
31 print '<?xml version="1.0" encoding="UTF-8"?>
34 $group_id = getIntFromRequest('group_id');
35 $limit = getIntFromRequest('limit', 10);
36 if ($limit > 100) $limit = 100;
39 forge_require_perm('project_read', $group_id);
41 $res = db_query_params ('SELECT group_name FROM groups WHERE group_id=$1',
44 $row = db_fetch_array($res);
45 $title = ": ".$row['group_name']." - ";
46 $link = "?group_id=$group_id";
47 $description = " of ".$row['group_name'];
49 $admins = RBACEngine::getInstance()->getUsersByAllowedAction ('project_admin', $group_id) ;
50 if (count ($admins)) {
51 $webmaster = $admins[0]->getUnixName()."@".forge_get_config('users_host')." (".$admins[0]->getRealName().")";
53 $webmaster = forge_get_config('admin_email');
59 $webmaster = forge_get_config('admin_email');
62 $rssTitle = forge_get_config ('forge_name')." Project$title News";
63 $rssLink = util_make_url("/news/$link");
67 print " <title>".$rssTitle."</title>\n";
68 print " <link>".$rssLink."</link>\n";
69 print " <description>".forge_get_config ('forge_name')." Project News$description</description>\n";
70 print " <language>en-us</language>\n";
71 print " <copyright>Copyright ".date("Y")." ".forge_get_config ('forge_name')."</copyright>\n";
72 print " <webMaster>$webmaster</webMaster>\n";
73 print " <lastBuildDate>".rss_date(time())."</lastBuildDate>\n";
74 print " <docs>http://blogs.law.harvard.edu/tech/rss</docs>\n";
75 print " <generator>".forge_get_config ('forge_name')." RSS generator</generator>\n";
77 $res = db_query_params ('SELECT forum_id,summary,post_date,details,g.group_id,g.group_name,u.realname,u.user_name
78 FROM news_bytes, groups g,users u
79 WHERE news_bytes.group_id=g.group_id
80 AND u.user_id=news_bytes.submitted_by
82 AND news_bytes.is_approved <> 4
83 AND (g.group_id=$2 OR 1 != $3)
84 AND (is_approved=1 OR 1 != $4)
85 ORDER BY post_date DESC',
93 while ($row = db_fetch_array($res)) {
95 print " <title>".htmlspecialchars($row['summary'])."</title>\n";
96 // if news group, link is main page
97 if ($row['group_id'] != forge_get_config('news_group')) {
98 print " <link>http://".forge_get_config('web_host')."/forum/forum.php?forum_id=".$row['forum_id']."</link>\n";
100 print " <link>http://".forge_get_config('web_host')."/</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";