Show rss.php syntax highlighted
<?php
if (isset($_REQUEST['items'])){ $items=$_REQUEST['items']; }else{$items=25;}
include_once("admin/logged.php");
$rss_channelVersion="0.92";
$rss_channelTitle="AllToAvi";
$rss_channelDescription="Latest news for AllToAvi";
$newsFile="admin/".$NEWS_FILENAME;
$rss_channelLink="http://alltoavi.sourceforge.net";
$rss_channelCopyright="Copyrighted 2005-".date("Y")." by AllToAvi developpers";
$rss_channelManageEditor="no@mail.com";
$rss_channelWebmaster="no@mail.com";
//Sets the XML encoding
header("Content-type: application/xhtml+xml");
echo "<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>\n";
//RSS uses the same news get out of newspage.php in wos versie 3
echo "<rss version=\"".$rss_channelVersion."\">\n"; //Initlize version
echo "<channel>\n"; //Creates the channel
echo "<title>".$rss_channelTitle."</title>\n"; //Title
echo "<link>".$rss_channelLink."</link>\n"; //Link
echo "<description>".$rss_channelDescription."</description>\n"; //Description
echo "<language>".$rss_channelLanguage."</language>\n"; //Language
echo "<copyright>".$rss_channelCopyright."</copyright>\n"; //Copyrighted
echo "<managingEditor>".$rss_channelManageEditor."</managingEditor>\n"; //ManagingEditor
echo "<webMaster>".$rss_channelWebmaster."</webMaster>\n"; //Webmaster
/* //Image
echo "<image>";
echo "<title>WriteTheWeb</title>";
echo "<url>http://writetheweb.com/images/mynetscape88.gif</url>";
echo "<link>http://writetheweb.com</link>";
echo "<width>88</width>";
echo "<height>31</height>";
echo "<description>News for web users that write back</description>";
echo "</image>";
*/
//--Get news out of the news file an put it as items
if (file_exists($newsFile)) {
$open=fopen($newsFile,"r"); //Open in read modus
if ($open) {
$newsLines=file($newsFile); //Each CR Carriage Return is a new array element
$newsLinesCounted=count($newsLines); //Get the newslines count
//Calculate show untill news
if ($items<$newsLinesCounted) {
$untill=$newsLinesCounted-$items;
}else{
$untill=0;
}
for ($n=$newsLinesCounted-2; $n>$untill; $n--) {
$con=split("\t",$newsLines[$n]);
$wroteBy=$con[0];
$date=$con[1];
$time=$con[2];
$gmt=$con[3];
$title=$con[4];
$news=$con[5];
$title=str_replace("<","<",$title);
$title=str_replace(">",">",$title);
$news=str_replace("<","<",$news);
$news=str_replace(">",">",$news);
$rss_ItemTitle=$title;
$rss_ItemLink="http://alltoavi.sourceforge.net?id=".str_replace(" ","-",$date).str_replace(" ","_",$time);
$rss_ItemDescription=str_replace(" ","-",$date)."<br />\n".$news;
echo "<item>\n";
echo "<title>".$title."</title>\n";
echo "<link>".$rss_ItemLink."</link>\n";
echo "<description>".$rss_ItemDescription."</description>\n";
echo "</item>\n";
}
}else{
//Error file open
echo "Error, file could not be openend.<br>Please be patient and try after a few more minutes.<br>It can also be a bug, please mail the webmaster about it.";
}
}else{
//File could not be located
echo "File didn't exist. <br>Please be patient and try after a few more minutes.<br>It can also be a bug, please mail the webmaster about it.";
}
//Close the channel and rss
echo "</channel>\n</rss>";
?>
See more files for this project here