* @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 ? "<i>NULL</i>" : (preg_match("~char|binary~", $field["type"]) && !preg_match("~var~", $field["type"]) ? "<code>$val</code>" : $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 ? "<a href='" . h($link) . "'>$return</a>" : $return);
}
);
}
}
- $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
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
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 = "<img src='$link' alt='$return'>";
}
}
}
}
- 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";
}
<?php
}
- function selectVal(&$val, $link, $field) {
+ function selectVal(&$val, $link, $field, $original) {
if (preg_match("~_html~", $field["field"]) && $val != ' ') {
$shortened = (substr($val, -10) == "<i>...</i>");
if ($shortened) {
}
}
- 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) == "<i>...</i>");