]> git.wh0rd.org Git - tt-rss.git/commitdiff
use print_hidden() for hidden dojo form fields
authorAndrew Dolgov <noreply@madoka.volgo-balt.ru>
Fri, 10 Feb 2017 11:36:21 +0000 (14:36 +0300)
committerAndrew Dolgov <noreply@madoka.volgo-balt.ru>
Fri, 10 Feb 2017 11:36:21 +0000 (14:36 +0300)
14 files changed:
classes/article.php
classes/feeds.php
classes/pref/feeds.php
classes/pref/filters.php
classes/pref/labels.php
classes/pref/prefs.php
classes/pref/users.php
plugins/af_psql_trgm/init.php
plugins/af_readability/init.php
plugins/af_redditimgur/init.php
plugins/instances/init.php
plugins/mail/init.php
plugins/note/init.php
plugins/nsfw/init.php

index 46e9bb7977aea98ea6409893b48599d1d0f994d2..4126843af6d36b5d8e1c32b2038da09312c7f0a1 100644 (file)
@@ -202,9 +202,9 @@ class Article extends Handler_Protected {
 
                $tags_str = join(", ", $tags);
 
-               print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"id\" value=\"$param\">";
-               print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"article\">";
-               print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"method\" value=\"setArticleTags\">";
+               print_hidden("id", "$param");
+               print_hidden("op", "article");
+               print_hidden("method", "setArticleTags");
 
                print "<table width='100%'><tr><td>";
 
index 1375f0c376dafdaf1a75d159cd058dbe4395dfa8..a41109383551c7be8cdb058ceb04bb0195f01f7a 100755 (executable)
@@ -1027,8 +1027,8 @@ class Feeds extends Handler_Protected {
        }
 
        function quickAddFeed() {
-               print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"rpc\">";
-               print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"method\" value=\"addfeed\">";
+               print_hidden("op", "rpc");
+               print_hidden("method", "addfeed");
 
                print "<div id='fadd_error_message' style='display : none' class='alert alert-danger'></div>";
 
@@ -1111,8 +1111,8 @@ class Feeds extends Handler_Protected {
 
                $browser_search = $this->dbh->escape_string($_REQUEST["search"]);
 
-               print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"rpc\">";
-               print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"method\" value=\"updateFeedBrowser\">";
+               print_hidden("op", "rpc");
+               print_hidden("method", "updateFeedBrowser");
 
                print "<div dojoType=\"dijit.Toolbar\">
                        <div style='float : right'>
index bac859d7524d3a5b23a878aa0c3bb7cc32871dcb..8c37b430b66214333108bfa7e5d0bbb208b4577e 100755 (executable)
@@ -548,9 +548,9 @@ class Pref_Feeds extends Handler_Protected {
                $title = htmlspecialchars($this->dbh->fetch_result($result,
                        0, "title"));
 
-               print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"id\" value=\"$feed_id\">";
-               print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"pref-feeds\">";
-               print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"method\" value=\"editSave\">";
+               print_hidden("id", "$feed_id");
+               print_hidden("op", "pref-feeds");
+               print_hidden("method", "editSave");
 
                print "<div class=\"dlgSec\">".__("Feed")."</div>";
                print "<div class=\"dlgSecCont\">";
@@ -816,9 +816,9 @@ class Pref_Feeds extends Handler_Protected {
 
                print "<p>";
 
-               print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"ids\" value=\"$feed_ids\">";
-               print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"pref-feeds\">";
-               print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"method\" value=\"batchEditSave\">";
+               print_hidden("ids", "$feed_ids");
+               print_hidden("op", "pref-feeds");
+               print_hidden("method", "batchEditSave");
 
                print "<div class=\"dlgSec\">".__("Feed")."</div>";
                print "<div class=\"dlgSecCont\">";
@@ -1812,8 +1812,8 @@ class Pref_Feeds extends Handler_Protected {
        }
 
        function batchSubscribe() {
-               print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"pref-feeds\">";
-               print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"method\" value=\"batchaddfeeds\">";
+               print_hidden("op", "pref-feeds");
+               print_hidden("method", "batchaddfeeds");
 
                print "<table width='100%'><tr><td>
                        ".__("Add one valid RSS feed per line (no feed detection is done)")."
index b7c286ecf2665c41c71eec2eef077ae715e25eba..5629f530cb44422088951be1029e834c28e2a602 100755 (executable)
@@ -340,10 +340,10 @@ class Pref_Filters extends Handler_Protected {
 
                print "<form id=\"filter_edit_form\" onsubmit='return false'>";
 
-               print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"pref-filters\">";
-               print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"id\" value=\"$filter_id\">";
-               print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"method\" value=\"editSave\">";
-               print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"csrf_token\" value=\"".$_SESSION['csrf_token']."\">";
+               print_hidden("op", "pref-filters");
+               print_hidden("id", "$filter_id");
+               print_hidden("method", "editSave");
+               print_hidden("csrf_token", $_SESSION['csrf_token']);
 
                print "<div class=\"dlgSec\">".__("Caption")."</div>";
 
@@ -816,9 +816,9 @@ class Pref_Filters extends Handler_Protected {
 
                print "<form name='filter_new_form' id='filter_new_form'>";
 
-               print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"pref-filters\">";
-               print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"method\" value=\"add\">";
-               print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"csrf_token\" value=\"".$_SESSION['csrf_token']."\">";
+               print_hidden("op", "pref-filters");
+               print_hidden("method", "add");
+               print_hidden("csrf_token", $_SESSION['csrf_token']);
 
                print "<div class=\"dlgSec\">".__("Caption")."</div>";
 
index 458e4f88b0a9b39c28b8b4cfb8f9180d3e0a151d..b127ce95cc28be1f514f9b1199c9697c3cae002e 100644 (file)
@@ -15,9 +15,9 @@ class Pref_Labels extends Handler_Protected {
 
                $line = $this->dbh->fetch_assoc($result);
 
-               print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"id\" value=\"$label_id\">";
-               print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"pref-labels\">";
-               print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"method\" value=\"save\">";
+               print_hidden("id", "$label_id");
+               print_hidden("op", "pref-labels");
+               print_hidden("method", "save");
 
                print "<div class=\"dlgSec\">".__("Caption")."</div>";
 
index 18ffcc720cd0f08e19965cd48f996c0a6ddc4928..9a7ab55a0bff4ee6af4225dbc18f98968dd32d35 100644 (file)
@@ -226,8 +226,8 @@ class Pref_Prefs extends Handler_Protected {
 
                print "</table>";
 
-               print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"pref-prefs\">";
-               print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"method\" value=\"changeemail\">";
+               print_hidden("op", "pref-prefs");
+               print_hidden("method", "changeemail");
 
                print "<p><button dojoType=\"dijit.form.Button\" type=\"submit\">".
                        __("Save data")."</button>";
@@ -305,8 +305,8 @@ class Pref_Prefs extends Handler_Protected {
 
                        print "</table>";
 
-                       print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"pref-prefs\">";
-                       print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"method\" value=\"changepassword\">";
+                       print_hidden("op", "pref-prefs");
+                       print_hidden("method", "changepassword");
 
                        print "<p><button dojoType=\"dijit.form.Button\" type=\"submit\">".
                                __("Change password")."</button>";
@@ -351,8 +351,8 @@ class Pref_Prefs extends Handler_Protected {
 
                                print "</table>";
 
-                               print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"pref-prefs\">";
-                               print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"method\" value=\"otpdisable\">";
+                               print_hidden("op", "pref-prefs");
+                               print_hidden("method", "otpdisable");
 
                                print "<p><button dojoType=\"dijit.form.Button\" type=\"submit\">".
                                        __("Disable OTP")."</button>";
@@ -371,8 +371,8 @@ class Pref_Prefs extends Handler_Protected {
 
                                        print "<form dojoType=\"dijit.form.Form\" id=\"changeOtpForm\">";
 
-                                       print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"pref-prefs\">";
-                                       print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"method\" value=\"otpenable\">";
+                                       print_hidden("op", "pref-prefs");
+                                       print_hidden("method", "otpenable");
 
                                        print "<script type=\"dojo/method\" event=\"onSubmit\" args=\"evt\">
                                        evt.preventDefault();
@@ -658,7 +658,7 @@ class Pref_Prefs extends Handler_Protected {
 
                $listed_boolean_prefs = htmlspecialchars(join(",", $listed_boolean_prefs));
 
-               print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"boolean_prefs\" value=\"$listed_boolean_prefs\">";
+               print_hidden("boolean_prefs", "$listed_boolean_prefs");
 
                PluginHost::getInstance()->run_hooks(PluginHost::HOOK_PREFS_TAB_SECTION,
                        "hook_prefs_tab_section", "prefPrefsPrefsInside");
@@ -666,8 +666,8 @@ class Pref_Prefs extends Handler_Protected {
                print '</div>'; # inside pane
                print '<div dojoType="dijit.layout.ContentPane" region="bottom">';
 
-               print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"pref-prefs\">";
-               print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"method\" value=\"saveconfig\">";
+               print_hidden("op", "pref-prefs");
+               print_hidden("method", "saveconfig");
 
                print "<div dojoType=\"dijit.form.ComboButton\" type=\"submit\">
                        <span>".__('Save configuration')."</span>
@@ -734,8 +734,8 @@ class Pref_Prefs extends Handler_Protected {
                }
                </script>";
 
-               print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"pref-prefs\">";
-               print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"method\" value=\"setplugins\">";
+               print_hidden("op", "pref-prefs");
+               print_hidden("method", "setplugins");
 
                print "<table width='100%' class='prefPluginsList'>";
 
@@ -975,9 +975,9 @@ class Pref_Prefs extends Handler_Protected {
 
                print_notice(T_sprintf("You can override colors, fonts and layout of your currently selected theme with custom CSS declarations here. <a target=\"_blank\" class=\"visibleLink\" href=\"%s\">This file</a> can be used as a baseline.", "css/tt-rss.css"));
 
-               print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"rpc\">";
-               print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"method\" value=\"setpref\">";
-               print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"key\" value=\"USER_STYLESHEET\">";
+               print_hidden("op", "rpc");
+               print_hidden("method", "setpref");
+               print_hidden("key", "USER_STYLESHEET");
 
                print "<table width='100%'><tr><td>";
                print "<textarea dojoType=\"dijit.form.SimpleTextarea\"
index 164935b234533db0d773f06734fcc93a2819bdb5..f211a8f2fd34bb7d55c1ddf874df3cf8db3b2287 100644 (file)
@@ -27,9 +27,9 @@ class Pref_Users extends Handler_Protected {
 
                        $id = (int) $this->dbh->escape_string($_REQUEST["id"]);
 
-                       print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"id\" value=\"$id\">";
-                       print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"pref-users\">";
-                       print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"method\" value=\"editSave\">";
+                       print_hidden("id", "$id");
+                       print_hidden("op", "pref-users");
+                       print_hidden("method", "editSave");
 
                        $result = $this->dbh->query("SELECT * FROM ttrss_users WHERE id = '$id'");
 
@@ -43,7 +43,7 @@ class Pref_Users extends Handler_Protected {
                        print "<div class=\"dlgSecCont\">";
 
                        if ($sel_disabled) {
-                               print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"login\" value=\"$login\">";
+                               print_hidden("login", "$login");
                        }
 
                        print "<input size=\"30\" style=\"font-size : 16px\"
@@ -64,7 +64,7 @@ class Pref_Users extends Handler_Protected {
                        } else {
                                print_select_hash("", $access_level, $access_level_names,
                                        "dojoType=\"dijit.form.Select\" $sel_disabled");
-                               print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"access_level\" value=\"$access_level\">";
+                               print_hidden("access_level", "$access_level");
                        }
 
                        print "<hr/>";
index 8dde76d40b7726e523a123c115346f299a192509..63c52bf2d0d50a59ee0338371b9be60d12ecbc49 100644 (file)
@@ -152,9 +152,9 @@ class Af_Psql_Trgm extends Plugin {
                                }
                                </script>";
 
-                       print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"pluginhandler\">";
-                       print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"method\" value=\"save\">";
-                       print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"plugin\" value=\"af_psql_trgm\">";
+                       print_hidden("op", "pluginhandler");
+                       print_hidden("method", "save");
+                       print_hidden("plugin", "af_psql_trgm");
 
                        print "<p>" . __("PostgreSQL trigram extension returns string similarity as a floating point number (0-1). Setting it too low might produce false positives, zero disables checking.") . "</p>";
                        print_notice("Enable the plugin for specific feeds in the feed editor.");
index 34bd99ae006324f66527d641d2bd870fe6cbdd21..a4cb892af0ee9b05374ec59bb112b4164e9109de 100755 (executable)
@@ -56,9 +56,9 @@ class Af_Readability extends Plugin {
                        }
                        </script>";
 
-               print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"pluginhandler\">";
-               print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"method\" value=\"save\">";
-               print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"plugin\" value=\"af_readability\">";
+               print_hidden("op", "pluginhandler");
+               print_hidden("method", "save");
+               print_hidden("plugin", "af_readability");
 
                $enable_share_anything = $this->host->get($this, "enable_share_anything");
                $enable_share_anything_checked = $enable_share_anything ? "checked" : "";
index 29ea329ad13ca9f7edf3b056b4ad2bf9ce0675c5..b5b4cca346e7b6d2719bc45fc59b5af93b6f9835 100755 (executable)
@@ -46,9 +46,9 @@ class Af_RedditImgur extends Plugin {
                        }
                        </script>";
 
-               print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"pluginhandler\">";
-               print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"method\" value=\"save\">";
-               print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"plugin\" value=\"af_redditimgur\">";
+               print_hidden("op", "pluginhandler");
+               print_hidden("method", "save");
+               print_hidden("plugin", "af_redditimgur");
 
                print "<p>" . __("Uses Readability (full-text-rss) implementation by <a target='_blank' href='https://bitbucket.org/fivefilters/'>FiveFilters.org</a>");
                print "<p/>";
index 1979af85d5e016e1abc1f6d0f23b64bcc504862a..643475dcada942df10eadf7ad1d6a5addd7ee62f 100644 (file)
@@ -197,9 +197,9 @@ class Instances extends Plugin implements IHandler {
                $result = db_query("SELECT * FROM ttrss_linked_instances WHERE
                        id = '$id'");
 
-               print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\"  name=\"id\" value=\"$id\">";
-               print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\"  name=\"op\" value=\"pref-instances\">";
-               print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\"  name=\"method\" value=\"editSave\">";
+               print_hidden("id", "$id");
+               print_hidden("op", "pref-instances");
+               print_hidden("method", "editSave");
 
                print "<div class=\"dlgSec\">".__("Instance")."</div>";
 
@@ -389,8 +389,8 @@ class Instances extends Plugin implements IHandler {
        }
 
        function addInstance() {
-               print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\"  name=\"op\" value=\"pref-instances\">";
-               print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\"  name=\"method\" value=\"add\">";
+               print_hidden("op", "pref-instances");
+               print_hidden("method", "add");
 
                print "<div class=\"dlgSec\">".__("Instance")."</div>";
 
index acd89de4745f1240eaef68aab6ba17c148759383..ef97797f4d8d2770df43104c794fbe251c8a17d7 100644 (file)
@@ -51,9 +51,9 @@ class Mail extends Plugin {
                        }
                        </script>";
 
-                       print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"pluginhandler\">";
-                       print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"method\" value=\"save\">";
-                       print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"plugin\" value=\"mail\">";
+                       print_hidden("op", "pluginhandler");
+                       print_hidden("method", "save");
+                       print_hidden("plugin", "mail");
 
                        $addresslist = $this->host->get($this, "addresslist");
 
@@ -79,9 +79,9 @@ class Mail extends Plugin {
 
                $param = db_escape_string($_REQUEST['param']);
 
-               print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"pluginhandler\">";
-               print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"plugin\" value=\"mail\">";
-               print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"method\" value=\"sendEmail\">";
+               print_hidden("op", "pluginhandler");
+               print_hidden("plugin", "mail");
+               print_hidden("method", "sendEmail");
 
                $result = db_query("SELECT email, full_name FROM ttrss_users WHERE
                        id = " . $_SESSION["uid"]);
@@ -91,8 +91,8 @@ class Mail extends Plugin {
 
                if (!$user_name) $user_name = $_SESSION['name'];
 
-               print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"from_email\" value=\"$user_email\">";
-               print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"from_name\" value=\"$user_name\">";
+               print_hidden("from_email", "$user_email");
+               print_hidden("from_name", "$user_name");
 
                require_once "lib/MiniTemplator.class.php";
 
index 94cb53c6c59baf3655d51bae6d39acfd723af3e9..7231845fed441c3b09a25aa5728379fbfb40da8d 100644 (file)
@@ -34,10 +34,10 @@ class Note extends Plugin {
 
                $note = db_fetch_result($result, 0, "note");
 
-               print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"id\" value=\"$param\">";
-               print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"pluginhandler\">";
-               print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"method\" value=\"setNote\">";
-               print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"plugin\" value=\"note\">";
+               print_hidden("id", "$param");
+               print_hidden("op", "pluginhandler");
+               print_hidden("method", "setNote");
+               print_hidden("plugin", "note");
 
                print "<table width='100%'><tr><td>";
                print "<textarea dojoType=\"dijit.form.SimpleTextarea\"
index 51566592383cecac780c19a4eef201fd3ac1e03f..7a3265fa0ba7c4d766aeadd81140150357cc83d8 100644 (file)
@@ -70,9 +70,9 @@ class NSFW extends Plugin {
                        }
                        </script>";
 
-                       print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"pluginhandler\">";
-                       print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"method\" value=\"save\">";
-                       print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"plugin\" value=\"nsfw\">";
+                       print_hidden("op", "pluginhandler");
+                       print_hidden("method", "save");
+                       print_hidden("plugin", "nsfw");
 
                        print "<table width=\"100%\" class=\"prefPrefsList\">";