From cb0e5f3c943272864a8456ecd8afe12038b13714 Mon Sep 17 00:00:00 2001 From: Sebastian Mendel Date: Tue, 19 Dec 2006 17:45:07 +0000 Subject: [PATCH] added second optional parameter: $sql_query --- ChangeLog | 4 ++ libraries/common.lib.php | 112 ++++++++++++++++++--------------------- 2 files changed, 57 insertions(+), 59 deletions(-) diff --git a/ChangeLog b/ChangeLog index b72b2af58..964d2dd7c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,10 @@ phpMyAdmin - ChangeLog $Id$ $HeadURL$ +2006-12-19 Sebastian Mendel + * libarsies/common.lib.php::PMA_showMessage(): + added second optional parameter: $sql_query + 2006-12-19 Sebastian Mendel * tbl_change.php, tbl_replace.php, include/tbl_replace_fields.inc.php: refactored: made register_globals independent; added documentation; diff --git a/libraries/common.lib.php b/libraries/common.lib.php index 4c4e6e437..290442927 100644 --- a/libraries/common.lib.php +++ b/libraries/common.lib.php @@ -1214,22 +1214,31 @@ if (typeof(window.parent) != 'undefined' } /** - * Displays a message at the top of the "main" (right) frame - * - * @param string the message to display + * dsiplays the message und the query + * usally the message is the result of the query executed * + * @param string $message the message to display + * @param string $sql_query the query to display * @global array the configuration array - * + * @uses $GLOBALS['cfg'] * @access public */ - function PMA_showMessage($message) + function PMA_showMessage($message, $sql_query = null) { global $cfg; - // Sanitizes $message - $message = PMA_sanitize($message); + if (null === $sql_query) { + if (! empty($GLOBALS['display_query'])) { + $sql_query = $GLOBALS['display_query']; + } elseif ($cfg['SQP']['fmtType'] == 'none' && ! empty($GLOBALS['unparsed_sql'])) { + $sql_query = $GLOBALS['unparsed_sql']; + } else { + $sql_query = $GLOBALS['sql_query']; + } + } // Corrects the tooltip text via JS if required + // @todo this is REALLY the wrong place to do this - very unexpected here if ( isset($GLOBALS['table']) && strlen($GLOBALS['table']) && $cfg['ShowTooltip']) { $result = PMA_DBI_try_query('SHOW TABLE STATUS FROM ' . PMA_backquote($GLOBALS['db']) . ' LIKE \'' . PMA_sqlAddslashes($GLOBALS['table'], true) . '\''); if ($result) { @@ -1241,17 +1250,17 @@ if (typeof(window.parent) != 'undefined' PMA_DBI_free_result($result); $uni_tbl = PMA_jsFormat($GLOBALS['db'] . '.' . $GLOBALS['table'], false); echo "\n"; - ?> - - ' . "\n"; + echo '//' . "\n"; + echo '' . "\n"; } // end if } // end if ... elseif // Checks if the table needs to be repaired after a TRUNCATE query. + // @todo this should only be done if isset($GLOBALS['sql_query']), what about $GLOBALS['display_query']??? + // @todo this is REALLY the wrong place to do this - very unexpected here if (isset($GLOBALS['table']) && isset($GLOBALS['sql_query']) && $GLOBALS['sql_query'] == 'TRUNCATE TABLE ' . PMA_backquote($GLOBALS['table'])) { if (!isset($tbl_status)) { @@ -1266,19 +1275,16 @@ window.parent.updateTableTitle('', ' -
-
- ' . "\n"; + + echo '
' . "\n"; if (!empty($GLOBALS['show_error_header'])) { - ?> -
-

- ' . "\n"; + echo '

' . $GLOBALS['strError'] . '

' . "\n"; } echo '
'; - echo $message; + echo PMA_sanitize($message); if (isset($GLOBALS['special_message'])) { echo PMA_sanitize($GLOBALS['special_message']); unset($GLOBALS['special_message']); @@ -1289,17 +1295,7 @@ window.parent.updateTableTitle('', ''; } - if ($cfg['ShowSQL'] == true - && (!empty($GLOBALS['sql_query']) || !empty($GLOBALS['display_query']))) { - if (!empty($GLOBALS['display_query'])) { - $local_query = $GLOBALS['display_query']; - } else { - if ($cfg['SQP']['fmtType'] == 'none' && !empty($GLOBALS['unparsed_sql'])) { - $local_query = $GLOBALS['unparsed_sql']; - } else { - $local_query = $GLOBALS['sql_query']; - } - } + if ($cfg['ShowSQL'] == true && ! empty($sql_query)) { // Basic url query part $url_qpart = '?' . PMA_generate_common_url(isset($GLOBALS['db']) ? $GLOBALS['db'] : '', isset($GLOBALS['table']) ? $GLOBALS['table'] : ''); @@ -1314,11 +1310,11 @@ window.parent.updateTableTitle('', '', '', ' $onclick)) . ']'; } else { @@ -1418,11 +1414,11 @@ window.parent.updateTableTitle('', '', '', '', '', '', '' . "\n"; @@ -1520,9 +1516,7 @@ window.parent.updateTableTitle('', ''; } } - ?> -

-
' . "\n"; } // end of the 'PMA_showMessage()' function @@ -2188,8 +2182,8 @@ window.parent.updateTableTitle('', '', '', '