binary fields weren't well displayed in browse mode

This commit is contained in:
Loïc Chapeaux
2001-10-14 09:47:36 +00:00
parent 11b46733c3
commit bd3de960a2
2 changed files with 16 additions and 4 deletions

View File

@@ -8,7 +8,8 @@ $Source$
2001-10-14 Lo<4C>c Chapeaux <lolo@phpheaven.net>
* 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<4C>c Chapeaux <lolo@phpheaven.net>
* Documentation.html, lines 504-506: added some words about requirement for

View File

@@ -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 <cr>/<lf>
// loic1: displays <cr>/<lf>
$row[$primary->name] = ereg_replace("((\015\012)|(\015)|(\012))+", '<br />', htmlspecialchars($row[$primary->name]));
echo ' <td>' . $row[$primary->name] . '</td>' . "\n";
} else {
@@ -765,8 +765,19 @@ if (!defined('__LIB_DISPLAY_TBL__')){
$row[$primary->name] = substr($row[$primary->name], 0, $GLOBALS['cfgLimitChars']) . '...';
}
}
// loic1 : displays <cr>/<lf>
// 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 <cr>/<lf>
else {
$row[$primary->name] = ereg_replace("((\015\012)|(\015)|(\012))+", '<br />', htmlspecialchars($row[$primary->name]));
}
echo ' <td>' . $row[$primary->name] . '</td>' . "\n";
} else {
echo ' <td>&nbsp;</td>' . "\n";