]> git.wh0rd.org Git - tt-rss.git/commitdiff
search_to_sql: quoting fix
authorAndrew Dolgov <noreply@fakecake.org>
Sat, 2 Dec 2017 19:58:59 +0000 (22:58 +0300)
committerAndrew Dolgov <noreply@fakecake.org>
Sat, 2 Dec 2017 19:58:59 +0000 (22:58 +0300)
include/functions.php

index 21cf3fef8372c9094e3d7f6edf56b0f2c63b6a39..9e4ed34627262af14f6b35f68c31ab5423dbec93 100644 (file)
                        switch ($commandpair[0]) {
                                case "title":
                                        if ($commandpair[1]) {
-                                               array_push($query_keywords, "($not (LOWER(ttrss_entries.title) LIKE '%".
-                                                       $pdo->quote(mb_strtolower($commandpair[1]))."%'))");
+                                               array_push($query_keywords, "($not (LOWER(ttrss_entries.title) LIKE ".
+                                                       $pdo->quote('%' . 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 '%".
-                                                       $pdo->quote(mb_strtolower($commandpair[1]))."%'))");
+                                               array_push($query_keywords, "($not (LOWER(author) LIKE ".
+                                                       $pdo->quote('%' . 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%'))");
                                                else if ($commandpair[1] == "false")
                                                        array_push($query_keywords, "($not (note IS NULL OR note = ''))");
                                                else
-                                                       array_push($query_keywords, "($not (LOWER(note) LIKE '%".
-                                                               $pdo->quote(mb_strtolower($commandpair[1]))."%'))");
+                                                       array_push($query_keywords, "($not (LOWER(note) LIKE ".
+                                                               $pdo->quote('%' . 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%'))");