MDL-24079 blog now using new sql_like()

This commit is contained in:
Petr Skoda 2010-09-04 12:04:01 +00:00
parent 88bb11eb55
commit c014d57c4f
2 changed files with 4 additions and 6 deletions

View file

@ -36,8 +36,7 @@ $PAGE->set_url('/blog/index.php', $url_params);
//correct tagid if a text tag is provided as a param //correct tagid if a text tag is provided as a param
if (!empty($tag)) { if (!empty($tag)) {
$ILIKE = $DB->sql_ilike(); if ($tagrec = $DB->get_record_sql("SELECT * FROM {tag} WHERE ". $DB->sql_ilike('name', '?', false), array("%$tag%"))) {
if ($tagrec = $DB->get_record_sql("SELECT * FROM {tag} WHERE name $ILIKE ?", array("%$tag%"))) {
$tagid = $tagrec->id; $tagid = $tagrec->id;
} else { } else {
unset($tagid); unset($tagid);

View file

@ -1143,10 +1143,9 @@ class blog_filter_search extends blog_filter {
public function __construct($searchterm) { public function __construct($searchterm) {
global $DB; global $DB;
$ilike = $DB->sql_ilike(); $this->conditions = array("(".$DB->sql_like('p.summary', '?', false)." OR
$this->conditions = array("(p.summary $ilike ? OR ".$DB->sql_like('p.content', '?', false)." OR
p.content $ilike ? OR ".$DB->sql_like('p.subject', '?', false).")");
p.subject $ilike ?)");
$this->params[] = "%$searchterm%"; $this->params[] = "%$searchterm%";
$this->params[] = "%$searchterm%"; $this->params[] = "%$searchterm%";
$this->params[] = "%$searchterm%"; $this->params[] = "%$searchterm%";