changeset 37:5eb974b45cb1

Deplacement de la feed atom vers le nouveau code.
author Franck Deroche <webmaster@defr.org>
date Mon, 05 Nov 2007 10:44:07 +0100
parents a6c3716cab6a
children 33d1c5a13acd
files .htaccess atom.php
diffstat 2 files changed, 1 insertions(+), 76 deletions(-) [+]
line wrap: on
line diff
--- a/.htaccess	Mon Nov 05 10:41:27 2007 +0100
+++ b/.htaccess	Mon Nov 05 10:44:07 2007 +0100
@@ -1,6 +1,6 @@
 Options +FollowSymlinks
 RewriteEngine on
-RewriteRule ^dualblog.atom$ atom.php
+RewriteRule ^dualblog.atom$ index.php?outputType=atom
 RewriteRule ^dualblog.rss$ rss.php
 RewriteRule ^posts/$ index.php [L]
 RewriteRule ^posts/([0-9]+)/([0-9]{1,2})$ index.php?mode=cal&year=$1&month=$2 [L]
--- a/atom.php	Mon Nov 05 10:41:27 2007 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,75 +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/atom+xml"))
-	header("Content-Type: application/atom+xml; charset=utf-8");
- else
-	header("Content-Type: application/xml; charset=utf-8");
- echo("<?xml version='1.0' encoding='utf-8'?>\n");
- $Data = new DataAccess();
- $Data->Query("SELECT * FROM Mess ORDER BY num_mess DESC LIMIT 0, 1");
- $val=$Data->GetRow();
- $modifiedDate=gmdate("Y-m-d", strtotime($val['DatePost'])) . "T" . gmdate("H:i:s-02:00", strtotime($val['DatePost']));
-?>
-<feed xmlns="http://www.w3.org/2005/Atom" xml:lang='fr-FR'>
-  <title>Dual Blog</title>
-  <subtitle>Le blog de DeFr, parlant de tout et de rien ^^;</subtitle>
-  <link rel='alternate' type='text/html' href='http://defr.org/blog/' />
-  <link rel='self' type='application/atom+xml' href='http://defr.org/blog/dualblog.atom' />
-  <updated><?php echo $modifiedDate; ?></updated>
-  <author>
-   <name>Deroche Franck</name>
-   <uri>http://defr.org</uri>
-  </author>
-  <id>urn:uuid:cface534-634f-4ce8-a07b-3a4187982583</id>
-  <?php
-
-  $result=$Data->Query("SELECT * FROM Mess ORDER BY num_mess DESC LIMIT 0, 20");
-  while($val=$Data->GetRow()) {
-   $utf8_Mess=str_replace("</P>", "</p>", str_replace("<P>", "<p>", (str_replace("&euro;", "&#x20AC;", utf8_ensure($val['Message'])))));
-   $utf8_Mess = str_replace("&nbsp;", " ", $utf8_Mess);
-   $utf8_Titre=utf8_ensure($val['Titre']);
-   $issuedDate=gmdate("Y-m-d", strtotime($val['DatePost'])) . "T" . gmdate("H:i:s-02:00", strtotime($val['DatePost']));
-  echo("
-  <entry>
-   <title type='xhtml'>
-     <div xmlns='http://www.w3.org/1999/xhtml'>
-     {$utf8_Titre}
-     </div>
-   </title>
-   <id>tag:defr.org,2006:{$val['num_mess']}</id>
-   <content type='xhtml'>
-   	<div xmlns='http://www.w3.org/1999/xhtml'>
-	{$utf8_Mess}
-	</div>
-   </content>
-   <published>{$issuedDate}</published>
-   <updated>{$issuedDate}</updated>
-   <link rel='alternate' type='text/html' href='http://www.defr.org/blog/posts/{$val['id']}' />
-  </entry>
-  ");
-  }
-  ?>
-</feed>