From 96f83271162af1f6b24dcbc99741b76cf2d072ca Mon Sep 17 00:00:00 2001 From: Garvin Hicking Date: Thu, 10 Jul 2003 15:53:33 +0000 Subject: [PATCH] default function makes string formatting. --- ChangeLog | 7 +++++++ libraries/display_tbl.lib.php3 | 13 ++++++++----- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 09cc83338..be32bfec2 100755 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,13 @@ phpMyAdmin - Changelog $Id$ $Source$ +2003-07-10 Garvin Hicking + * libraries/display_tbl.lib.php3: Let the default function take + the honor to replace special strings, so that a non-default function + does not necessary have them introduced. Very convenient for the + text/plain->formatted display, which would otherwise get every + CR/LF converted to a
and introduce nasty skew. + 2003-07-10 Marc Delisle * pdf_schema.php3: do not display a foreign table if it's not selected by user to be on the schema diff --git a/libraries/display_tbl.lib.php3 b/libraries/display_tbl.lib.php3 index 9ce1907ae..4e3a12561 100644 --- a/libraries/display_tbl.lib.php3 +++ b/libraries/display_tbl.lib.php3 @@ -1085,7 +1085,7 @@ if (!defined('PMA_DISPLAY_TBL_LIB_INCLUDED')) { } // garvin: Wrap MIME-transformations. [MIME] - $default_function = 'htmlspecialchars'; // default_function + $default_function = 'default_function'; // default_function $transform_function = $default_function; $transform_options = array(); @@ -1214,8 +1214,6 @@ if (!defined('PMA_DISPLAY_TBL_LIB_INCLUDED')) { // loic1: displays all space characters, 4 space // characters for tabulations and / $row[$pointer] = ($default_function != $transform_function ? $transform_function($row[$pointer], $transform_options) : $default_function($row[$pointer])); - $row[$pointer] = str_replace("\011", '    ', str_replace(' ', '  ', $row[$pointer])); - $row[$pointer] = ereg_replace("((\015\012)|(\015)|(\012))", '
', $row[$pointer]); $vertical_display['data'][$row_no][$i] = ' ' . $row[$pointer] . '' . "\n"; } else { @@ -1250,8 +1248,6 @@ if (!defined('PMA_DISPLAY_TBL_LIB_INCLUDED')) { // characters for tabulations and / else { $row[$pointer] = ($default_function != $transform_function ? $transform_function($row[$pointer], $transform_options) : $default_function($row[$pointer])); - $row[$pointer] = str_replace("\011", '    ', str_replace(' ', '  ', $row[$pointer])); - $row[$pointer] = ereg_replace("((\015\012)|(\015)|(\012))", '
', $row[$pointer]); } // garvin: transform functions may enable nowrapping: @@ -1674,5 +1670,12 @@ if (!defined('PMA_DISPLAY_TBL_LIB_INCLUDED')) { } } // end of the 'PMA_displayTable()' function + function default_function($buffer) { + $buffer = htmlspecialchars($buffer); + $buffer = str_replace("\011", '    ', str_replace(' ', '  ', $buffer)); + $buffer = ereg_replace("((\015\012)|(\015)|(\012))", '
', $buffer); + + return $buffer; + } } // $__PMA_DISPLAY_TBL_LIB__ ?>