diff options
Diffstat (limited to 'plugins')
| -rw-r--r-- | plugins/close_button/button.png | bin | 3643 -> 655 bytes | |||
| -rw-r--r-- | plugins/googlereaderimport/init.php | 7 | ||||
| -rw-r--r-- | plugins/mail/mail.png | bin | 192 -> 641 bytes | |||
| -rw-r--r-- | plugins/mailto/mail.png | bin | 254 -> 821 bytes | |||
| -rw-r--r-- | plugins/mark_button/init.php | 4 | ||||
| -rw-r--r-- | plugins/note/note.png | bin | 159 -> 500 bytes | |||
| -rw-r--r-- | plugins/share/init.php | 58 | ||||
| -rw-r--r-- | plugins/share/share.js | 59 | ||||
| -rw-r--r-- | plugins/share/share.png | bin | 3639 -> 343 bytes | |||
| -rw-r--r-- | plugins/share/share_prefs.js | 21 | ||||
| -rw-r--r-- | plugins/updater/init.php | 2 | ||||
| -rw-r--r-- | plugins/vf_shared/init.php | 60 | ||||
| -rw-r--r-- | plugins/vf_shared/share.png | bin | 0 -> 343 bytes |
13 files changed, 204 insertions, 7 deletions
diff --git a/plugins/close_button/button.png b/plugins/close_button/button.png Binary files differindex b04aed796..1514d51a3 100644 --- a/plugins/close_button/button.png +++ b/plugins/close_button/button.png diff --git a/plugins/googlereaderimport/init.php b/plugins/googlereaderimport/init.php index 2e22161b9..dcb335a0d 100644 --- a/plugins/googlereaderimport/init.php +++ b/plugins/googlereaderimport/init.php @@ -114,6 +114,7 @@ class GoogleReaderImport extends Plugin { $guid = db_escape_string(mb_substr($item['id'], 0, 250)); $title = db_escape_string($item['title']); $updated = date('Y-m-d h:i:s', $item['updated']); + $last_marked = date('Y-m-d h:i:s', mb_substr($item['crawlTimeMsec'], 0, 10)); $link = ''; $content = ''; $author = db_escape_string($item['author']); @@ -165,7 +166,7 @@ class GoogleReaderImport extends Plugin { $imported += (int) $this->create_article($owner_uid, $guid, $title, $link, $updated, $content, $author, $sql_set_marked, $tags, - $orig_feed_data); + $orig_feed_data, $last_marked); if ($file && $processed % 25 == 0) { _debug("processed $processed articles..."); @@ -196,7 +197,7 @@ class GoogleReaderImport extends Plugin { } // expects ESCAPED data - private function create_article($owner_uid, $guid, $title, $link, $updated, $content, $author, $marked, $tags, $orig_feed_data) { + private function create_article($owner_uid, $guid, $title, $link, $updated, $content, $author, $marked, $tags, $orig_feed_data, $last_marked) { if (!$guid) $guid = sha1($link); @@ -299,7 +300,7 @@ class GoogleReaderImport extends Plugin { (ref_id, uuid, feed_id, orig_feed_id, owner_uid, marked, tag_cache, label_cache, last_read, note, unread, last_marked) VALUES - ('$ref_id', '', NULL, $orig_feed_id, $owner_uid, $marked, '', '', NOW(), '', false, NOW())"); + ('$ref_id', '', NULL, $orig_feed_id, $owner_uid, $marked, '', '', '$last_marked', '', false, '$last_marked')"); $result = db_query("SELECT int_id FROM ttrss_user_entries, ttrss_entries WHERE owner_uid = $owner_uid AND ref_id = id AND ref_id = $ref_id"); diff --git a/plugins/mail/mail.png b/plugins/mail/mail.png Binary files differindex 4d3fe7751..7348aed77 100644 --- a/plugins/mail/mail.png +++ b/plugins/mail/mail.png diff --git a/plugins/mailto/mail.png b/plugins/mailto/mail.png Binary files differindex fcdcbd604..2c49f78a6 100644 --- a/plugins/mailto/mail.png +++ b/plugins/mailto/mail.png diff --git a/plugins/mark_button/init.php b/plugins/mark_button/init.php index 971b12932..4cdff53d0 100644 --- a/plugins/mark_button/init.php +++ b/plugins/mark_button/init.php @@ -21,12 +21,12 @@ class Mark_Button extends Plugin { if (get_pref("COMBINED_DISPLAY_MODE")) { if (sql_bool_to_bool($line["marked"])) { $marked_pic = "<img - src=\"images/mark_set.svg\" + src=\"images/mark_set.png\" class=\"markedPic\" alt=\"Unstar article\" onclick='toggleMark($id)'>"; } else { $marked_pic = "<img - src=\"images/mark_unset.svg\" + src=\"images/mark_unset.png\" class=\"markedPic\" alt=\"Star article\" onclick='toggleMark($id)'>"; } diff --git a/plugins/note/note.png b/plugins/note/note.png Binary files differindex 7f9f3fc3f..244e6ca04 100644 --- a/plugins/note/note.png +++ b/plugins/note/note.png diff --git a/plugins/share/init.php b/plugins/share/init.php index 72a4d4bf9..552aa0a31 100644 --- a/plugins/share/init.php +++ b/plugins/share/init.php @@ -12,12 +12,62 @@ 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']); + + db_query("UPDATE ttrss_user_entries SET uuid = '' WHERE int_id = '$id' + AND owner_uid = " . $_SESSION['uid']); + + 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']); + + $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 +100,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 +111,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>"; diff --git a/plugins/share/share.js b/plugins/share/share.js index 6752189ea..bbfb553d5 100644 --- a/plugins/share/share.js +++ b/plugins/share/share.js @@ -9,12 +9,69 @@ function shareArticle(id) { id: "shareArticleDlg", title: __("Share article by URL"), style: "width: 600px", + newurl: function() { + + var ok = confirm(__("Generate new share URL for this article?")); + + if (ok) { + + notify_progress("Trying to change URL...", true); + + var query = "op=pluginhandler&plugin=share&method=newkey&id=" + param_escape(id); + + new Ajax.Request("backend.php", { + parameters: query, + onComplete: function(transport) { + var reply = JSON.parse(transport.responseText); + var new_link = reply.link; + + var e = $('gen_article_url'); + + if (new_link) { + + e.innerHTML = e.innerHTML.replace(/\&key=.*$/, + "&key=" + new_link); + + e.href = e.href.replace(/\&key=.*$/, + "&key=" + new_link); + + new Effect.Highlight(e); + + notify(''); + + } else { + notify_error("Could not change URL."); + } + } }); + + } + + }, + unshare: function() { + + var ok = confirm(__("Remove sharing for this article?")); + + if (ok) { + + notify_progress("Trying to unshare...", true); + + var query = "op=pluginhandler&plugin=share&method=unshare&id=" + param_escape(id); + + new Ajax.Request("backend.php", { + parameters: query, + onComplete: function(transport) { + notify("Article unshared."); + dialog.hide(); + } }); + } + + }, href: query}); dialog.show(); } catch (e) { - exception_error("emailArticle", e); + exception_error("shareArticle", e); } } diff --git a/plugins/share/share.png b/plugins/share/share.png Binary files differindex 3b6398f4a..25eacb7c2 100644 --- a/plugins/share/share.png +++ b/plugins/share/share.png diff --git a/plugins/share/share_prefs.js b/plugins/share/share_prefs.js new file mode 100644 index 000000000..9efe291f9 --- /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; +} + + + diff --git a/plugins/updater/init.php b/plugins/updater/init.php index fa283c8be..69d9b08b2 100644 --- a/plugins/updater/init.php +++ b/plugins/updater/init.php @@ -24,6 +24,8 @@ class Updater extends Plugin { // __FILE__ is in plugins/updater so we need to go one level up $work_dir = dirname(dirname(dirname(__FILE__))); $parent_dir = dirname($work_dir); + // Set PATH to run "which" + putenv('PATH="$PATH:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin"'); $log = array(); if (!is_array($params)) $params = array(); diff --git a/plugins/vf_shared/init.php b/plugins/vf_shared/init.php new file mode 100644 index 000000000..00d288c05 --- /dev/null +++ b/plugins/vf_shared/init.php @@ -0,0 +1,60 @@ +<?php +class VF_Shared extends Plugin { + + private $host; + + function about() { + return array(1.0, + "Feed for all articles actively shared by URL", + "fox", + false); + } + + function init($host) { + $this->host = $host; + + $host->add_feed(-1, __("Shared articles"), 'plugins/vf_shared/share.png', $this); + } + + function api_version() { + return 2; + } + + function get_unread($feed_id) { + $result = db_query("select count(int_id) AS count from ttrss_user_entries where owner_uid = ".$_SESSION["uid"]." and unread = true and uuid != ''"); + + return db_fetch_result($result, 0, "count"); + } + + function get_total($feed_id) { + $result = db_query("select count(int_id) AS count from ttrss_user_entries where owner_uid = ".$_SESSION["uid"]." and uuid != ''"); + + return db_fetch_result($result, 0, "count"); + } + + //function queryFeedHeadlines($feed, $limit, $view_mode, $cat_view, $search, $search_mode, $override_order = false, $offset = 0, $owner_uid = 0, $filter = false, $since_id = 0, $include_children = false, $ignore_vfeed_group = false, $override_strategy = false, $override_vfeed = false) { + + function get_headlines($feed_id, $options) { + $qfh_ret = queryFeedHeadlines(-4, + $options['limit'], + $this->get_unread() > 0 ? "adaptive" : "all_articles", + false, + $options['search'], + $options['search_mode'], + $options['override_order'], + $options['offset'], + $options['owner_uid'], + $options['filter'], + $options['since_id'], + $options['include_children'], + false, + "uuid != ''", + "ttrss_feeds.title AS feed_title,"); + + $qfh_ret[1] = __("Shared articles"); + + return $qfh_ret; + } + +} +?> diff --git a/plugins/vf_shared/share.png b/plugins/vf_shared/share.png Binary files differnew file mode 100644 index 000000000..25eacb7c2 --- /dev/null +++ b/plugins/vf_shared/share.png |