diff --git a/adminer/sql.inc.php b/adminer/sql.inc.php index 5f632f82..c1549a3f 100644 --- a/adminer/sql.inc.php +++ b/adminer/sql.inc.php @@ -219,7 +219,7 @@ if (!isset($_GET["import"])) { } echo "

"; textarea("query", $q, 20); - echo ($_POST ? "" : script("qs('textarea').focus();")); + echo script(($_POST ? "" : "qs('textarea').focus();\n") . "qs('#form').onsubmit = partial(sqlSubmit, qs('#form'), '" . remove_from_uri("sql|limit|error_stops|only_errors") . "');"); echo "

$execute\n"; echo lang('Limit rows') . ": \n"; diff --git a/adminer/static/editing.js b/adminer/static/editing.js index 25d8c49e..8ef5a93d 100644 --- a/adminer/static/editing.js +++ b/adminer/static/editing.js @@ -595,6 +595,23 @@ function indexesAddColumn(prefix) { +/** Updates the form action +* @param HTMLFormElement +* @param string +*/ +function sqlSubmit(form, root) { + if (encodeURIComponent(form['query'].value).length < 2e3) { + form.action = root + + '&sql=' + encodeURIComponent(form['query'].value) + + (form['limit'].value ? '&limit=' + +form['limit'].value : '') + + (form['error_stops'].checked ? '&error_stops=1' : '') + + (form['only_errors'].checked ? '&only_errors=1' : '') + ; + } +} + + + /** Handle changing trigger time or event * @param RegExp * @param string diff --git a/adminer/static/functions.js b/adminer/static/functions.js index c34b1cf9..084fb1bd 100644 --- a/adminer/static/functions.js +++ b/adminer/static/functions.js @@ -491,6 +491,9 @@ function bodyKeydown(event, button) { if (button) { target.form[button].click(); } else { + if (target.form.onsubmit) { + target.form.onsubmit(); + } target.form.submit(); } target.focus(); diff --git a/changes.txt b/changes.txt index d19c85f9..859063bb 100644 --- a/changes.txt +++ b/changes.txt @@ -1,4 +1,5 @@ Adminer 4.7.0-dev: +Simplify storing executed SQL queries to bookmarks Warn when using password with leading or trailing spaces Fix inline editing of empty cells (regression from 4.6.3) Allow adding more than two indexes and forign key columns at a time (regression from 4.4.0)