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 $res = db_query_params ('SELECT group_name FROM groups WHERE group_id=$1 AND is_public=1',
42 $row = db_fetch_array($res);
43 $title = ": ".$row['group_name']." - ";
44 $link = "?group_id=$group_id";
45 $description = " of ".$row['group_name'];
47 $admins = RBACEngine::getInstance()->getUsersByAllowedAction ('project_admin', $group_id) ;
48 if (count ($admins)) {
49 $webmaster = $admins[0]->getUnixName()."@".forge_get_config('users_host')." (".$admins[0]->getRealName().")";
51 $webmaster = forge_get_config('admin_email');
57 $webmaster = forge_get_config('admin_email');
60 $rssTitle = forge_get_config ('forge_name')." Project$title News";
61 $rssLink = util_make_url("/news/$link");
65 print " <title>".$rssTitle."</title>\n";
66 print " <link>".$rssLink."</link>\n";
67 print " <description>".forge_get_config ('forge_name')." Project News$description</description>\n";
68 print " <language>en-us</language>\n";
69 print " <copyright>Copyright ".date("Y")." ".forge_get_config ('forge_name')."</copyright>\n";
70 print " <webMaster>$webmaster</webMaster>\n";
71 print " <lastBuildDate>".rss_date(time())."</lastBuildDate>\n";
72 print " <docs>http://blogs.law.harvard.edu/tech/rss</docs>\n";
73 print " <generator>".forge_get_config ('forge_name')." RSS generator</generator>\n";
75 $res = db_query_params ('SELECT forum_id,summary,post_date,details,g.group_id,g.group_name,u.realname,u.user_name
76 FROM news_bytes, groups g,users u
77 WHERE news_bytes.group_id=g.group_id
78 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)) {
94 print " <title>".htmlspecialchars($row['summary'])."</title>\n";
95 // if news group, link is main page
96 if ($row['group_id'] != forge_get_config('news_group')) {
97 print " <link>http://".forge_get_config('web_host')."/forum/forum.php?forum_id=".$row['forum_id']."</link>\n";
99 print " <link>http://".forge_get_config('web_host')."/</link>\n";
101 print " <description>".rss_description($row['details'])."</description>\n";
102 print " <author>".$row['user_name']."@".forge_get_config('users_host')." (".$row['realname'].")</author>\n";
103 print " <pubDate>".rss_date($row['post_date'])."</pubDate>\n";
104 if ($row['group_id'] != forge_get_config('news_group')) {
105 print " <guid>http://".forge_get_config('web_host')."/forum/forum.php?forum_id=".$row['forum_id']."</guid>\n";
107 print " <guid>http://".forge_get_config('web_host')."/</guid>\n";
109 // if news group, comment is main page
110 if ($row['group_id'] != forge_get_config('news_group')) {
111 print " <comments>http://".forge_get_config('web_host')."/forum/forum.php?forum_id=".$row['forum_id']."</comments>\n";
113 print " <comments>http://".forge_get_config('web_host')."/</comments>\n";
118 print " </channel>\n";