gaim/www

Added an RSS feed for our news.

2003-12-22, Christian Hammond
c765e9958583
Parents abd08f4463e6
Children 4451042e9501
Added an RSS feed for our news.
--- a/htdocs/news.txt Sun Dec 21 17:03:42 2003 -0500
+++ b/htdocs/news.txt Mon Dec 22 15:26:02 2003 -0500
@@ -1,3 +1,7 @@
+Gaim RSS News Feed
+December 22, 2003 - 12:28PM PST
+For those who enjoy keeping track of news through RSS aggregators, we now have an <a href="/rss.php/news">RSS feed</a> for the news up. Enjoy.
+#
Gaim 0.74 - Seldom right, but never hesitant
November 26, 2003 - 12:43AM EST
Ethan was too tired to be clever, so I'll just say we released 0.74. It fixes stuff, so go <a href="http://sourceforge.net/project/shownotes.php?release_id=200082">get it.</a>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/htdocs/rss.php Mon Dec 22 15:26:02 2003 -0500
@@ -0,0 +1,109 @@
+<?php
+
+ function rss_header($title, $description, $url)
+ {
+ print "<?xml version=\"1.0\"?>\n\n";
+ print "<rss version=\"0.91\">\n";
+ print " <channel>\n";
+ print " <title>$title</title>\n";
+ print " <description>$description</description>\n";
+ print " <link>$url</link>\n";
+ }
+
+ function rss_footer()
+ {
+ print " </channel>\n";
+ print "</rss>\n";
+ }
+
+ function rss_start_item($title, $date, $link)
+ {
+ $title = chop($title);
+ $date = chop($date);
+
+ $title = htmlentities($title);
+
+ print " <item>\n";
+ print " <title>$title</title>\n";
+ print " <pubDate>$date</pubDate>\n";
+ print " <link>$link</link>\n";
+ }
+
+ function rss_end_item()
+ {
+ print " </item>\n";
+ }
+
+ function rss_description($text)
+ {
+ $text = chop($text);
+ $text = htmlentities($text);
+
+ print " <description>\n";
+ print " $text\n";
+ print " </description>\n";
+ }
+
+ if ($PATH_INFO == "/news")
+ {
+ header("Content-type: text/xml");
+
+ rss_header("Gaim news", "Gaim news",
+ "http://gaim.sourceforge.net/index.php");
+
+ if (!isset($start)) { $start = 0; }
+ if (!isset($limit)) { $limit = 5; }
+
+ $fcontents = file("news.txt");
+ $index = 0;
+ $pos = 0;
+
+ while (list($linenum, $line) = each($fcontents))
+ {
+ if ($pos < $start)
+ {
+ if (chop($line) == "#")
+ $pos++;
+
+ continue;
+ }
+ elseif ($pos < ($start + $limit))
+ {
+ if (chop($line) == "#")
+ {
+ rss_end_item();
+
+ $index = 0;
+ $pos++;
+
+ continue;
+ }
+ elseif ($index == 0) { $cur_title = $line; }
+ elseif ($index == 1)
+ {
+ rss_start_item($cur_title, $line,
+ "http://gaim.sourceforge.net/index.php?start=$pos");
+ $cur_title = "";
+ }
+ else
+ {
+ rss_description($line);
+ }
+ }
+ else
+ break;
+
+ $index++;
+ }
+
+ if ($index > 0)
+ rss_end_item();
+
+ rss_footer();
+ }
+ else
+ {
+ print "RSS information for $PATH_INFO is not provided.";
+ }
+
+?>