share: move unsharing all articles into the plugin

master
Andrew Dolgov 12 years ago
parent 6e3224a26c
commit 41a7a066ef

@ -1471,15 +1471,6 @@ class Pref_Feeds extends Handler_Protected {
print "</p>"; 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, PluginHost::getInstance()->run_hooks(PluginHost::HOOK_PREFS_TAB_SECTION,
"hook_prefs_tab_section", "prefFeedsPublishedGenerated"); "hook_prefs_tab_section", "prefFeedsPublishedGenerated");

@ -467,14 +467,6 @@ class RPC extends Handler_Protected {
print_feed_cat_select("cat_id", $id, ''); 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() { function setpanelmode() {
$wide = (int) $_REQUEST["wide"]; $wide = (int) $_REQUEST["wide"];

@ -1529,25 +1529,6 @@ function clearFeedAccessKeys() {
return false; 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() { function resetFilterOrder() {
try { try {
notify_progress("Loading, please wait..."); notify_progress("Loading, please wait...");

@ -12,12 +12,18 @@ class Share extends Plugin {
$this->host = $host; $this->host = $host;
$host->add_hook($host::HOOK_ARTICLE_BUTTON, $this); $host->add_hook($host::HOOK_ARTICLE_BUTTON, $this);
$host->add_hook($host::HOOK_PREFS_TAB_SECTION, $this);
} }
function get_js() { function get_js() {
return file_get_contents(dirname(__FILE__) . "/share.js"); return file_get_contents(dirname(__FILE__) . "/share.js");
} }
function get_prefs_js() {
return file_get_contents(dirname(__FILE__) . "/share_prefs.js");
}
function unshare() { function unshare() {
$id = db_escape_string($_REQUEST['id']); $id = db_escape_string($_REQUEST['id']);
@ -27,6 +33,30 @@ class Share extends Plugin {
print "OK"; 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() { function newkey() {
$id = db_escape_string($_REQUEST['id']); $id = db_escape_string($_REQUEST['id']);

@ -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;
}
Loading…
Cancel
Save