From bd3de960a285ff80c0b8ca25d8f1f36bf46c4207 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Chapeaux?= Date: Sun, 14 Oct 2001 09:47:36 +0000 Subject: [PATCH] binary fields weren't well displayed in browse mode --- ChangeLog | 3 ++- libraries/display_tbl.lib.php3 | 17 ++++++++++++++--- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 26ac2b7a8..e96744237 100755 --- a/ChangeLog +++ b/ChangeLog @@ -8,7 +8,8 @@ $Source$ 2001-10-14 Loïc Chapeaux * libraries/build_dump.lib.php3, lines 202-203: improved the fix against the bug #469416 (Dumps with binary data dont work mysql). - * left.php3: removed unnecessary md5 calls. + * libraries/display_tbl.lib.php3, lines 768-780: binary fields weren't + well displayed. 2001-10-13 Loïc Chapeaux * Documentation.html, lines 504-506: added some words about requirement for diff --git a/libraries/display_tbl.lib.php3 b/libraries/display_tbl.lib.php3 index c6a1e810d..458733f31 100644 --- a/libraries/display_tbl.lib.php3 +++ b/libraries/display_tbl.lib.php3 @@ -748,7 +748,7 @@ if (!defined('__LIB_DISPLAY_TBL__')){ if (strlen($row[$primary->name]) > $GLOBALS['cfgLimitChars'] && ($dontlimitchars != 1)) { $row[$primary->name] = substr($row[$primary->name], 0, $GLOBALS['cfgLimitChars']) . '...'; } - // loic1 : displays / + // loic1: displays / $row[$primary->name] = ereg_replace("((\015\012)|(\015)|(\012))+", '
', htmlspecialchars($row[$primary->name])); echo ' ' . $row[$primary->name] . '' . "\n"; } else { @@ -765,8 +765,19 @@ if (!defined('__LIB_DISPLAY_TBL__')){ $row[$primary->name] = substr($row[$primary->name], 0, $GLOBALS['cfgLimitChars']) . '...'; } } - // loic1 : displays / - $row[$primary->name] = ereg_replace("((\015\012)|(\015)|(\012))+", '
', htmlspecialchars($row[$primary->name])); + // loic1: displays special characters from binaries + $field_flags = mysql_field_flags($dt_result, $i); + if (eregi('BINARY', $field_flags)) { + $row[$primary->name] = str_replace("\x00", '\0', $row[$primary->name]); + $row[$primary->name] = str_replace("\x08", '\b', $row[$primary->name]); + $row[$primary->name] = str_replace("\x0a", '\n', $row[$primary->name]); + $row[$primary->name] = str_replace("\x0d", '\r', $row[$primary->name]); + $row[$primary->name] = str_replace("\x1a", '\Z', $row[$primary->name]); + } + // loic1: displays / + else { + $row[$primary->name] = ereg_replace("((\015\012)|(\015)|(\012))+", '
', htmlspecialchars($row[$primary->name])); + } echo ' ' . $row[$primary->name] . '' . "\n"; } else { echo '  ' . "\n";