X-Git-Url: https://git.wh0rd.org/?a=blobdiff_plain;ds=inline;f=classes%2Ffeeds.php;h=52c3be97fff7628ab429f66b7d7e6b5c1eee9d05;hb=f75e7c64460b8337ecc769fb956cbe8a08b351e4;hp=c57328fe7e57ffdcb613aa87ceb67a2120158f1d;hpb=940e29a63789111c813d5c2d88c0e30071b113f0;p=tt-rss.git diff --git a/classes/feeds.php b/classes/feeds.php index c57328fe..52c3be97 100644 --- a/classes/feeds.php +++ b/classes/feeds.php @@ -13,12 +13,6 @@ class Feeds extends Handler_Protected { $feed_id, $is_cat, $search, $search_mode, $view_mode, $error, $feed_last_updated) { - $page_prev_link = "viewFeedGoPage(-1)"; - $page_next_link = "viewFeedGoPage(1)"; - $page_first_link = "viewFeedGoPage(0)"; - - $catchup_page_link = "catchupPage()"; - $catchup_feed_link = "catchupCurrentFeed()"; $catchup_sel_link = "catchupSelection()"; $archive_sel_link = "archiveSelection()"; @@ -43,14 +37,24 @@ class Feeds extends Handler_Protected { $search_q = ""; } + $reply .= ""; + $rss_link = htmlspecialchars(get_self_url_prefix() . "/public.php?op=rss&id=$feed_id$cat_q$search_q"); // right part - $reply .= ""; - $reply .= ""; - $reply .= ""; + $error_class = $error ? "error" : ""; + + $reply .= " + + "; + + +# $reply .= ""; + $reply .= ""; if ($feed_site_url) { $last_updated = T_sprintf("Last updated: %s", @@ -58,10 +62,11 @@ class Feeds extends Handler_Protected { $target = "target=\"_blank\""; $reply .= "". - truncate_string($feed_title,30).""; + truncate_string($feed_title, 30).""; if ($error) { - $reply .= " error"; + $error = htmlspecialchars($error); + $reply .= " error"; } } else { @@ -70,17 +75,16 @@ class Feeds extends Handler_Protected { $reply .= ""; - $reply .= " - - "; - $reply .= ""; +# $reply .= ""; + // left part - $reply .= __('Select:')." + $reply .= ""; + $reply .= ""; + + $reply .= " ".__('All').", ".__('Unread').", ".__('Invert').", @@ -129,14 +133,14 @@ class Feeds extends Handler_Protected { $reply .= ""; - //$reply .= ""; - //$reply .= "get_hooks(PluginHost::HOOK_HEADLINE_TOOLBAR_BUTTON) as $p) { - echo $p->hook_headline_toolbar_button($feed_id, $is_cat); + $reply .= $p->hook_headline_toolbar_button($feed_id, $is_cat); } + $reply .= ""; + return $reply; } @@ -145,7 +149,7 @@ class Feeds extends Handler_Protected { $override_order = false, $include_children = false) { if (isset($_REQUEST["DevForceUpdate"])) - header("Content-Type: text/plain"); + header("Content-Type: text/plain; charset=utf-8"); $disable_cache = false; @@ -244,6 +248,8 @@ class Feeds extends Handler_Protected { false, 0, $include_children); } + $vfeed_group_enabled = get_pref("VFEED_GROUP_BY_FEED") && $feed != -6; + if ($_REQUEST["debug"]) $timing_info = print_checkpoint("H1", $timing_info); $result = $qfh_ret[0]; @@ -252,6 +258,7 @@ class Feeds extends Handler_Protected { $last_error = $qfh_ret[3]; $last_updated = strpos($qfh_ret[4], '1970-') === FALSE ? make_local_datetime($qfh_ret[4], false) : __("Never"); + $highlight_words = $qfh_ret[5]; $vgroup_last_feed = $vgr_last_feed; @@ -274,6 +281,12 @@ class Feeds extends Handler_Protected { } } */ + if ($offset == 0) { + foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_HEADLINES_BEFORE) as $p) { + $reply['content'] .= $p->hook_headlines_before($feed, $cat_view, $qfh_ret); + } + } + if ($this->dbh->num_rows($result) > 0) { $lnum = $offset; @@ -281,14 +294,12 @@ class Feeds extends Handler_Protected { $num_unread = 0; $cur_feed_title = ''; - $fresh_intl = get_pref("FRESH_ARTICLE_MAX_AGE") * 60 * 60; - if ($_REQUEST["debug"]) $timing_info = print_checkpoint("PS", $timing_info); $expand_cdm = get_pref('CDM_EXPANDED'); while ($line = $this->dbh->fetch_assoc($result)) { - $line["content_preview"] = "— " . truncate_string(strip_tags($line["content_preview"]), 250); + $line["content_preview"] = "— " . truncate_string(strip_tags($line["content"]), 250); foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_QUERY_HEADLINES) as $p) { $line = $p->hook_query_headlines($line, 250, false); @@ -316,7 +327,7 @@ class Feeds extends Handler_Protected { if (!is_array($labels)) $labels = get_article_labels($id); - $labels_str = ""; + $labels_str = ""; $labels_str .= format_article_labels($labels, $id); $labels_str .= ""; @@ -418,7 +429,7 @@ class Feeds extends Handler_Protected { if (!get_pref('COMBINED_DISPLAY_MODE')) { - if (get_pref('VFEED_GROUP_BY_FEED')) { + if ($vfeed_group_enabled) { if ($feed_id != $vgroup_last_feed && $line["feed_title"]) { $cur_feed_title = $line["feed_title"]; @@ -426,12 +437,12 @@ class Feeds extends Handler_Protected { $cur_feed_title = htmlspecialchars($cur_feed_title); - $vf_catchup_link = "(".__('Mark as read').")"; + $vf_catchup_link = "".__('mark feed as read').""; - $reply['content'] .= "
". - "
$feed_icon_img
". - "". - $line["feed_title"]." $vf_catchup_link
"; + $reply['content'] .= "
". + "
$feed_icon_img
". + "". $line["feed_title"]." + $vf_catchup_link
"; } } @@ -439,7 +450,7 @@ class Feeds extends Handler_Protected { $mouseover_attrs = "onmouseover='postMouseIn(event, $id)' onmouseout='postMouseOut($id)'"; - $reply['content'] .= "
"; + $reply['content'] .= "
"; $reply['content'] .= "
"; @@ -469,17 +480,18 @@ class Feeds extends Handler_Protected { $reply['content'] .= "
"; - $reply['content'] .= ""; - - if (!get_pref('VFEED_GROUP_BY_FEED')) { + if (!$vfeed_group_enabled) { if (@$line["feed_title"]) { $rgba = @$rgba_cache[$feed_id]; - $reply['content'] .= "". - truncate_string($line["feed_title"],30).""; + $reply['content'] .= "". + truncate_string($line["feed_title"],30).""; } } + + $reply['content'] .= ""; + $reply['content'] .= "
$updated_fmt
"; @@ -487,12 +499,12 @@ class Feeds extends Handler_Protected { $reply['content'] .= $score_pic; - if ($line["feed_title"] && !get_pref('VFEED_GROUP_BY_FEED')) { + if ($line["feed_title"] && !$vfeed_group_enabled) { $reply['content'] .= " - $feed_icon_img"; + $feed_icon_img"; } $reply['content'] .= "
"; @@ -506,13 +518,13 @@ class Feeds extends Handler_Protected { $tags = false; $line["content"] = sanitize($line["content"], - sql_bool_to_bool($line['hide_images']), false, $entry_site_url); + sql_bool_to_bool($line['hide_images']), false, $entry_site_url, $highlight_words, $line["id"]); foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_RENDER_ARTICLE_CDM) as $p) { $line = $p->hook_render_article_cdm($line); } - if (get_pref('VFEED_GROUP_BY_FEED') && $line["feed_title"]) { + if ($vfeed_group_enabled && $line["feed_title"]) { if ($feed_id != $vgroup_last_feed) { $cur_feed_title = $line["feed_title"]; @@ -520,7 +532,7 @@ class Feeds extends Handler_Protected { $cur_feed_title = htmlspecialchars($cur_feed_title); - $vf_catchup_link = "(".__('mark as read').")"; + $vf_catchup_link = "".__('mark feed as read').""; $has_feed_icon = feed_has_icon($feed_id); @@ -530,7 +542,7 @@ class Feeds extends Handler_Protected { //$feed_icon_img = "\"\""; } - $reply['content'] .= "
". + $reply['content'] .= "
". "
$feed_icon_img
". "". $line["feed_title"]." $vf_catchup_link
"; @@ -543,9 +555,9 @@ class Feeds extends Handler_Protected { $expanded_class = $expand_cdm ? "expanded" : "expandable"; $reply['content'] .= "
"; + id=\"RROW-$id\" orig-feed-id='$feed_id' $mouseover_attrs>"; - $reply['content'] .= ""; $reply['content'] .= "
"; @@ -787,8 +812,6 @@ class Feeds extends Handler_Protected { if ($_REQUEST["debug"]) $timing_info = print_checkpoint("0", $timing_info); - $omode = $this->dbh->escape_string($_REQUEST["omode"]); - $feed = $this->dbh->escape_string($_REQUEST["feed"]); $method = $this->dbh->escape_string($_REQUEST["m"]); $view_mode = $this->dbh->escape_string($_REQUEST["view_mode"]); @@ -881,7 +904,7 @@ class Feeds extends Handler_Protected { //$topmost_article_ids = $ret[0]; $headlines_count = $ret[1]; - $returned_feed = $ret[2]; + /* $returned_feed = $ret[2]; */ $disable_cache = $ret[3]; $vgroup_last_feed = $ret[4]; @@ -962,6 +985,10 @@ class Feeds extends Handler_Protected { print ""; print ""; + print ""; + print "
".__("Feed or site URL")."
"; print "
"; @@ -1057,20 +1084,18 @@ class Feeds extends Handler_Protected { print " "; print "
"; - $owner_uid = $_SESSION["uid"]; - require_once "feedbrowser.php"; print "
    "; - print make_feed_browser($search, 25); + print make_feed_browser("", 25); print "
"; print "
@@ -1129,9 +1154,9 @@ class Feeds extends Handler_Protected { print "
"; - if (!SPHINX_ENABLED) { + if (count(PluginHost::getInstance()->get_hooks(PluginHost::HOOK_SEARCH)) == 0) { print ""; }