[pLog-svn] r2960 - plog/trunk/class/dao
oscar at devel.lifetype.net
oscar at devel.lifetype.net
Thu Feb 16 18:06:30 GMT 2006
Author: oscar
Date: 2006-02-16 18:06:29 +0000 (Thu, 16 Feb 2006)
New Revision: 2960
Modified:
plog/trunk/class/dao/commentscommon.class.php
Log:
search terms were not being taken into account when generating the number of comments a blog has
Modified: plog/trunk/class/dao/commentscommon.class.php
===================================================================
--- plog/trunk/class/dao/commentscommon.class.php 2006-02-16 17:55:04 UTC (rev 2959)
+++ plog/trunk/class/dao/commentscommon.class.php 2006-02-16 18:06:29 UTC (rev 2960)
@@ -216,7 +216,7 @@
*/
function getNumBlogComments( $blogId, $status = COMMENT_STATUS_ALL, $type = COMMENT_TYPE_ANY, $searchTerms = "" )
{
- if( $status == COMMENT_STATUS_ALL && $type != COMMENT_TYPE_ANY ) {
+ if( $status == COMMENT_STATUS_ALL && $type != COMMENT_TYPE_ANY && $searchTerms == "" ) {
// fast case, we can load the blog and query one of its intrinsic fields
include_once( PLOG_CLASS_PATH."class/dao/blogs.class.php" );
$blogs = new Blogs();
@@ -233,14 +233,16 @@
else {
// create the table name
$prefix = $this->getPrefix();
- $table = "{$prefix}articles_comments";
+ $table = "{$prefix}articles_comments c";
// and the condition if any...
- $cond = "blog_id = '".Db::qstr($blogId)."'";
+ $cond = "c.blog_id = '".Db::qstr($blogId)."'";
if( $status != COMMENT_STATUS_ALL )
- $cond .= " AND status = '".Db::qstr($status)."'";
+ $cond .= " AND c.status = '".Db::qstr($status)."'";
if( $type != COMMENT_TYPE_ANY )
- $cond .= " AND type = '".Db::qstr($type)."'";
- //print("type = ".$type." - cond = $cond");
+ $cond .= " AND c.type = '".Db::qstr($type)."'";
+ if( $searchTerms != "" )
+ $cond .= " AND ".$this->getSearchConditions( $searchTerms );
+ //print("type = ".$type." - cond = $cond");
$numComments = $this->getNumItems( $table, $cond );
}
@@ -496,4 +498,4 @@
return( $where_string );
}
}
-?>
\ No newline at end of file
+?>
More information about the pLog-svn
mailing list