1
0
mirror of https://github.com/vrana/adminer.git synced 2025-08-09 08:06:59 +02:00

Function nbsp

git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@1004 7c3ca157-0c34-0410-bff1-cbf682f78f5c
This commit is contained in:
jakubvrana
2009-08-25 10:26:47 +00:00
parent bcff0255ee
commit c196985004
5 changed files with 9 additions and 5 deletions

View File

@@ -60,7 +60,7 @@ if (!$table_status) {
$val = number_format($row[$key], 0, '.', lang(','));
echo '<td align="right">' . (strlen($row[$key]) ? '<a href="' . h(ME . "$link=") . urlencode($name) . '">' . str_replace(" ", "&nbsp;", ($key == "Rows" && $row["Engine"] == "InnoDB" && $val ? lang('~ %s', $val) : $val)) . '</a>' : '&nbsp;');
}
echo "<td>" . (strlen(trim($row["Comment"])) ? h($row["Comment"]) : "&nbsp;");
echo "<td>" . nbsp($row["Comment"]);
} else {
echo '<td colspan="8"><a href="' . h(ME) . "select=" . urlencode($name) . '">' . lang('View') . '</a>';
}

View File

@@ -23,6 +23,10 @@ function h($string) {
return htmlspecialchars($string, ENT_QUOTES);
}
function nbsp($string) {
return (strlen(trim($string)) ? h($string) : "&nbsp;");
}
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 ? "<select name='function[$name]'>" . optionlist($functions, $function) . "</select>" : (strlen($functions[0]) ? h($functions[0]) : "&nbsp;")) . '<td>';
echo (count($functions) > 1 ? "<select name='function[$name]'>" . optionlist($functions, $function) . "</select>" : nbsp($functions[0])) . '<td>';
$input = $adminer->editInput($_GET["edit"], $field, " name='fields[$name]'$onchange", $value); // usage in call is without a table
if (strlen($input)) {
echo $input;

View File

@@ -20,7 +20,7 @@ for ($i=0; $row = $result->fetch_assoc(); $i++) {
if (!$i) {
echo "<thead><tr lang='en'><th>&nbsp;<th>" . implode("<th>", array_keys($row)) . "</thead>\n";
}
echo "<tr" . odd() . "><td><input type='checkbox' name='kill[]' value='$row[Id]'><td>" . implode("<td>", $row) . "\n";
echo "<tr" . odd() . "><td><input type='checkbox' name='kill[]' value='$row[Id]'><td>" . implode("<td>", array_map('nbsp', $row)) . "\n";
}
$result->free();
?>

View File

@@ -14,7 +14,7 @@ if ($result) {
while ($row = $result->fetch_assoc()) {
echo "<tr><th>" . h($row["Field"]);
echo "<td>" . h($row["Type"]) . ($row["Null"] == "YES" ? " <i>NULL</i>" : "");
echo "<td>" . (strlen(trim($row["Comment"])) ? h($row["Comment"]) : "&nbsp;");
echo "<td>" . nbsp($row["Comment"]);
echo "\n";
}
echo "</table>\n";

View File

@@ -6,7 +6,7 @@ $result = $dbh->query("SHOW VARIABLES");
while ($row = $result->fetch_assoc()) {
echo "<tr>";
echo "<th><code class='jush-sqlset'>" . h($row["Variable_name"]) . "</code>";
echo "<td>" . (strlen(trim($row["Value"])) ? h($row["Value"]) : "&nbsp;");
echo "<td>" . nbsp($row["Value"]);
}
$result->free();
echo "</table>\n";