[pLog-svn] r4304 - plog/branches/lifetype-1.1.3/class/dao

jondaley at devel.lifetype.net jondaley at devel.lifetype.net
Thu Nov 16 03:47:59 GMT 2006


Author: jondaley
Date: 2006-11-16 03:47:57 +0000 (Thu, 16 Nov 2006)
New Revision: 4304

Modified:
   plog/branches/lifetype-1.1.3/class/dao/commentscommon.class.php
Log:
this can't be doing what it was supposed to be doing, can it?  if the status was COMMENT_STATUS_SPAM, getNumComments used to return all of the comment data?! 

Modified: plog/branches/lifetype-1.1.3/class/dao/commentscommon.class.php
===================================================================
--- plog/branches/lifetype-1.1.3/class/dao/commentscommon.class.php	2006-11-16 02:00:54 UTC (rev 4303)
+++ plog/branches/lifetype-1.1.3/class/dao/commentscommon.class.php	2006-11-16 03:47:57 UTC (rev 4304)
@@ -179,28 +179,39 @@
         	$numComments = 0;
 			$articles = new Articles();
 			$article = $articles->getArticle( $artId );        	
-        
+            
+            if(!$article)
+                return 0;
+            
 			if( $type == COMMENT_TYPE_COMMENT ) {
-				if( $status == COMMENT_STATUS_ALL && $article ) {
+				if( $status == COMMENT_STATUS_ALL ) {
 					$numComments = $article->getTotalComments();
 				}
-				elseif( $status == COMMENT_STATUS_NONSPAM && $article ) {
+				elseif( $status == COMMENT_STATUS_NONSPAM ) {
 					$numComments = $article->getNumComments();
 				}
+				elseif( $status == COMMENT_STATUS_SPAM ) {
+					$numComments = $article->getTotalComments() - $article->getNumComments();
+				}
 				else {
-					$numComments = $this->getPostComments( $artId, COMMENT_ORDER_NEWEST_FIRST, $status, $type );
+//					$numComments = $this->getPostComments( $artId, COMMENT_ORDER_NEWEST_FIRST, $status, $type );
+                    $numComments = 0;
 				}
 			}
 			else {
-				if( $status == COMMENT_STATUS_ALL && $article ) {
+				if( $status == COMMENT_STATUS_ALL ) {
 					$numComments = $article->getTotalTrackBacks();
 				}
-				elseif( $status == COMMENT_STATUS_NONSPAM && $article ) {
+				elseif( $status == COMMENT_STATUS_NONSPAM ) {
 					$numComments = $article->getNumTrackBacks();
 				}
+				elseif( $status == COMMENT_STATUS_SPAM ) {
+					$numComments = $article->getTotalTrackbacks() - $article->getNumTrackbacks();
+				}
 				else {
-					$numComments = $this->getPostComments( $artId, COMMENT_ORDER_NEWEST_FIRST, $status, $type );
-				}			
+//					$numComments = $this->getPostComments( $artId, COMMENT_ORDER_NEWEST_FIRST, $status, $type );
+                    $numComments = 0;
+				}
 			}
 			
 			return( $numComments );



More information about the pLog-svn mailing list