[pLog-svn] r5304 - in plog/branches/lifetype-1.2/class: dao gallery/dao

jondaley at devel.lifetype.net jondaley at devel.lifetype.net
Fri Apr 13 18:25:17 EDT 2007


Author: jondaley
Date: 2007-04-13 18:25:17 -0400 (Fri, 13 Apr 2007)
New Revision: 5304

Modified:
   plog/branches/lifetype-1.2/class/dao/searchengine.class.php
   plog/branches/lifetype-1.2/class/gallery/dao/galleryalbums.class.php
   plog/branches/lifetype-1.2/class/gallery/dao/galleryresources.class.php
Log:
I believe I fixed http://bugs.lifetype.net/view.php?id=1278 though I get the search terms displayed as don''t, must be getting double-escaped somewhere, I'll look for that too

Modified: plog/branches/lifetype-1.2/class/dao/searchengine.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/dao/searchengine.class.php	2007-04-12 21:14:07 UTC (rev 5303)
+++ plog/branches/lifetype-1.2/class/dao/searchengine.class.php	2007-04-13 22:25:17 UTC (rev 5304)
@@ -97,12 +97,12 @@
 			if( $db->isFullTextSupported()) {
 				$query = "(SELECT a.* FROM {$prefix}articles a 
 						  INNER JOIN {$prefix}articles_text at ON a.id = at.article_id
-				          WHERE MATCH(at.normalized_text, at.normalized_topic) AGAINST ('{$searchTerms}' IN BOOLEAN MODE) 
+				          WHERE MATCH(at.normalized_text, at.normalized_topic) AGAINST ('".Db::qstr($searchTerms)."' IN BOOLEAN MODE) 
 				          {$conds})
 					 	  UNION
 						  (SELECT a.* FROM {$prefix}articles a 
 						  INNER JOIN {$prefix}custom_fields_values cfv ON a.id = cfv.article_id
-						  WHERE MATCH(cfv.normalized_value) AGAINST ('{$searchTerms}' IN BOOLEAN MODE) 
+						  WHERE MATCH(cfv.normalized_value) AGAINST ('".Db::qstr($searchTerms)."' IN BOOLEAN MODE) 
 						  {$conds})
 						  ORDER BY date DESC";
 			}
@@ -162,12 +162,12 @@
 				// faster path via the fulltext indexes
 				$query = "(SELECT COUNT(a.id) AS total FROM {$prefix}articles a 
 						  INNER JOIN {$prefix}articles_text at ON a.id = at.article_id
-				          WHERE MATCH(at.normalized_text, at.normalized_topic) AGAINST ('{$searchTerms}' IN BOOLEAN MODE) 
+				          WHERE MATCH(at.normalized_text, at.normalized_topic) AGAINST ('".Db::qstr($searchTerms)."' IN BOOLEAN MODE) 
 				          {$conds})
 					 	  UNION
 						  (SELECT COUNT(a.id) AS total FROM {$prefix}articles a 
 						  INNER JOIN {$prefix}custom_fields_values cfv ON a.id = cfv.article_id
-						  WHERE MATCH(cfv.normalized_value) AGAINST ('{$searchTerms}' IN BOOLEAN MODE) 
+						  WHERE MATCH(cfv.normalized_value) AGAINST ('".Db::qstr($searchTerms)."' IN BOOLEAN MODE) 
 						  {$conds})";
 				// execute the query, and it should give us exactly two rows: one per each one of the queries of the union, so 
 				// the total amount of posts that match the search condition should be the sum of those two rows

Modified: plog/branches/lifetype-1.2/class/gallery/dao/galleryalbums.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/gallery/dao/galleryalbums.class.php	2007-04-12 21:14:07 UTC (rev 5303)
+++ plog/branches/lifetype-1.2/class/gallery/dao/galleryalbums.class.php	2007-04-13 22:25:17 UTC (rev 5304)
@@ -410,7 +410,7 @@
 		{
 			$db =& Db::getDb();
 			if( $db->isFullTextSupported()) {			
-				$query = "MATCH(normalized_name,normalized_description) AGAINST ('{$searchTerms}')";
+				$query = "MATCH(normalized_name,normalized_description) AGAINST ('".Db::qstr($searchTerms)."')";
 			}
 			else {
 				$query = "name LIKE '%".Db::qstr( $searchTerms )."%' OR normalized_description LIKE '%".Db::qstr( $searchTerms )."%'";

Modified: plog/branches/lifetype-1.2/class/gallery/dao/galleryresources.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/gallery/dao/galleryresources.class.php	2007-04-12 21:14:07 UTC (rev 5303)
+++ plog/branches/lifetype-1.2/class/gallery/dao/galleryresources.class.php	2007-04-13 22:25:17 UTC (rev 5304)
@@ -856,7 +856,7 @@
 			// search the text via the existing FULLTEXT index
 			$db =& Db::getDb();
 			if( $db->isFullTextSupported()) {			
-				$query .= " OR MATCH(normalized_description) AGAINST ('{$searchTerms}')";	
+				$query .= " OR MATCH(normalized_description) AGAINST ('".Db::qstr($searchTerms)."')";	
 			}
 			else {
 				$query .= " OR normalized_description LIKE '%".Db::qstr( $searchTerms )."%'";



More information about the pLog-svn mailing list