summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordedioste <[email protected]>2015-07-26 14:44:16 +0200
committerdedioste <[email protected]>2015-07-26 14:44:16 +0200
commit5d46fdeb4e6ac211606feaf95d14091dc97a98fd (patch)
tree1e3cc793991665f4823fc18af534ec3fb5fd65be
parent90173e7a9b46a0469cdf1fefa8b3c200b00d8542 (diff)
parentdda84c62fc302b324c8851fb94c023fa298994a9 (diff)
Merge branch 'master' of https://tt-rss.org/git/tt-rss
-rw-r--r--README.md18
-rw-r--r--plugins/af_redditimgur/init.php47
2 files changed, 44 insertions, 21 deletions
diff --git a/README.md b/README.md
index 0c3176f13..84d576034 100644
--- a/README.md
+++ b/README.md
@@ -4,7 +4,7 @@ Tiny Tiny RSS
Web-based news feed aggregator, designed to allow you to read news from
any location, while feeling as close to a real desktop application as possible.
-http://tt-rss.org (http://mirror.tt-rss.org)
+http://tt-rss.org
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -23,19 +23,3 @@ Copyright (c) 2005 Andrew Dolgov (unless explicitly stated otherwise).
Uses Silk icons by Mark James: http://www.famfamfam.com/lab/icons/silk/
-## Requirements
-
-* Compatible web browser (http://tt-rss.org/wiki/CompatibleBrowsers)
-* Web server, for example Apache
-* PHP (with support for mbstring functions)
-* PostgreSQL (tested on 8.3) or MySQL (InnoDB and version 4.1+ required)
-
-## Installation Notes
-
-http://tt-rss.org/wiki/InstallationNotes
-
-## See also
-
-* FAQ: http://tt-rss.org/wiki/FrequentlyAskedQuestions
-* Forum: http://tt-rss.org/forum
-* Wiki: http://tt-rss.org/wiki/WikiStart
diff --git a/plugins/af_redditimgur/init.php b/plugins/af_redditimgur/init.php
index 023d7c181..59b97d6e5 100644
--- a/plugins/af_redditimgur/init.php
+++ b/plugins/af_redditimgur/init.php
@@ -23,6 +23,9 @@ class Af_RedditImgur extends Plugin {
$enable_readability = $this->host->get($this, "enable_readability");
$enable_readability_checked = $enable_readability ? "checked" : "";
+ $enable_dupecheck = $this->host->get($this, "enable_dupecheck");
+ $enable_dupecheck_checked = $enable_dupecheck ? "checked" : "";
+
print "<form dojoType=\"dijit.form.Form\">";
print "<script type=\"dojo/method\" event=\"onSubmit\" args=\"evt\">
@@ -53,6 +56,13 @@ class Af_RedditImgur extends Plugin {
print "<label for=\"enable_readability\">" . __("Extract missing content using Readability") . "</label>";
+ print "<br/>";
+
+ print "<input dojoType=\"dijit.form.CheckBox\" id=\"enable_dupecheck\"
+ $enable_dupecheck_checked name=\"enable_dupecheck\">&nbsp;";
+
+ print "<label for=\"enable_dupecheck\">" . __("Mark duplicates as read using content links") . "</label>";
+
print "<p><button dojoType=\"dijit.form.Button\" type=\"submit\">".
__("Save")."</button>";
@@ -63,8 +73,10 @@ class Af_RedditImgur extends Plugin {
function save() {
$enable_readability = checkbox_to_sql_bool($_POST["enable_readability"]) == "true";
-
+ $enable_dupecheck = checkbox_to_sql_bool($_POST["enable_dupecheck"]) == "true";
+
$this->host->set($this, "enable_readability", $enable_readability);
+ $this->host->set($this, "enable_dupecheck", $enable_dupecheck);
echo __("Configuration saved");
}
@@ -228,15 +240,42 @@ class Af_RedditImgur extends Plugin {
@$doc->loadHTML($article["content"]);
$xpath = new DOMXPath($doc);
- $found = $this->inline_stuff($article, $doc, $xpath);
+ $content_link = $xpath->query("(//a[contains(., '[link]')])")->item(0);
+
+ if ($content_link && $this->host->get($this, "enable_dupecheck")) {
+
+ if (DB_TYPE == "pgsql") {
+ $date_qpart = "date_entered < NOW() - INTERVAL '1 day' ";
+ } else {
+ $date_qpart = "date_entered < DATE_SUB(NOW(), INTERVAL 1 DAY) ";
+ }
+
+ $content_href = db_escape_string($content_link->getAttribute("href"));
+ $owner_uid = $article["owner_uid"];
+ $guid = db_escape_string($article["guid_hashed"]);
+
+ $result = db_query("SELECT id FROM ttrss_entries, ttrss_user_entries
+ WHERE
+ content LIKE '%$content_href%' AND
+ $date_qpart AND
+ ref_id = id AND
+ owner_uid = $owner_uid
+ AND guid != '$guid'
+ LIMIT 1");
+
+ if (db_num_rows($result) != 0) {
+ $found = true;
+ $article["force_catchup"] = true;
+ }
+ }
+
+ if (!$found) $found = $this->inline_stuff($article, $doc, $xpath);
if (function_exists("curl_init") && !$found && $this->host->get($this, "enable_readability") &&
mb_strlen(strip_tags($article["content"])) <= 150) {
if (!class_exists("Readability")) require_once(dirname(dirname(__DIR__)). "/lib/readability/Readability.php");
- $content_link = $xpath->query("(//a[contains(., '[link]')])")->item(0);
-
if ($content_link &&
strpos($content_link->getAttribute("href"), "twitter.com") === FALSE &&
strpos($content_link->getAttribute("href"), "youtube.com") === FALSE &&