is not needed with border-collapse

This commit is contained in:
Jakub Vrana 2018-02-20 16:02:25 +01:00
parent 7cb3e768bb
commit 2021ea8fd7
21 changed files with 42 additions and 52 deletions

View file

@ -104,18 +104,18 @@ if ($adminer->homepage()) {
echo ($link ? "<td align='right'>" . (support("table") || $key == "Rows" || (support("indexes") && $key != "Data_length")
? "<a href='" . h(ME . "$link[0]=") . urlencode($name) . "'$id title='$link[1]'>?</a>"
: "<span$id>?</span>"
) : "<td id='$key-" . h($name) . "'>&nbsp;");
) : "<td id='$key-" . h($name) . "'>");
}
$tables++;
}
echo (support("comment") ? "<td id='Comment-" . h($name) . "'>&nbsp;" : "");
echo (support("comment") ? "<td id='Comment-" . h($name) . "'>" : "");
}
echo "<tr><td>&nbsp;<th>" . lang('%d in total', count($tables_list));
echo "<td>" . nbsp($jush == "sql" ? $connection->result("SELECT @@storage_engine") : "");
echo "<td>" . nbsp(db_collation(DB, collations()));
echo "<tr><td><th>" . lang('%d in total', count($tables_list));
echo "<td>" . h($jush == "sql" ? $connection->result("SELECT @@storage_engine") : "");
echo "<td>" . h(db_collation(DB, collations()));
foreach (array("Data_length", "Index_length", "Data_free") as $key) {
echo "<td align='right' id='sum-$key'>&nbsp;";
echo "<td align='right' id='sum-$key'>";
}
echo "</table>\n";
@ -159,7 +159,7 @@ if ($adminer->homepage()) {
$routines = routines();
if ($routines) {
echo "<table cellspacing='0'>\n";
echo '<thead><tr><th>' . lang('Name') . '<td>' . lang('Type') . '<td>' . lang('Return type') . "<td>&nbsp;</thead>\n";
echo '<thead><tr><th>' . lang('Name') . '<td>' . lang('Type') . '<td>' . lang('Return type') . "<td></thead>\n";
odd('');
foreach ($routines as $row) {
$name = ($row["SPECIFIC_NAME"] == $row["ROUTINE_NAME"] ? "" : "&name=" . urlencode($row["ROUTINE_NAME"])); // not computed on the pages to be able to print the header first

View file

@ -42,7 +42,7 @@ if (!$row && $EVENT != "") {
<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>&nbsp;<td><?php echo checkbox("ON_COMPLETION", "PRESERVE", $row["ON_COMPLETION"] == "PRESERVE", lang('On completion preserve')); ?>
<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"]); ?>
<p>

View file

@ -312,7 +312,7 @@ class Adminer {
echo ($field["null"] ? " <i>NULL</i>" : "");
echo ($field["auto_increment"] ? " <i>" . lang('Auto Increment') . "</i>" : "");
echo (isset($field["default"]) ? " <span title='" . lang('Default value') . "'>[<b>" . h($field["default"]) . "</b>]</span>" : "");
echo (support("comment") ? "<td>" . nbsp($field["comment"]) : "");
echo (support("comment") ? "<td>" . h($field["comment"]) : "");
echo "\n";
}
echo "</table>\n";

View file

@ -32,7 +32,7 @@ function connect_error() {
echo "<table cellspacing='0' class='checkable'>\n";
echo script("mixin(qsl('table'), {onclick: tableClick, ondblclick: partialArg(tableClick, true)});");
echo "<thead><tr>"
. (support("database") ? "<td>&nbsp;" : "")
. (support("database") ? "<td>" : "")
. "<th>" . lang('Database') . " - <a href='" . h(ME) . "refresh=1'>" . lang('Refresh') . "</a>"
. "<td>" . lang('Collation')
. "<td>" . lang('Tables')
@ -47,7 +47,7 @@ function connect_error() {
$id = h("Db-" . $db);
echo "<tr" . odd() . ">" . (support("database") ? "<td>" . checkbox("db[]", $db, in_array($db, (array) $_POST["db"]), "", "", "", $id) : "");
echo "<th><a href='$root' id='$id'>" . h($db) . "</a>";
$collation = nbsp(db_collation($db, $collations));
$collation = h(db_collation($db, $collations));
echo "<td>" . (support("database") ? "<a href='$root" . ($scheme ? "&amp;ns=" : "") . "&amp;database=' title='" . lang('Alter database') . "'>$collation</a>" : $collation);
echo "<td align='right'><a href='$root&amp;schema=' id='tables-" . h($db) . "' title='" . lang('Database schema') . "'>" . ($_GET["dbsize"] ? $tables : "?") . "</a>";
echo "<td align='right' id='size-" . h($db) . "'>" . ($_GET["dbsize"] ? db_size($db) : "?");

View file

@ -64,8 +64,6 @@ function select($result, $connection2 = null, $orgtables = array(), $limit = 0)
$val = "<i>NULL</i>";
} elseif ($blobs[$key] && !is_utf8($val)) {
$val = "<i>" . lang('%d byte(s)', strlen($val)) . "</i>"; //! link to download
} elseif (!strlen($val)) { // strlen - SQLite can return int
$val = "&nbsp;"; // some content to print a border
} else {
$val = h($val);
if ($types[$key] == 254) { // 254 - char
@ -245,7 +243,7 @@ function edit_fields($fields, $collations, $type = "TABLE", $foreign_keys = arra
$fields = array_values($fields);
?>
<thead><tr>
<?php if ($type == "PROCEDURE") { ?><td>&nbsp;<?php } ?>
<?php if ($type == "PROCEDURE") { ?><td><?php } ?>
<th id="label-name"><?php echo ($type == "TABLE" ? lang('Column name') : lang('Parameter name')); ?>
<td id="label-type"><?php echo lang('Type'); ?><textarea id="enum-edit" rows="4" cols="12" wrap="off" style="display: none;"></textarea><?php echo script("qs('#enum-edit').onblur = editingLengthBlur;"); ?>
<td id="label-length"><?php echo lang('Length'); ?>
@ -285,9 +283,9 @@ function edit_fields($fields, $collations, $type = "TABLE", $foreign_keys = arra
}
echo "<td>";
echo (support("move_col") ?
"<input type='image' class='icon' name='add[$i]' src='../adminer/static/plus.gif' alt='+' title='" . lang('Add next') . "'>&nbsp;"
. "<input type='image' class='icon' name='up[$i]' src='../adminer/static/up.gif' alt='↑' title='" . lang('Move up') . "'>&nbsp;"
. "<input type='image' class='icon' name='down[$i]' src='../adminer/static/down.gif' alt='↓' title='" . lang('Move down') . "'>&nbsp;"
"<input type='image' class='icon' name='add[$i]' src='../adminer/static/plus.gif' alt='+' title='" . lang('Add next') . "'> "
. "<input type='image' class='icon' name='up[$i]' src='../adminer/static/up.gif' alt='↑' title='" . lang('Move up') . "'> "
. "<input type='image' class='icon' name='down[$i]' src='../adminer/static/down.gif' alt='↓' title='" . lang('Move down') . "'> "
: "");
echo ($orig == "" || support("drop_col") ? "<input type='image' class='icon' name='drop_col[$i]' src='../adminer/static/cross.gif' alt='x' title='" . lang('Remove') . "'>" : "");
}

View file

@ -154,14 +154,6 @@ function h($string) {
return str_replace("\0", "&#0;", htmlspecialchars($string, ENT_QUOTES, 'utf-8'));
}
/** Escape for TD
* @param string
* @return string
*/
function nbsp($string) {
return (trim($string) != "" ? h($string) : "&nbsp;");
}
/** Convert \n to <br>
* @param string
* @return string
@ -946,14 +938,14 @@ function input($field, $value, $function) {
$functions = (isset($_GET["select"]) || $reset ? array("orig" => lang('original')) : array()) + $adminer->editFunctions($field);
$attrs = " name='fields[$name]'";
if ($field["type"] == "enum") {
echo nbsp($functions[""]) . "<td>" . $adminer->editInput($_GET["edit"], $field, $attrs, $value);
echo h($functions[""]) . "<td>" . $adminer->editInput($_GET["edit"], $field, $attrs, $value);
} else {
$has_function = (in_array($function, $functions) || isset($functions[$function]));
echo (count($functions) > 1
? "<select name='function[$name]'>" . optionlist($functions, $function === null || $has_function ? $function : "") . "</select>"
. on_help("getTarget(event).value.replace(/^SQL\$/, '')", 1)
. script("qsl('select').onchange = functionChange;", "")
: nbsp(reset($functions))
: h(reset($functions))
) . '<td>';
$input = $adminer->editInput($_GET["edit"], $field, $attrs, $value); // usage in call is without a table
if ($input != "") {
@ -1253,9 +1245,7 @@ function select_value($val, $link, $field, $text_length) {
}
$return = $adminer->editVal($val, $field);
if ($return !== null) {
if ($return === "") { // === - may be int
$return = "&nbsp;";
} elseif (!is_utf8($return)) {
if (!is_utf8($return)) {
$return = "\0"; // htmlspecialchars of binary data returns an empty string
} elseif ($text_length != "" && is_shortable($field)) {
$return = shorten_utf8($return, max(0, +$text_length)); // usage of LEFT() would reduce traffic but complicate query - expected average speedup: .001 s VS .01 s on local network

View file

@ -1,2 +1,2 @@
<?php
$VERSION = "4.6.2";
$VERSION = "4.6.3-dev";

View file

@ -99,7 +99,7 @@ if (!$row) {
<th id="label-type"><?php echo lang('Index Type'); ?>
<th><input type="submit" class="wayoff"><?php echo lang('Column (length)'); ?>
<th id="label-name"><?php echo lang('Name'); ?>
<th><noscript><input type='image' class='icon' name='add[0]' src='../adminer/static/plus.gif' alt='+' title='<?php echo lang('Add next'); ?>'></noscript>&nbsp;
<th><noscript><input type='image' class='icon' name='add[0]' src='../adminer/static/plus.gif' alt='+' title='<?php echo lang('Add next'); ?>'></noscript>
</thead>
<?php
if ($primary) {

View file

@ -15,7 +15,7 @@ hidden_fields_get();
echo "<input type='hidden' name='db' value='" . h(DB) . "'>\n";
echo ($grant ? "" : "<input type='hidden' name='grant' value=''>\n");
echo "<table cellspacing='0'>\n";
echo "<thead><tr><th>" . lang('Username') . "<th>" . lang('Server') . "<th>&nbsp;</thead>\n";
echo "<thead><tr><th>" . lang('Username') . "<th>" . lang('Server') . "<th></thead>\n";
while ($row = $result->fetch_assoc()) {
echo '<tr' . odd() . '><td>' . h($row["User"]) . "<td>" . h($row["Host"]) . '<td><a href="' . h(ME . 'user=' . urlencode($row["User"]) . '&host=' . urlencode($row["Host"])) . '">' . lang('Edit') . "</a>\n";

View file

@ -21,7 +21,7 @@ $i = -1;
foreach (process_list() as $i => $row) {
if (!$i) {
echo "<thead><tr lang='en'>" . (support("kill") ? "<th>&nbsp;" : "");
echo "<thead><tr lang='en'>" . (support("kill") ? "<th>" : "");
foreach ($row as $key => $val) {
echo "<th>$key" . doc_link(array(
'sql' => "show-processlist.html#processlist_" . strtolower($key),
@ -38,7 +38,7 @@ foreach (process_list() as $i => $row) {
($jush == "pgsql" && $key == "current_query" && $val != "<IDLE>") ||
($jush == "oracle" && $key == "sql_text" && $val != "")
? "<code class='jush-$jush'>" . shorten_utf8($val, 100, "</code>") . ' <a href="' . h(ME . ($row["db"] != "" ? "db=" . urlencode($row["db"]) . "&" : "") . "sql=" . urlencode($val)) . '">' . lang('Clone') . '</a>'
: nbsp($val)
: h($val)
);
}
echo "\n";

View file

@ -4,10 +4,10 @@ header("Content-Type: text/javascript; charset=utf-8");
if ($_GET["script"] == "db") {
$sums = array("Data_length" => 0, "Index_length" => 0, "Data_free" => 0);
foreach (table_status() as $name => $table_status) {
json_row("Comment-$name", nbsp($table_status["Comment"]));
json_row("Comment-$name", h($table_status["Comment"]));
if (!is_view($table_status)) {
foreach (array("Engine", "Collation") as $key) {
json_row("$key-$name", nbsp($table_status[$key]));
json_row("$key-$name", h($table_status[$key]));
}
foreach ($sums + array("Auto_increment" => 0, "Rows" => 0) as $key => $val) {
if ($table_status[$key] != "") {

View file

@ -319,13 +319,13 @@ function checkboxClick(event) {
/** Set HTML code of an element
* @param string
* @param string undefined to set parentNode to &nbsp;
* @param string undefined to set parentNode to empty string
*/
function setHtml(id, html) {
var el = qs('#' + id);
if (el) {
if (html == null) {
el.parentNode.innerHTML = '&nbsp;';
el.parentNode.innerHTML = '';
} else {
el.innerHTML = html;
}
@ -716,7 +716,7 @@ function selectClick(event, text, warning) {
});
input.rows = rows;
}
if (value == '\u00A0' || qsa('i', td).length) { // &nbsp; or i - NULL
if (qsa('i', td).length) { // <i> - NULL
value = '';
}
if (document.selection) {

View file

@ -34,7 +34,7 @@ if (!is_view($table_status)) {
$foreign_keys = foreign_keys($TABLE);
if ($foreign_keys) {
echo "<table cellspacing='0'>\n";
echo "<thead><tr><th>" . lang('Source') . "<td>" . lang('Target') . "<td>" . lang('ON DELETE') . "<td>" . lang('ON UPDATE') . "<td>&nbsp;</thead>\n";
echo "<thead><tr><th>" . lang('Source') . "<td>" . lang('Target') . "<td>" . lang('ON DELETE') . "<td>" . lang('ON UPDATE') . "<td></thead>\n";
foreach ($foreign_keys as $name => $foreign_key) {
echo "<tr title='" . h($name) . "'>";
echo "<th><i>" . implode("</i>, <i>", array_map('h', $foreign_key["source"])) . "</i>";
@ -43,8 +43,8 @@ if (!is_view($table_status)) {
. "</a>"
;
echo "(<i>" . implode("</i>, <i>", array_map('h', $foreign_key["target"])) . "</i>)";
echo "<td>" . nbsp($foreign_key["on_delete"]) . "\n";
echo "<td>" . nbsp($foreign_key["on_update"]) . "\n";
echo "<td>" . h($foreign_key["on_delete"]) . "\n";
echo "<td>" . h($foreign_key["on_update"]) . "\n";
echo '<td><a href="' . h(ME . 'foreign=' . urlencode($TABLE) . '&name=' . urlencode($name)) . '">' . lang('Alter') . '</a>';
}
echo "</table>\n";

View file

@ -165,7 +165,7 @@ foreach (array(
$name = "'grants[$i][" . h(strtoupper($privilege)) . "]'";
$value = $grant[strtoupper($privilege)];
if ($context == "Server Admin" && $object != (isset($grants["*.*"]) ? "*.*" : ".*")) {
echo "<td>&nbsp;";
echo "<td>";
} elseif (isset($_GET["grant"])) {
echo "<td><select name=$name><option><option value='1'" . ($value ? " selected" : "") . ">" . lang('Grant') . "<option value='0'" . ($value == "0" ? " selected" : "") . ">" . lang('Revoke') . "</select>";
} else {

View file

@ -10,7 +10,7 @@ if (!$variables) {
foreach ($variables as $key => $val) {
echo "<tr>";
echo "<th><code class='jush-" . $jush . ($status ? "status" : "set") . "'>" . h($key) . "</code>";
echo "<td>" . nbsp($val);
echo "<td>" . h($val);
}
echo "</table>\n";
}

View file

@ -1,3 +1,5 @@
Adminer 4.6.3-dev:
Adminer 4.6.2 (released 2018-02-20):
Semi-transparent border on table actions
Shorten JSON values in select (bug #594)

View file

@ -189,7 +189,7 @@ ORDER BY ORDINAL_POSITION", null, "") as $row) { //! requires MySQL 5
}
function selectVal($val, $link, $field, $original) {
$return = ($val === null ? "&nbsp;" : $val);
$return = $val;
$link = h($link);
if (preg_match('~blob|bytea~', $field["type"]) && !is_utf8($val)) {
$return = lang('%d byte(s)', strlen($original));
@ -197,7 +197,7 @@ ORDER BY ORDINAL_POSITION", null, "") as $row) { //! requires MySQL 5
$return = "<img src='$link' alt='$return'>";
}
}
if (like_bool($field) && $return != "&nbsp;") { // bool
if (like_bool($field) && $return != "") { // bool
$return = (preg_match('~^(1|t|true|y|yes|on)$~i', $val) ? lang('yes') : lang('no'));
}
if ($link) {

View file

@ -45,7 +45,7 @@ class AdminerFileUpload {
}
function selectVal($val, &$link, $field, $original) {
if ($val != "&nbsp;" && preg_match('~(.*)_path$~', $field["field"], $regs)) {
if ($val != "" && preg_match('~(.*)_path$~', $field["field"], $regs)) {
$link = "$this->displayPath$_GET[select]/$regs[1]-$val";
}
}

View file

@ -21,8 +21,8 @@ class AdminerTableStructure {
echo ($field["auto_increment"] ? " <i>" . lang('Auto Increment') . "</i>" : "");
echo ($field["collation"] ? " <i>" . h($field["collation"]) . "</i>" : "");
echo "<td>" . ($field["null"] ? lang('Yes') : lang('No'));
echo "<td>" . (isset($field["default"]) ? h($field["default"]) : "&nbsp;");
echo (support("comment") ? "<td>" . nbsp($field["comment"]) : "");
echo "<td>" . h($field["default"]);
echo (support("comment") ? "<td>" . h($field["comment"]) : "");
echo "\n";
}
echo "</table>\n";

View file

@ -39,7 +39,7 @@ tinyMCE.init({
}
function selectVal(&$val, $link, $field, $original) {
if (preg_match("~_html~", $field["field"]) && $val != '&nbsp;') {
if (preg_match("~_html~", $field["field"]) && $val != '') {
$shortened = (substr($val, -10) == "<i>...</i>");
if ($shortened) {
$val = substr($val, 0, -10);

View file

@ -28,7 +28,7 @@ class AdminerWymeditor {
function selectVal(&$val, $link, $field, $original) {
// copied from tinymce.php
if (preg_match("~_html~", $field["field"]) && $val != '&nbsp;') {
if (preg_match("~_html~", $field["field"]) && $val != '') {
$shortened = (substr($val, -10) == "<i>...</i>");
if ($shortened) {
$val = substr($val, 0, -10);