diff options
Diffstat (limited to 'classes/feeds.php')
-rwxr-xr-x | classes/feeds.php | 42 |
1 files changed, 26 insertions, 16 deletions
diff --git a/classes/feeds.php b/classes/feeds.php index a06486883..afcc97d81 100755 --- a/classes/feeds.php +++ b/classes/feeds.php @@ -122,7 +122,7 @@ class Feeds extends Handler_Protected { $feed_title = $qfh_ret[1]; $feed_site_url = $qfh_ret[2]; $last_error = $qfh_ret[3]; - $last_updated = strpos($qfh_ret[4], '1970-') === false ? + $last_updated = strpos($qfh_ret[4] ?? "", '1970-') === false ? TimeHelper::make_local_datetime($qfh_ret[4], false) : __("Never"); $highlight_words = $qfh_ret[5]; $reply['first_id'] = $qfh_ret[6]; @@ -248,11 +248,12 @@ class Feeds extends Handler_Protected { function ($result, $plugin) use (&$line, &$button_doc) { if ($result && $button_doc->loadXML($result)) { - /** @var DOMElement|null */ + /** @var DOMElement|null $child */ $child = $button_doc->firstChild; if ($child) { do { + /** @var DOMElement|null $child */ $child->setAttribute('data-plugin-name', get_class($plugin)); } while ($child = $child->nextSibling); @@ -271,11 +272,12 @@ class Feeds extends Handler_Protected { function ($result, $plugin) use (&$line, &$button_doc) { if ($result && $button_doc->loadXML($result)) { - /** @var DOMElement|null */ + /** @var DOMElement|null $child */ $child = $button_doc->firstChild; if ($child) { do { + /** @var DOMElement|null $child */ $child->setAttribute('data-plugin-name', get_class($plugin)); } while ($child = $child->nextSibling); @@ -665,7 +667,7 @@ class Feeds extends Handler_Protected { } Debug::set_enabled(true); - Debug::set_loglevel($xdebug); + Debug::set_loglevel(Debug::map_loglevel($xdebug)); $feed_id = (int)$_REQUEST["feed_id"]; $do_update = ($_REQUEST["action"] ?? "") == "do_update"; @@ -1936,8 +1938,8 @@ class Feeds extends Handler_Protected { $sth->execute([$cat, $owner_uid]); while ($line = $sth->fetch()) { - array_push($rv, (int)$line["parent_cat"]); - $rv = array_merge($rv, self::_get_parent_cats($line["parent_cat"], $owner_uid)); + $cat = (int) $line["parent_cat"]; + array_push($rv, $cat, ...self::_get_parent_cats($cat, $owner_uid)); } return $rv; @@ -1956,8 +1958,7 @@ class Feeds extends Handler_Protected { $sth->execute([$cat, $owner_uid]); while ($line = $sth->fetch()) { - array_push($rv, $line["id"]); - $rv = array_merge($rv, self::_get_child_cats($line["id"], $owner_uid)); + array_push($rv, $line["id"], ...self::_get_child_cats($line["id"], $owner_uid)); } return $rv; @@ -1978,16 +1979,18 @@ class Feeds extends Handler_Protected { $sth = $pdo->prepare("SELECT DISTINCT cat_id, fc.parent_cat FROM ttrss_feeds f LEFT JOIN ttrss_feed_categories fc ON (fc.id = f.cat_id) WHERE f.owner_uid = ? AND f.id IN ($feeds_qmarks)"); - $sth->execute(array_merge([$owner_uid], $feeds)); + $sth->execute([$owner_uid, ...$feeds]); $rv = []; if ($row = $sth->fetch()) { + $cat_id = (int) $row["cat_id"]; + $rv[] = $cat_id; array_push($rv, (int)$row["cat_id"]); - if ($with_parents && $row["parent_cat"]) - $rv = array_merge($rv, - self::_get_parent_cats($row["cat_id"], $owner_uid)); + if ($with_parents && $row["parent_cat"]) { + array_push($rv, ...self::_get_parent_cats($cat_id, $owner_uid)); + } } $rv = array_unique($rv); @@ -2357,8 +2360,11 @@ class Feeds extends Handler_Protected { $k = mb_strtolower($k); array_push($search_query_leftover, $not ? "!$k" : $k); } else { - array_push($query_keywords, "(UPPER(ttrss_entries.title) $not LIKE UPPER(".$pdo->quote("%$k%").") - OR UPPER(ttrss_entries.content) $not LIKE UPPER(".$pdo->quote("%$k%")."))"); + $k = mb_strtolower($k); + array_push($search_query_leftover, $not ? "-$k" : $k); + + //array_push($query_keywords, "(UPPER(ttrss_entries.title) $not LIKE UPPER(".$pdo->quote("%$k%").") + // OR UPPER(ttrss_entries.content) $not LIKE UPPER(".$pdo->quote("%$k%")."))"); } if (!$not) array_push($search_words, $k); @@ -2380,12 +2386,16 @@ class Feeds extends Handler_Protected { array_push($query_keywords, "(tsvector_combined @@ to_tsquery($search_language, $tsquery))"); - } + } else { + $ft_query = $pdo->quote(implode(" ", $search_query_leftover)); + array_push($query_keywords, + "MATCH (ttrss_entries.title, ttrss_entries.content) AGAINST ($ft_query IN BOOLEAN MODE)"); + } } if (count($query_keywords) > 0) - $search_query_part = implode("AND", $query_keywords); + $search_query_part = implode("AND ", $query_keywords); else $search_query_part = "false"; |