mirror of
https://github.com/vrana/adminer.git
synced 2025-08-18 12:21:24 +02:00
Display whitespace in texts (bug #2858042)
git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@1110 7c3ca157-0c34-0410-bff1-cbf682f78f5c
This commit is contained in:
@@ -53,10 +53,10 @@ function select($result, $dbh2 = null) {
|
||||
} else {
|
||||
if ($blobs[$key] && !is_utf8($val)) {
|
||||
$val = "<i>" . lang('%d byte(s)', strlen($val)) . "</i>"; //! link to download
|
||||
} elseif (!strlen(trim($val, " \t"))) {
|
||||
} elseif (!strlen($val)) {
|
||||
$val = " "; // some content to print a border
|
||||
} else {
|
||||
$val = nl2br(h($val));
|
||||
$val = whitespace(h($val));
|
||||
if ($types[$key] == 254) {
|
||||
$val = "<code>$val</code>";
|
||||
}
|
||||
@@ -124,7 +124,7 @@ function process_field($field, $type_field) {
|
||||
global $dbh;
|
||||
return idf_escape($field["field"]) . process_type($type_field)
|
||||
. ($field["null"] ? " NULL" : " NOT NULL") // NULL for timestamp
|
||||
. (!isset($field["default"]) || $field["auto_increment"] || ereg('text|blob', $field["type"]) ? "" : " DEFAULT " . ($field["type"] == "timestamp" && eregi("^CURRENT_TIMESTAMP( on update CURRENT_TIMESTAMP)?$", $field["default"]) ? $field["default"] : $dbh->quote($field["default"])))
|
||||
. (!$field["has_default"] || $field["auto_increment"] || ereg('text|blob', $field["type"]) ? "" : " DEFAULT " . ($field["type"] == "timestamp" && eregi("^CURRENT_TIMESTAMP( on update CURRENT_TIMESTAMP)?$", $field["default"]) ? $field["default"] : $dbh->quote($field["default"])))
|
||||
. " COMMENT " . $dbh->quote($field["comment"])
|
||||
;
|
||||
}
|
||||
|
@@ -43,6 +43,14 @@ function h($string) {
|
||||
return htmlspecialchars($string, ENT_QUOTES);
|
||||
}
|
||||
|
||||
/** Convert text whitespace to HTML
|
||||
* @param string
|
||||
* @return string
|
||||
*/
|
||||
function whitespace($string) {
|
||||
return nl2br(preg_replace('~(^| ) ~m', '\\1 ', str_replace("\t", " ", $string)));
|
||||
}
|
||||
|
||||
/** Escape for TD
|
||||
* @param string
|
||||
* @return string
|
||||
|
Reference in New Issue
Block a user