MDL-24079 blog now using new sql_like()
authorPetr Skoda <skodak@moodle.org>
Sat, 4 Sep 2010 12:04:01 +0000 (12:04 +0000)
committerPetr Skoda <skodak@moodle.org>
Sat, 4 Sep 2010 12:04:01 +0000 (12:04 +0000)
blog/index.php
blog/locallib.php

index c78e666..f2025e3 100755 (executable)
@@ -36,8 +36,7 @@ $PAGE->set_url('/blog/index.php', $url_params);
 
 //correct tagid if a text tag is provided as a param
 if (!empty($tag)) {
-    $ILIKE = $DB->sql_ilike();
-    if ($tagrec = $DB->get_record_sql("SELECT * FROM {tag} WHERE name $ILIKE ?", array("%$tag%"))) {
+    if ($tagrec = $DB->get_record_sql("SELECT * FROM {tag} WHERE ". $DB->sql_ilike('name', '?', false), array("%$tag%"))) {
         $tagid = $tagrec->id;
     } else {
         unset($tagid);
index f09c3bf..f604558 100644 (file)
@@ -1143,10 +1143,9 @@ class blog_filter_search extends blog_filter {
 
     public function __construct($searchterm) {
         global $DB;
-        $ilike = $DB->sql_ilike();
-        $this->conditions = array("(p.summary $ilike ? OR
-                                    p.content $ilike ? OR
-                                    p.subject $ilike ?)");
+        $this->conditions = array("(".$DB->sql_like('p.summary', '?', false)." OR
+                                    ".$DB->sql_like('p.content', '?', false)." OR
+                                    ".$DB->sql_like('p.subject', '?', false).")");
         $this->params[] = "%$searchterm%";
         $this->params[] = "%$searchterm%";
         $this->params[] = "%$searchterm%";