Remove deprecated $match_on

This commit is contained in:
Joschasa 2013-03-21 00:36:30 +01:00
parent 2a3b6de0ef
commit ca5d9be49f
6 changed files with 18 additions and 27 deletions

View File

@ -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];

View File

@ -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);

View File

@ -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');
}

View File

@ -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() {

View File

@ -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 ";
}

View File

@ -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];