[pLog-svn] r5382 - plog/branches/lifetype-1.2/class/action/admin

jondaley at devel.lifetype.net jondaley at devel.lifetype.net
Sun May 6 21:46:26 EDT 2007


Author: jondaley
Date: 2007-05-06 21:46:26 -0400 (Sun, 06 May 2007)
New Revision: 5382

Modified:
   plog/branches/lifetype-1.2/class/action/admin/adminupdatepostaction.class.php
Log:
debugging why I was getting double trackbacks posted on a blog, but it turned out to be a template error (they had included the <!- postTrackbackLink --> stuff twice in their template.  So these changes are just comments and making stuff fit in 80 columns

Modified: plog/branches/lifetype-1.2/class/action/admin/adminupdatepostaction.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/action/admin/adminupdatepostaction.class.php	2007-05-07 01:33:05 UTC (rev 5381)
+++ plog/branches/lifetype-1.2/class/action/admin/adminupdatepostaction.class.php	2007-05-07 01:46:26 UTC (rev 5382)
@@ -172,42 +172,56 @@
             	}
         	}
 			
-			// if the "send xmlrpc pings" checkbox was enabled, do something about it...
+                // only send trackbacks and xmlrpc pings
+                // when a post is "published"
 			if( $post->getStatus() == POST_STATUS_PUBLISHED ) {
 				// get the links from the text of the post
-				$postLinks = StringUtils::getLinks( stripslashes($post->getText()));
+                $postLinks = StringUtils::getLinks(
+                    stripslashes($post->getText()));
 
                 // get the real trackback links from trackbackUrls
                 $trackbackLinks = Array();
                 foreach(explode( "\r\n", $this->_trackbackUrls ) as $host ) {
                 	trim($host);
-                	if( $host != "" && $host != "\r\n" && $host != "\r" && $host != "\n" )
+                	if( $host != "" && $host != "\r\n" &&
+                        $host != "\r" && $host != "\n" )
+                    {
                     	array_push( $trackbackLinks, $host );
+                    }
                 }
 				
-				if( $this->_sendPings ) {
+                    // if the "send xmlrpc pings" checkbox was enabled,
+                    // do something about it...
+                if( $this->_sendPings ) {
                     $t = new Timestamp();
                     $today = $t->getTimestamp();
                     if($today > $post->getDate()){
                         $message .= "<br/><br/>".$this->sendXmlRpcPings();
                     }
 				}				
-				// and now check what to do with the trackbacks
-				if( $this->_sendTrackbacks ) {					
-					// if no links, there is nothing to do
-					if( count($postLinks) == 0 && count($trackbackLinks) == 0 ) {
-						$this->_view = new AdminPostsListView( $this->_blogInfo );
-		                $this->_view->setErrorMessage( $this->_locale->tr("error_no_trackback_links_sent"));
-					}
-					else {
-						$this->_view = new AdminTemplatedView( $this->_blogInfo, "sendtrackbacks" );
-						// get the links from the text of the post
-						$this->_view->setValue( "post", $post );
-						$this->_view->setValue( "postLinks", $postLinks );
-						$this->_view->setValue( "trackbackLinks", $trackbackLinks );
-					}
-				}
-			}
+                    // and now check what to do with the trackbacks
+                if( $this->_sendTrackbacks ) {
+                        // if no links, there is nothing to do
+                    if( count($postLinks) == 0 &&
+                        count($trackbackLinks) == 0 )
+                    {
+                        $this->_view = new AdminPostsListView(
+                            $this->_blogInfo );
+                        $this->_view->setErrorMessage(
+                            $this->_locale->tr(
+                                "error_no_trackback_links_sent"));
+                    }
+                    else {
+                        $this->_view = new AdminTemplatedView(
+                            $this->_blogInfo, "sendtrackbacks" );
+                            // get the links from the text of the post
+                        $this->_view->setValue( "post", $post );
+                        $this->_view->setValue( "postLinks", $postLinks );
+                        $this->_view->setValue( "trackbackLinks",
+                                                $trackbackLinks );
+                    }
+                }
+            }
 
         	// show the message
         	$this->_view->setSuccessMessage( $message );



More information about the pLog-svn mailing list