Old stuff/old_sites/appo/rss.php
(Deskargatu)
<? header("Content-type: text/xml"); ?>
<? echo '<?xml version="1.0" encoding="iso-8859-15" ?>'; ?>
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns="http://purl.org/rss/1.0/"
>
<?
include("connect.php");
$contenu = array();
$query = "SELECT * from blog ORDER BY id DESC Limit 10";
$result = mysql_query($query) or die();
while ($row = mysql_fetch_assoc($result))
{
$row['date'] = preg_replace("/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/","$1-$2-$3T$4:$5:$6Z",$row['date']);
$content = array('id'=>$row['id'],'type'=>$row['section'],'date' => $row['date'], 'posteur' => 'appolon' , 'titre' => $row['titre'] , 'contenu' => $row['contenu']);
array_push($contenu,$content);
}
echo "<channel rdf:about=\"http://blog.i-monde.org/blog.php\">
<title>Blog</title>
<description>RSS</description>
<link>http://blog.i-monde.org/blog.php</link>
<dc:language>fr</dc:language>
<dc:creator></dc:creator>
<dc:rights></dc:rights>
<dc:date>2004-06-01T00:00:00Z</dc:date>
<admin:generatorAgent rdf:resource=\"http://blog.i-monde.org/blog.php\" />
<items>
<rdf:Seq>
";
foreach($contenu as $key)
{
ereg("([0-9]{4})\-([0-9]{2})\-([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})Z",$key['date'],$regs);
echo "<rdf:li rdf:resource=\"http://blog.i-monde.org/blog.php?id=$regs[1]/$regs[2]/$regs[3]/".$key['id']."\" />\n";
}
echo "
</rdf:Seq>
</items>
</channel>
";
foreach ($contenu as $key)
{
ereg("([0-9]{4})\-([0-9]{2})\-([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})Z",$key['date'],$regs);
echo "\n
<item rdf:about=\"http://blog.i-monde.org/blog.php?id=$regs[1]/$regs[2]/$regs[3]/".$key['id']."\">
<title>".$key['titre']."</title>
<link>http://blog.i-monde.org/blog.php?id=$regs[1]/$regs[2]/$regs[3]/".$key['id']."</link>
<dc:date>".$key['date']."</dc:date>
<dc:language>fr</dc:language>
<dc:creator>".$key['posteur']."</dc:creator>
<dc:subject>".$key['titre']."</dc:subject>
<description>".$key['type']."</description>
<content:encoded><![CDATA[ ".$key['contenu']."]]>
</content:encoded>
</item>
";
}
echo "
</rdf:RDF>
";
?>