[pLog-svn] r2414 - in plog/branches/plog-1.0.2: class/locale templates/rss

pwestbro at devel.plogworld.net pwestbro at devel.plogworld.net
Thu Aug 18 21:12:49 GMT 2005


Author: pwestbro
Date: 2005-08-18 21:12:48 +0000 (Thu, 18 Aug 2005)
New Revision: 2414

Modified:
   plog/branches/plog-1.0.2/class/locale/locale.class.php
   plog/branches/plog-1.0.2/templates/rss/atom.template
   plog/branches/plog-1.0.2/templates/rss/rss090.template
   plog/branches/plog-1.0.2/templates/rss/rss20.template
Log:
Fixed  part of bug http://bugs.plogworld.net/view.php?id=442

Now rss 2.0, rss 0.90 and atom feeds that report the dates as GMT will
correcly remove the offset that had been added to the timestamp.  This will
allow the time of the post to be reported correctly in GMT.


A following checkin will allow the dates to be specified in local time, and
the correct time zone offset will be calculated.


Modified: plog/branches/plog-1.0.2/class/locale/locale.class.php
===================================================================
--- plog/branches/plog-1.0.2/class/locale/locale.class.php	2005-08-18 11:35:08 UTC (rev 2413)
+++ plog/branches/plog-1.0.2/class/locale/locale.class.php	2005-08-18 21:12:48 UTC (rev 2414)
@@ -568,12 +568,29 @@
          * <li>%D	cardinal representation of the day</li>
          * </ul>
 		 */
-        function formatDateGMT( $timeStamp, $format = null )
+        function formatDateGMT( $timeStamp, $format = null, $blog = null )
         {
             // load the file if it hadn't been loaded yet       
             if( !is_array($this->_messages))
                 $this->_loadLocaleFile();       
         
+            if ( $blog ) {
+                //
+                // The blog was specified.  Use it to get the time offset
+                //
+                $timeDiff = 0;
+                if( $this->_blogInfo == null ) {
+                    $blogSettings = $blog->getSettings();
+                    $timeDiff = $blogSettings->getValue( 'time_offset' );
+                    $timeDiff *= -1;
+                }
+                
+                if( $timeDiff > 0 )
+                    $timeStamp->addSeconds( $timeDiff * 3600 );
+                else
+                    $timeStamp->subtractSeconds( $timeDiff * (-3600));
+            
+            }
             // Convert this timestamp to on that is in GMT
             $strTimeStamp = $timeStamp->getTimestamp();
             // Now have a local time stamp 

Modified: plog/branches/plog-1.0.2/templates/rss/atom.template
===================================================================
--- plog/branches/plog-1.0.2/templates/rss/atom.template	2005-08-18 11:35:08 UTC (rev 2413)
+++ plog/branches/plog-1.0.2/templates/rss/atom.template	2005-08-18 21:12:48 UTC (rev 2414)
@@ -3,7 +3,7 @@
 <title>{$blog->getBlog()|escape}</title> 
 <link rel="alternate" type="text/html" href="{$url->blogLink()}" /> 
 {assign var="newestDate" value=$posts[0]->getDateObject()} 
-<modified>{$locale->formatDateGMT($newestDate, "%Y-%m-%dT%H:%M:%S-00:00")}</modified> 
+<modified>{$locale->formatDateGMT($newestDate, "%Y-%m-%dT%H:%M:%S-00:00", $blog)}</modified> 
 <tagline>{$blog->getAbout()|escape}</tagline> 
 <generator url="http://www.plogworld.net/" version="1.0.1">pLog</generator> 
 {assign var="blogOwner" value=$posts[0]->getUserInfo()} 
@@ -14,9 +14,9 @@
  <title>{$post->getTopic()|escape}</title> 
  <link rel="alternate" type="text/html" href="{$url->postPermalink($post)}" /> 
  {assign var="postDate" value=$post->getDateObject()} 
- <modified>{$locale->formatDateGMT($postDate, "%Y-%m-%dT%H:%M:%S-00:00")}</modified> 
- <issued>{$locale->formatDateGMT($postDate, "%Y-%m-%dT%H:%M:%S-00:00")}</issued> 
- <created>{$locale->formatDateGMT($postDate, "%Y-%m-%dT%H:%M:%S-00:00")}</created> 
+ <modified>{$locale->formatDateGMT($postDate, "%Y-%m-%dT%H:%M:%S-00:00", $blog)}</modified> 
+ <issued>{$locale->formatDateGMT($postDate, "%Y-%m-%dT%H:%M:%S-00:00", $blog)}</issued> 
+ <created>{$locale->formatDateGMT($postDate, "%Y-%m-%dT%H:%M:%S-00:00", $blog)}</created> 
  <summary type="text/plain">{$post->getText()|strip_tags|truncate:200:" ..."|escape:"html"}</summary> 
  <author> 
  {assign var="postOwner" value=$post->getUserInfo()} 

Modified: plog/branches/plog-1.0.2/templates/rss/rss090.template
===================================================================
--- plog/branches/plog-1.0.2/templates/rss/rss090.template	2005-08-18 11:35:08 UTC (rev 2413)
+++ plog/branches/plog-1.0.2/templates/rss/rss090.template	2005-08-18 21:12:48 UTC (rev 2414)
@@ -16,7 +16,7 @@
    <description>{$post->getText()|escape}</description>
    <link>{$url->postPermalink($post)}</link>
    {assign var="postDate" value=$post->getDateObject()}
-   <pubDate>{$locale->formatDateGMT($postDate, "%a, %d %b %Y %H:%M:%S GMT")}</pubDate>   
+   <pubDate>{$locale->formatDateGMT($postDate, "%a, %d %b %Y %H:%M:%S GMT", $blog)}</pubDate>   
   </item>
   {/foreach}
 </rdf:RDF>

Modified: plog/branches/plog-1.0.2/templates/rss/rss20.template
===================================================================
--- plog/branches/plog-1.0.2/templates/rss/rss20.template	2005-08-18 11:35:08 UTC (rev 2413)
+++ plog/branches/plog-1.0.2/templates/rss/rss20.template	2005-08-18 21:12:48 UTC (rev 2414)
@@ -26,7 +26,7 @@
     <category>{$category->getName()|escape}</category>
    {/foreach}
    {assign var="postDate" value=$post->getDateObject()}
-   <pubDate>{$locale->formatDateGMT($postDate, "%a, %d %b %Y %H:%M:%S GMT")}</pubDate>
+   <pubDate>{$locale->formatDateGMT($postDate, "%a, %d %b %Y %H:%M:%S GMT", $blog)}</pubDate>
    <source url="{$url->rssLink("rss20")}">{$blog->getBlog()|escape}</source>
    {foreach from=$post->getArticleResources() item=resource}
     {** please uncomment the line below if you'd like to server everything but images, instead of




More information about the pLog-svn mailing list