changeset 33:c6508503269a

Possibilité d'avoir les dates en ISO 8601, requis par Atom.
author Franck Deroche <webmaster@defr.org>
date Mon, 05 Nov 2007 09:23:40 +0100
parents 4cea8b128fdd
children efba519d2d32
files comment.php includes/class.post.php templates/commentAtom.xml templates/postAtom.xml
diffstat 4 files changed, 11 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/comment.php	Mon Nov 05 09:06:46 2007 +0100
+++ b/comment.php	Mon Nov 05 09:23:40 2007 +0100
@@ -49,6 +49,7 @@
       while(0 !== ($row = $Data->GetRow())) {
 	    $commentTpl = new Template(Skeleton::getTemplateFile('comment'));
         $dateFormatee = strftime(" à %Hh%M le <span class='Date'>%A %d %B %Y</span>", strtotime($row['DateComment']));
+        $dateFormateeISO = date('c', strtotime($row['DateComment']));
         $AdresseMail = $row['AdresseMail'];
         $grav_id = md5($AdresseMail);
         $grav_url = 'http://www.gravatar.com/avatar.php?gravatar_id=' . $grav_id . '&size=50&default=' . $defaultGravatar;
@@ -62,6 +63,7 @@
 		  '#auteur@name' => 'c' . $row['num_comm'],
 		  '#auteur' => $row['Auteur'],
 		  'commentDate' => $dateFormatee,
+		  'commentDateISO' => $dateFormateeISO,
 		  'commentNumber' => $row['num_comm'],
 		  'comment' => $commentFrag,
 	    );
--- a/includes/class.post.php	Mon Nov 05 09:06:46 2007 +0100
+++ b/includes/class.post.php	Mon Nov 05 09:23:40 2007 +0100
@@ -3,7 +3,7 @@
   private $tpl;
   private $infos;
   private $mess;
-  private $dateFormatee;
+  private $dateFormatee = array();
   private $url;
   private $commentLabel;
   private $mood;
@@ -25,7 +25,8 @@
     
     // Formatage de la date
     $time = strtotime($infos['DatePost']);
-    $this->dateFormatee = strftime("%A %d %B %Y, %Hh%M", $time);
+    $this->dateFormatee['human'] = strftime("%A %d %B %Y, %Hh%M", $time);
+    $this->dateFormatee['iso']   = date("c", $time);
     
     // On détermine l'url de ce post
     $strippedTitle = TextUtils::StripTitle($infos['Titre']);
@@ -74,7 +75,8 @@
     $params = array(
         '#post@class' => 'PostContent ' . $this->infos->Emot,
         'postTitle' => $this->infos->Titre,
-        'postDate' => $this->dateFormatee,
+        'postDate' => $this->dateFormatee['human'],
+        'postDateISO' => $this->dateFormatee['iso'],
         'postContent' => $this->mess,
         'postNumber' => $this->infos->num_mess,
         'postComments' => $this->commentLabel,
--- a/templates/commentAtom.xml	Mon Nov 05 09:06:46 2007 +0100
+++ b/templates/commentAtom.xml	Mon Nov 05 09:23:40 2007 +0100
@@ -10,7 +10,7 @@
 	  <tr:comment />
 	</div>
    </content>
-   <published><tr:dateComment /></published>
-   <updated><tr:dateComment /></updated>
+   <published><tr:commentDateISO /></published>
+   <updated><tr:commentDateISO /></updated>
    <link tr:id='linkPostNumber' rel='alternate' type='text/html' />
 </entry>
--- a/templates/postAtom.xml	Mon Nov 05 09:06:46 2007 +0100
+++ b/templates/postAtom.xml	Mon Nov 05 09:23:40 2007 +0100
@@ -11,7 +11,7 @@
 	  <tr:postContent />
 	</div>
    </content>
-   <published><tr:postDate /></published>
-   <updated><tr:postDate /></updated>
+   <published><tr:postDateISO /></published>
+   <updated><tr:postDateISO /></updated>
    <link tr:id='linkPostNumber' rel='alternate' type='text/html' />
 </entry>