changeset 39:876d42d93e5b

Suppression du mode RSS, l'ancienne url pointe maintenant vers le flux Atom. Vu la facon dont est concu RSS, il n'y a pas vraiment moyen pour proprement intégré le XML des posts là dedans... En conséquence, il n'y aura qu'un flux Atom 1.0.
author Franck Deroche <webmaster@defr.org>
date Mon, 05 Nov 2007 14:20:58 +0100
parents 33d1c5a13acd
children 17d9188755b0 8d209692d734
files .htaccess rss.php templates/main.xml
diffstat 3 files changed, 3 insertions(+), 61 deletions(-) [+]
line wrap: on
line diff
--- a/.htaccess	Mon Nov 05 10:48:33 2007 +0100
+++ b/.htaccess	Mon Nov 05 14:20:58 2007 +0100
@@ -1,7 +1,8 @@
 Options +FollowSymlinks
 RewriteEngine on
-RewriteRule ^dualblog.atom$ index.php?outputType=atom
-RewriteRule ^dualblog.rss$ rss.php
+# Kill the RSS version, re-direct to the atom feed
+RewriteRule ^dualblog.rss$ index.php?outputType=atom [L,QSA]
+RewriteRule ^dualblog.atom$ index.php?outputType=atom [L,QSA]
 RewriteRule ^posts/$ index.php [L]
 RewriteRule ^posts/([0-9]+)/([0-9]{1,2})$ index.php?mode=cal&year=$1&month=$2 [L]
 RewriteRule ^posts/([0-9]+)-(.*)$ comment.php?id=$1 [L]
--- a/rss.php	Mon Nov 05 10:48:33 2007 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,58 +0,0 @@
-<?php
-
-include("classes.php");
-
- function utf8_ensure($str) {
-  return seems_utf8($str)?$str:utf8_encode($str);
- }
-  
- function seems_utf8($Str) {
-  for ($i=0; $i<strlen($Str) && $i<150; $i++) {
-   if (ord($Str[$i]) < 0x80) continue; # 0bbbbbbb
-   elseif ((ord($Str[$i]) & 0xE0) == 0xC0) $n=1; # 110bbbbb
-   elseif ((ord($Str[$i]) & 0xF0) == 0xE0) $n=2; # 1110bbbb
-   elseif ((ord($Str[$i]) & 0xF8) == 0xF0) $n=3; # 11110bbb
-   elseif ((ord($Str[$i]) & 0xFC) == 0xF8) $n=4; # 111110bb
-   elseif ((ord($Str[$i]) & 0xFE) == 0xFC) $n=5; # 1111110b
-   else return false; # Does not match any model
-   for ($j=0; $j<$n; $j++) { # n bytes matching 10bbbbbb follow ?
-    if ((++$i == strlen($Str)) || ((ord($Str[$i]) & 0xC0) != 0x80))
-    return false;
-   }
-  }
-  return true;
- }
-
- if(stristr($_SERVER['HTTP_ACCEPT'], "application/rss+xml"))
-	header("Content-Type: application/rss+xml; charset=utf-8");
- else
-	header("Content-Type: text/xml; charset=utf-8");
- echo("<?xml version='1.0' encoding='utf-8'?>\n");
-?>
-<rss version='2.0'>
- <channel>
-  <title>Dual Blog</title>
-  <link>http://www.defr.org/blog/</link>
-  <description>Le blog de DeFr, parlant de tout et de rien ^^;</description>
-  <language>fr-fr</language>
-  <?php
-  $Data = new DataAccess();
-  $Data->Connect();
-  $Data->Query("SELECT * FROM Mess ORDER BY num_mess DESC LIMIT 0, 20");
-  while($val=$Data->GetRow()) {
-   $utf8_Mess=utf8_ensure($val['Message']);
-   $utf8_Titre=utf8_ensure($val['Titre']);
-   $dateRFC=gmdate("r", strtotime($val['DatePost']));
-  echo("
-  <item>
-   <title>{$utf8_Titre}</title>
-   <description><![CDATA[{$utf8_Mess}]]></description>
-   <pubDate>{$dateRFC}</pubDate>
-   <link>http://www.defr.org/blog/posts/{$val['num_mess']}</link>
-  </item>
-  ");
-  }
-  $Data->Close();
-  ?>
- </channel>
-</rss>
--- a/templates/main.xml	Mon Nov 05 10:48:33 2007 +0100
+++ b/templates/main.xml	Mon Nov 05 14:20:58 2007 +0100
@@ -8,7 +8,6 @@
       <link tr:toClone='true' type='text/css' media='screen' />
   </tr:possibleStyleSheets>
   <link rel="alternate" type="application/atom+xml" title="Atom feed" href="/blog/dualblog.atom" />
-  <link rel="alternate" type="application/rss+xml" title="RSS 2.0 feed" href="/blog/dualblog.rss" />
   <link rel="icon" type="image/png" href="/favicon.png" />
   <meta http-equiv='content-type' content='text/html; charset=utf-8' />
   <meta name='author' content='Franck Deroche' />