]> git.joonet.de Git - adminer.git/commitdiff
Make maxlength in all fields a soft limit
authorJakub Vrana <jakub@vrana.cz>
Sun, 15 Jul 2018 19:05:26 +0000 (21:05 +0200)
committerJakub Vrana <jakub@vrana.cz>
Sun, 15 Jul 2018 19:05:26 +0000 (21:05 +0200)
adminer/create.inc.php
adminer/database.inc.php
adminer/event.inc.php
adminer/include/editing.inc.php
adminer/procedure.inc.php
adminer/trigger.inc.php
adminer/user.inc.php
adminer/view.inc.php
changes.txt
plugins/edit-calendar.php
plugins/slugify.php

index fc15a237921f59cfbf2e75bf99a421145e75be90..7d355ba0140321667256750b816a9525e36b3524 100644 (file)
@@ -162,7 +162,7 @@ foreach ($engines as $engine) {
 <form action="" method="post" id="form">
 <p>
 <?php if (support("columns") || $TABLE == "") { ?>
-<?php echo lang('Table name'); ?>: <input name="name" maxlength="64" value="<?php echo h($row["name"]); ?>" autocapitalize="off">
+<?php echo lang('Table name'); ?>: <input name="name" data-maxlength="64" value="<?php echo h($row["name"]); ?>" autocapitalize="off">
 <?php if ($TABLE == "" && !$_POST) { echo script("focus(qs('#form')['name']);"); } ?>
 <?php echo ($engines ? "<select name='Engine'>" . optionlist(array("" => "(" . lang('engine') . ")") + $engines, $row["Engine"]) . "</select>" . on_help("getTarget(event).value", 1) . script("qsl('select').onchange = helpClose;") : ""); ?>
  <?php echo ($collations && !preg_match("~sqlite|mssql~", $jush) ? html_select("Collation", array("" => "(" . lang('collation') . ")") + $collations, $row["Collation"]) : ""); ?>
@@ -191,7 +191,7 @@ edit_fields($row["fields"], $collations, "TABLE", $foreign_keys, $comments);
 <?php echo (support("comment")
        ? "<label><input type='checkbox' name='comments' value='1' class='jsonly'" . ($comments ? " checked" : "") . ">" . lang('Comment') . "</label>"
                . script("qsl('input').onclick = partial(editingCommentsClick, true);")
-               . ' <input name="Comment" value="' . h($row["Comment"]) . '" maxlength="' . (min_version(5.5) ? 2048 : 60) . '"' . ($comments ? '' : ' class="hidden"') . '>'
+               . ' <input name="Comment" value="' . h($row["Comment"]) . '" data-maxlength="' . (min_version(5.5) ? 2048 : 60) . '"' . ($comments ? '' : ' class="hidden"') . '>'
        : '')
 ; ?>
 <p>
index 71b1de40a0dd24f411abb48d907734bd08f551b2..bc5e4dbf3ff79c56fd8f356b499360e940030648 100644 (file)
@@ -60,7 +60,7 @@ if ($_POST) {
 <?php
 echo ($_POST["add_x"] || strpos($name, "\n")
        ? '<textarea id="name" name="name" rows="10" cols="40">' . h($name) . '</textarea><br>'
-       : '<input name="name" id="name" value="' . h($name) . '" maxlength="64" autocapitalize="off">'
+       : '<input name="name" id="name" value="' . h($name) . '" data-maxlength="64" autocapitalize="off">'
 ) . "\n" . ($collations ? html_select("collation", array("" => "(" . lang('collation') . ")") + $collations, $row["collation"]) . doc_link(array(
        'sql' => "charset-charsets.html",
        'mariadb' => "supported-character-sets-and-collations/",
index 91d07f12494a6bc03dc04905595ea9e616ac19e3..d0ec05f2e11dde6a02d6c51aeb5c4b7587282996 100644 (file)
@@ -36,12 +36,12 @@ if (!$row && $EVENT != "") {
 
 <form action="" method="post">
 <table cellspacing="0">
-<tr><th><?php echo lang('Name'); ?><td><input name="EVENT_NAME" value="<?php echo h($row["EVENT_NAME"]); ?>" maxlength="64" autocapitalize="off">
+<tr><th><?php echo lang('Name'); ?><td><input name="EVENT_NAME" value="<?php echo h($row["EVENT_NAME"]); ?>" data-maxlength="64" autocapitalize="off">
 <tr><th title="datetime"><?php echo lang('Start'); ?><td><input name="STARTS" value="<?php echo h("$row[EXECUTE_AT]$row[STARTS]"); ?>">
 <tr><th title="datetime"><?php echo lang('End'); ?><td><input name="ENDS" value="<?php echo h($row["ENDS"]); ?>">
 <tr><th><?php echo lang('Every'); ?><td><input type="number" name="INTERVAL_VALUE" value="<?php echo h($row["INTERVAL_VALUE"]); ?>" class="size"> <?php echo html_select("INTERVAL_FIELD", $intervals, $row["INTERVAL_FIELD"]); ?>
 <tr><th><?php echo lang('Status'); ?><td><?php echo html_select("STATUS", $statuses, $row["STATUS"]); ?>
-<tr><th><?php echo lang('Comment'); ?><td><input name="EVENT_COMMENT" value="<?php echo h($row["EVENT_COMMENT"]); ?>" maxlength="64">
+<tr><th><?php echo lang('Comment'); ?><td><input name="EVENT_COMMENT" value="<?php echo h($row["EVENT_COMMENT"]); ?>" data-maxlength="64">
 <tr><th><td><?php echo checkbox("ON_COMPLETION", "PRESERVE", $row["ON_COMPLETION"] == "PRESERVE", lang('On completion preserve')); ?>
 </table>
 <p><?php textarea("EVENT_DEFINITION", $row["EVENT_DEFINITION"]); ?>
index 69f02df5f264dc1da514b436844b3984e11c2ac7..405efdb5976c62f5ff844df8c32b50a6ca8fd810 100644 (file)
@@ -272,14 +272,14 @@ function edit_fields($fields, $collations, $type = "TABLE", $foreign_keys = arra
                ?>
 <tr<?php echo ($display ? "" : " style='display: none;'"); ?>>
 <?php echo ($type == "PROCEDURE" ? "<td>" . html_select("fields[$i][inout]", explode("|", $inout), $field["inout"]) : ""); ?>
-<th><?php if ($display) { ?><input name="fields[<?php echo $i; ?>][field]" value="<?php echo h($field["field"]); ?>" maxlength="64" autocapitalize="off" aria-labelledby="label-name"><?php echo script("qsl('input').oninput = function () { editingNameChange.call(this);" . ($field["field"] != "" || count($fields) > 1 ? "" : " editingAddRow.call(this);") . " };", ""); ?><?php } ?>
+<th><?php if ($display) { ?><input name="fields[<?php echo $i; ?>][field]" value="<?php echo h($field["field"]); ?>" data-maxlength="64" autocapitalize="off" aria-labelledby="label-name"><?php echo script("qsl('input').oninput = function () { editingNameChange.call(this);" . ($field["field"] != "" || count($fields) > 1 ? "" : " editingAddRow.call(this);") . " };", ""); ?><?php } ?>
 <input type="hidden" name="fields[<?php echo $i; ?>][orig]" value="<?php echo h($orig); ?>">
 <?php edit_type("fields[$i]", $field, $collations, $foreign_keys); ?>
 <?php if ($type == "TABLE") { ?>
 <td><?php echo checkbox("fields[$i][null]", 1, $field["null"], "", "", "block", "label-null"); ?>
 <td><label class="block"><input type="radio" name="auto_increment_col" value="<?php echo $i; ?>"<?php if ($field["auto_increment"]) { ?> checked<?php } ?> aria-labelledby="label-ai"></label><td><?php
                        echo checkbox("fields[$i][has_default]", 1, $field["has_default"], "", "", "", "label-default"); ?><input name="fields[<?php echo $i; ?>][default]" value="<?php echo h($field["default"]); ?>" aria-labelledby="label-default"><?php
-                       echo (support("comment") ? "<td" . ($comments ? "" : " class='hidden'") . "><input name='fields[$i][comment]' value='" . h($field["comment"]) . "' maxlength='" . (min_version(5.5) ? 1024 : 255) . "' aria-labelledby='label-comment'>" : "");
+                       echo (support("comment") ? "<td" . ($comments ? "" : " class='hidden'") . "><input name='fields[$i][comment]' value='" . h($field["comment"]) . "' data-maxlength='" . (min_version(5.5) ? 1024 : 255) . "' aria-labelledby='label-comment'>" : "");
                }
                echo "<td>";
                echo (support("move_col") ?
index 4a2731ac2c4b7cf6855e9502e5e9042b9e3c2b14..c6550b0f0d22b0262f92934cf93b2e473a5c0674 100644 (file)
@@ -35,7 +35,7 @@ $routine_languages = routine_languages();
 ?>
 
 <form action="" method="post" id="form">
-<p><?php echo lang('Name'); ?>: <input name="name" value="<?php echo h($row["name"]); ?>" maxlength="64" autocapitalize="off">
+<p><?php echo lang('Name'); ?>: <input name="name" value="<?php echo h($row["name"]); ?>" data-maxlength="64" autocapitalize="off">
 <?php echo ($routine_languages ? lang('Language') . ": " . html_select("language", $routine_languages, $row["language"]) . "\n" : ""); ?>
 <input type="submit" value="<?php echo lang('Save'); ?>">
 <table cellspacing="0" class="nowrap">
index 54454991071d46d20c2265439fcf48bbbb860f00..269609c6d617fc63bbe082359e85e34a53060f65 100644 (file)
@@ -39,7 +39,7 @@ page_header(($name != "" ? lang('Alter trigger') . ": " . h($name) : lang('Creat
 <?php echo (in_array("UPDATE OF", $trigger_options["Event"]) ? " <input name='Of' value='" . h($row["Of"]) . "' class='hidden'>": ""); ?>
 <tr><th><?php echo lang('Type'); ?><td><?php echo html_select("Type", $trigger_options["Type"], $row["Type"]); ?>
 </table>
-<p><?php echo lang('Name'); ?>: <input name="Trigger" value="<?php echo h($row["Trigger"]); ?>" maxlength="64" autocapitalize="off">
+<p><?php echo lang('Name'); ?>: <input name="Trigger" value="<?php echo h($row["Trigger"]); ?>" data-maxlength="64" autocapitalize="off">
 <?php echo script("qs('#form')['Timing'].onchange();"); ?>
 <p><?php textarea("Statement", $row["Statement"]); ?>
 <p>
index babcc1008cc73508fbbe9f2709b6857b5a90370d..8cb76cbefd481936033e75f92ce1e61ef3727990 100644 (file)
@@ -132,8 +132,8 @@ if ($_POST) {
 ?>
 <form action="" method="post">
 <table cellspacing="0">
-<tr><th><?php echo lang('Server'); ?><td><input name="host" maxlength="60" value="<?php echo h($row["host"]); ?>" autocapitalize="off">
-<tr><th><?php echo lang('Username'); ?><td><input name="user" maxlength="80" value="<?php echo h($row["user"]); ?>" autocapitalize="off">
+<tr><th><?php echo lang('Server'); ?><td><input name="host" data-maxlength="60" value="<?php echo h($row["host"]); ?>" autocapitalize="off">
+<tr><th><?php echo lang('Username'); ?><td><input name="user" data-maxlength="80" value="<?php echo h($row["user"]); ?>" autocapitalize="off">
 <tr><th><?php echo lang('Password'); ?><td><input name="pass" id="pass" value="<?php echo h($row["pass"]); ?>" autocomplete="new-password">
 <?php if (!$row["hashed"]) { echo script("typePassword(qs('#pass'));"); } ?>
 <?php echo checkbox("hashed", 1, $row["hashed"], lang('Hashed'), "typePassword(this.form['pass'], this.checked);"); ?>
index 0b2f8fa21a0791fc55e11062703fe4924bd647b5..6bbaf4ab6917ecfabd8d9daa90ce345162ed21e0 100644 (file)
@@ -48,7 +48,7 @@ page_header(($TABLE != "" ? lang('Alter view') : lang('Create view')), $error, a
 ?>
 
 <form action="" method="post">
-<p><?php echo lang('Name'); ?>: <input name="name" value="<?php echo h($row["name"]); ?>" maxlength="64" autocapitalize="off">
+<p><?php echo lang('Name'); ?>: <input name="name" value="<?php echo h($row["name"]); ?>" data-maxlength="64" autocapitalize="off">
 <?php echo (support("materializedview") ? " " . checkbox("materialized", 1, $row["materialized"], lang('Materialized view')) : ""); ?>
 <p><?php textarea("select", $row["select"]); ?>
 <p>
index b7b5972b0d67de1eee555d6cb51b07087fe46695..1676a5c2636fa80ceba28f3e9b64eeeb0f34ea25 100644 (file)
@@ -3,6 +3,7 @@ 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)
 Fix function change with set data type
 Increase username maxlength to 80 (bug #623)
+Make maxlength in all fields a soft limit
 MySQL: Support foreign keys created with ANSI quotes (bug #620)
 
 Adminer 4.6.3 (released 2018-06-28):
index a1b510f40078c1f85f7700c7ec1d9ac9e74c65e9..655a37237a141f36b5678218284480a798592b75 100644 (file)
@@ -44,7 +44,7 @@ class AdminerEditCalendar {
                if (preg_match("~date|time~", $field["type"])) {
                        $dateFormat = "changeYear: true, dateFormat: 'yy-mm-dd'"; //! yy-mm-dd regional
                        $timeFormat = "showSecond: true, timeFormat: 'HH:mm:ss', timeInput: true";
-                       return "<input id='fields-" . h($field["field"]) . "' value='" . h($value) . "'" . (@+$field["length"] ? " maxlength='" . (+$field["length"]) . "'" : "") . "$attrs>" . script(
+                       return "<input id='fields-" . h($field["field"]) . "' value='" . h($value) . "'" . (@+$field["length"] ? " data-maxlength='" . (+$field["length"]) . "'" : "") . "$attrs>" . script(
                                "jQuery('#fields-" . js_escape($field["field"]) . "')."
                                . ($field["type"] == "time" ? "timepicker({ $timeFormat })"
                                        : (preg_match("~time~", $field["type"]) ? "datetimepicker({ $dateFormat, $timeFormat })"
index f934ae3545c70471b2591f5877250ce966070859..094d4d1e1b1a44ce35b6f186704ac04187417938 100644 (file)
@@ -34,7 +34,7 @@ class AdminerSlugify {
                        }
                        $slug = $slugify[$field["field"]];
                        if ($slug !== null) {
-                               return "<input value='" . h($value) . "' maxlength='$field[length]' size='40'$attrs>"
+                               return "<input value='" . h($value) . "' data-maxlength='$field[length]' size='40'$attrs>"
                                        . script("qsl('input').onchange = function () {
        var find = '$this->from';
        var repl = '$this->to';