Skip to content

Commit

Permalink
MDL-24079 blog now using new sql_like()
Browse files Browse the repository at this point in the history
  • Loading branch information
skodak committed Sep 4, 2010
1 parent 88bb11e commit c014d57
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
3 changes: 1 addition & 2 deletions blog/index.php
Expand Up @@ -36,8 +36,7 @@

//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);
Expand Down
7 changes: 3 additions & 4 deletions blog/locallib.php
Expand Up @@ -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%";
Expand Down

0 comments on commit c014d57

Please sign in to comment.