From 257efb43c6e32226280d8198acc946a2fc4c454f Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Mon, 15 Feb 2021 15:52:28 +0300 Subject: article: unify naming --- plugins/note/init.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'plugins/note') diff --git a/plugins/note/init.php b/plugins/note/init.php index 3c2ca0075..d5b231190 100644 --- a/plugins/note/init.php +++ b/plugins/note/init.php @@ -65,7 +65,7 @@ class Note extends Plugin { WHERE ref_id = ? AND owner_uid = ?"); $sth->execute([$note, $id, $_SESSION['uid']]); - $formatted_note = Article::format_article_note($id, $note); + $formatted_note = Article::_format_note_html($id, $note); print json_encode(array("note" => $formatted_note, "raw_length" => mb_strlen($note))); -- cgit v1.2.3 From 1f43d7916cda16e9680b9087bda1f52934e8f25b Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Tue, 16 Feb 2021 14:32:06 +0300 Subject: replace print_hidden with hidden_tag --- plugins/note/init.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'plugins/note') diff --git a/plugins/note/init.php b/plugins/note/init.php index d5b231190..0634d4c57 100644 --- a/plugins/note/init.php +++ b/plugins/note/init.php @@ -37,10 +37,10 @@ class Note extends Plugin { $note = $row['note']; - print_hidden("id", "$param"); - print_hidden("op", "pluginhandler"); - print_hidden("method", "setNote"); - print_hidden("plugin", "note"); + print \Controls\hidden_tag("id", "$param"); + print \Controls\hidden_tag("op", "pluginhandler"); + print \Controls\hidden_tag("method", "setNote"); + print \Controls\hidden_tag("plugin", "note"); print ""; - + name='note'> + "; - print " "; - print ""; - print ""; - + ?> +
+ + +
+ Date: Wed, 17 Feb 2021 14:56:36 +0300 Subject: plugins: load dialogs via xhr instead of http --- plugins/note/init.php | 6 +++--- plugins/note/note.js | 15 ++++++++++----- 2 files changed, 13 insertions(+), 8 deletions(-) (limited to 'plugins/note') diff --git a/plugins/note/init.php b/plugins/note/init.php index 12c56f7ad..65e1f0eef 100644 --- a/plugins/note/init.php +++ b/plugins/note/init.php @@ -27,17 +27,17 @@ class Note extends Plugin { } function edit() { - $param = $_REQUEST['param']; + $id = clean($_REQUEST['id']); $sth = $this->pdo->prepare("SELECT note FROM ttrss_user_entries WHERE ref_id = ? AND owner_uid = ?"); - $sth->execute([$param, $_SESSION['uid']]); + $sth->execute([$id, $_SESSION['uid']]); if ($row = $sth->fetch()) { $note = $row['note']; - print \Controls\hidden_tag("id", "$param"); + print \Controls\hidden_tag("id", $id); print \Controls\hidden_tag("op", "pluginhandler"); print \Controls\hidden_tag("method", "setNote"); print \Controls\hidden_tag("plugin", "note"); diff --git a/plugins/note/note.js b/plugins/note/note.js index ab2ed9208..215058b21 100644 --- a/plugins/note/note.js +++ b/plugins/note/note.js @@ -1,11 +1,8 @@ -/* global Plugins, xhrJson, Notify, fox, __ */ +/* global dojo, xhrPost, Plugins, xhrJson, Notify, fox, __ */ Plugins.Note = { edit: function(id) { - const query = "backend.php?op=pluginhandler&plugin=note&method=edit¶m=" + encodeURIComponent(id); - const dialog = new fox.SingleUseDialog({ - id: "editNoteDlg", title: __("Edit article note"), execute: function () { if (this.validate()) { @@ -30,7 +27,15 @@ Plugins.Note = { }); } }, - href: query, + content: __("Loading, please wait...") + }); + + const tmph = dojo.connect(dialog, 'onShow', function () { + dojo.disconnect(tmph); + + xhrPost("backend.php", {op: "pluginhandler", plugin: "note", method: "edit", id: id}, (transport) => { + dialog.attr('content', transport.responseText); + }); }); dialog.show(); -- cgit v1.2.3 From e4609c18efceebb1e021d814f53061ada7f6489a Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Wed, 17 Feb 2021 21:44:21 +0300 Subject: * add (disabled) shortcut syntax for plugin methods * add controls shortcut for pluginhandler tags * add similar shortcut for frontend * allow plugins to selectively exclude their methods from CSRF checking --- plugins/note/init.php | 4 +--- plugins/note/note.js | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) (limited to 'plugins/note') diff --git a/plugins/note/init.php b/plugins/note/init.php index 65e1f0eef..278cfe6c3 100644 --- a/plugins/note/init.php +++ b/plugins/note/init.php @@ -38,9 +38,7 @@ class Note extends Plugin { $note = $row['note']; print \Controls\hidden_tag("id", $id); - print \Controls\hidden_tag("op", "pluginhandler"); - print \Controls\hidden_tag("method", "setNote"); - print \Controls\hidden_tag("plugin", "note"); + print \Controls\pluginhandler_tags($this, "setnote"); ?>