diff options
author | Andrew Dolgov <[email protected]> | 2013-07-11 14:03:40 +0400 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2013-07-11 14:03:40 +0400 |
commit | 98d01eb19e5824b6fd457f8d0876447cc8c87583 (patch) | |
tree | 2e3c57945552c58545b1bec8ef655520951d4d41 /plugins/share/init.php | |
parent | a6a61a8cb14a17a4767c4564b531d9a6595b9124 (diff) |
allow unsharing specific articles / creating new share key
Diffstat (limited to 'plugins/share/init.php')
-rw-r--r-- | plugins/share/init.php | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/plugins/share/init.php b/plugins/share/init.php index 72a4d4bf9..a1b0146a1 100644 --- a/plugins/share/init.php +++ b/plugins/share/init.php @@ -18,6 +18,26 @@ class Share extends Plugin { return file_get_contents(dirname(__FILE__) . "/share.js"); } + function unshare() { + $id = db_escape_string($_REQUEST['id']); + + db_query("UPDATE ttrss_user_entries SET uuid = '' WHERE int_id = '$id' + AND owner_uid = " . $_SESSION['uid']); + + print "OK"; + } + + function newkey() { + $id = db_escape_string($_REQUEST['id']); + + $uuid = db_escape_string(sha1(uniqid(rand(), true))); + + db_query("UPDATE ttrss_user_entries SET uuid = '$uuid' WHERE int_id = '$id' + AND owner_uid = " . $_SESSION['uid']); + + print json_encode(array("link" => $uuid)); + } + function hook_article_button($line) { return "<img src=\"plugins/share/share.png\" class='tagsPic' style=\"cursor : pointer\" @@ -50,7 +70,7 @@ class Share extends Plugin { $url_path .= "/public.php?op=share&key=$uuid"; print "<div class=\"tagCloudContainer\">"; - print "<a id='pub_opml_url' href='$url_path' target='_blank'>$url_path</a>"; + print "<a id='gen_article_url' href='$url_path' target='_blank'>$url_path</a>"; print "</div>"; /* if (!label_find_id(__('Shared'), $_SESSION["uid"])) @@ -61,6 +81,12 @@ class Share extends Plugin { print "<div align='center'>"; + print "<button dojoType=\"dijit.form.Button\" onclick=\"return dijit.byId('shareArticleDlg').unshare()\">". + __('Unshare article')."</button>"; + + print "<button dojoType=\"dijit.form.Button\" onclick=\"return dijit.byId('shareArticleDlg').newurl()\">". + __('Generate new URL')."</button>"; + print "<button dojoType=\"dijit.form.Button\" onclick=\"return dijit.byId('shareArticleDlg').hide()\">". __('Close this window')."</button>"; |