* db_details.php3, db_stats.php3, main.php3, sql.php3

tbl_change.php3, tbl_query_box.php3, user_details.php3
libraries/common.lib.php3:
- changed show_query to use 1/0 instead of 'y'/'n'
* sql.php3, libraries/common.lib.php3:
- Improved logic of edit, show_as_php, explain and validator
in the SQL query box
This commit is contained in:
Robin Johnson
2002-08-03 21:34:20 +00:00
parent 04ff50b206
commit c28a9175ec
9 changed files with 126 additions and 116 deletions

View File

@@ -24,6 +24,13 @@ $Source$
* ChangeLog:
- Neatened Changelog to general follow a format
- (* <filename>: <details>)
* db_details.php3, db_stats.php3, main.php3, sql.php3
tbl_change.php3, tbl_query_box.php3, user_details.php3
libraries/common.lib.php3:
- changed show_query to use 1/0 instead of 'y'/'n'
* sql.php3, libraries/common.lib.php3:
- Improved logic of edit, show_as_php, explain and validator
in the SQL query box
2002-08-02 Robin Johnson <robbat2@users.sourceforge.net>
* libraries/defines*:
@@ -107,7 +114,7 @@ $Source$
* lang/italian: update, thanks to Pietro Danesi
* lang/lithuanian: update, thanks to Vilius Zigmantas
* lang/dutch: update, thanks to Ivo Teel.
* :2.3.0-rc4 released
2.3.0-rc4 released
2002-07-27 Marc Delisle <lem9@users.sourceforge.net>
* lang/italian: update, thanks to Pietro Danesi
@@ -126,8 +133,8 @@ $Source$
2002-07-25 Lo<4C>c Chapeaux <lolo@phpheaven.net>
* libraries/sqlparser.lib.php3:
- PHP3 parse errors fixed;
- coding standards.
- PHP3 parse errors fixed;
- coding standards.
* pdf_schema.php3; lang/*: translated a string.
* header.inc.php3, lines 155-156: better "fix" against bug
#585094 (Runtime Error on Line 62).
@@ -258,8 +265,8 @@ $Source$
* lang/sync_lang.sh: support for multiple convertors (recode added),
thanks to Michal Cihar
* lang/spanish update:
- thanks to Daniel Hinostroza
- (Daniel.Hinostroza at grunenthal.com.ec)
- thanks to Daniel Hinostroza
- (Daniel.Hinostroza at grunenthal.com.ec)
* lang/swedish: updates: thanks to Bj<42>rn T. Hallberg
* lang/indonesian: updates, thanks to Rachim Tamsjadi.
* lang/japanese*: updates, thanks to Yukihiro Kawada
@@ -300,8 +307,8 @@ $Source$
2002-07-15 Alexander M. Turek <rabus@users.sourceforge.net>
* libraries/config_import.lib.php3:
- Removed a comment and
- Changed the default value for $cfg['AllowAnywhereRecoding'] into FALSE.
- Removed a comment and
- Changed the default value for $cfg['AllowAnywhereRecoding'] into FALSE.
* header.inc.php3: Better fix against bug #571409, thanks to Lo<4C>c.
* libraries/common.lib.php3: Coding standards.
@@ -321,7 +328,7 @@ $Source$
* Documentation.html, db_details_exports.php3, tbl_properties_export.php3:
add a link to a new faq entry explaining some dump options
* libraries/relation.lib.php3: bug 575868 Unitialized string offset
* 2.3.0-rc3 released
2.3.0-rc3 released
2002-07-14 Alexander M. Turek <rabus@users.sourceforge.net>
* config.inc.php3, libraries/common.lib.php3: Fixed bug #576018.
@@ -451,7 +458,7 @@ $Source$
2002-06-30 Marc Delisle <lem9@users.sourceforge.net>
* user_details.php3: fix the tooltip
* 2.3.0-rc2 released
2.3.0-rc2 released
2002-06-30 Alexander M. Turek <rabus@users.sourceforge.net>
* user_details.php3: Added a tooltip for the new documenation link.
@@ -529,13 +536,14 @@ $Source$
* lang/portuguese.inc.php3 updates: thanks to Lopo Pizarro
2002-06-23 Alexander M. Turek <rabus@users.sourceforge.net>
* Revised some files in /lang/:
- chinese_*.inc.php3, estonian.inc.php3, finnish.inc.php3:
Reordered Strings.
- arabic.inc.php3, brazilian_portuguese.inc.php3, bulgarian_*.php3,
croatian-*.php3, danish.inc.php3, korean.inc.php3, russian_*.inc.php3,
serbian-win1250.inc.php3: Synchronized the untranslated string
$strSplitWordsWithSpace with the English translation.
Revised some files in /lang/:
* chinese_*.inc.php3, estonian.inc.php3, finnish.inc.php3:
- Reordered Strings.
* arabic.inc.php3, brazilian_portuguese.inc.php3, bulgarian_*.php3,
croatian-*.php3, danish.inc.php3, korean.inc.php3, russian_*.inc.php3,
serbian-win1250.inc.php3:
- Synchronized the untranslated string
$strSplitWordsWithSpace with the English translation.
2002-06-23 Olivier L. M<>ller <om@omnis.ch>
* db_stats.php3: Fixed warning from mysql_free_result.
@@ -1344,7 +1352,7 @@ $Source$
authentication mode with IIS.
2002-04-21 Marc Delisle <lem9@users.sourceforge.net>
* ### 2.2.6 released ###
### 2.2.6 released ###
--- Older ChangeLogs can be found on our project website ---

View File

@@ -11,7 +11,7 @@ $url_query .= '&amp;goto=db_details.php3';
/**
* Database work
*/
if (isset($show_query) && $show_query == 'y') {
if (isset($show_query) && $show_query == '1') {
// This script has been called by read_dump.php3
if (isset($sql_query_cpy)) {
$query_to_display = $sql_query_cpy;
@@ -65,7 +65,7 @@ $is_upload = (PMA_PHP_INT_VERSION >= 40000 && function_exists('ini_get'))
onfocus="if (typeof(document.layers) == 'undefined' || typeof(textarea_selected) == 'undefined') {textarea_selected = 1; this.form.elements['sql_query'].select();}">
<?php echo ((!empty($query_to_display)) ? htmlspecialchars($query_to_display) : ''); ?>
</textarea><br />
<input type="checkbox" name="show_query" value="y" id="checkbox_show_query" checked="checked" />&nbsp;
<input type="checkbox" name="show_query" value="1" id="checkbox_show_query" checked="checked" />&nbsp;
<label for="checkbox_show_query"><?php echo $strShowThisQuery; ?></label><br />
</div>
<?php

View File

@@ -31,7 +31,7 @@ if ((!empty($submit_mult) && isset($selected_db))
. '&amp;convcharset=' . $convcharset
. '&amp;server=' . $server;
$action = 'db_stats.php3';
$show_query = 'y';
$show_query = '1';
include('./mult_submits.inc.php3');
}

View File

@@ -329,7 +329,7 @@ h1 {font-family: sans-serif; font-size: large; font-weight: bold}
echo ' ' . $GLOBALS['strSQLQuery'] . '&nbsp;:&nbsp;' . "\n";
if ($is_modify_link) {
echo ' ['
. '<a href="db_details.php3?lang=' . $GLOBALS['lang'] . '&amp;convcharset=' . $GLOBALS['convcharset'] . '&amp;server=' . urlencode($GLOBALS['server']) . '&amp;db=' . urlencode($GLOBALS['db']) . '&amp;sql_query=' . urlencode($the_query) . '&amp;show_query=y">' . $GLOBALS['strEdit'] . '</a>'
. '<a href="db_details.php3?lang=' . $GLOBALS['lang'] . '&amp;convcharset=' . $GLOBALS['convcharset'] . '&amp;server=' . urlencode($GLOBALS['server']) . '&amp;db=' . urlencode($GLOBALS['db']) . '&amp;sql_query=' . urlencode($the_query) . '&amp;show_query=1">' . $GLOBALS['strEdit'] . '</a>'
. ']' . "\n";
} // end if
echo '</p>' . "\n"
@@ -1113,12 +1113,15 @@ if (typeof(document.getElementById) != 'undefined'
// The nl2br function isn't used because its result isn't a valid
// xhtml1.0 statement before php4.0.5 ("<br>" and not "<br />")
// 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 = '&quot;;<br />' . "\n" . ' $sql .= &quot;';
}
if (isset($new_line)) {
/* SQL-Parser-Analyzer */
$query_base = htmlspecialchars($GLOBALS['sql_query']);
/* SQL-Parser-Analyzer */
$query_base = ereg_replace("((\015\012)|(\015)|(\012))+", $new_line, $query_base);
} else {
$query_base = $GLOBALS['sql_query'];
@@ -1133,99 +1136,98 @@ if (typeof(document.getElementById) != 'undefined'
}
// Prepares links that may be displayed to edit/explain the query
if (!isset($GLOBALS['show_query']) || $GLOBALS['show_query'] != 'y') {
if (!isset($GLOBALS['goto'])) {
$edit_target = (isset($GLOBALS['table'])) ? 'tbl_properties.php3' : 'db_details.php3';
} else if ($GLOBALS['goto'] != 'main.php3') {
$edit_target = $GLOBALS['goto'];
} else {
$edit_target = '';
}
if (isset($cfg['SQLQuery']['Edit'])
&& $cfg['SQLQuery']['Edit'] == TRUE) {
if ($edit_target == 'tbl_properties.php3') {
$edit_link = '<a href="tbl_properties.php3'
. $url_qpart
. '&amp;sql_query=' . urlencode($GLOBALS['sql_query']) . '&amp;show_query=y#querybox">' . $GLOBALS['strEdit'] . '</a>';
} else if ($edit_target != '') {
$edit_link = '<a href="db_details.php3'
. $url_qpart
. '&amp;sql_query=' . urlencode($GLOBALS['sql_query']) . '&amp;show_query=y#querybox">' . $GLOBALS['strEdit'] . '</a>';
}
$edit_link = '&nbsp;[' . $edit_link . ']';
} 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 = '&amp;validatequery=1';
} else {
$explain_link_validate = '';
}
if (!isset($GLOBALS['goto'])) {
$edit_target = (isset($GLOBALS['table'])) ? 'tbl_properties.php3' : 'db_details.php3';
} else if ($GLOBALS['goto'] != 'main.php3') {
$edit_target = $GLOBALS['goto'];
} else {
$edit_target = '';
}
if (isset($cfg['SQLQuery']['Edit'])
&& ($cfg['SQLQuery']['Edit'] == TRUE )
&& (!empty($edit_target))) {
$edit_link = '&nbsp;[<a href="'
. $edit_target
. $url_qpart
. '&amp;sql_query=' . urlencode($GLOBALS['sql_query']) . '&amp;show_query=1#querybox">' . $GLOBALS['strEdit'] . '</a>]';
} 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 = '&amp;validatequery=1';
} else {
$explain_link_validate = '';
}
$explain_link = '&nbsp;[<a href="sql.php3'
. $url_qpart
. $explain_link_validate
. '&amp;sql_query=';
$explain_link = '&nbsp;[<a href="sql.php3'
. $url_qpart
. $explain_link_validate
. '&amp;sql_query=';
if (eregi('^SELECT[[:space:]]+', $GLOBALS['sql_query'])) {
$explain_link .= urlencode('EXPLAIN ' . $GLOBALS['sql_query']) . '">' . $GLOBALS['strExplain'];
} else if (eregi('^EXPLAIN[[:space:]]+SELECT[[:space:]]+', $GLOBALS['sql_query'])) {
$explain_link .= substr($GLOBALS['sql_query'],8) . '">' . $GLOBALS['strNoExplain'];
} else {
$explain_link = '';
}
if(!empty($explain_link)) {
$explain_link .= '</a>]';
}
if (eregi('^SELECT[[:space:]]+', $GLOBALS['sql_query'])) {
$explain_link .= urlencode('EXPLAIN ' . $GLOBALS['sql_query']) . '">' . $GLOBALS['strExplain'];
} else if (eregi('^EXPLAIN[[:space:]]+SELECT[[:space:]]+', $GLOBALS['sql_query'])) {
$explain_link .= substr($GLOBALS['sql_query'],8) . '">' . $GLOBALS['strNoExplain'];
} else {
$explain_link = '';
}
if(!empty($explain_link)) {
$explain_link .= '</a>]';
}
} 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) {
if (!empty($GLOBALS['show_as_php'])) {
$php_link = '<a href="sql.php3'
. $url_qpart
. '&amp;sql_query=' . urlencode($GLOBALS['sql_query']) . '&amp;show_as_php=0">' . $GLOBALS['strNoPhp'] . '</a>';
} else {
$php_link = '<a href="sql.php3'
. $url_qpart
. '&amp;sql_query=' . urlencode($GLOBALS['sql_query']) . '&amp;show_as_php=1">' . $GLOBALS['strPhp'] . '</a>';
}
$php_link = '&nbsp;[' . $php_link . ']';
} else {
$php_link = '';
}
// 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 = '&nbsp;[<a href="sql.php3'
. $url_qpart
. '&amp;show_query=1'
. '&amp;sql_query=' . urlencode($GLOBALS['sql_query'])
. '&amp;show_as_php=';
if (isset($cfg['SQLValidator']['use'])
&& $cfg['SQLValidator']['use'] == TRUE
&& isset($cfg['SQLQuery']['Validate'])
&& $cfg['SQLQuery']['Validate'] == TRUE) {
$validate_link = '&nbsp;[<a href="sql.php3'
. $url_qpart
. '&amp;sql_query=' . urlencode($GLOBALS['sql_query']) . '&amp;validatequery=';
if (!empty($GLOBALS['validatequery'])) {
$validate_link .= '0">' . $GLOBALS['strNoValidateSQL'] ;
} else {
$validate_link .= '1">'. $GLOBALS['strValidateSQL'] ;
}
$validate_link .= '</a>]';
if (!empty($GLOBALS['show_as_php'])) {
$php_link .= '0">' . $GLOBALS['strNoPhp'];
} else {
$validate_link = '';
$php_link .= '1">' . $GLOBALS['strPhp'];
}
} // end if (prepare links)
$php_link .= '</a>]';
} else {
$php_link = '';
} //show as php
if (isset($cfg['SQLValidator']['use'])
&& $cfg['SQLValidator']['use'] == TRUE
&& isset($cfg['SQLQuery']['Validate'])
&& $cfg['SQLQuery']['Validate'] == TRUE) {
$validate_link = '&nbsp;[<a href="sql.php3'
. $url_qpart
. '&amp;show_query=1'
. '&amp;sql_query=' . urlencode($GLOBALS['sql_query'])
. '&amp;validatequery=';
if (!empty($GLOBALS['validatequery'])) {
$validate_link .= '0">' . $GLOBALS['strNoValidateSQL'] ;
} else {
$validate_link .= '1">'. $GLOBALS['strValidateSQL'] ;
}
$validate_link .= '</a>]';
} else {
$validate_link = '';
} //validator
// Displays the message
echo ' ' . $GLOBALS['strSQLQuery'] . '&nbsp;:';

