function left($str, $num) return substr($str, 0, $num); function rss_parse_date($date) $date = str_replace("st,", "", $date); $date = str_replace("nd,", "", $date); $date = str_replace("rd,", "", $date); $date = str_replace("th,", "", $date); $timestamp = strtotime($date); return date("r", $timestamp); function rss_header($title, $description, $url) print "<?xml version=\"1.0\"?>\n\n"; print "<rss version=\"0.91\">\n"; print " <title>$title</title>\n"; print " <description>$description</description>\n"; print " <link>$url</link>\n"; function rss_start_item($title, $date, $link) $title = htmlentities($title); $date = rss_parse_date($date); print " <title>$title</title>\n"; print " <pubDate>$date</pubDate>\n"; print " <link>$link</link>\n"; function rss_description($text) $text = htmlentities($text); print " <description>\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 = 10; } $fcontents = file("news.txt"); while (list($linenum, $line) = each($fcontents)) elseif ($pos < ($start + $limit)) elseif ($index == 0) { $cur_title = $line; } rss_start_item($cur_title, $line, "http://gaim.sourceforge.net/index.php?start=$pos"); print "RSS information for $PATH_INFO is not provided.";