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

Oscar Renalias oscar at renalias.net
Thu Nov 16 07:59:40 GMT 2006


We'll have to verify this with a test case. It can't be that this
method has been broken for so long, as it's used in a few places
throughout the code.

On 11/16/06, jondaley at devel.lifetype.net <jondaley at devel.lifetype.net> wrote:
> 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 );
>
> _______________________________________________
> pLog-svn mailing list
> pLog-svn at devel.lifetype.net
> http://devel.lifetype.net/mailman/listinfo/plog-svn
>


More information about the pLog-svn mailing list