[pLog-svn] r4270 - plugins/branches/lifetype-1.1/topcommentposts
jondaley at devel.lifetype.net
jondaley at devel.lifetype.net
Wed Nov 8 05:22:52 GMT 2006
Author: jondaley
Date: 2006-11-08 05:22:51 +0000 (Wed, 08 Nov 2006)
New Revision: 4270
Modified:
plugins/branches/lifetype-1.1/topcommentposts/plugintopcommentposts.class.php
Log:
now really updated to 1.1
Modified: plugins/branches/lifetype-1.1/topcommentposts/plugintopcommentposts.class.php
===================================================================
--- plugins/branches/lifetype-1.1/topcommentposts/plugintopcommentposts.class.php 2006-11-08 05:18:15 UTC (rev 4269)
+++ plugins/branches/lifetype-1.1/topcommentposts/plugintopcommentposts.class.php 2006-11-08 05:22:51 UTC (rev 4270)
@@ -61,19 +61,12 @@
$comments = new ArticleComments();
$blogId = $this->blogInfo->getId();
- if ($based == 'BLOG') {
- $query = "SELECT ".$this->prefix."articles_comments.article_id,count(".$this->prefix."articles_comments.article_id) as comment_count";
- $query .= " FROM ".$this->prefix."articles_comments, ".$this->prefix."articles";
- $query .= " WHERE ".$this->prefix."articles_comments.article_id = ".$this->prefix."articles.id AND ".$this->prefix."articles.blog_id = ".$blogId." AND ".$this->prefix."articles.status = 1 AND ".$this->prefix."articles_comments.status = 0";
- $query .= " GROUP BY ".$this->prefix."articles_comments.article_id ORDER BY comment_count DESC";
- } elseif ($based == 'SITE') {
- $query = "SELECT ".$this->prefix."articles_comments.article_id,count(".$this->prefix."articles_comments.article_id) as comment_count";
- $query .= " FROM ".$this->prefix."articles_comments, ".$this->prefix."articles";
- $query .= " WHERE ".$this->prefix."articles_comments.article_id = ".$this->prefix."articles.id AND ".$this->prefix."articles.status = 1 AND ".$this->prefix."articles_comments.status = 0";
- $query .= " GROUP BY ".$this->prefix."articles_comments.article_id ORDER BY comment_count DESC";
- } else {
- return false;
- }
+ $query = "SELECT id, num_nonspam_comments ".
+ "FROM ".$this->prefix."articles WHERE ";
+ if ($based == 'BLOG')
+ $query .= "blog_id='".$blogId."' ";
+ $query .= "AND status=1 AND num_nonspam_comments != 0 ".
+ "ORDER BY num_nonspam_comments DESC";
if( $maxPosts > 0 )
{
@@ -90,7 +83,7 @@
$topcommentposts = Array();
while( $row = $result->FetchRow()) {
- $article = $this->getArticle($row["article_id"]);
+ $article = $this->getArticle($row["id"]);
array_push( $topcommentposts, $article);
}
More information about the pLog-svn
mailing list