";
@@ -821,9 +821,9 @@ class Pref_Feeds extends Handler_Protected {
print "";
- print_hidden("ids", "$feed_ids");
- print_hidden("op", "pref-feeds");
- print_hidden("method", "batchEditSave");
+ print \Controls\hidden_tag("ids", "$feed_ids");
+ print \Controls\hidden_tag("op", "pref-feeds");
+ print \Controls\hidden_tag("method", "batchEditSave");
print "";
print "";
diff --git a/classes/pref/filters.php b/classes/pref/filters.php
index 23275a1d6..9b740753a 100755
--- a/classes/pref/filters.php
+++ b/classes/pref/filters.php
@@ -327,16 +327,16 @@ class Pref_Filters extends Handler_Protected {
print "";
}
function sendEmail() {
@@ -229,20 +224,6 @@ class Mail extends Plugin {
print json_encode($reply);
}
- /* function completeEmails() {
- $search = $_REQUEST["search"];
-
- print "";
-
- foreach ($_SESSION['stored_emails'] as $email) {
- if (strpos($email, $search) !== false) {
- print "$email ";
- }
- }
-
- print " ";
- } */
-
function api_version() {
return 2;
}
diff --git a/plugins/mail/mail.js b/plugins/mail/mail.js
index 5ddc0dc41..4cdf6999d 100644
--- a/plugins/mail/mail.js
+++ b/plugins/mail/mail.js
@@ -1,4 +1,4 @@
-/* global Plugins, Headlines, xhrJson, Notify, fox, __ */
+/* global Plugins, Headlines, dojo, xhrPost, xhrJson, Notify, fox, __ */
Plugins.Mail = {
send: function(id) {
@@ -13,10 +13,7 @@ Plugins.Mail = {
id = ids.toString();
}
- const query = "backend.php?op=pluginhandler&plugin=mail&method=emailArticle¶m=" + encodeURIComponent(id);
-
const dialog = new fox.SingleUseDialog({
- id: "emailArticleDlg",
title: __("Forward article by email"),
execute: function () {
if (this.validate()) {
@@ -35,16 +32,16 @@ Plugins.Mail = {
});
}
},
- href: query
+ content: __("Loading, please wait...")
});
- /* var tmph = dojo.connect(dialog, 'onLoad', function() {
- dojo.disconnect(tmph);
+ const tmph = dojo.connect(dialog, 'onShow', function () {
+ dojo.disconnect(tmph);
- new Ajax.Autocompleter('emailArticleDlg_destination', 'emailArticleDlg_dst_choices',
- "backend.php?op=pluginhandler&plugin=mail&method=completeEmails",
- { tokens: '', paramName: "search" });
- }); */
+ xhrPost("backend.php", {op: "pluginhandler", plugin: "mail", method: "emailArticle", ids: id}, (transport) => {
+ dialog.attr('content', transport.responseText);
+ });
+ });
dialog.show();
},
diff --git a/plugins/mailto/init.js b/plugins/mailto/init.js
index ae68bf49b..4bf672a88 100644
--- a/plugins/mailto/init.js
+++ b/plugins/mailto/init.js
@@ -1,4 +1,4 @@
-/* global Plugins, Headlines, fox, __ */
+/* global Plugins, Headlines, xhrPost, dojo, fox, __ */
Plugins.Mailto = {
send: function (id) {
@@ -13,12 +13,19 @@ Plugins.Mailto = {
id = ids.toString();
}
- const query = "backend.php?op=pluginhandler&plugin=mailto&method=emailArticle¶m=" + encodeURIComponent(id);
-
const dialog = new fox.SingleUseDialog({
- id: "emailArticleDlg",
title: __("Forward article by email"),
- href: query});
+ content: __("Loading, please wait...")
+ });
+
+ const tmph = dojo.connect(dialog, 'onShow', function () {
+ dojo.disconnect(tmph);
+
+ xhrPost("backend.php", {op: "pluginhandler", plugin: "mailto", method: "emailArticle", ids: id}, (transport) => {
+ dialog.attr('content', transport.responseText);
+ });
+ });
+
dialog.show();
}
diff --git a/plugins/mailto/init.php b/plugins/mailto/init.php
index 3e24dcf29..4b858eae6 100644
--- a/plugins/mailto/init.php
+++ b/plugins/mailto/init.php
@@ -20,7 +20,7 @@ class MailTo extends Plugin {
}
function get_js() {
- return file_get_contents(dirname(__FILE__) . "/init.js");
+ return file_get_contents(__DIR__ . "/init.js");
}
function hook_article_button($line) {
@@ -31,7 +31,7 @@ class MailTo extends Plugin {
function emailArticle() {
- $ids = explode(",", $_REQUEST['param']);
+ $ids = explode(",", clean($_REQUEST['ids']));
$ids_qmarks = arr_qmarks($ids);
$tpl = new Templator();
@@ -85,7 +85,7 @@ class MailTo extends Plugin {
print "";
print "";
- print "".__('Close this dialog')." ";
+ print \Controls\submit_tag(__('Close this dialog'));
print " ";
//return;
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-54-g00ecf
From 2ac6508fe697ed5e95cc7bf73ffb9e2e0bf0d3fa Mon Sep 17 00:00:00 2001
From: Andrew Dolgov
Date: Wed, 17 Feb 2021 15:53:00 +0300
Subject: mail, mailto: cleanup markup
---
plugins/mail/init.php | 150 ++++++++++++++++++++++++++----------------------
plugins/mailto/init.js | 2 +-
plugins/mailto/init.php | 33 +++++------
3 files changed, 97 insertions(+), 88 deletions(-)
(limited to 'plugins')
diff --git a/plugins/mail/init.php b/plugins/mail/init.php
index 8a0d01aca..bb576a4d9 100644
--- a/plugins/mail/init.php
+++ b/plugins/mail/init.php
@@ -37,42 +37,44 @@ class Mail extends Plugin {
function hook_prefs_tab($args) {
if ($args != "prefPrefs") return;
- print "mail ".__('Mail plugin')."\">";
-
- print "
" . __("You can set predefined email addressed here (comma-separated list):") . "
";
-
- print "
";
-
- print "";
+
- print \Controls\hidden_tag("op", "pluginhandler");
- print \Controls\hidden_tag("method", "save");
- print \Controls\hidden_tag("plugin", "mail");
+ = __("You can set predefined email addressed here (comma-separated list):") ?>
- $addresslist = $this->host->get($this, "addresslist");
+ = $addresslist ?>
- print "$addresslist ";
+
- print "".
- __("Save")." ";
+ = \Controls\submit_tag(__("Save")) ?>
- print "
";
+
- print "
";
+