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
13 require_once('../env.inc.php');
14 require_once $gfwww.'include/pre.php'; // Initial db and session library, opens session
16 function rss_setscheme() {
17 if ($GLOBALS['scheme'] == "netscape") {
18 $GLOBALS['description_maxlen'] = 500;
19 $GLOBALS['description_notnull'] = 1;
23 function rss_date($date) {
24 return gmdate('D, d M Y H:i:s', $date).' GMT';
27 function rss_description ($in) {
28 // if description_maxlen is defined, then truncate appropriately
29 // added for netscape rss schema compat
30 if (isset($GLOBALS['description_maxlen']) && $GLOBALS['description_maxlen'] &&
31 (strlen($in) > $GLOBALS['description_maxlen'])) {
32 $in = substr($in,0,$GLOBALS['description_maxlen']);
34 // according to netscape, this cannot be blank
35 if ((strlen($in)==0) && $GLOBALS['description_notnull']) {
36 $in = "No description available.";
38 return htmlspecialchars($in);
41 // callback is optional function name which should be called for each project
42 // row and which result will be appended to description element
43 function rss_dump_project_result_set ($res,$title,$desription='',$callback=0) {
44 if (!$desription) $desription=$title;
47 print " <copyright>Copyright ".date("Y")." ".fusionforge_get_config ('core', 'forge_name')."</copyright>\n";
48 print " <pubDate>".rss_date(time())."</pubDate>\n";
49 print " <description>$desription</description>\n";
50 print " <link>http://".$GLOBALS['sys_default_domain']."/</link>\n";
51 print " <title>$title</title>\n";
52 print " <webMaster>".$GLOBALS['sys_admin_email']."</webMaster>\n";
53 print " <language>en-us</language>\n";
57 while ($row = db_fetch_array($res)) {
59 $addendum=$callback($row);
62 print " <title>".htmlspecialchars($row['group_name'])."</title>\n";
63 print " <link>".util_make_url_g ($row['unix_group_name'],$row['group_id'])."</link>\n";
64 print " <description>";
65 print ereg_replace(" *\r*\n *"," ",rss_description($row['short_description']));
67 print "</description>\n";
71 print " </channel>\n";