From e938b1de117cfde17a5773fe0c6fc92185c873fe Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Sun, 30 Dec 2012 13:36:40 +0400 Subject: rename plugin main class files --- plugins/share/init.php | 74 +++++++++++++++++++++++++++++++++++++++++++++++++ plugins/share/share.php | 74 ------------------------------------------------- 2 files changed, 74 insertions(+), 74 deletions(-) create mode 100644 plugins/share/init.php delete mode 100644 plugins/share/share.php (limited to 'plugins/share') diff --git a/plugins/share/init.php b/plugins/share/init.php new file mode 100644 index 000000000..e1151849b --- /dev/null +++ b/plugins/share/init.php @@ -0,0 +1,74 @@ +link = $host->get_link(); + $this->host = $host; + + $host->add_hook($host::HOOK_ARTICLE_BUTTON, $this); + } + + function get_js() { + return file_get_contents(dirname(__FILE__) . "/share.js"); + } + + function hook_article_button($line) { + return "link, 'plugins/share/share.png')."\" + class='tagsPic' style=\"cursor : pointer\" + onclick=\"shareArticle(".$line['int_id'].")\" + title='".__('Share by URL')."'>"; + } + + function shareArticle() { + $param = db_escape_string($_REQUEST['param']); + + $result = db_query($this->link, "SELECT uuid, ref_id FROM ttrss_user_entries WHERE int_id = '$param' + AND owner_uid = " . $_SESSION['uid']); + + if (db_num_rows($result) == 0) { + print "Article not found."; + } else { + + $uuid = db_fetch_result($result, 0, "uuid"); + $ref_id = db_fetch_result($result, 0, "ref_id"); + + if (!$uuid) { + $uuid = db_escape_string(sha1(uniqid(rand(), true))); + db_query($this->link, "UPDATE ttrss_user_entries SET uuid = '$uuid' WHERE int_id = '$param' + AND owner_uid = " . $_SESSION['uid']); + } + + print __("You can share this article by the following unique URL:"); + + $url_path = get_self_url_prefix(); + $url_path .= "/public.php?op=share&key=$uuid"; + + print "
"; + print "$url_path"; + print "
"; + + /* if (!label_find_id($this->link, __('Shared'), $_SESSION["uid"])) + label_create($this->link, __('Shared'), $_SESSION["uid"]); + + label_add_article($this->link, $ref_id, __('Shared'), $_SESSION['uid']); */ + } + + print "
"; + + print ""; + + print "
"; + } + + +} +?> diff --git a/plugins/share/share.php b/plugins/share/share.php deleted file mode 100644 index e1151849b..000000000 --- a/plugins/share/share.php +++ /dev/null @@ -1,74 +0,0 @@ -link = $host->get_link(); - $this->host = $host; - - $host->add_hook($host::HOOK_ARTICLE_BUTTON, $this); - } - - function get_js() { - return file_get_contents(dirname(__FILE__) . "/share.js"); - } - - function hook_article_button($line) { - return "link, 'plugins/share/share.png')."\" - class='tagsPic' style=\"cursor : pointer\" - onclick=\"shareArticle(".$line['int_id'].")\" - title='".__('Share by URL')."'>"; - } - - function shareArticle() { - $param = db_escape_string($_REQUEST['param']); - - $result = db_query($this->link, "SELECT uuid, ref_id FROM ttrss_user_entries WHERE int_id = '$param' - AND owner_uid = " . $_SESSION['uid']); - - if (db_num_rows($result) == 0) { - print "Article not found."; - } else { - - $uuid = db_fetch_result($result, 0, "uuid"); - $ref_id = db_fetch_result($result, 0, "ref_id"); - - if (!$uuid) { - $uuid = db_escape_string(sha1(uniqid(rand(), true))); - db_query($this->link, "UPDATE ttrss_user_entries SET uuid = '$uuid' WHERE int_id = '$param' - AND owner_uid = " . $_SESSION['uid']); - } - - print __("You can share this article by the following unique URL:"); - - $url_path = get_self_url_prefix(); - $url_path .= "/public.php?op=share&key=$uuid"; - - print "
"; - print "$url_path"; - print "
"; - - /* if (!label_find_id($this->link, __('Shared'), $_SESSION["uid"])) - label_create($this->link, __('Shared'), $_SESSION["uid"]); - - label_add_article($this->link, $ref_id, __('Shared'), $_SESSION['uid']); */ - } - - print "
"; - - print ""; - - print "
"; - } - - -} -?> -- cgit v1.2.3