From 7c10022c6f976d914988dd163740260d56184d11 Mon Sep 17 00:00:00 2001 From: Jakub Vrana Date: Sun, 3 Oct 2010 00:17:13 +0200 Subject: [PATCH] Treat binary as hex --- editor/include/adminer.inc.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/editor/include/adminer.inc.php b/editor/include/adminer.inc.php index 74c694e7..986b146e 100644 --- a/editor/include/adminer.inc.php +++ b/editor/include/adminer.inc.php @@ -156,7 +156,7 @@ ORDER BY ORDINAL_POSITION"); function selectVal($val, $link, $field) { $return = ($val == "NULL" ? " " : $val); - if (ereg('binary|blob|bytea', $field["type"]) && !is_utf8($val)) { + if (ereg('blob|bytea', $field["type"]) && !is_utf8($val)) { $return = lang('%d byte(s)', strlen($val)); if (ereg("^(GIF|\xFF\xD8\xFF|\x89\x50\x4E\x47\x0D\x0A\x1A\x0A)", $val)) { // GIF|JPG|PNG, getimagetype() works with filename $return = "$return"; @@ -180,7 +180,7 @@ ORDER BY ORDINAL_POSITION"); if (ereg('date|timestamp', $field["type"]) && isset($val)) { return preg_replace('~^([0-9]{2}([0-9]+))-(0?([0-9]+))-(0?([0-9]+))~', lang('$1-$3-$5'), $val); } - return $val; + return (ereg("binary", $field["type"]) ? reset(unpack("H*", $val)) : $val); } function selectColumnsPrint($select, $columns) { @@ -426,6 +426,9 @@ ORDER BY ORDINAL_POSITION"); } elseif (ereg('^(md5|sha1)$', $function)) { $return = "$function($return)"; } + if (ereg("binary", $field["type"])) { + $return = "unhex($return)"; + } return $return; } -- 2.39.5