]> git.joonet.de Git - adminer.git/commitdiff
Don't print query in edit
authorJakub Vrana <jakub@vrana.cz>
Sat, 11 Jan 2014 05:32:07 +0000 (21:32 -0800)
committerJakub Vrana <jakub@vrana.cz>
Sat, 11 Jan 2014 05:32:07 +0000 (21:32 -0800)
adminer/include/adminer.inc.php
adminer/include/functions.inc.php
changes.txt
editor/include/adminer.inc.php
plugins/file-upload.php
plugins/tinymce.php
plugins/wymeditor.php

index bb1557a2221b4e82023b617378b02cfb24fd1b86..336ef35976e8717f7670a7ba98a158d3b04f562f 100644 (file)
@@ -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 ? "<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);
        }
index 7d47e1276334e44fb88fc46d43217033b666c08e..17de6629952d5160c46915093333c1778014e914 100644 (file)
@@ -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 = "&nbsp;";
-               } 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 = "&nbsp;";
+               } 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
index cc4f9acbd53165c7b7475fe1e1a8e219159ade2d..698d871f641ef7a672ddde1b757ef46c4724b96c 100644 (file)
@@ -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
index dcb41ac7ef57eb4b204adc9936fb90347ad4af5e..1a075807bde1f19aad287a9722a82414305f508e 100644 (file)
@@ -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 ? "&nbsp;" : $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'>";
                        }
                }
index b0d518e723802f64edccffde44e12d531b95ac98..b42333aadb6d5d97b1a6bd36163a1042a1c1607b 100644 (file)
@@ -44,7 +44,7 @@ class AdminerFileUpload {
                }
        }
 
-       function selectVal($val, &$link, $field) {
+       function selectVal($val, &$link, $field, $original) {
                if ($val != "&nbsp;" && preg_match('~(.*)_path$~', $field["field"], $regs)) {
                        $link = "$this->displayPath$_GET[select]/$regs[1]-$val";
                }
index 7dbc484018ea33e0b78d6ae75f84d2a23c6b092f..75cb08b75e751e4168df2217625a7626b484d1b5 100644 (file)
@@ -46,7 +46,7 @@ tinyMCE.init({
 <?php
        }
 
-       function selectVal(&$val, $link, $field) {
+       function selectVal(&$val, $link, $field, $original) {
                if (preg_match("~_html~", $field["field"]) && $val != '&nbsp;') {
                        $shortened = (substr($val, -10) == "<i>...</i>");
                        if ($shortened) {
index 90119f43ebccafd3e58edb721004d114c5de76d3..522c94d742e1331bf8bf02921c32a84b74cb564f 100644 (file)
@@ -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 != '&nbsp;') {
                        $shortened = (substr($val, -10) == "<i>...</i>");