summaryrefslogtreecommitdiff
path: root/modules/pref-feeds.php
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2009-10-07 15:12:21 +0400
committerAndrew Dolgov <[email protected]>2009-10-07 15:12:21 +0400
commit1638fc4e13e1d71eceb1deefe983c7f48d47b8a1 (patch)
tree1c4910786308b17c713c61d2e49c6570e25d767d /modules/pref-feeds.php
parent4b67e71e7d30fc61160a734815a759f6ff7f3060 (diff)
prefs: rudimentary multiple keyword search
Diffstat (limited to 'modules/pref-feeds.php')
-rw-r--r--modules/pref-feeds.php18
1 files changed, 15 insertions, 3 deletions
diff --git a/modules/pref-feeds.php b/modules/pref-feeds.php
index ce12806ee..b0269243e 100644
--- a/modules/pref-feeds.php
+++ b/modules/pref-feeds.php
@@ -1184,9 +1184,21 @@
$_SESSION["pref_sort_feeds"] = $feeds_sort;
if ($feed_search) {
- $search_qpart = "(UPPER(F1.title) LIKE UPPER('%$feed_search%') OR
- UPPER(C1.title) LIKE UPPER('%$feed_search%') OR
- UPPER(F1.feed_url) LIKE UPPER('%$feed_search%')) AND";
+
+ $feed_search = split(" ", $feed_search);
+ $tokens = array();
+
+ foreach ($feed_search as $token) {
+
+ $token = trim($token);
+
+ array_push($tokens, "(UPPER(F1.title) LIKE UPPER('%$token%') OR
+ UPPER(C1.title) LIKE UPPER('%$token%') OR
+ UPPER(F1.feed_url) LIKE UPPER('%$token%'))");
+ }
+
+ $search_qpart = "(" . join($tokens, " AND ") . ") AND ";
+
} else {
$search_qpart = "";
}