[pLog-svn] r2202 - plog/trunk/class/dao

ork at devel.plogworld.net ork at devel.plogworld.net
Sat Jun 11 22:11:29 GMT 2005


Author: ork
Date: 2005-06-11 22:11:28 +0000 (Sat, 11 Jun 2005)
New Revision: 2202

Modified:
   plog/trunk/class/dao/blogs.class.php
Log:
used generic buildSelectQuery syntax


Modified: plog/trunk/class/dao/blogs.class.php
===================================================================
--- plog/trunk/class/dao/blogs.class.php	2005-06-11 22:05:53 UTC (rev 2201)
+++ plog/trunk/class/dao/blogs.class.php	2005-06-11 22:11:28 UTC (rev 2202)
@@ -410,18 +410,26 @@
           * is sorted by the blog identifier, so that $blogs[$blogId] will give us the information
           * of the blog with $blogId as its identifier.
           */
-         function getAllBlogs( $status = BLOG_STATUS_ALL, $searchTerms = "", $page = -1, $itemsPerPage = DEFAULT_ITEMS_PER_PAGE )
+         function getAllBlogs( $status = BLOG_STATUS_ALL, 
+                               $searchTerms = "", 
+                               $page = -1, 
+                               $itemsPerPage = DEFAULT_ITEMS_PER_PAGE )
          {
             require_once( PLOG_CLASS_PATH . 'class/database/db.class.php' );
 
+            $whereConditions = array();
+
             if( $status != BLOG_STATUS_ALL )
-                $whereStatus = "status = '".Db::qstr($status)."'";
+                $whereConditions['status'] = $status;
+
             if( $searchTerms != "" )
-                $whereSearch = $this->buildSearchCondition( $searchTerms );
-                
-            $where = $this->buildWhereCondition( Array( $whereStatus, $whereSearch ));
+                $whereConditions['blog'] = "~" . $searchTerms;
 
-            $query = "SELECT * FROM ".$this->getPrefix()."blogs $where ORDER BY blog $limits";
+            $query = Db::buildSelectQuery( BLOGS_TABLENAME,
+                                           array(),
+                                           $whereConditions,
+                                           null,
+                                           'blog' );
 
             $result = $this->Execute( $query, $page, $itemsPerPage );
 




More information about the pLog-svn mailing list