diff --git a/classes/article.php b/classes/article.php index 2624a3d67..3ddf66d5c 100755 --- a/classes/article.php +++ b/classes/article.php @@ -27,6 +27,7 @@ class Article extends Handler_Protected { } } + /* function view() { $id = clean($_REQUEST["id"]); $cids = explode(",", clean($_REQUEST["cids"])); @@ -63,8 +64,9 @@ class Article extends Handler_Protected { } print json_encode($articles); - } + } */ + /* private function catchupArticleById($id, $cmode) { if ($cmode == 0) { @@ -86,6 +88,7 @@ class Article extends Handler_Protected { $feed_id = $this->getArticleFeed($id); CCache::update($feed_id, $_SESSION["uid"]); } + */ static function create_published_article($title, $url, $content, $labels_str, $owner_uid) { diff --git a/classes/feeds.php b/classes/feeds.php index a5810cdaa..6b499e65c 100755 --- a/classes/feeds.php +++ b/classes/feeds.php @@ -285,60 +285,58 @@ class Feeds extends Handler_Protected { if (!$line["feed_title"]) $line["feed_title"] = ""; - if (get_pref('COMBINED_DISPLAY_MODE')) { - - $line["buttons_left"] = ""; - foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_ARTICLE_LEFT_BUTTON) as $p) { - $line["buttons_left"] .= $p->hook_article_left_button($line); - } + $line["buttons_left"] = ""; + foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_ARTICLE_LEFT_BUTTON) as $p) { + $line["buttons_left"] .= $p->hook_article_left_button($line); + } - $line["buttons"] = ""; - foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_ARTICLE_BUTTON) as $p) { - $line["buttons"] .= $p->hook_article_button($line); - } + $line["buttons"] = ""; + foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_ARTICLE_BUTTON) as $p) { + $line["buttons"] .= $p->hook_article_button($line); + } - $line["content"] = sanitize($line["content"], - $line['hide_images'], false, $line["site_url"], $highlight_words, $line["id"]); + $line["content"] = sanitize($line["content"], + $line['hide_images'], false, $line["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); - } + 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']); - $line["content"] = htmlspecialchars($line["content"]); + $line['content'] = rewrite_cached_urls($line['content']); - if ($line['note']) - $line['note'] = Article::format_article_note($id, $line['note']); - else - $line['note'] = ""; + if ($line['note']) + $line['note'] = Article::format_article_note($id, $line['note']); + else + $line['note'] = ""; - if (!get_pref("CDM_EXPANDED")) { - $line["cdm_excerpt"] = " - remove_circle"; + if (!get_pref("CDM_EXPANDED")) { + $line["cdm_excerpt"] = " + remove_circle"; - if (get_pref('SHOW_CONTENT_PREVIEW')) { - $line["cdm_excerpt"] .= "" . $line["content_preview"] . ""; - } - } + if (get_pref('SHOW_CONTENT_PREVIEW')) { + $line["cdm_excerpt"] .= "" . $line["content_preview"] . ""; + } + } - $line["enclosures"] = Article::format_article_enclosures($id, $line["always_display_enclosures"], - $line["content"], $line["hide_images"]); + $line["enclosures"] = Article::format_article_enclosures($id, $line["always_display_enclosures"], + $line["content"], $line["hide_images"]); - if ($line["orig_feed_id"]) { + 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']]); + $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()) { - $line["orig_feed"] = [ $tmp_line["title"], $tmp_line["site_url"], $tmp_line["feed_url"] ]; - } - } + if ($tmp_line = $ofgh->fetch()) { + $line["orig_feed"] = [ $tmp_line["title"], $tmp_line["site_url"], $tmp_line["feed_url"] ]; + } } - + $line["updated_long"] = make_local_datetime($line["updated"],true); $line["updated"] = make_local_datetime($line["updated"], false, false, false, true); + + $line['imported'] = T_sprintf("Imported at %s", make_local_datetime($line["date_entered"], false)); diff --git a/js/Article.js b/js/Article.js index 46769223e..b91501faf 100644 --- a/js/Article.js +++ b/js/Article.js @@ -137,58 +137,65 @@ define(["dojo/_base/declare"], function (declare) { } catch (e) { } }, - view: function (id, noexpand) { - this.setActive(id); - - if (!noexpand) { - console.log("loading article", id); + formatComments: function(hl) { + let comments = ""; - const cids = []; - - /* only request uncached articles */ - - this.getRelativeIds(id).each((n) => { - if (!ArticleCache.get(n)) - cids.push(n); - }); + if (hl.comments) { + let comments_msg = __("comments"); - const cached_article = ArticleCache.get(id); - - if (cached_article) { - console.log('rendering cached', id); - this.render(cached_article); - return false; + if (hl.num_comments > 0) { + comments_msg = hl.num_comments + " " + ngettext("comment", "comments", hl.num_comments) } - xhrPost("backend.php", {op: "article", method: "view", id: id, cids: cids.toString()}, (transport) => { - try { - const reply = App.handleRpcJson(transport); - - if (reply) { - - reply.each(function (article) { - if (Article.getActive() == article['id']) { - Article.render(article['content']); - } - ArticleCache.set(article['id'], article['content']); - }); - - } else { - console.error("Invalid object received: " + transport.responseText); - - Article.render("