Tfe

Ongi etorri tfe-ren webgunera...

Old stuff/old_sites/epik/rss.php

(Deskargatu)
<?
header("Content-type: text/xml");
include("include/config.inc.php");
include("include/connect.php");

if (!empty($_SERVER['PATH_INFO']))
{ $chemin = explode('/',($_SERVER['PATH_INFO'])); }

if ($chemin[1] !== "article" and $chemin[1] !== "breves" and $chemin[1] !== "edito") { die; }
$contenu = array();
$query = "SELECT * from $chemin[1] ORDER BY id DESC Limit 10";
$result = mysql_query($query) or die();
while ($row = mysql_fetch_array($result))
{
    $row[1] = preg_replace("  /(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/","$1-$2-$3T$4:$5:$6Z",$row[1]);
    $content = array('id'=>$row[0],'type'=>$row[3],'date' => $row[1], 'posteur' => $row[2] , 'titre' => $row[4] , 'contenu' => $row[5]);
    array_push($contenu,$content);
}




echo "<?xml version=\"1.0\" encoding=\"iso-8859-15\" ?>
<?xml-stylesheet type=\"text/css\" href=\"/css/rss.css\"?>
<rdf:RDF

 xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"
 xmlns:dc=\"http://purl.org/dc/elements/1.1/\"
 xmlns:sy=\"http://purl.org/rss/1.0/modules/syndication/\"
 xmlns:admin=\"http://webns.net/mvcb/\"
 xmlns:cc=\"http://web.resource.org/cc/\"
 xmlns:content=\"http://purl.org/rss/1.0/modules/content/\"
 xmlns=\"http://purl.org/rss/1.0/\">
 
<channel rdf:about=\"http://informatique.epiknet.org/site\"> 
    <title>Informatique $chemin[1]</title>
    <description>RSS</description>
    <link>http://informatique.epiknet.org/site</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://informatique.epiknet.org/site\" />
    
    <items>
    <rdf:Seq>
    ";
foreach($contenu as $key)
{	
    echo "<rdf:li rdf:resource=\"http://informatique.epiknet.org/site/$chemin[1]/".$key['id']."\" />\n";
}    
echo "
    </rdf:Seq>
    </items>
</channel>
";


foreach ($contenu as $key)
{
echo "\n\n<item rdf:about=\"http://informatique.epiknet.org/site/$chemin[1]/".$key['id']."\">
    <title>".html_entity_decode($key['titre'])."</title>
    <link>http://informatique.epiknet.org/site/$chemin[1]/".$key['id']."</link>
    <dc:date>".$key['date']."</dc:date>
    <dc:language>fr</dc:language>
    <dc:creator>".$key['posteur']."</dc:creator>
    <dc:subject>".html_entity_decode($key['titre'])."</dc:subject>
    <description>".html_entity_decode($key['type'])."</description>
    <content:encoded><![CDATA[ ".html_entity_decode($key['contenu'])."]]>
    </content:encoded>
</item>
";
}

echo "
</rdf:RDF>
";    
   

?>