af_redditimgur: add option for previous

master
Andrew Dolgov 9 years ago
parent 902b1ac7b5
commit 891b77f90e

@ -27,6 +27,9 @@ class Af_RedditImgur extends Plugin {
$enable_readability = $this->host->get($this, "enable_readability");
$enable_readability_checked = $enable_readability ? "checked" : "";
$enable_content_dupcheck = $this->host->get($this, "enable_content_dupcheck");
$enable_content_dupcheck_checked = $enable_content_dupcheck ? "checked" : "";
print "<form dojoType=\"dijit.form.Form\">";
print "<script type=\"dojo/method\" event=\"onSubmit\" args=\"evt\">
@ -55,6 +58,12 @@ 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_content_dupcheck\"
$enable_content_dupcheck_checked name=\"enable_content_dupcheck\">&nbsp;";
print "<label for=\"enable_content_dupcheck\">" . __("Enable additional duplicate checking") . "</label>";
print "<p><button dojoType=\"dijit.form.Button\" type=\"submit\">".
__("Save")."</button>";
@ -65,8 +74,10 @@ class Af_RedditImgur extends Plugin {
function save() {
$enable_readability = checkbox_to_sql_bool($_POST["enable_readability"]) == "true";
$enable_content_dupcheck = checkbox_to_sql_bool($_POST["enable_content_dupcheck"]) == "true";
$this->host->set($this, "enable_readability", $enable_readability);
$this->host->set($this, "enable_readability", $enable_readability, false);
$this->host->set($this, "enable_content_dupcheck", $enable_content_dupcheck);
echo __("Configuration saved");
}
@ -244,33 +255,35 @@ class Af_RedditImgur extends Plugin {
@$doc->loadHTML($article["content"]);
$xpath = new DOMXPath($doc);
/*$content_link = $xpath->query("(//a[contains(., '[link]')])")->item(0);
if ($this->host->get($this, "enable_content_dupcheck")) {
$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 ($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)";
}
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]%'");
$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 ($result) {
$num_found = db_fetch_result($result, 0, "cid");
if ($num_found > 0) $article["force_catchup"] = true;
if ($num_found > 0) $article["force_catchup"] = true;
}
}
}*/
}
$found = $this->inline_stuff($article, $doc, $xpath);

Loading…
Cancel
Save