View File

@@ -23,7 +23,7 @@ if (isset($db)) {
if (isset($table)) {
unset($table);
}
$show_query = 'y';
$show_query = '1';
require('./header.inc.php3');
if (isset($message)) {
PMA_showMessage($message);

View File

@@ -341,7 +341,7 @@ else {
$error = PMA_mysql_error();
include('./header.inc.php3');
$full_err_url = (ereg('^(db_details|tbl_properties)', $err_url))
? $err_url . '&amp;show_query=y&amp;sql_query=' . urlencode($sql_query)
? $err_url . '&amp;show_query=1&amp;sql_query=' . urlencode($sql_query)
: $err_url;
PMA_mysqlDie($error, $full_sql_query, '', $full_err_url);
}

View File

@@ -22,10 +22,10 @@ if (!empty($message)) {
. '&amp;server=' . $server
. '&amp;db=' . urlencode($db)
. '&amp;table=' . urlencode($table)
. '&amp;$show_query=y'
. '&amp;$show_query=1'
. '&amp;sql_query=' . urlencode($disp_query);
} else {
$show_query = 'y';
$show_query = '1';
}
if (isset($sql_query)) {
$sql_query_cpy = $sql_query;
@@ -112,7 +112,7 @@ if (isset($primary_key)) {
. '&amp;server=' . $server
. '&amp;db=' . urlencode($db)
. '&amp;table=' . urlencode($table)
. '&amp;$show_query=y'
. '&amp;$show_query=1'
. '&amp;sql_query=' . urlencode($local_query);
if (isset($sql_query)) {
$sql_query_cpy = $sql_query;

View File

@@ -5,7 +5,7 @@
/**
* Defines the query to be displayed in the query textarea
*/
if (isset($show_query) && $show_query == 'y') {
if (isset($show_query) && $show_query == '1') {
// This script has been called by read_dump.php3
if (isset($sql_query_cpy)) {
$query_to_display = $sql_query_cpy;
@@ -85,7 +85,7 @@ for ($i = 0 ; $i < $fields_cnt; $i++) {
onfocus="if (typeof(document.layers) == 'undefined' || typeof(textarea_selected) == 'undefined') {textarea_selected = 1; this.form.elements['sql_query'].select();}">
<?php echo ((!empty($query_to_display)) ? htmlspecialchars($query_to_display) : 'SELECT * FROM ' . PMA_backquote($table) . ' WHERE 1'); ?>
</textarea><br />
<input type="checkbox" name="show_query" value="y" id="checkbox_show_query" checked="checked" />&nbsp;
<input type="checkbox" name="show_query" value="1" id="checkbox_show_query" checked="checked" />&nbsp;
<label for="checkbox_show_query"><?php echo $strShowThisQuery; ?></label><br />
</div>
<?php

View File

@@ -1036,7 +1036,7 @@ if (!isset($submit_updProfile)) {
echo '</h1>';
}
if (isset($message)) {
$show_query = 'y';
$show_query = '1';
PMA_showMessage($message);
}
@@ -1104,7 +1104,7 @@ else if (isset($delete) && $delete
// Adds an user
else if (isset($submit_addUser)) {
$show_query = 'y';
$show_query = '1';
if (!isset($host) || $host == '') {
$host = '%';
}
@@ -1159,7 +1159,7 @@ else if (isset($submit_addUser)) {
// Updates the profile of an user
else if (isset($submit_updProfile)) {
$show_query = 'y';
$show_query = '1';
$edit = TRUE;
if (!isset($host) || $host == '') {
$host = '%';
@@ -1262,7 +1262,7 @@ else if (isset($submit_updProfile)) {
// Changes the privileges of an user
else if (isset($submit_chgPriv)) {
$show_query = 'y';
$show_query = '1';
$edit = TRUE;
if (!isset($host) || $host == '') {
$host = '%';
@@ -1293,7 +1293,7 @@ else if (isset($submit_chgPriv)) {
// Revoke/Grant privileges
else if (isset($grants) && $grants) {
$show_query = 'y';
$show_query = '1';
if (!isset($host) || $host == '') {
$host = '%';
}