'en-iso-8859-1', 'AllowAnywhereRecoding' => FALSE); // Loads the language file require_once('./libraries/select_lang.lib.php'); // Sends the Content-Type header header('Content-Type: text/html; charset=' . $charset); // Displays the error message ?>
' . "\n" . (($cfg['SQP']['fmtType'] == 'none' && $unparsed_sql != '') ? $unparsed_sql : $parsed_sql) . "\n" . ''; return $formatted_sql; } $formatted_sql = ''; switch ($cfg['SQP']['fmtType']) { case 'none': if ($unparsed_sql != '') { $formatted_sql = "
\n" . PMA_SQP_formatNone(array('raw' => $unparsed_sql)) . "\n"; } else { $formatted_sql = PMA_SQP_formatNone($parsed_sql); } break; case 'html': $formatted_sql = PMA_SQP_formatHtml($parsed_sql,'color'); break; case 'text': //$formatted_sql = PMA_SQP_formatText($parsed_sql); $formatted_sql = PMA_SQP_formatHtml($parsed_sql,'text'); break; default: break; } // end switch return $formatted_sql; } // end of the "PMA_formatSql()" function /** * Displays a link to the official MySQL documentation * * @param chapter of "HTML, one page per chapter" documentation * @param contains name of page/anchor that is being linked * * @return string the html link * * @access public */ // 2004-05-04: replaced with a modified function from Michael Keck (mkkeck) function PMA_showMySQLDocu($chapter, $link) { if (!empty($GLOBALS['cfg']['MySQLManualBase'])) { if (!empty($GLOBALS['cfg']['MySQLManualType'])) { switch ($GLOBALS['cfg']['MySQLManualType']) { case 'old': if ($GLOBALS['cfg']['ReplaceHelpImg']) { return '
' . $GLOBALS['strError'] . ' | ' . "\n"
. '
---|
';
// if the config password is wrong, or the MySQL server does not
// respond, do not show the query that would reveal the
// username/password
if (!empty($the_query) && !strstr($the_query, 'connect')) {
// --- Added to solve bug #641765
// Robbat2 - 12 January 2003, 9:46PM
// Revised, Robbat2 - 13 Janurary 2003, 2:59PM
if (function_exists('PMA_SQP_isError') && PMA_SQP_isError()) {
echo PMA_SQP_getErrorString();
}
// ---
// modified to show me the help on sql errors (Michael Keck)
echo ' ' . "\n";
echo ' ' . $GLOBALS['strSQLQuery'] . ':' . "\n";
if (strstr(strtolower($formatted_sql),'select')) { // please show me help to the error on select
echo PMA_showMySQLDocu('Reference', 'SELECT');
}
if ($is_modify_link && isset($db)) {
if (isset($table)) {
$doedit_goto = '';
} else {
$doedit_goto = '';
}
if ($GLOBALS['cfg']['PropertiesIconic']) {
echo $doedit_goto
. ' ' . "\n" . ' ' . $formatted_sql . "\n" . ' ' . "\n" . ' ' . $GLOBALS['strMySQLSaid'] . '' . PMA_showMySQLDocu('Error-returns', 'Error-returns') . "\n" . ' ' . "\n"; // The error message will be displayed within a CODE segment. // To preserve original formatting, but allow wordwrapping, we do a couple of replacements // Replace all non-single blanks with their HTML-counterpart $error_message = str_replace(' ', ' ', $error_message); // Replace TAB-characters with their HTML-counterpart $error_message = str_replace("\t", ' ', $error_message); // Replace linebreaks $error_message = nl2br($error_message); echo '' . "\n"
. $error_message . "\n"
. ' ' . "\n"; echo ' | ' . "\n"
. '
'; echo '[' . $goto_back_url . $GLOBALS['strBack'] . ' ]'; } echo ' | ' . "\n" . '
> |
---|
" and not " ") // If we want to show some sql code it is easiest to create it here /* SQL-Parser-Analyzer */ $sqlnr = 1; if (!empty($GLOBALS['show_as_php'])) { $new_line = '\' ' . "\n" . ' . \' '; } if (isset($new_line)) { /* SQL-Parser-Analyzer */ $query_base = PMA_sqlAddslashes(htmlspecialchars($local_query)); /* SQL-Parser-Analyzer */ $query_base = preg_replace("@((\015\012)|(\015)|(\012))+@", $new_line, $query_base); } else { $query_base = $local_query; } if (!empty($GLOBALS['show_as_php'])) { $query_base = '$sql = \'' . $query_base; } else if (!empty($GLOBALS['validatequery'])) { $query_base = PMA_validateSQL($query_base); } else { $parsed_sql = PMA_SQP_parse($query_base); $query_base = PMA_formatSql($parsed_sql, $query_base); } // Prepares links that may be displayed to edit/explain the query // (don't go to default pages, we must go to the page // where the query box is available) // (also, I don't see why we should check the goto variable) //if (!isset($GLOBALS['goto'])) { //$edit_target = (isset($GLOBALS['table'])) ? $cfg['DefaultTabTable'] : $cfg['DefaultTabDatabase']; $edit_target = isset($GLOBALS['db']) ? (isset($GLOBALS['table']) ? 'tbl_properties.php' : 'db_details.php') : ''; //} else if ($GLOBALS['goto'] != 'main.php') { // $edit_target = $GLOBALS['goto']; //} else { // $edit_target = ''; //} if (isset($cfg['SQLQuery']['Edit']) && ($cfg['SQLQuery']['Edit'] == TRUE ) && (!empty($edit_target))) { $onclick = ''; if ($cfg['QueryFrameJS'] && $cfg['QueryFrame']) { $onclick = 'onclick="focus_querywindow(\'' . urlencode($local_query) . '\'); return false;"'; } $edit_link = ' [' . $GLOBALS['strEdit'] . ']'; } else { $edit_link = ''; } // Want to have the query explained (Mike Beck 2002-05-22) // but only explain a SELECT (that has not been explained) /* SQL-Parser-Analyzer */ if (isset($cfg['SQLQuery']['Explain']) && $cfg['SQLQuery']['Explain'] == TRUE) { // Detect if we are validating as well // To preserve the validate uRL data if (!empty($GLOBALS['validatequery'])) { $explain_link_validate = '&validatequery=1'; } else { $explain_link_validate = ''; } $explain_link = ' [' . $GLOBALS['strExplain']; } else if (preg_match('@^EXPLAIN[[:space:]]+SELECT[[:space:]]+@i', $local_query)) { $explain_link .= urlencode(substr($local_query, 8)) . '">' . $GLOBALS['strNoExplain']; } else { $explain_link = ''; } if (!empty($explain_link)) { $explain_link .= ']'; } } else { $explain_link = ''; } //show explain // Also we would like to get the SQL formed in some nice // php-code (Mike Beck 2002-05-22) if (isset($cfg['SQLQuery']['ShowAsPHP']) && $cfg['SQLQuery']['ShowAsPHP'] == TRUE) { $php_link = ' [' . $GLOBALS['strNoPhp']; } else { $php_link .= '1">' . $GLOBALS['strPhp']; } $php_link .= ']'; if (isset($GLOBALS['show_as_php']) && $GLOBALS['show_as_php'] == '1') { $php_link .= ' [' . $GLOBALS['strRunQuery'] . ']'; } } else { $php_link = ''; } //show as php // Refresh query if (isset($cfg['SQLQuery']['Refresh']) && $cfg['SQLQuery']['Refresh'] && preg_match('@^(SELECT|SHOW)[[:space:]]+@i', $local_query)) { $refresh_link = ' ['; $refresh_link .= $GLOBALS['strRefresh']; $refresh_link .= ']'; } else { $refresh_link = ''; } //show as php if (isset($cfg['SQLValidator']['use']) && $cfg['SQLValidator']['use'] == TRUE && isset($cfg['SQLQuery']['Validate']) && $cfg['SQLQuery']['Validate'] == TRUE) { $validate_link = ' [' . $GLOBALS['strNoValidateSQL'] ; } else { $validate_link .= '1">'. $GLOBALS['strValidateSQL'] ; } $validate_link .= ']'; } else { $validate_link = ''; } //validator // Displays the message echo ' ' . $GLOBALS['strSQLQuery'] . ': '; echo ' ' . "\n"; echo ' ' . $query_base; // If a 'LIMIT' clause has been programatically added to the query // displays it if (!empty($GLOBALS['sql_limit_to_append'])) { if (!empty($GLOBALS['show_as_php'])) { echo $GLOBALS['sql_limit_to_append']; } else if (!empty($GLOBALS['validatequery'])) { // skip the extra bit here } else { echo ' ' . PMA_formatSql(PMA_SQP_parse($GLOBALS['sql_limit_to_append'], $GLOBALS['sql_limit_to_append'])); } } unset($local_query); //Clean up the end of the PHP if (!empty($GLOBALS['show_as_php'])) { echo '\';'; } echo "\n"; ?> |
'; echo $edit_link . $explain_link . $php_link . $refresh_link . $validate_link; echo ' | ' . "\n"; } } echo "\n"; ?>
' . $error_message . '