From: Jakub Vrana Date: Sat, 2 Oct 2010 22:17:13 +0000 (+0200) Subject: Treat binary as hex X-Git-Tag: v3.0.0~18 X-Git-Url: https://git.joonet.de/?a=commitdiff_plain;h=7c10022c6f976d914988dd163740260d56184d11;p=adminer.git Treat binary as hex --- 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; }