[pLog-svn] r766 - in plog/trunk/class: action/admin dao

oscar at devel.plogworld.net oscar at devel.plogworld.net
Wed Jan 19 20:28:49 GMT 2005


Author: oscar
Date: 2005-01-19 20:28:49 +0000 (Wed, 19 Jan 2005)
New Revision: 766

Modified:
   plog/trunk/class/action/admin/admindeletecommentaction.class.php
   plog/trunk/class/dao/articlecomments.class.php
Log:
fixed a bug

Modified: plog/trunk/class/action/admin/admindeletecommentaction.class.php
===================================================================
--- plog/trunk/class/action/admin/admindeletecommentaction.class.php	2005-01-19 18:51:01 UTC (rev 765)
+++ plog/trunk/class/action/admin/admindeletecommentaction.class.php	2005-01-19 20:28:49 UTC (rev 766)
@@ -38,7 +38,7 @@
 				$this->registerFieldValidator( "commentIds", new ArrayValidator());
 				
 			$view = new AdminPostsListView( $this->_blogInfo );
-			$view->setErrorMessage( $this->_locale->tr("error_deleting_comment"));
+			$view->setErrorMessage( $this->_locale->tr("error_deleting_comments"));
 			$this->setValidationErrorView( $view );			
         }
 		
@@ -86,28 +86,35 @@
             	// fetch the comment
                 $comment = $comments->getPostComment( $this->_articleId, $commentId );
 				
-				// fire the pre-event
-				$this->notifyEvent( EVENT_PRE_COMMENT_DELETE, Array( "comment" => &$comment ));
-				
-            	if( !$comments->deletePostComment( $article->getId(), $commentId ))
-                    $errorMessage .= $this->_locale->pr("error_deleting_comment")." \"".$comment->getTopic()."\"<br/>";
-                else {
-					$totalOk++;
-					if( $totalOk < 2 )
-						$successMessage .= $this->_locale->pr("comment_deleted_ok", $comment->getTopic())."<br/>";
-					else
-						$successMessage = $this->_locale->pr("comments_deleted_ok", $totalOk );
-						
-					// fire the post-event
-					$this->notifyEvent( EVENT_POST_COMMENT_DELETE, Array( "comment" => &$comment ));
-					// clear the cache
-					CacheControl::resetBlogCache( $this->_blogInfo->getId());
+				if( !$comment ) {
+					$errorMessage .= $this->_locale->pr("error_deleting_comment2", $commentId);
 				}
+				else {
+					// fire the pre-event
+					$this->notifyEvent( EVENT_PRE_COMMENT_DELETE, Array( "comment" => &$comment ));
+					
+					if( !$comments->deletePostComment( $article->getId(), $commentId ))
+						$errorMessage .= $this->_locale->pr("error_deleting_comment", $comment->getTopic())."<br/>";
+					else {
+						$totalOk++;
+						if( $totalOk < 2 )
+							$successMessage .= $this->_locale->pr("comment_deleted_ok", $comment->getTopic())."<br/>";
+						else
+							$successMessage = $this->_locale->pr("comments_deleted_ok", $totalOk );
+							
+						// fire the post-event
+						$this->notifyEvent( EVENT_POST_COMMENT_DELETE, Array( "comment" => &$comment ));
+					}
+				}
             }
 
 			// if everything fine, then display the same view again with the feedback
             $this->_view = new AdminArticleCommentsListView( $this->_blogInfo, Array( "article" => $article ));
-			if( $successMessage != "" ) $this->_view->setSuccessMessage( $successMessage );
+			if( $successMessage != "" ) {
+				$this->_view->setSuccessMessage( $successMessage );
+				// clear the cache
+				CacheControl::resetBlogCache( $this->_blogInfo->getId());
+			}
 			if( $errorMessage != "" ) $this->_view->setErrorMessage( $errorMessage );
             $this->setCommonData();
 

Modified: plog/trunk/class/dao/articlecomments.class.php
===================================================================
--- plog/trunk/class/dao/articlecomments.class.php	2005-01-19 18:51:01 UTC (rev 765)
+++ plog/trunk/class/dao/articlecomments.class.php	2005-01-19 20:28:49 UTC (rev 766)
@@ -294,6 +294,9 @@
                           a.blog_id = b.id
                           AND a.id = $articleId";
                 $result = $this->Execute( $query );
+				if( !$result ) 
+					return false;
+				
                 $tmpRow = $result->FetchRow();
                 $blogSettings = Blogs::getBlogSettingsFromField( $tmpRow["settings"] );
                 $this->_blogSettings[$articleId] = $blogSettings;




More information about the pLog-svn mailing list