]> git.wh0rd.org - tt-rss.git/commitdiff
search_to_sql: fix searching for reserved keywords
authorAndrew Dolgov <fox@madoka.volgo-balt.ru>
Tue, 9 Apr 2013 12:30:45 +0000 (16:30 +0400)
committerAndrew Dolgov <fox@madoka.volgo-balt.ru>
Tue, 9 Apr 2013 12:30:45 +0000 (16:30 +0400)
include/functions.php

index 68d2df344ac7f4a77af972f7d97c3a5a196bc676..f639b973bfb6f8f8871ab869f59d7d3fe73ea694 100644 (file)
                                if ($commandpair[1]) {
                                        array_push($query_keywords, "($not (LOWER(ttrss_entries.title) LIKE '%".
                                                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;
                        case "author":
                                if ($commandpair[1]) {
                                        array_push($query_keywords, "($not (LOWER(author) LIKE '%".
                                                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;
                        case "note":
                                        else
                                                array_push($query_keywords, "($not (LOWER(note) LIKE '%".
                                                        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;
                        case "star":
                                                array_push($query_keywords, "($not (marked = true))");
                                        else
                                                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;
                        case "pub":
                                        else
                                                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;
                        default: