4 * SourceForge Exports: RSS support module
7 * SourceForge: Breaking Down the Barriers to Open Source Development
8 * Copyright 1999-2001 (c) VA Linux Systems
9 * http://sourceforge.net
15 require_once('env.inc.php');
16 require_once $gfwww.'include/pre.php'; // Initial db and session library, opens session
18 function rss_setscheme() {
19 if ($GLOBALS['scheme'] == "netscape") {
20 $GLOBALS['description_maxlen'] = 500;
21 $GLOBALS['description_notnull'] = 1;
25 function rss_description ($in) {
26 // if description_maxlen is defined, then truncate appropriately
27 // added for netscape rss schema compat
28 if (isset($GLOBALS['description_maxlen']) && $GLOBALS['description_maxlen'] &&
29 (strlen($in) > $GLOBALS['description_maxlen'])) {
30 $in = substr($in,0,$GLOBALS['description_maxlen']);
32 // according to netscape, this cannot be blank
33 if ((strlen($in)==0) && $GLOBALS['description_notnull']) {
34 $in = "No description available.";
36 return htmlspecialchars($in);
39 // callback is optional function name which should be called for each project
40 // row and which result will be appended to description element
41 function rss_dump_project_result_set ($res,$title,$desription='',$callback=0) {
42 if (!$desription) $desription=$title;
45 print " <copyright>Copyright 1999-2000 VA Linux Systems, Inc.</copyright>\n";
46 print " <pubDate>".gmdate('D, d M Y g:i:s',time())." GMT</pubDate>\n";
47 print " <description>$desription</description>\n";
48 print " <link>http://$GLOBALS[sys_default_domain]</link>\n";
49 print " <title>$title</title>\n";
50 print " <webMaster>webmaster@$GLOBALS[sys_default_domain]</webMaster>\n";
51 print " <language>en-us</language>\n";
54 while ($row = db_fetch_array($res)) {
56 $addendum=$callback($row);
59 print " <title>".htmlspecialchars($row['group_name'])."</title>\n";
60 print " <link>".util_make_url_p ($row['unix_group_name'],$row['group_id'])."</link>\n";
61 print " <description>";
62 print ereg_replace(" *\r*\n *"," ",rss_description($row['short_description']));
64 print "</description>\n";
68 print " </channel>\n";