search_to_sql: fix searching for reserved keywords

This commit is contained in:
Andrew Dolgov 2013-04-09 16:30:45 +04:00
parent 1666e95522
commit efd840d87f
1 changed files with 15 additions and 0 deletions

View File

@ -2143,12 +2143,18 @@
if ($commandpair[1]) { if ($commandpair[1]) {
array_push($query_keywords, "($not (LOWER(ttrss_entries.title) LIKE '%". array_push($query_keywords, "($not (LOWER(ttrss_entries.title) LIKE '%".
db_escape_string($link, mb_strtolower($commandpair[1]))."%'))"); db_escape_string($link, mb_strtolower($commandpair[1]))."%'))");
} else {
array_push($query_keywords, "(UPPER(ttrss_entries.title) $not LIKE UPPER('%$k%')
OR UPPER(ttrss_entries.content) $not LIKE UPPER('%$k%'))");
} }
break; break;
case "author": case "author":
if ($commandpair[1]) { if ($commandpair[1]) {
array_push($query_keywords, "($not (LOWER(author) LIKE '%". array_push($query_keywords, "($not (LOWER(author) LIKE '%".
db_escape_string($link, mb_strtolower($commandpair[1]))."%'))"); db_escape_string($link, mb_strtolower($commandpair[1]))."%'))");
} else {
array_push($query_keywords, "(UPPER(ttrss_entries.title) $not LIKE UPPER('%$k%')
OR UPPER(ttrss_entries.content) $not LIKE UPPER('%$k%'))");
} }
break; break;
case "note": case "note":
@ -2160,6 +2166,9 @@
else else
array_push($query_keywords, "($not (LOWER(note) LIKE '%". array_push($query_keywords, "($not (LOWER(note) LIKE '%".
db_escape_string($link, mb_strtolower($commandpair[1]))."%'))"); db_escape_string($link, mb_strtolower($commandpair[1]))."%'))");
} else {
array_push($query_keywords, "(UPPER(ttrss_entries.title) $not LIKE UPPER('%$k%')
OR UPPER(ttrss_entries.content) $not LIKE UPPER('%$k%'))");
} }
break; break;
case "star": case "star":
@ -2169,6 +2178,9 @@
array_push($query_keywords, "($not (marked = true))"); array_push($query_keywords, "($not (marked = true))");
else else
array_push($query_keywords, "($not (marked = false))"); array_push($query_keywords, "($not (marked = false))");
} else {
array_push($query_keywords, "(UPPER(ttrss_entries.title) $not LIKE UPPER('%$k%')
OR UPPER(ttrss_entries.content) $not LIKE UPPER('%$k%'))");
} }
break; break;
case "pub": case "pub":
@ -2178,6 +2190,9 @@
else else
array_push($query_keywords, "($not (published = false))"); array_push($query_keywords, "($not (published = false))");
} else {
array_push($query_keywords, "(UPPER(ttrss_entries.title) $not LIKE UPPER('%$k%')
OR UPPER(ttrss_entries.content) $not LIKE UPPER('%$k%'))");
} }
break; break;
default: default: