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
16 function rss_setscheme() {
17 if ($GLOBALS['scheme'] == "netscape") {
18 $GLOBALS['description_maxlen'] = 500;
19 $GLOBALS['description_notnull'] = 1;
23 function rss_description ($in) {
24 // if description_maxlen is defined, then truncate appropriately
25 // added for netscape rss schema compat
26 if ($GLOBALS['description_maxlen'] &&
27 (strlen($in) > $GLOBALS['description_maxlen'])) {
28 $in = substr($in,0,$GLOBALS['description_maxlen']);
30 // according to netscape, this cannot be blank
31 if ((strlen($in)==0) && $GLOBALS['description_notnull']) {
32 $in = "No description available.";
34 return htmlspecialchars($in);
37 // callback is optional function name which should be called for each project
38 // row and which result will be appended to description element
39 function rss_dump_project_result_set ($res,$title,$desription='',$callback=0) {
40 if (!$desription) $desription=$title;
43 print " <copyright>Copyright 1999-2000 VA Linux Systems, Inc.</copyright>\n";
44 print " <pubDate>".gmdate('D, d M Y g:i:s',time())." GMT</pubDate>\n";
45 print " <description>$desription</description>\n";
46 print " <link>http://$GLOBALS[sys_default_domain]</link>\n";
47 print " <title>$title</title>\n";
48 print " <webMaster>webmaster@$GLOBALS[sys_default_domain]</webMaster>\n";
49 print " <language>en-us</language>\n";
52 while ($row = db_fetch_array($res)) {
54 $addendum=$callback($row);
57 print " <title>".htmlspecialchars($row[group_name])."</title>\n";
58 print " <link>http://$GLOBALS[sys_default_domain]/projects/$row[unix_group_name]/</link>\n";
59 print " <description>";
60 print ereg_replace(" *\r*\n *"," ",rss_description($row[short_description]));
62 print "</description>\n";
66 print " </channel>\n";