]> git.joonet.de Git - adminer.git/commitdiff
Move inline event handlers to <script>
authorJakub Vrana <jakub@vrana.cz>
Fri, 12 Jan 2018 13:35:22 +0000 (14:35 +0100)
committerJakub Vrana <jakub@vrana.cz>
Fri, 12 Jan 2018 16:09:41 +0000 (17:09 +0100)
adminer/include/connect.inc.php
adminer/include/functions.inc.php
adminer/select.inc.php

index 45ba46d21b0540737e646ec7e41a286ea0a7eaf2..4d3be410432fe6f7434dbebb987dca5d2959ffdb 100644 (file)
@@ -36,7 +36,7 @@ function connect_error() {
                                . "<th>" . lang('Database') . " - <a href='" . h(ME) . "refresh=1'>" . lang('Refresh') . "</a>"
                                . "<td>" . lang('Collation')
                                . "<td>" . lang('Tables')
-                               . "<td>" . lang('Size') . " - <a href='" . h(ME) . "dbsize=1' onclick=\"return ajaxSetHtml('" . h(js_escape(ME)) . "script=connect');\">" . lang('Compute') . "</a>"
+                               . "<td>" . lang('Size') . " - <a href='" . h(ME) . "dbsize=1'>" . lang('Compute') . "</a><script>qsl('a').onclick = partial(ajaxSetHtml, '" . js_escape(ME) . "script=connect');</script>"
                                . "</thead>\n"
                        ;
                        
@@ -57,7 +57,7 @@ function connect_error() {
                        echo "</table>\n";
                        echo (support("database")
                                ? "<fieldset><legend>" . lang('Selected') . " <span id='selected'></span></legend><div>\n"
-                                       . "<input type='hidden' name='all' value='' onclick=\"selectCount('selected', formChecked(this, /^db/));\">\n" // used by trCheck()
+                                       . "<input type='hidden' name='all' value=''><script>qsl('input').onclick = function () { selectCount('selected', formChecked(this, /^db/)); };</script>\n" // used by trCheck()
                                        . "<input type='submit' name='drop' value='" . lang('Drop') . "'" . confirm() . ">\n"
                                        . "</div></fieldset>\n"
                                : ""
index 0953e52df2b9da71cfc7949ce6eb247331ebe027..3bd4d0fa6219887420f66c42047bed89c586ff1e 100644 (file)
@@ -119,8 +119,8 @@ function checkbox($name, $value, $checked, $label = "", $onclick = "", $class =
        $return = "<input type='checkbox' name='$name' value='" . h($value) . "'"
                . ($checked ? " checked" : "")
                . ($labelled_by ? " aria-labelledby='$labelled_by'" : "")
-               . ($onclick ? ' onclick="' . h($onclick) . '"' : '')
                . ">"
+               . ($onclick ? "<script>qsl('input').onclick = function () { $onclick };</script>" : "")
        ;
        return ($label != "" || $class ? "<label" . ($class ? " class='$class'" : "") . ">$return" . h($label) . "</label>" : $return);
 }
@@ -160,9 +160,10 @@ function optionlist($options, $selected = null, $use_keys = false) {
 function html_select($name, $options, $value = "", $onchange = true, $labelled_by = "") {
        if ($onchange) {
                return "<select name='" . h($name) . "'"
-                       . (is_string($onchange) ? ' onchange="' . h($onchange) . '"' : "")
                        . ($labelled_by ? " aria-labelledby='$labelled_by'" : "")
-                       . ">" . optionlist($options, $value) . "</select>";
+                       . ">" . optionlist($options, $value) . "</select>"
+                       . (is_string($onchange) ? "<script>qsl('select').onchange = function () { $onchange };</script>" : "")
+               ;
        }
        $return = "";
        foreach ($options as $key => $val) {
index 6a8e95b95c88e39ddded233b158259a8b79f8615..ef9d3e483de68a52903977bf4eb8338fe1196191 100644 (file)
@@ -465,7 +465,7 @@ if (!$columns && support("table")) {
                                );
                                if ($jush != "simpledb") {
                                        echo '<a href="' . h(remove_from_uri("page")) . '">' . lang('Page') . "</a>:";
-                                       echo "<script>qsl('a').onclick = function () { pageClick(this.href, +prompt('" . lang('Page') . "', '" . ($page + 1) . "')); return false; }</script>\n";
+                                       echo "<script>qsl('a').onclick = function () { pageClick(this.href, +prompt('" . lang('Page') . "', '" . ($page + 1) . "')); return false; };</script>\n";
                                        echo pagination(0, $page) . ($page > 5 ? " ..." : "");
                                        for ($i = max(1, $page - 4); $i < min($max_page, $page + 5); $i++) {
                                                echo pagination($i, $page);