2004-05-31 17:37:22 +00:00
|
|
|
<?php
|
|
|
|
// rss_main.php:
|
|
|
|
// RSS 2.0 feed for BOINC default server installation.
|
|
|
|
// Channel Main show the current news on project mainpage
|
|
|
|
// - for more informations about RSS see RSS 2.0 Specification:
|
|
|
|
// http://blogs.law.harvard.edu/tech/rss
|
|
|
|
|
2006-02-18 09:44:34 +00:00
|
|
|
// Check your page with http://feedvalidator.org/
|
|
|
|
|
2004-05-31 17:37:22 +00:00
|
|
|
// Create and send out http header
|
|
|
|
//
|
2006-03-16 21:38:06 +00:00
|
|
|
|
|
|
|
// Get unix time that last modification was made to the news source
|
|
|
|
//
|
|
|
|
$last_mod_time=filemtime("../project/project_news.inc");
|
2006-03-17 00:39:16 +00:00
|
|
|
$create_date = gmdate('D, d M Y H:i:s', $last_mod_time) . ' GMT';
|
2006-03-16 21:38:06 +00:00
|
|
|
|
|
|
|
// Now construct header
|
|
|
|
//
|
2004-05-31 17:37:22 +00:00
|
|
|
header ("Expires: " . gmdate('D, d M Y H:i:s', time()) . " GMT");
|
2006-03-17 00:39:16 +00:00
|
|
|
header ("Last-Modified: " . $create_date);
|
2006-02-22 06:19:54 +00:00
|
|
|
header ("Content-Type: application/xml");
|
2004-05-31 17:37:22 +00:00
|
|
|
|
|
|
|
// Get or set display options
|
|
|
|
// - from 1 to 9 News could be set by option news, default is up to 9
|
|
|
|
//
|
2005-05-11 08:29:35 +00:00
|
|
|
$news = "9";
|
|
|
|
if (isset($_GET["news"])) $news=$_GET["news"];
|
|
|
|
|
|
|
|
if($news < "1" or $news > "9") {
|
2004-05-31 17:37:22 +00:00
|
|
|
$news = "9";
|
|
|
|
}
|
|
|
|
|
2005-05-11 08:29:35 +00:00
|
|
|
// include project constants and news file
|
2004-05-31 17:37:22 +00:00
|
|
|
//
|
|
|
|
require_once("../project/project.inc");
|
|
|
|
require_once("../project/project_news.inc");
|
|
|
|
|
|
|
|
// Create channel header and open XML content
|
|
|
|
//
|
|
|
|
$description = "BOINC project ".PROJECT.": Main page News";
|
2007-07-05 19:37:33 +00:00
|
|
|
$channel_image = URL_BASE . "/rss_image.gif";
|
2004-05-31 17:37:22 +00:00
|
|
|
$language = "en-us";
|
2004-10-19 22:12:00 +00:00
|
|
|
echo "<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>
|
|
|
|
<rss version=\"2.0\">
|
|
|
|
<channel>
|
|
|
|
<title>".PROJECT."</title>
|
|
|
|
<link>".URL_BASE."</link>
|
|
|
|
<description>".$description."</description>
|
|
|
|
<copyright>".COPYRIGHT_HOLDER."</copyright>
|
|
|
|
<lastBuildDate>".$create_date."</lastBuildDate>
|
|
|
|
<language>".$language."</language>
|
|
|
|
<image>
|
|
|
|
<url>".$channel_image."</url>
|
|
|
|
<title>".PROJECT."</title>
|
|
|
|
<link>".URL_BASE."</link>
|
|
|
|
</image>
|
|
|
|
";
|
2004-05-31 17:37:22 +00:00
|
|
|
|
2006-01-20 07:39:29 +00:00
|
|
|
// write news items
|
2004-05-31 17:37:22 +00:00
|
|
|
//
|
2006-01-20 07:39:29 +00:00
|
|
|
$tot = count($project_news);
|
|
|
|
$news = min( $tot, $news);
|
2004-05-31 17:37:22 +00:00
|
|
|
for( $item=0; $item < $news; $item++ ) {
|
2006-01-20 07:39:29 +00:00
|
|
|
$j = $tot - $item;
|
2007-01-03 16:18:43 +00:00
|
|
|
if( count($project_news[$item]) >= 2) {
|
2005-08-30 14:55:17 +00:00
|
|
|
$d = strtotime($project_news[$item][0]);
|
2006-02-18 09:57:43 +00:00
|
|
|
$news_date=gmdate('D, d M Y H:i:s',$d) . ' GMT';
|
2007-07-05 19:37:33 +00:00
|
|
|
$unique_url=URL_BASE."/all_news.php#$j";
|
2007-01-03 16:18:43 +00:00
|
|
|
if (isset($project_news[$item][2])) {
|
|
|
|
$title = strip_tags($project_news[$item][2]);
|
|
|
|
} else {
|
|
|
|
$title = "Project News ".strip_tags($project_news[$item][0]);
|
|
|
|
}
|
2004-10-19 22:12:00 +00:00
|
|
|
echo "<item>
|
2007-01-03 16:18:43 +00:00
|
|
|
<title>".$title."</title>
|
2006-02-22 06:19:54 +00:00
|
|
|
<link>$unique_url</link>
|
|
|
|
<guid isPermaLink=\"true\">$unique_url</guid>
|
2006-12-29 16:22:08 +00:00
|
|
|
<description><![CDATA[".strip_tags($project_news[$item][1])."]]></description>
|
2006-02-18 09:57:43 +00:00
|
|
|
<pubDate>$news_date</pubDate>
|
2004-10-19 22:12:00 +00:00
|
|
|
</item>
|
|
|
|
";
|
2004-05-31 17:37:22 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Close XML content
|
|
|
|
//
|
2004-10-19 22:12:00 +00:00
|
|
|
echo "
|
|
|
|
</channel>
|
|
|
|
</rss>
|
|
|
|
";
|
2004-05-31 17:37:22 +00:00
|
|
|
|
|
|
|
?>
|