From 902b1ac7b5fb1ef556aba46a17ac4bad82e6757c Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Sun, 31 Jan 2016 14:01:18 +0300 Subject: [PATCH] af_redditimgur: add (disabled) wip content dupe checker --- plugins/af_redditimgur/init.php | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) 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); -- 2.39.5