diff --git a/adminer/db.inc.php b/adminer/db.inc.php index 6f397977..b3e71b95 100644 --- a/adminer/db.inc.php +++ b/adminer/db.inc.php @@ -104,18 +104,18 @@ if ($adminer->homepage()) { echo ($link ? "" . (support("table") || $key == "Rows" || (support("indexes") && $key != "Data_length") ? "?" : "?" - ) : " "); + ) : ""); } $tables++; } - echo (support("comment") ? " " : ""); + echo (support("comment") ? "" : ""); } - echo " " . lang('%d in total', count($tables_list)); - echo "" . nbsp($jush == "sql" ? $connection->result("SELECT @@storage_engine") : ""); - echo "" . nbsp(db_collation(DB, collations())); + echo "" . lang('%d in total', count($tables_list)); + echo "" . h($jush == "sql" ? $connection->result("SELECT @@storage_engine") : ""); + echo "" . h(db_collation(DB, collations())); foreach (array("Data_length", "Index_length", "Data_free") as $key) { - echo " "; + echo ""; } echo "\n"; @@ -159,7 +159,7 @@ if ($adminer->homepage()) { $routines = routines(); if ($routines) { echo "\n"; - echo '\n"; + echo '\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 diff --git a/adminer/event.inc.php b/adminer/event.inc.php index 92e4cb16..91d07f12 100644 --- a/adminer/event.inc.php +++ b/adminer/event.inc.php @@ -42,7 +42,7 @@ if (!$row && $EVENT != "") {
' . lang('Name') . '' . lang('Type') . '' . lang('Return type') . " 
' . lang('Name') . '' . lang('Type') . '' . lang('Return type') . "
" class="size">
" maxlength="64"> -
  +

diff --git a/adminer/include/adminer.inc.php b/adminer/include/adminer.inc.php index 68dad1e4..cf003af9 100644 --- a/adminer/include/adminer.inc.php +++ b/adminer/include/adminer.inc.php @@ -312,7 +312,7 @@ class Adminer { echo ($field["null"] ? " NULL" : ""); echo ($field["auto_increment"] ? " " . lang('Auto Increment') . "" : ""); echo (isset($field["default"]) ? " [" . h($field["default"]) . "]" : ""); - echo (support("comment") ? "" . nbsp($field["comment"]) : ""); + echo (support("comment") ? "" . h($field["comment"]) : ""); echo "\n"; } echo "\n"; diff --git a/adminer/include/connect.inc.php b/adminer/include/connect.inc.php index 0564878c..a3e188fa 100644 --- a/adminer/include/connect.inc.php +++ b/adminer/include/connect.inc.php @@ -32,7 +32,7 @@ function connect_error() { echo "\n"; echo script("mixin(qsl('table'), {onclick: tableClick, ondblclick: partialArg(tableClick, true)});"); echo "" - . (support("database") ? " -\n"; echo ($grant ? "" : "\n"); echo "
 " : "") + . (support("database") ? "" : "") . "" . lang('Database') . " - " . lang('Refresh') . "" . "" . lang('Collation') . "" . lang('Tables') @@ -47,7 +47,7 @@ function connect_error() { $id = h("Db-" . $db); echo "" . (support("database") ? "" . checkbox("db[]", $db, in_array($db, (array) $_POST["db"]), "", "", "", $id) : ""); echo "" . h($db) . ""; - $collation = nbsp(db_collation($db, $collations)); + $collation = h(db_collation($db, $collations)); echo "" . (support("database") ? "$collation" : $collation); echo "" . ($_GET["dbsize"] ? $tables : "?") . ""; echo "" . ($_GET["dbsize"] ? db_size($db) : "?"); diff --git a/adminer/include/editing.inc.php b/adminer/include/editing.inc.php index fef5e213..f3b741a1 100644 --- a/adminer/include/editing.inc.php +++ b/adminer/include/editing.inc.php @@ -64,8 +64,6 @@ function select($result, $connection2 = null, $orgtables = array(), $limit = 0) $val = "NULL"; } elseif ($blobs[$key] && !is_utf8($val)) { $val = "" . lang('%d byte(s)', strlen($val)) . ""; //! link to download - } elseif (!strlen($val)) { // strlen - SQLite can return int - $val = " "; // 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); ?>
  + @@ -285,9 +283,9 @@ function edit_fields($fields, $collations, $type = "TABLE", $foreign_keys = arra } echo ""; echo (support("move_col") ? - " " - . " " - . " " + " " + . " " + . " " : ""); echo ($orig == "" || support("drop_col") ? "" : ""); } diff --git a/adminer/include/functions.inc.php b/adminer/include/functions.inc.php index 0dc638d8..a9d8b931 100644 --- a/adminer/include/functions.inc.php +++ b/adminer/include/functions.inc.php @@ -154,14 +154,6 @@ function h($string) { return str_replace("\0", "�", htmlspecialchars($string, ENT_QUOTES, 'utf-8')); } -/** Escape for TD -* @param string -* @return string -*/ -function nbsp($string) { - return (trim($string) != "" ? h($string) : " "); -} - /** Convert \n to
* @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[""]) . "
" . $adminer->editInput($_GET["edit"], $field, $attrs, $value); + echo h($functions[""]) . "" . $adminer->editInput($_GET["edit"], $field, $attrs, $value); } else { $has_function = (in_array($function, $functions) || isset($functions[$function])); echo (count($functions) > 1 ? "" . on_help("getTarget(event).value.replace(/^SQL\$/, '')", 1) . script("qsl('select').onchange = functionChange;", "") - : nbsp(reset($functions)) + : h(reset($functions)) ) . ''; $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 = " "; - } 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 diff --git a/adminer/include/version.inc.php b/adminer/include/version.inc.php index 69105a13..59ff893c 100644 --- a/adminer/include/version.inc.php +++ b/adminer/include/version.inc.php @@ -1,2 +1,2 @@ -  +
\n"; -echo "\n"; +echo "\n"; while ($row = $result->fetch_assoc()) { echo '" . (support("kill") ? "" . (support("kill") ? ""; echo "
" . lang('Username') . "" . lang('Server') . " 
" . lang('Username') . "" . lang('Server') . "
' . h($row["User"]) . "" . h($row["Host"]) . '' . lang('Edit') . "\n"; diff --git a/adminer/processlist.inc.php b/adminer/processlist.inc.php index dd39268b..00a79714 100644 --- a/adminer/processlist.inc.php +++ b/adminer/processlist.inc.php @@ -21,7 +21,7 @@ $i = -1; foreach (process_list() as $i => $row) { if (!$i) { - echo "
 " : ""); + echo "
" : ""); foreach ($row as $key => $val) { echo "$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 != "") || ($jush == "oracle" && $key == "sql_text" && $val != "") ? "" . shorten_utf8($val, 100, "") . ' ' . lang('Clone') . '' - : nbsp($val) + : h($val) ); } echo "\n"; diff --git a/adminer/script.inc.php b/adminer/script.inc.php index d36f03df..f5461bc2 100644 --- a/adminer/script.inc.php +++ b/adminer/script.inc.php @@ -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] != "") { diff --git a/adminer/static/functions.js b/adminer/static/functions.js index 907b37f2..75115923 100644 --- a/adminer/static/functions.js +++ b/adminer/static/functions.js @@ -319,13 +319,13 @@ function checkboxClick(event) { /** Set HTML code of an element * @param string -* @param string undefined to set parentNode to   +* @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 = ' '; + 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) { //   or i - NULL + if (qsa('i', td).length) { // - NULL value = ''; } if (document.selection) { diff --git a/adminer/table.inc.php b/adminer/table.inc.php index 86d20695..6c63f970 100644 --- a/adminer/table.inc.php +++ b/adminer/table.inc.php @@ -34,7 +34,7 @@ if (!is_view($table_status)) { $foreign_keys = foreign_keys($TABLE); if ($foreign_keys) { echo "\n"; - echo "\n"; + echo "\n"; foreach ($foreign_keys as $name => $foreign_key) { echo ""; echo "
" . lang('Source') . "" . lang('Target') . "" . lang('ON DELETE') . "" . lang('ON UPDATE') . " 
" . lang('Source') . "" . lang('Target') . "" . lang('ON DELETE') . "" . lang('ON UPDATE') . "
" . implode(", ", array_map('h', $foreign_key["source"])) . ""; @@ -43,8 +43,8 @@ if (!is_view($table_status)) { . "" ; echo "(" . implode(", ", array_map('h', $foreign_key["target"])) . ")"; - echo "" . nbsp($foreign_key["on_delete"]) . "\n"; - echo "" . nbsp($foreign_key["on_update"]) . "\n"; + echo "" . h($foreign_key["on_delete"]) . "\n"; + echo "" . h($foreign_key["on_update"]) . "\n"; echo '' . lang('Alter') . ''; } echo "
\n"; diff --git a/adminer/user.inc.php b/adminer/user.inc.php index abaab55a..b000165f 100644 --- a/adminer/user.inc.php +++ b/adminer/user.inc.php @@ -165,7 +165,7 @@ foreach (array( $name = "'grants[$i][" . h(strtoupper($privilege)) . "]'"; $value = $grant[strtoupper($privilege)]; if ($context == "Server Admin" && $object != (isset($grants["*.*"]) ? "*.*" : ".*")) { - echo "
 "; + echo ""; } elseif (isset($_GET["grant"])) { echo ""; } else { diff --git a/adminer/variables.inc.php b/adminer/variables.inc.php index 901109e0..3976440d 100644 --- a/adminer/variables.inc.php +++ b/adminer/variables.inc.php @@ -10,7 +10,7 @@ if (!$variables) { foreach ($variables as $key => $val) { echo "
" . h($key) . ""; - echo "" . nbsp($val); + echo "" . h($val); } echo "
\n"; } diff --git a/changes.txt b/changes.txt index 38d6f50d..a2e812fa 100644 --- a/changes.txt +++ b/changes.txt @@ -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) diff --git a/editor/include/adminer.inc.php b/editor/include/adminer.inc.php index ea4680a5..70b5b1a3 100644 --- a/editor/include/adminer.inc.php +++ b/editor/include/adminer.inc.php @@ -189,7 +189,7 @@ ORDER BY ORDINAL_POSITION", null, "") as $row) { //! requires MySQL 5 } function selectVal($val, $link, $field, $original) { - $return = ($val === null ? " " : $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 = "$return"; } } - if (like_bool($field) && $return != " ") { // bool + if (like_bool($field) && $return != "") { // bool $return = (preg_match('~^(1|t|true|y|yes|on)$~i', $val) ? lang('yes') : lang('no')); } if ($link) { diff --git a/plugins/file-upload.php b/plugins/file-upload.php index 806fd593..af352673 100644 --- a/plugins/file-upload.php +++ b/plugins/file-upload.php @@ -45,7 +45,7 @@ class AdminerFileUpload { } function selectVal($val, &$link, $field, $original) { - if ($val != " " && preg_match('~(.*)_path$~', $field["field"], $regs)) { + if ($val != "" && preg_match('~(.*)_path$~', $field["field"], $regs)) { $link = "$this->displayPath$_GET[select]/$regs[1]-$val"; } } diff --git a/plugins/table-structure.php b/plugins/table-structure.php index 09d7a6e5..cd639b59 100644 --- a/plugins/table-structure.php +++ b/plugins/table-structure.php @@ -21,8 +21,8 @@ class AdminerTableStructure { echo ($field["auto_increment"] ? " " . lang('Auto Increment') . "" : ""); echo ($field["collation"] ? " " . h($field["collation"]) . "" : ""); echo "" . ($field["null"] ? lang('Yes') : lang('No')); - echo "" . (isset($field["default"]) ? h($field["default"]) : " "); - echo (support("comment") ? "" . nbsp($field["comment"]) : ""); + echo "" . h($field["default"]); + echo (support("comment") ? "" . h($field["comment"]) : ""); echo "\n"; } echo "\n"; diff --git a/plugins/tinymce.php b/plugins/tinymce.php index 5c4d32bc..f5f169c8 100644 --- a/plugins/tinymce.php +++ b/plugins/tinymce.php @@ -39,7 +39,7 @@ tinyMCE.init({ } function selectVal(&$val, $link, $field, $original) { - if (preg_match("~_html~", $field["field"]) && $val != ' ') { + if (preg_match("~_html~", $field["field"]) && $val != '') { $shortened = (substr($val, -10) == "..."); if ($shortened) { $val = substr($val, 0, -10); diff --git a/plugins/wymeditor.php b/plugins/wymeditor.php index 36c07564..083a254c 100644 --- a/plugins/wymeditor.php +++ b/plugins/wymeditor.php @@ -28,7 +28,7 @@ class AdminerWymeditor { function selectVal(&$val, $link, $field, $original) { // copied from tinymce.php - if (preg_match("~_html~", $field["field"]) && $val != ' ') { + if (preg_match("~_html~", $field["field"]) && $val != '') { $shortened = (substr($val, -10) == "..."); if ($shortened) { $val = substr($val, 0, -10);