]> git.wh0rd.org - tt-rss.git/commitdiff
share: move unsharing all articles into the plugin
authorAndrew Dolgov <fox@madoka.volgo-balt.ru>
Thu, 11 Jul 2013 10:11:41 +0000 (14:11 +0400)
committerAndrew Dolgov <fox@madoka.volgo-balt.ru>
Thu, 11 Jul 2013 10:11:41 +0000 (14:11 +0400)
classes/pref/feeds.php
classes/rpc.php
js/prefs.js
plugins/share/init.php
plugins/share/share_prefs.js [new file with mode: 0644]

index 870c4fed4bf1ef72a406160af7cb6a064878bd8e..1f8c5e4a0101be73e49ac19d7f20730fd7b9804e 100644 (file)
@@ -1471,15 +1471,6 @@ class Pref_Feeds extends Handler_Protected {
 
                print "</p>";
 
-               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>";
-
                PluginHost::getInstance()->run_hooks(PluginHost::HOOK_PREFS_TAB_SECTION,
                        "hook_prefs_tab_section", "prefFeedsPublishedGenerated");
 
index 46583feb58469d333e6b97489eeebe6920575d58..9cc8e704669db4a28d96ff175e2e03d2feb54bb6 100644 (file)
@@ -467,14 +467,6 @@ class RPC extends Handler_Protected {
                print_feed_cat_select("cat_id", $id, '');
        }
 
-       // Silent
-       function clearArticleKeys() {
-               $this->dbh->query("UPDATE ttrss_user_entries SET uuid = '' WHERE
-                       owner_uid = " . $_SESSION["uid"]);
-
-               return;
-       }
-
        function setpanelmode() {
                $wide = (int) $_REQUEST["wide"];
 
index 287804c6f0e3d2364ad82cb57aa3089b1041ffa3..67a4a378c57c9b1131c7027ebaf7516a1863b908 100644 (file)
@@ -1529,25 +1529,6 @@ function clearFeedAccessKeys() {
        return false;
 }
 
-function clearArticleAccessKeys() {
-
-       var ok = confirm(__("This will invalidate all previously shared article URLs. Continue?"));
-
-       if (ok) {
-               notify_progress("Clearing URLs...");
-
-               var query = "?op=rpc&method=clearArticleKeys";
-
-               new Ajax.Request("backend.php", {
-                       parameters: query,
-                       onComplete: function(transport) {
-                               notify_info("Shared URLs cleared.");
-                       } });
-       }
-
-       return false;
-}
-
 function resetFilterOrder() {
        try {
                notify_progress("Loading, please wait...");
index a1b0146a1d2599fa133838466d53fb33c5810dac..552aa0a3138787c1466ff7c00b568027ba4d2d6a 100644 (file)
@@ -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 (file)
index 0000000..9efe291
--- /dev/null
@@ -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;
+}
+
+
+