mirror of
https://github.com/vrana/adminer.git
synced 2025-08-17 20:01:25 +02:00
Use min_version
This commit is contained in:
@@ -235,7 +235,7 @@ function type_class($type) {
|
||||
* @return null
|
||||
*/
|
||||
function edit_fields($fields, $collations, $type = "TABLE", $foreign_keys = array(), $comments = false) {
|
||||
global $connection, $inout;
|
||||
global $inout;
|
||||
$fields = array_values($fields);
|
||||
?>
|
||||
<thead><tr class="wrap">
|
||||
@@ -274,7 +274,7 @@ function edit_fields($fields, $collations, $type = "TABLE", $foreign_keys = arra
|
||||
<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"><?php echo script("qsl('input').onclick = function () { var field = this.form['fields[' + this.value + '][field]']; if (!field.value) { field.value = 'id'; field.oninput(); } }"); ?></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 script("qsl('input').oninput = function () { this.previousSibling.checked = true; }", ""); ?>
|
||||
<?php echo (support("comment") ? "<td" . ($comments ? "" : " class='hidden'") . "><input name='fields[$i][comment]' value='" . h($field["comment"]) . "' maxlength='" . ($connection->server_info >= 5.5 ? 1024 : 255) . "' aria-labelledby='label-comment'>" : ""); ?>
|
||||
<?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'>" : ""); ?>
|
||||
<?php } ?>
|
||||
<?php
|
||||
echo "<td>";
|
||||
|
@@ -93,7 +93,7 @@ function min_version($version, $maria_db = "") {
|
||||
* @return string
|
||||
*/
|
||||
function charset($connection) {
|
||||
return (version_compare($connection->server_info, "5.5.3") >= 0 ? "utf8mb4" : "utf8"); // SHOW CHARSET would require an extra query
|
||||
return (min_version("5.5.3") ? "utf8mb4" : "utf8"); // SHOW CHARSET would require an extra query
|
||||
}
|
||||
|
||||
/** Return <script> element
|
||||
@@ -906,7 +906,7 @@ function enum_input($type, $attrs, $field, $value, $empty = null) {
|
||||
* @return null
|
||||
*/
|
||||
function input($field, $value, $function) {
|
||||
global $connection, $types, $adminer, $jush;
|
||||
global $types, $adminer, $jush;
|
||||
$name = h(bracket_escape($field["field"]));
|
||||
echo "<td class='function'>";
|
||||
if (is_array($value) && !$function) {
|
||||
@@ -961,7 +961,7 @@ function input($field, $value, $function) {
|
||||
} else {
|
||||
// int(3) is only a display hint
|
||||
$maxlength = (!preg_match('~int~', $field["type"]) && preg_match('~^(\\d+)(,(\\d+))?$~', $field["length"], $match) ? ((preg_match("~binary~", $field["type"]) ? 2 : 1) * $match[1] + ($match[3] ? 1 : 0) + ($match[2] && !$field["unsigned"] ? 1 : 0)) : ($types[$field["type"]] ? $types[$field["type"]] + ($field["unsigned"] ? 0 : 1) : 0));
|
||||
if ($jush == 'sql' && $connection->server_info >= 5.6 && preg_match('~time~', $field["type"])) {
|
||||
if ($jush == 'sql' && min_version(5.6) && preg_match('~time~', $field["type"])) {
|
||||
$maxlength += 7; // microtime
|
||||
}
|
||||
// type='date' and type='time' display localized value which may be confusing, type='datetime' uses 'T' as date and time separator
|
||||
|
Reference in New Issue
Block a user