From b420984a06195aa49bdeeecec979dbabf49dc2b3 Mon Sep 17 00:00:00 2001 From: Sebastian Mendel Date: Fri, 14 Dec 2007 10:09:42 +0000 Subject: [PATCH] bug #1724217 [Create PHP Code] doesn't include newlines for text fields --- ChangeLog | 4 ++-- libraries/common.lib.php | 27 +++++++++++++-------------- 2 files changed, 15 insertions(+), 16 deletions(-) diff --git a/ChangeLog b/ChangeLog index a488dd044..1ec58e994 100644 --- a/ChangeLog +++ b/ChangeLog @@ -24,7 +24,7 @@ $HeadURL: https://phpmyadmin.svn.sourceforge.net/svnroot/phpmyadmin/trunk/phpMyA + rfe #1741101, patch #1798184 UUID default for CHAR(36) PRIMARY KEY, thanks to Gert Palok - gert_p - bug #1664240 [GUI] css height makes cfg TextareaRows useless - +- bug #1724217 [Create PHP Code] doesn't include newlines for text fields 2.11.4.0 (not yet released) - bug #1843428 [GUI] Space issue with DROP/DELETE/ALTER TABLE @@ -33,7 +33,7 @@ $HeadURL: https://phpmyadmin.svn.sourceforge.net/svnroot/phpmyadmin/trunk/phpMyA - bug #1843463 [GUI] DROP PROCEDURE does not show alert - bug #1835904 [GUI] Back link after a SQL error forgets the query - bug #1835654 [core] wrong escaping when using double quotes -- bug #1817612 [cookies] Wrong cookie path on IIS with PHP-CGI, +- bug #1817612 [cookies] Wrong cookie path on IIS with PHP-CGI, thanks to Carsten Wiedmann 2.11.3.0 (2007-12-08) diff --git a/libraries/common.lib.php b/libraries/common.lib.php index 935fef931..9bb18c847 100644 --- a/libraries/common.lib.php +++ b/libraries/common.lib.php @@ -1030,11 +1030,10 @@ function PMA_showMessage($message, $sql_query = null, $type = 'notice') /* SQL-Parser-Analyzer */ if (! empty($GLOBALS['show_as_php'])) { - $new_line = '\'
' . "\n" . '        . \' '; - /* SQL-Parser-Analyzer */ - $query_base = PMA_sqlAddslashes(htmlspecialchars($sql_query), false, false, true); - /* SQL-Parser-Analyzer */ - $query_base = preg_replace("@((\015\012)|(\015)|(\012))+@", $new_line, $query_base); + $new_line = '\\n"
' . "\n" + . '    . "'; + $query_base = htmlspecialchars(addslashes($sql_query)); + $query_base = preg_replace('/((\015\012)|(\015)|(\012))/', $new_line, $query_base); } else { $query_base = $sql_query; } @@ -1082,7 +1081,7 @@ function PMA_showMessage($message, $sql_query = null, $type = 'notice') } if (! empty($GLOBALS['show_as_php'])) { - $query_base = '$sql = \'' . $query_base; + $query_base = '$sql = "' . $query_base; } elseif (! empty($GLOBALS['validatequery'])) { $query_base = PMA_validateSQL($query_base); } elseif (isset($parsed_sql)) { @@ -1210,7 +1209,7 @@ function PMA_showMessage($message, $sql_query = null, $type = 'notice') //Clean up the end of the PHP if (! empty($GLOBALS['show_as_php'])) { - echo '\';'; + echo '";'; } echo ' '; echo '' . "\n"; @@ -1224,12 +1223,12 @@ function PMA_showMessage($message, $sql_query = null, $type = 'notice') } // end of the 'PMA_showMessage()' function /** - * Verifies if current MySQL server supports profiling + * Verifies if current MySQL server supports profiling * * @access public - * @return boolean whether profiling is supported + * @return boolean whether profiling is supported * - * @author Marc Delisle + * @author Marc Delisle */ function PMA_profilingSupported() { // 5.0.37 has profiling but for example, 5.1.20 does not @@ -2311,13 +2310,13 @@ function PMA_externalBug($functionality, $component, $minimum_version, $bugref) /** - * Generates a set of radio HTML fields + * Generates a set of radio HTML fields * * @uses htmlspecialchars() * @param string $html_field_name the radio HTML field - * @param array $choices the choices values and labels - * @param string $checked_choice the choice to check by default - * @param boolean $line_break whether to add an HTML line break after a choice + * @param array $choices the choices values and labels + * @param string $checked_choice the choice to check by default + * @param boolean $line_break whether to add an HTML line break after a choice */ function PMA_generate_html_radio($html_field_name, $choices, $checked_choice = '', $line_break = true) { foreach ($choices as $choice_value => $choice_label) {