summaryrefslogtreecommitdiff
path: root/plugins/share
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2013-07-11 14:11:41 +0400
committerAndrew Dolgov <[email protected]>2013-07-11 14:11:41 +0400
commit41a7a066eff0c4914720685c38fa282e99d79041 (patch)
tree1a9e55c8186cc77b1bfd0e15273b87a2a43e53ed /plugins/share
parent6e3224a26c46280a351fb0f28c6e9fc0b798ca53 (diff)
share: move unsharing all articles into the plugin
Diffstat (limited to 'plugins/share')
-rw-r--r--plugins/share/init.php30
-rw-r--r--plugins/share/share_prefs.js21
2 files changed, 51 insertions, 0 deletions
diff --git a/plugins/share/init.php b/plugins/share/init.php
index a1b0146a1..552aa0a31 100644
--- a/plugins/share/init.php
+++ b/plugins/share/init.php
@@ -12,12 +12,18 @@ class Share extends Plugin {
$this->host = $host;
$host->add_hook($host::HOOK_ARTICLE_BUTTON, $this);
+ $host->add_hook($host::HOOK_PREFS_TAB_SECTION, $this);
}
function get_js() {
return file_get_contents(dirname(__FILE__) . "/share.js");
}
+ function get_prefs_js() {
+ return file_get_contents(dirname(__FILE__) . "/share_prefs.js");
+ }
+
+
function unshare() {
$id = db_escape_string($_REQUEST['id']);
@@ -27,6 +33,30 @@ class Share extends Plugin {
print "OK";
}
+ function hook_prefs_tab_section($id) {
+ if ($id == "prefFeedsPublishedGenerated") {
+
+ print_warning(__("You can disable all articles shared by unique URLs here."));
+
+ print "<p>";
+
+ print "<button dojoType=\"dijit.form.Button\" onclick=\"return clearArticleAccessKeys()\">".
+ __('Unshare all articles')."</button> ";
+
+ print "</p>";
+
+ }
+ }
+
+ // Silent
+ function clearArticleKeys() {
+ db_query("UPDATE ttrss_user_entries SET uuid = '' WHERE
+ owner_uid = " . $_SESSION["uid"]);
+
+ return;
+ }
+
+
function newkey() {
$id = db_escape_string($_REQUEST['id']);
diff --git a/plugins/share/share_prefs.js b/plugins/share/share_prefs.js
new file mode 100644
index 000000000..9efe291f9
--- /dev/null
+++ b/plugins/share/share_prefs.js
@@ -0,0 +1,21 @@
+function clearArticleAccessKeys() {
+
+ var ok = confirm(__("This will invalidate all previously shared article URLs. Continue?"));
+
+ if (ok) {
+ notify_progress("Clearing URLs...");
+
+ var query = "?op=pluginhandler&plugin=share&method=clearArticleKeys";
+
+ new Ajax.Request("backend.php", {
+ parameters: query,
+ onComplete: function(transport) {
+ notify_info("Shared URLs cleared.");
+ } });
+ }
+
+ return false;
+}
+
+
+