diff --git a/adminer/include/adminer.inc.php b/adminer/include/adminer.inc.php
index bb1557a2..336ef359 100644
--- a/adminer/include/adminer.inc.php
+++ b/adminer/include/adminer.inc.php
@@ -220,12 +220,13 @@ username.form['auth[driver]'].onchange();
* @param string HTML-escaped value to print
* @param string link to foreign key
* @param array single field returned from fields()
+ * @param array original value before applying editVal() and escaping
* @return string
*/
- function selectVal($val, $link, $field) {
+ function selectVal($val, $link, $field, $original) {
$return = ($val === null ? "NULL" : (preg_match("~char|binary~", $field["type"]) && !preg_match("~var~", $field["type"]) ? "$val
" : $val));
if (preg_match('~blob|bytea|raw|file~', $field["type"]) && !is_utf8($val)) {
- $return = lang('%d byte(s)', strlen(html_entity_decode($val, ENT_QUOTES)));
+ $return = lang('%d byte(s)', strlen($original));
}
return ($link ? "$return" : $return);
}
diff --git a/adminer/include/functions.inc.php b/adminer/include/functions.inc.php
index 7d47e127..17de6629 100644
--- a/adminer/include/functions.inc.php
+++ b/adminer/include/functions.inc.php
@@ -1041,18 +1041,17 @@ function select_value($val, $link, $field, $text_length) {
);
}
}
- $val = $adminer->editVal($val, $field);
- if ($val !== null) {
- if ($val === "") { // === - may be int
- $val = " ";
- } elseif ($text_length != "" && is_shortable($field)) {
- $val = shorten_utf8($val, max(0, +$text_length)); // usage of LEFT() would reduce traffic but complicate query - expected average speedup: .001 s VS .01 s on local network
+ $return = $adminer->editVal($val, $field);
+ if ($return !== null) {
+ if ($return === "") { // === - may be int
+ $return = " ";
+ } elseif ($text_length != "" && is_shortable($field) && is_utf8($return)) {
+ $return = shorten_utf8($return, max(0, +$text_length)); // usage of LEFT() would reduce traffic but complicate query - expected average speedup: .001 s VS .01 s on local network
} else {
- $val = h($val);
+ $return = h($return);
}
}
- $val = $adminer->selectVal($val, $link, $field);
- return $val;
+ return $adminer->selectVal($return, $link, $field, $val);
}
/** Check whether the string is e-mail address
diff --git a/changes.txt b/changes.txt
index cc4f9acb..698d871f 100644
--- a/changes.txt
+++ b/changes.txt
@@ -1,11 +1,11 @@
Adminer 4.0.1-dev:
-Fix compiled version of Elasticsearch
Don't use type=number if a SQL function is used
Disable highlighting in textareas with long texts
Don't autofocus SQL textarea in Firefox
Don't link NULL foreign key values
+Fix displaying images in Editor, bug since Adminer 3.6.0
MongoDB: Count tables, display ObjectIds, sort, limit, offset, count rows
-Elasticsearch: Create and drop DB, drop table
+Elasticsearch: Fix compiled version, create and drop DB, drop table
Adminer 4.0.0 (released 2014-01-08):
Driver for SimpleDB, MongoDB and Elasticsearch
diff --git a/editor/include/adminer.inc.php b/editor/include/adminer.inc.php
index dcb41ac7..1a075807 100644
--- a/editor/include/adminer.inc.php
+++ b/editor/include/adminer.inc.php
@@ -170,12 +170,12 @@ ORDER BY ORDINAL_POSITION", null, "") as $row) { //! requires MySQL 5
function selectLink($val, $field) {
}
- function selectVal($val, $link, $field) {
+ function selectVal($val, $link, $field, $original) {
$return = ($val === null ? " " : $val);
$link = h($link);
if (preg_match('~blob|bytea~', $field["type"]) && !is_utf8($val)) {
- $return = lang('%d byte(s)', strlen($val));
- if (preg_match("~^(GIF|\xFF\xD8\xFF|\x89PNG\x0D\x0A\x1A\x0A)~", $val)) { // GIF|JPG|PNG, getimagetype() works with filename
+ $return = lang('%d byte(s)', strlen($original));
+ if (preg_match("~^(GIF|\xFF\xD8\xFF|\x89PNG\x0D\x0A\x1A\x0A)~", $original)) { // GIF|JPG|PNG, getimagetype() works with filename
$return = "
";
}
}
diff --git a/plugins/file-upload.php b/plugins/file-upload.php
index b0d518e7..b42333aa 100644
--- a/plugins/file-upload.php
+++ b/plugins/file-upload.php
@@ -44,7 +44,7 @@ class AdminerFileUpload {
}
}
- function selectVal($val, &$link, $field) {
+ function selectVal($val, &$link, $field, $original) {
if ($val != " " && preg_match('~(.*)_path$~', $field["field"], $regs)) {
$link = "$this->displayPath$_GET[select]/$regs[1]-$val";
}
diff --git a/plugins/tinymce.php b/plugins/tinymce.php
index 7dbc4840..75cb08b7 100644
--- a/plugins/tinymce.php
+++ b/plugins/tinymce.php
@@ -46,7 +46,7 @@ tinyMCE.init({
...");
if ($shortened) {
diff --git a/plugins/wymeditor.php b/plugins/wymeditor.php
index 90119f43..522c94d7 100644
--- a/plugins/wymeditor.php
+++ b/plugins/wymeditor.php
@@ -26,7 +26,7 @@ class AdminerWymeditor {
}
}
- function selectVal(&$val, $link, $field) {
+ function selectVal(&$val, $link, $field, $original) {
// copied from tinymce.php
if (preg_match("~_html~", $field["field"]) && $val != ' ') {
$shortened = (substr($val, -10) == "...");