From: Andrew Dolgov Date: Sun, 31 Jan 2016 11:01:18 +0000 (+0300) Subject: af_redditimgur: add (disabled) wip content dupe checker X-Git-Tag: 16.3~35 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=902b1ac7b5fb1ef556aba46a17ac4bad82e6757c;p=tt-rss.git af_redditimgur: add (disabled) wip content dupe checker --- diff --git a/plugins/af_redditimgur/init.php b/plugins/af_redditimgur/init.php index 8ef83532..347afbc8 100755 --- a/plugins/af_redditimgur/init.php +++ b/plugins/af_redditimgur/init.php @@ -244,7 +244,33 @@ class Af_RedditImgur extends Plugin { @$doc->loadHTML($article["content"]); $xpath = new DOMXPath($doc); - $content_link = $xpath->query("(//a[contains(., '[link]')])")->item(0); + /*$content_link = $xpath->query("(//a[contains(., '[link]')])")->item(0); + + if ($content_link) { + $content_href = db_escape_string($content_link->getAttribute("href")); + $entry_guid = db_escape_string($article["guid_hashed"]); + $owner_uid = $article["owner_uid"]; + + if (DB_TYPE == "pgsql") { + $interval_qpart = "date_entered < NOW() - INTERVAL '1 day'"; + } else { + $interval_qpart = "date_entered < DATE_SUB(NOW(), INTERVAL 1 DAY)"; + } + + $result = db_query("SELECT COUNT(id) AS cid + FROM ttrss_entries, ttrss_user_entries WHERE + ref_id = id AND + $interval_qpart AND + guid != '$entry_guid' AND + owner_uid = '$owner_uid' AND + content LIKE '%href=\"$content_href\">[link]%'"); + + if ($result) { + $num_found = db_fetch_result($result, 0, "cid"); + + if ($num_found > 0) $article["force_catchup"] = true; + } + }*/ $found = $this->inline_stuff($article, $doc, $xpath);