1
0
mirror of https://github.com/vrana/adminer.git synced 2025-08-07 23:27:17 +02:00

Use <script> instead of inline event handler in confirm()

This commit is contained in:
Jakub Vrana
2018-01-12 14:43:55 +01:00
parent da671df728
commit a5ee3451ac
15 changed files with 19 additions and 18 deletions

View File

@@ -189,10 +189,11 @@ function select_input($attrs, $options, $value = "", $onchange = "", $placeholde
}
/** Get onclick confirmation
* @param string
* @return string
*/
function confirm() {
return " onclick=\"return confirm('" . lang('Are you sure?') . "');\"";
function confirm($selector = "qsl('input')") {
return "<script>$selector.onclick = function () { return confirm('" . lang('Are you sure?') . "'); };</script>";
}
/** Print header for hidden fieldset (close by </div></fieldset>)
@@ -1385,7 +1386,7 @@ function edit_form($TABLE, $fields, $row, $update) {
) . "' title='Ctrl+Shift+Enter'>\n";
}
}
echo ($update ? "<input type='submit' name='delete' value='" . lang('Delete') . "'" . confirm() . ">\n"
echo ($update ? "<input type='submit' name='delete' value='" . lang('Delete') . "'>" . confirm() . "\n"
: ($_POST || !$fields ? "" : "<script>focus(qsa('td', qs('#form'))[1].firstChild);</script>\n")
);
if (isset($_GET["select"])) {