X-Git-Url: https://git.wh0rd.org/?a=blobdiff_plain;f=classes%2Ffeeds.php;h=5ec10961438ffe7a5e89ef8454cdef059fd28ec2;hb=7eb87b80d533d0bdd538938b69064352a8587204;hp=4cace8d5c9aac54840c0b22ba8db1679d9eea799;hpb=7a7a0dc2dd02c7064ce367004bd476345464d8cd;p=tt-rss.git diff --git a/classes/feeds.php b/classes/feeds.php index 4cace8d5..5ec10961 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,6 +37,8 @@ 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"); @@ -50,8 +46,14 @@ class Feeds extends Handler_Protected { $error_class = $error ? "error" : ""; - $reply .= ""; - $reply .= ""; + $reply .= " + + "; + + +# $reply .= ""; $reply .= ""; if ($feed_site_url) { @@ -60,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 { @@ -72,17 +75,16 @@ class Feeds extends Handler_Protected { $reply .= ""; - $reply .= " - - "; - $reply .= ""; +# $reply .= ""; + // left part - $reply .= __('Select:')." + $reply .= ""; + $reply .= ""; + + $reply .= " ".__('All').", ".__('Unread').", ".__('Invert').", @@ -131,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; } @@ -147,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; @@ -246,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]; @@ -254,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; @@ -276,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; @@ -283,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); @@ -420,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"]; @@ -428,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
"; } } @@ -441,7 +450,7 @@ class Feeds extends Handler_Protected { $mouseover_attrs = "onmouseover='postMouseIn(event, $id)' onmouseout='postMouseOut($id)'"; - $reply['content'] .= "
"; + $reply['content'] .= "
"; $reply['content'] .= "
"; @@ -471,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
"; @@ -489,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'] .= "
"; @@ -508,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"]; @@ -522,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); @@ -532,7 +542,7 @@ class Feeds extends Handler_Protected { //$feed_icon_img = "\"\""; } - $reply['content'] .= "
". + $reply['content'] .= "
". "
$feed_icon_img
". "". $line["feed_title"]." $vf_catchup_link
"; @@ -545,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'] .= "
"; $reply['content'] .= "
"; $reply['content'] .= " 0)) { + foreach ($highlight_words as $word) { + $line["title"] = preg_replace("/(\Q$word\E)/i", + "$1", $line["title"]); + } + } + $reply['content'] .= " @@ -583,7 +600,7 @@ class Feeds extends Handler_Protected { $reply['content'] .= ""; - if (!get_pref('VFEED_GROUP_BY_FEED')) { + if (!$vfeed_group_enabled) { if (@$line["feed_title"]) { $rgba = @$rgba_cache[$feed_id]; @@ -620,7 +637,9 @@ class Feeds extends Handler_Protected { } $reply['content'] .= "
"; - $reply['content'] .= "
"; + if (!$line['lang']) $line['lang'] = 'en'; + + $reply['content'] .= "
"; if ($line["orig_feed_id"]) { @@ -690,10 +709,13 @@ class Feeds extends Handler_Protected { } else { $comments_url = htmlspecialchars($line["link"]); } - $entry_comments = "$num_comments comments"; + $entry_comments = "$num_comments ". + _ngettext("comment", "comments", $num_comments).""; + } else { if ($line["comments"] && $line["link"] != $line["comments"]) { - $entry_comments = "comments"; + $entry_comments = "".__("comments").""; } } @@ -711,7 +733,7 @@ class Feeds extends Handler_Protected { $reply['content'] .= "
"; $reply['content'] .= "
"; - $reply['content'] .= "

"; + $reply['content'] .= "
"; $reply['content'] .= "
"; @@ -789,8 +811,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"]); @@ -883,7 +903,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]; @@ -964,6 +984,10 @@ class Feeds extends Handler_Protected { print ""; print ""; + print ""; + print "
".__("Feed or site URL")."
"; print "
"; @@ -1059,20 +1083,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 "
@@ -1131,9 +1153,9 @@ class Feeds extends Handler_Protected { print "
"; - if (!SPHINX_ENABLED) { + if (count(PluginHost::getInstance()->get_hooks(PluginHost::HOOK_SEARCH)) == 0) { print ""; }