From: Andrew Dolgov Date: Thu, 11 Jul 2013 10:11:41 +0000 (+0400) Subject: share: move unsharing all articles into the plugin X-Git-Tag: 1.9~45 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=41a7a066eff0c4914720685c38fa282e99d79041;p=tt-rss.git share: move unsharing all articles into the plugin --- diff --git a/classes/pref/feeds.php b/classes/pref/feeds.php index 870c4fed..1f8c5e4a 100644 --- a/classes/pref/feeds.php +++ b/classes/pref/feeds.php @@ -1471,15 +1471,6 @@ class Pref_Feeds extends Handler_Protected { print "

"; - print_warning(__("You can disable all articles shared by unique URLs here.")); - - print "

"; - - print " "; - - print "

"; - PluginHost::getInstance()->run_hooks(PluginHost::HOOK_PREFS_TAB_SECTION, "hook_prefs_tab_section", "prefFeedsPublishedGenerated"); diff --git a/classes/rpc.php b/classes/rpc.php index 46583feb..9cc8e704 100644 --- a/classes/rpc.php +++ b/classes/rpc.php @@ -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"]; diff --git a/js/prefs.js b/js/prefs.js index 287804c6..67a4a378 100644 --- a/js/prefs.js +++ b/js/prefs.js @@ -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..."); diff --git a/plugins/share/init.php b/plugins/share/init.php index a1b0146a..552aa0a3 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 "

"; + + print " "; + + print "

"; + + } + } + + // 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 00000000..9efe291f --- /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; +} + + +