[pLog-svn] r6917 - in plog/branches/lifetype-1.2/class: action/admin net/xmlrpc

jondaley at devel.lifetype.net jondaley at devel.lifetype.net
Wed Sep 9 17:51:45 EDT 2009


Author: jondaley
Date: 2009-09-09 17:51:45 -0400 (Wed, 09 Sep 2009)
New Revision: 6917

Modified:
   plog/branches/lifetype-1.2/class/action/admin/adminaddpostaction.class.php
   plog/branches/lifetype-1.2/class/action/admin/adminpreviewpostaction.class.php
   plog/branches/lifetype-1.2/class/action/admin/adminsavedraftarticleajaxaction.class.php
   plog/branches/lifetype-1.2/class/net/xmlrpc/xmlrpcserver.class.php
Log:
I ended up fixing this another way, so reverting last change the xmlrpc server. He can simply give us the server time, and not call 
setTimeOffset (so it'll default to zero).  Each caller of addArticle($article) should make sure that $article->setDate() (or 
setDateObject(), etc.) is called, and also call setTimeOffset() if the caller is sending in a time that isn't +0 compared to the 
server.




Modified: plog/branches/lifetype-1.2/class/action/admin/adminaddpostaction.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/action/admin/adminaddpostaction.class.php	2009-09-09 20:59:13 UTC (rev 6916)
+++ plog/branches/lifetype-1.2/class/action/admin/adminaddpostaction.class.php	2009-09-09 21:51:45 UTC (rev 6917)
@@ -106,6 +106,8 @@
 									 $this->_postSlug );
 			// set also the date before it's too late
 			$article->setDateObject( $this->_postTimestamp );
+            $blogSettings = $this->_blogInfo->getSettings();
+            $article->setTimeOffset($blogSettings->getValue("time_offset"));
 			$article->setCommentsEnabled( $this->_commentsEnabled );
 			$article->setGlobalCategoryId( $this->_globalArticleCategoryId );
 		

Modified: plog/branches/lifetype-1.2/class/action/admin/adminpreviewpostaction.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/action/admin/adminpreviewpostaction.class.php	2009-09-09 20:59:13 UTC (rev 6916)
+++ plog/branches/lifetype-1.2/class/action/admin/adminpreviewpostaction.class.php	2009-09-09 21:51:45 UTC (rev 6917)
@@ -76,6 +76,8 @@
 			// and a few more properties that we need to know about
 			$this->_fetchPostDateInformation();
 			$article->setDateObject( $this->_postTimestamp );
+            $blogSettings = $this->_blogInfo->getSettings();
+            $article->setTimeOffset($blogSettings->getValue("time_offset"));
 			// we will not allow comments because it wouldn't work!
 			$article->setCommentsEnabled( false );
 			$article->setFields( $this->_getArticleCustomFields());

Modified: plog/branches/lifetype-1.2/class/action/admin/adminsavedraftarticleajaxaction.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/action/admin/adminsavedraftarticleajaxaction.class.php	2009-09-09 20:59:13 UTC (rev 6916)
+++ plog/branches/lifetype-1.2/class/action/admin/adminsavedraftarticleajaxaction.class.php	2009-09-09 21:51:45 UTC (rev 6917)
@@ -36,6 +36,8 @@
                                      $this->_blogInfo->getId(), $status, 0, Array(), $this->_postSlug );
             // set also the date before it's too late
             $article->setDateObject( $this->_postTimestamp );
+            $blogSettings = $this->_blogInfo->getSettings();
+            $article->setTimeOffset($blogSettings->getValue("time_offset"));
             $article->setCommentsEnabled( $this->_commentsEnabled );
             // prepare the custom fields
             $fields = Array();

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 20:59:13 UTC (rev 6916)
+++ plog/branches/lifetype-1.2/class/net/xmlrpc/xmlrpcserver.class.php	2009-09-09 21:51:45 UTC (rev 6917)
@@ -96,7 +96,6 @@
             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;
@@ -148,7 +147,7 @@
                 Array( "comments_enabled" => true ) // enable comments
 	            );
             
-            $article->setDate(date("YmdHis", time()-3600*$blogSettings->getValue('time_offset')));
+            $article->setDate(date("YmdHis"));
             
 	            // Get the plugin manager
             $plugMgr =& PluginManager::getPluginManager();
@@ -168,6 +167,7 @@
             $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,7 +223,6 @@
             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"];
                 
@@ -319,10 +318,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-3600*$blogSettings->getValue('time_offset'));
+                $articleDate = date("YmdHis", $localTimeStamp);
             } else
             {
-                $articleDate = date("YmdHis", time()-3600*$blogSettings->getValue('time_offset'));
+                $articleDate = date("YmdHis");
             }
                 
             $article->setDate($articleDate);
@@ -346,6 +345,8 @@
                     
             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