X-Git-Url: https://git.wh0rd.org/?a=blobdiff_plain;f=classes%2Farticle.php;h=c5e73ea0261edcbab4c57fa40a6e7697953a5f19;hb=3a0292303e453f38204279b5d1c978a4b9c367e9;hp=edf95b74318659d11f96355df9249ed47b99325b;hpb=8e1450aa1533b59547dfd451e9c979d37eef3486;p=tt-rss.git diff --git a/classes/article.php b/classes/article.php old mode 100644 new mode 100755 index edf95b74..c5e73ea0 --- a/classes/article.php +++ b/classes/article.php @@ -126,7 +126,7 @@ class Article extends Handler_Protected { if (filter_var($url, FILTER_VALIDATE_URL) === FALSE) return false; $pdo = Db::pdo(); - + $pdo->beginTransaction(); // only check for our user data here, others might have shared this with different content etc @@ -309,7 +309,7 @@ class Article extends Handler_Protected { if ($tag != '') { $sth = $this->pdo->prepare("INSERT INTO ttrss_tags - (post_int_id, owner_uid, tag_name) + (post_int_id, owner_uid, tag_name) VALUES (?, ?, ?)"); $sth->execute([$int_id, $_SESSION['uid'], $tag]); @@ -610,6 +610,8 @@ class Article extends Handler_Protected { $line = $p->hook_render_article($line); } + $line['content'] = rewrite_cached_urls($line['content']); + $num_comments = (int) $line["num_comments"]; $entry_comments = ""; @@ -629,16 +631,52 @@ class Article extends Handler_Protected { } } + $enclosures = self::get_article_enclosures($line["id"]); + if ($zoom_mode) { header("Content-Type: text/html"); - $rv['content'] .= " + $rv['content'] .= " + ".$line["title"]."". stylesheet_tag("css/default.css")." - + "; + + $rv['content'] .= "\n"; + $rv['content'] .= "\n"; + $rv['content'] .= "\n"; + + $rv['content'] .= ""; + + $og_image = false; + + foreach ($enclosures as $enc) { + if (strpos($enc["content_type"], "image/") !== FALSE) { + $og_image = $enc["content_url"]; + break; + } + } + + if (!$og_image) { + $tmpdoc = new DOMDocument(); + + if (@$tmpdoc->loadHTML(mb_substr($line["content"], 0, 131070))) { + $tmpxpath = new DOMXPath($tmpdoc); + $first_img = $tmpxpath->query("//img")->item(0); + + if ($first_img) { + $og_image = $first_img->getAttribute("src"); + } + } + } + + if ($og_image) { + $rv['content'] .= ""; + } - "; + $rv['content'] .= ""; } $rv['content'] .= "
"; @@ -791,7 +829,7 @@ class Article extends Handler_Protected { $pdo = Db::pdo(); $sth = $pdo->prepare("SELECT DISTINCT tag_name, - owner_uid as owner FROM ttrss_tags + owner_uid as owner FROM ttrss_tags WHERE post_int_id = (SELECT int_id FROM ttrss_user_entries WHERE ref_id = ? AND owner_uid = ? LIMIT 1) ORDER BY tag_name");