diff --git a/classes/api.php b/classes/api.php index 92e19e70a..5e7ec6573 100644 --- a/classes/api.php +++ b/classes/api.php @@ -194,11 +194,10 @@ class API extends Handler { $search = db_escape_string($_REQUEST["search"]); $search_mode = db_escape_string($_REQUEST["search_mode"]); - $match_on = db_escape_string($_REQUEST["match_on"]); $headlines = $this->api_get_headlines($this->link, $feed_id, $limit, $offset, $filter, $is_cat, $show_excerpt, $show_content, $view_mode, false, - $include_attachments, $since_id, $search, $search_mode, $match_on, + $include_attachments, $since_id, $search, $search_mode, $include_nested, $sanitize_content); print $this->wrap(self::STATUS_OK, $headlines); @@ -584,11 +583,11 @@ class API extends Handler { static function api_get_headlines($link, $feed_id, $limit, $offset, $filter, $is_cat, $show_excerpt, $show_content, $view_mode, $order, $include_attachments, $since_id, - $search = "", $search_mode = "", $match_on = "", + $search = "", $search_mode = "", $include_nested = false, $sanitize_content = true) { $qfh_ret = queryFeedHeadlines($link, $feed_id, $limit, - $view_mode, $is_cat, $search, $search_mode, $match_on, + $view_mode, $is_cat, $search, $search_mode, $order, $offset, 0, false, $since_id, $include_nested); $result = $qfh_ret[0]; diff --git a/classes/feeds.php b/classes/feeds.php index 50a265544..caf22322c 100644 --- a/classes/feeds.php +++ b/classes/feeds.php @@ -22,7 +22,7 @@ class Feeds extends Handler_Protected { } private function format_headline_subtoolbar($feed_site_url, $feed_title, - $feed_id, $is_cat, $search, $match_on, + $feed_id, $is_cat, $search, $search_mode, $view_mode, $error) { $page_prev_link = "viewFeedGoPage(-1)"; @@ -50,7 +50,7 @@ class Feeds extends Handler_Protected { if ($is_cat) $cat_q = "&is_cat=$is_cat"; if ($search) { - $search_q = "&q=$search&m=$match_on&smode=$search_mode"; + $search_q = "&q=$search&smode=$search_mode"; } else { $search_q = ""; } @@ -209,7 +209,6 @@ class Feeds extends Handler_Protected { } @$search_mode = db_escape_string($_REQUEST["search_mode"]); - $match_on = "both"; // deprecated, TODO: remove if ($_REQUEST["debug"]) $timing_info = print_checkpoint("H0", $timing_info); @@ -219,7 +218,7 @@ class Feeds extends Handler_Protected { } // error_log("search_mode: " . $search_mode); $qfh_ret = queryFeedHeadlines($this->link, $feed, $limit, $view_mode, $cat_view, - $search, $search_mode, $match_on, $override_order, $offset, 0, + $search, $search_mode, $override_order, $offset, 0, false, 0, $include_children); if ($_REQUEST["debug"]) $timing_info = print_checkpoint("H1", $timing_info); @@ -233,7 +232,7 @@ class Feeds extends Handler_Protected { $reply['toolbar'] = $this->format_headline_subtoolbar($feed_site_url, $feed_title, - $feed, $cat_view, $search, $match_on, $search_mode, $view_mode, + $feed, $cat_view, $search, $search_mode, $view_mode, $last_error); $headlines_count = db_num_rows($result); diff --git a/classes/handler/public.php b/classes/handler/public.php index 4a9b0c48e..dc1e10049 100644 --- a/classes/handler/public.php +++ b/classes/handler/public.php @@ -2,7 +2,7 @@ class Handler_Public extends Handler { private function generate_syndicated_feed($owner_uid, $feed, $is_cat, - $limit, $offset, $search, $search_mode, $match_on, + $limit, $offset, $search, $search_mode, $view_mode = false, $format = 'atom') { require_once "lib/MiniTemplator.class.php"; @@ -25,7 +25,7 @@ class Handler_Public extends Handler { $qfh_ret = queryFeedHeadlines($this->link, $feed, $limit, $view_mode, $is_cat, $search, $search_mode, - $match_on, "$date_sort_field DESC", $offset, $owner_uid, + "$date_sort_field DESC", $offset, $owner_uid, false, 0, false, true); $result = $qfh_ret[0]; @@ -314,7 +314,6 @@ class Handler_Public extends Handler { $offset = (int)db_escape_string($_REQUEST["offset"]); $search = db_escape_string($_REQUEST["q"]); - $match_on = db_escape_string($_REQUEST["m"]); $search_mode = db_escape_string($_REQUEST["smode"]); $view_mode = db_escape_string($_REQUEST["view-mode"]); @@ -338,7 +337,7 @@ class Handler_Public extends Handler { if ($owner_id) { $this->generate_syndicated_feed($owner_id, $feed, $is_cat, $limit, - $offset, $search, $search_mode, $match_on, $view_mode, $format); + $offset, $search, $search_mode, $view_mode, $format); } else { header('HTTP/1.1 403 Forbidden'); } diff --git a/classes/pref/filters.php b/classes/pref/filters.php index 20abae1d0..1921f2b97 100644 --- a/classes/pref/filters.php +++ b/classes/pref/filters.php @@ -47,7 +47,7 @@ class Pref_Filters extends Handler_Protected { $feed_title = getFeedTitle($this->link, $feed); $qfh_ret = queryFeedHeadlines($this->link, -4, 30, "", false, false, false, - false, "date_entered DESC", 0, $_SESSION["uid"], $filter); + "date_entered DESC", 0, $_SESSION["uid"], $filter); $result = $qfh_ret[0]; @@ -370,9 +370,9 @@ class Pref_Filters extends Handler_Protected { $result = db_query($this->link, "SELECT description FROM ttrss_filter_types WHERE id = ".(int)$rule["filter_type"]); - $match_on = db_fetch_result($result, 0, "description"); + $filter_type = db_fetch_result($result, 0, "description"); - return T_sprintf("%s on %s in %s", strip_tags($rule["reg_exp"]), $match_on, $feed); + return T_sprintf("%s on %s in %s", strip_tags($rule["reg_exp"]), $filter_type, $feed); } function printRuleName() { diff --git a/include/functions.php b/include/functions.php index c91735488..1a106be0b 100644 --- a/include/functions.php +++ b/include/functions.php @@ -2060,7 +2060,7 @@ return $data; } - function search_to_sql($link, $search, $match_on) { + function search_to_sql($link, $search) { $search_query_part = ""; @@ -2107,13 +2107,9 @@ //$k = date("Y-m-d", strtotime(substr($k, 1))); array_push($query_keywords, "(".SUBSTRING_FOR_DATE."(updated,1,LENGTH('$k')) $not = '$k')"); - } else if ($match_on == "both") { + } else { array_push($query_keywords, "(UPPER(ttrss_entries.title) $not LIKE UPPER('%$k%') OR UPPER(ttrss_entries.content) $not LIKE UPPER('%$k%'))"); - } else if ($match_on == "title") { - array_push($query_keywords, "(UPPER(ttrss_entries.title) $not LIKE UPPER('%$k%'))"); - } else if ($match_on == "content") { - array_push($query_keywords, "(UPPER(ttrss_entries.content) $not LIKE UPPER('%$k%'))"); } } @@ -2150,7 +2146,7 @@ return $rv; } - function queryFeedHeadlines($link, $feed, $limit, $view_mode, $cat_view, $search, $search_mode, $match_on, $override_order = false, $offset = 0, $owner_uid = 0, $filter = false, $since_id = 0, $include_children = false, $ignore_vfeed_group = false) { + function queryFeedHeadlines($link, $feed, $limit, $view_mode, $cat_view, $search, $search_mode, $override_order = false, $offset = 0, $owner_uid = 0, $filter = false, $since_id = 0, $include_children = false, $ignore_vfeed_group = false) { if (!$owner_uid) $owner_uid = $_SESSION["uid"]; @@ -2167,7 +2163,7 @@ $search_query_part = "ref_id = -1 AND "; } else { - $search_query_part = search_to_sql($link, $search, $match_on); + $search_query_part = search_to_sql($link, $search); $search_query_part .= " AND "; } diff --git a/mobile/mobile-functions.php b/mobile/mobile-functions.php index 65bba55df..39b89fa9c 100644 --- a/mobile/mobile-functions.php +++ b/mobile/mobile-functions.php @@ -341,14 +341,12 @@ if ($search) { $search_mode = 'this_feed'; - $match_on = 'both'; } else { $search_mode = ''; - $match_on = ''; } $qfh_ret = queryFeedHeadlines($link, $feed_id, $limit, - $view_mode, $is_cat, $search, $search_mode, $match_on, + $view_mode, $is_cat, $search, $search_mode, "score DESC, date_entered ".(mobile_get_pref($link, 'REVERSE_HEADLINES') ? 'ASC' : 'DESC'), $offset); $result = $qfh_ret[0];