diff --git a/classes/feeds.php b/classes/feeds.php index defeb075c..d25759283 100755 --- a/classes/feeds.php +++ b/classes/feeds.php @@ -160,8 +160,6 @@ class Feeds extends Handler_Protected { $disable_cache = true; } - if ($_REQUEST["debug"]) $timing_info = print_checkpoint("H0", $timing_info); - if (!$cat_view && is_numeric($feed) && $feed < PLUGIN_FEED_BASE_INDEX && $feed > LABEL_BASE_INDEX) { $handler = PluginHost::getInstance()->get_feed_handler( PluginHost::feed_to_pfeed_id($feed)); @@ -204,8 +202,6 @@ class Feeds extends Handler_Protected { $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]; // this could be either a PDO query result or a -1 if first id changed $feed_title = $qfh_ret[1]; $feed_site_url = $qfh_ret[2]; @@ -232,10 +228,7 @@ class Feeds extends Handler_Protected { $headlines_count = 0; - if ($_REQUEST["debug"]) $timing_info = print_checkpoint("PS", $timing_info); - if (is_object($result)) { - while ($line = $result->fetch(PDO::FETCH_ASSOC)) { ++$headlines_count; @@ -378,305 +371,9 @@ class Feeds extends Handler_Protected { } array_push($reply['content'], $line); - - /* if (!get_pref('COMBINED_DISPLAY_MODE')) { - - if ($vfeed_group_enabled) { - if ($feed_id != $vgroup_last_feed) { - - $vgroup_last_feed = $feed_id; - - $vf_catchup_link = "".__('mark feed as read').""; - - $reply['content'] .= "
". - "
$feed_icon_img
". - "". - $line["feed_title"]." - $vf_catchup_link
"; - } - } - - $reply['content'] .= "
"; - - $reply['content'] .= "
"; - - $reply['content'] .= ""; - - $reply['content'] .= "$marked_pic"; - $reply['content'] .= "$published_pic"; - - $reply['content'] .= "
"; - - $reply['content'] .= "
"; - $reply['content'] .= "" . - truncate_string($line["title"], 200); - - if (get_pref('SHOW_CONTENT_PREVIEW')) { - $reply['content'] .= "" . $line["content_preview"] . ""; - } - - $reply['content'] .= ""; - - $reply['content'] .= $labels_str; - - $reply['content'] .= "
"; - - if (!$vfeed_group_enabled) { - if (@$line["feed_title"]) { - $rgba = @$rgba_cache[$feed_id]; - - $reply['content'] .= "". - truncate_string($line["feed_title"],30).""; - } - } - - - $reply['content'] .= ""; - - $reply['content'] .= "
$updated_fmt
-
"; - - $reply['content'] .= "
"; - - $reply['content'] .= $score_pic; - - if (!$vfeed_group_enabled) { - $reply['content'] .= " - $feed_icon_img"; - } - - $reply['content'] .= "
"; - $reply['content'] .= "
"; - - } else { // CDM - - if ($line["tag_cache"]) - $tags = explode(",", $line["tag_cache"]); - else - $tags = false; - - $line["content"] = sanitize($line["content"], - $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); - } - - $line['content'] = rewrite_cached_urls($line['content']); - - if ($vfeed_group_enabled && $line["feed_title"]) { - if ($feed_id != $vgroup_last_feed) { - - $vgroup_last_feed = $feed_id; - - $vf_catchup_link = "".__('mark feed as read').""; - - $feed_icon_src = Feeds::getFeedIcon($feed_id); - $feed_icon_img = ""; - - $reply['content'] .= "
". - "
$feed_icon_img
". - "". - $line["feed_title"]." $vf_catchup_link
"; - - } - } - - $content_encoded = htmlspecialchars($line["content"]); - - $expanded_class = get_pref("CDM_EXPANDED") ? "expanded" : "expandable"; - $tmp_content = "
"; - - $tmp_content .= "
"; - $tmp_content .= "
"; - - $tmp_content .= ""; - - $tmp_content .= "$marked_pic"; - $tmp_content .= "$published_pic"; - - $tmp_content .= "
"; - - if ($highlight_words && count($highlight_words) > 0) { - foreach ($highlight_words as $word) { - $word = preg_quote($word, "/"); - - $line["title"] = preg_replace("/($word)/i", - "$1", $line["title"]); - } - } - - // data-article-id included for context menu - $tmp_content .= " - ". - $line["title"] . - " $entry_author"; - - $tmp_content .= $labels_str; - - if (!get_pref("CDM_EXPANDED")) { - $tmp_content .= " - remove_circle"; - - if (get_pref('SHOW_CONTENT_PREVIEW')) { - $tmp_content .= "" . $line["content_preview"] . ""; - } - } - - $tmp_content .= ""; - - if (!$vfeed_group_enabled) { - if (@$line["feed_title"]) { - $rgba = @$rgba_cache[$feed_id]; - - $tmp_content .= ""; - } - } - - $tmp_content .= "$updated_fmt"; - - $tmp_content .= "
"; - $tmp_content .= "$score_pic"; - - if (!get_pref("VFEED_GROUP_BY_FEED")) { - $tmp_content .= "$feed_icon_img"; - } - $tmp_content .= "
"; //score wrapper2 - - $tmp_content .= "
"; //header - - $tmp_content .= "
"; - - $tmp_content .= "
"; - if ($line['note']) { - $tmp_content .= Article::format_article_note($id, $line['note']); - } - $tmp_content .= "
"; //POSTNOTE - - if (!$line['lang']) $line['lang'] = 'en'; - - // this is filled from RROW data-content - $tmp_content .= "
- -
"; - $tmp_content .= "
"; - - if ($line["orig_feed_id"]) { - - $ofgh = $this->pdo->prepare("SELECT * FROM ttrss_archived_feeds - WHERE id = ? AND owner_uid = ?"); - $ofgh->execute([$line["orig_feed_id"], $_SESSION['uid']]); - - if ($tmp_line = $ofgh->fetch()) { - - $tmp_content .= "
"; - $tmp_content .= __("Originally from:"); - - $tmp_content .= " "; - - $tmp_content .= "" . - $tmp_line['title'] . ""; - - $tmp_content .= " "; - - $tmp_content .= ""; - - $tmp_content .= "
"; - } - } - - - $always_display_enclosures = $line["always_display_enclosures"]; - $tmp_content .= Article::format_article_enclosures($id, $always_display_enclosures, - $line["content"], $line["hide_images"]); - - $tmp_content .= "
"; // cdmIntermediate - - $tmp_content .= "
"; - - foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_ARTICLE_LEFT_BUTTON) as $p) { - $tmp_content .= $p->hook_article_left_button($line); - } - - $tags_str = Article::format_tags_string($tags, $id); - - $tmp_content .= "
"; - - $tmp_content .= "label_outline - $tags_str - (+)"; - - $num_comments = (int) $line["num_comments"]; - $entry_comments = ""; - - if ($num_comments > 0) { - if ($line["comments"]) { - $comments_url = htmlspecialchars($line["comments"]); - } else { - $comments_url = htmlspecialchars($line["link"]); - } - $entry_comments = "$num_comments ". - _ngettext("comment", "comments", $num_comments).""; - - } else { - if ($line["comments"] && $line["link"] != $line["comments"]) { - $entry_comments = "".__("comments").""; - } - } - - if ($entry_comments) $tmp_content .= " ($entry_comments)"; - - $tmp_content .= "
"; - $tmp_content .= "
"; - - foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_ARTICLE_BUTTON) as $p) { - $tmp_content .= $p->hook_article_button($line); - } - - $tmp_content .= "
"; // buttons - - $tmp_content .= "
"; // cdm footer - $tmp_content .= "
"; // cdmContent - $tmp_content .= "
"; // RROW.cdm - - foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_FORMAT_ARTICLE_CDM) as $p) { - $tmp_content = $p->hook_format_article_cdm($tmp_content, $line); - } - - $reply['content'] .= $tmp_content; - } // end html */ - } } - if ($_REQUEST["debug"]) $timing_info = print_checkpoint("PE", $timing_info); - if (!$headlines_count) { if (is_object($result)) { @@ -733,8 +430,6 @@ class Feeds extends Handler_Protected { } } - if ($_REQUEST["debug"]) $timing_info = print_checkpoint("H2", $timing_info); - return array($topmost_article_ids, $headlines_count, $feed, $disable_cache, $reply); } @@ -747,12 +442,8 @@ class Feeds extends Handler_Protected { } function view() { - $timing_info = microtime(true); - $reply = array(); - if ($_REQUEST["debug"]) $timing_info = print_checkpoint("0", $timing_info); - $feed = $_REQUEST["feed"]; $method = $_REQUEST["m"]; $view_mode = $_REQUEST["view_mode"]; @@ -825,7 +516,7 @@ class Feeds extends Handler_Protected { $sth->execute([$feed, $_SESSION['uid']]); } - $reply['headlines'] = array(); + $reply['headlines'] = []; $override_order = false; $skip_first_id_check = false; @@ -843,15 +534,12 @@ class Feeds extends Handler_Protected { break; } - if ($_REQUEST["debug"]) $timing_info = print_checkpoint("04", $timing_info); - $ret = $this->format_headlines_list($feed, $method, $view_mode, $limit, $cat_view, $offset, $override_order, true, $check_first_id, $skip_first_id_check); $headlines_count = $ret[1]; $disable_cache = $ret[3]; - $reply['headlines'] = $ret[4]; if (!$next_unread_feed) @@ -861,13 +549,10 @@ class Feeds extends Handler_Protected { $reply['headlines']['is_cat'] = (bool) $cat_view; - if ($_REQUEST["debug"]) $timing_info = print_checkpoint("05", $timing_info); - - $reply['headlines-info'] = array("count" => (int) $headlines_count, - "disable_cache" => (bool) $disable_cache); - - if ($_REQUEST["debug"]) $timing_info = print_checkpoint("30", $timing_info); + $reply['headlines-info'] = ["count" => (int) $headlines_count, + "disable_cache" => (bool) $disable_cache]; + // this is parsed by handleRpcJson() on first viewfeed() to set cdm expanded, etc $reply['runtime-info'] = make_runtime_info(); print json_encode($reply); diff --git a/js/Feeds.js b/js/Feeds.js index a896727a7..52c1476f7 100644 --- a/js/Feeds.js +++ b/js/Feeds.js @@ -358,7 +358,7 @@ define(["dojo/_base/declare"], function (declare) { if (viewfeed_debug) { window.open("backend.php?" + dojo.objectToQuery( - Object.assign({debug: 0, csrf_token: App.getInitParam("csrf_token")}, query) + Object.assign({csrf_token: App.getInitParam("csrf_token")}, query) )); } diff --git a/js/Headlines.js b/js/Headlines.js index 85467936c..78c9651cb 100755 --- a/js/Headlines.js +++ b/js/Headlines.js @@ -248,7 +248,6 @@ define(["dojo/_base/declare"], function (declare) { if (hl.published) row_class += " published"; if (hl.unread) row_class += " Unread"; - if (headlines.vfeed_group_enabled && hl.feed_title && this.vgroup_last_feed != hl.feed_id) { let vgrhdr = `
${hl.feed_icon}