[pLog-svn] r6916 - plog/branches/lifetype-1.2/class/net/xmlrpc

jondaley at devel.lifetype.net jondaley at devel.lifetype.net
Wed Sep 9 16:59:13 EDT 2009


Author: jondaley
Date: 2009-09-09 16:59:13 -0400 (Wed, 09 Sep 2009)
New Revision: 6916

Modified:
   plog/branches/lifetype-1.2/class/net/xmlrpc/xmlrpcserver.class.php
Log:
aha.  I finally figured out why Oscar objected to a fix I made years ago.  There is a bug in addArticle() (fix coming shortly), but when I tried to fix it, Oscar said that xmlrpc posting was working fine...  The trouble is that the xmlrpc post is setting the article with an time zone offset of 0, which happens to exploit the fact that addArticle() doesn't set the timeoffset to the correct value, thus causing all articles posted by the GUI to have the wrong time, if the time offset is non-zero.  I don't know why no one complained about this before.

Modified: plog/branches/lifetype-1.2/class/net/xmlrpc/xmlrpcserver.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/net/xmlrpc/xmlrpcserver.class.php	2009-09-09 18:27:07 UTC (rev 6915)
+++ plog/branches/lifetype-1.2/class/net/xmlrpc/xmlrpcserver.class.php	2009-09-09 20:59:13 UTC (rev 6916)
@@ -96,6 +96,7 @@
             if( !$this->userHasPermission( $userInfo, $blogInfo, "add_post" )) {
                 return new IXR_Error(-1, 'This user does not have enough permissions' );
             }		
+            $blogSettings = $blogInfo->getSettings();
             
             if ($publish) {
                 $status = POST_STATUS_PUBLISHED;
@@ -147,7 +148,7 @@
                 Array( "comments_enabled" => true ) // enable comments
 	            );
             
-            $article->setDate(date("YmdHis"));
+            $article->setDate(date("YmdHis", time()-3600*$blogSettings->getValue('time_offset')));
             
 	            // Get the plugin manager
             $plugMgr =& PluginManager::getPluginManager();
@@ -167,7 +168,6 @@
             $plugMgr->notifyEvent( EVENT_POST_POST_ADD, Array( "article" => &$article ));
             CacheControl::resetBlogCache( $blogid );
             
-            $blogSettings = $blogInfo->getSettings();
             
                 // Add article notifcations if this is specified by the default setting.
             if ($blogSettings->getValue( "default_send_notification" ))
@@ -223,6 +223,7 @@
             if( !$this->userHasPermission( $userInfo, $blogInfo, "add_post" )) {
                 return new IXR_Error(-1, 'This user does not have enough permissions' );
             }
+            $blogSettings = $blogInfo->getSettings();
                 
             $title = $content["title"];
                 
@@ -318,10 +319,10 @@
                 $ar = localtime ( $dateCreated->getTimestamp() );
                 $ar[5] += 1900; $ar[4]++;
                 $localTimeStamp = gmmktime ( $ar[2], $ar[1], $ar[0], $ar[4], $ar[3], $ar[5], $ar[8] );
-                $articleDate = date("YmdHis", $localTimeStamp);
+                $articleDate = date("YmdHis", $localTimeStamp-3600*$blogSettings->getValue('time_offset'));
             } else
             {
-                $articleDate = date("YmdHis");
+                $articleDate = date("YmdHis", time()-3600*$blogSettings->getValue('time_offset'));
             }
                 
             $article->setDate($articleDate);
@@ -345,8 +346,6 @@
                     
             CacheControl::resetBlogCache( $blogid );
                     
-            $blogSettings = $blogInfo->getSettings();
-                    
                 // Add article notifcations if this is specified by the default setting.
             if ($blogSettings->getValue( "default_send_notification" ))
             {



More information about the pLog-svn mailing list