[pLog-svn] r5713 - plog/branches/lifetype-1.2/class/dao

oscar at devel.lifetype.net oscar at devel.lifetype.net
Tue Jul 24 15:10:00 EDT 2007


Author: oscar
Date: 2007-07-24 15:10:00 -0400 (Tue, 24 Jul 2007)
New Revision: 5713

Modified:
   plog/branches/lifetype-1.2/class/dao/blogs.class.php
Log:
Fixed issue http://bugs.lifetype.net/view.php?id=1359 -- incorrect SQL query being generated when calling Blogs::getAllBlogs() with "BLOG_STATUS_ALL" as the blog status and a blog category id.


Modified: plog/branches/lifetype-1.2/class/dao/blogs.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/dao/blogs.class.php	2007-07-24 18:06:48 UTC (rev 5712)
+++ plog/branches/lifetype-1.2/class/dao/blogs.class.php	2007-07-24 19:10:00 UTC (rev 5713)
@@ -214,8 +214,11 @@
                 $statusCond = "status = '".Db::qstr($status)."'";
 			$where = $statusCond;
 			
-			if( $blogCategoryId != ALL_BLOG_CATEGORIES )
-				$where .= " AND blog_category_id = '".Db::qstr($blogCategoryId)."'";
+			if( $blogCategoryId != ALL_BLOG_CATEGORIES ) {
+				if( $where != "" ) 
+					$where .= " AND ";
+				$where .= " blog_category_id = '".Db::qstr($blogCategoryId)."'";
+			}
 
 			$searchCond = "";
 			if( $searchTerms != "" ){
@@ -226,7 +229,7 @@
             }
 				
 			if( $where != "" )
-				$where = " WHERE $where";
+				$where = " WHERE $where";			
 
             $query = "SELECT * FROM ".$this->getPrefix()."blogs $where ORDER BY id DESC";
 



More information about the pLog-svn mailing list