From c1969850044dd9629cc5b29217b6ef1513302332 Mon Sep 17 00:00:00 2001 From: jakubvrana Date: Tue, 25 Aug 2009 10:26:47 +0000 Subject: [PATCH] Function nbsp git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@1004 7c3ca157-0c34-0410-bff1-cbf682f78f5c --- adminer/db.inc.php | 2 +- adminer/include/functions.inc.php | 6 +++++- adminer/processlist.inc.php | 2 +- adminer/table.inc.php | 2 +- adminer/variables.inc.php | 2 +- 5 files changed, 9 insertions(+), 5 deletions(-) diff --git a/adminer/db.inc.php b/adminer/db.inc.php index 31b7a293..1e361a98 100644 --- a/adminer/db.inc.php +++ b/adminer/db.inc.php @@ -60,7 +60,7 @@ if (!$table_status) { $val = number_format($row[$key], 0, '.', lang(',')); echo '' . (strlen($row[$key]) ? '' . str_replace(" ", " ", ($key == "Rows" && $row["Engine"] == "InnoDB" && $val ? lang('~ %s', $val) : $val)) . '' : ' '); } - echo "" . (strlen(trim($row["Comment"])) ? h($row["Comment"]) : " "); + echo "" . nbsp($row["Comment"]); } else { echo '' . lang('View') . ''; } diff --git a/adminer/include/functions.inc.php b/adminer/include/functions.inc.php index 7bf84ca2..e8447b75 100644 --- a/adminer/include/functions.inc.php +++ b/adminer/include/functions.inc.php @@ -23,6 +23,10 @@ function h($string) { return htmlspecialchars($string, ENT_QUOTES); } +function nbsp($string) { + return (strlen(trim($string)) ? h($string) : " "); +} + function optionlist($options, $selected = null, $use_keys = false) { $return = ""; foreach ($options as $k => $v) { @@ -301,7 +305,7 @@ function input($field, $value, $function) { $functions = (isset($_GET["select"]) ? array("orig" => lang('original')) : array()) + $adminer->editFunctions($field); $first = array_search("", $functions) + (isset($_GET["select"]) ? 1 : 0); $onchange = ($first ? " onchange=\"var f = this.form['function[" . addcslashes($name, "\r\n'\\") . "]']; if ($first > f.selectedIndex) f.selectedIndex = $first;\"" : ""); - echo (count($functions) > 1 ? "" : (strlen($functions[0]) ? h($functions[0]) : " ")) . ''; + echo (count($functions) > 1 ? "" : nbsp($functions[0])) . ''; $input = $adminer->editInput($_GET["edit"], $field, " name='fields[$name]'$onchange", $value); // usage in call is without a table if (strlen($input)) { echo $input; diff --git a/adminer/processlist.inc.php b/adminer/processlist.inc.php index df800e94..4118229f 100644 --- a/adminer/processlist.inc.php +++ b/adminer/processlist.inc.php @@ -20,7 +20,7 @@ for ($i=0; $row = $result->fetch_assoc(); $i++) { if (!$i) { echo " " . implode("", array_keys($row)) . "\n"; } - echo "" . implode("", $row) . "\n"; + echo "" . implode("", array_map('nbsp', $row)) . "\n"; } $result->free(); ?> diff --git a/adminer/table.inc.php b/adminer/table.inc.php index c5655058..47c0c927 100644 --- a/adminer/table.inc.php +++ b/adminer/table.inc.php @@ -14,7 +14,7 @@ if ($result) { while ($row = $result->fetch_assoc()) { echo "" . h($row["Field"]); echo "" . h($row["Type"]) . ($row["Null"] == "YES" ? " NULL" : ""); - echo "" . (strlen(trim($row["Comment"])) ? h($row["Comment"]) : " "); + echo "" . nbsp($row["Comment"]); echo "\n"; } echo "\n"; diff --git a/adminer/variables.inc.php b/adminer/variables.inc.php index eba9c048..b1cdda0f 100644 --- a/adminer/variables.inc.php +++ b/adminer/variables.inc.php @@ -6,7 +6,7 @@ $result = $dbh->query("SHOW VARIABLES"); while ($row = $result->fetch_assoc()) { echo ""; echo "" . h($row["Variable_name"]) . ""; - echo "" . (strlen(trim($row["Value"])) ? h($row["Value"]) : " "); + echo "" . nbsp($row["Value"]); } $result->free(); echo "\n"; -- 2.39.5