Display a (javascript) based query window as a new frame below the left
frame with query history [#526008]. Currently a bit experimental, works with IE6 and Mozilla 1.2. Utilizes pretty basic JavaScript functions which *should* work with any browser.
This commit is contained in:
@@ -50,8 +50,10 @@ $Source$
|
|||||||
libraries/display_tbl.lib.php3, libraries/transformations/*
|
libraries/display_tbl.lib.php3, libraries/transformations/*
|
||||||
TODO: Add predefined functions!
|
TODO: Add predefined functions!
|
||||||
|
|
||||||
* IN PROGRESS: Display a (javascript) based query window as a new frame below the left
|
* Display a (javascript) based query window as a new frame below the left
|
||||||
frame with query history [#526008]
|
frame with query history [#526008]. Currently a bit experimental, works with
|
||||||
|
IE6 and Mozilla 1.2. Utilizes pretty basic JavaScript functions which *should*
|
||||||
|
work with any browser.
|
||||||
Files: queryframe.php3, querywindow.php3, header.inc.php3,
|
Files: queryframe.php3, querywindow.php3, header.inc.php3,
|
||||||
tbl_query_box.php3, common.lib.php3
|
tbl_query_box.php3, common.lib.php3
|
||||||
|
|
||||||
|
@@ -377,8 +377,8 @@ $cfg['QueryFrame'] = TRUE; // displays a new frame where a link
|
|||||||
$cfg['QueryFrameJS'] = TRUE; // whether to use JavaScript functions for opening a new window for SQL commands.
|
$cfg['QueryFrameJS'] = TRUE; // whether to use JavaScript functions for opening a new window for SQL commands.
|
||||||
// if set to 'false', the target of the querybox is always the right frame.
|
// if set to 'false', the target of the querybox is always the right frame.
|
||||||
$cfg['QueryFrameDebug'] = FALSE; // display JS debugging link (DEVELOPERS only)
|
$cfg['QueryFrameDebug'] = FALSE; // display JS debugging link (DEVELOPERS only)
|
||||||
$cfg['QueryFrameWidth'] = 750; // Width of Query window
|
$cfg['QueryWindowWidth'] = 750; // Width of Query window
|
||||||
$cfg['QueryFrameHeight'] = 300; // Height of Query window
|
$cfg['QueryWindowHeight'] = 300; // Height of Query window
|
||||||
|
|
||||||
+$cfg['BrowseMIME'] = TRUE; // Use MIME-Types (stored in column comments table) for
|
+$cfg['BrowseMIME'] = TRUE; // Use MIME-Types (stored in column comments table) for
|
||||||
|
|
||||||
|
@@ -232,6 +232,62 @@ var errorMsg2 = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strNotValidNum
|
|||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
echo "\n";
|
echo "\n";
|
||||||
|
|
||||||
|
// If query window is wanted and open, update with latest selected db/table.
|
||||||
|
if ($cfg['QueryFrame'] && $cfg['QueryFrameJS']) {
|
||||||
|
?>
|
||||||
|
<script>
|
||||||
|
<?php
|
||||||
|
if ($cfg['QueryFrameDebug']) {
|
||||||
|
?>
|
||||||
|
document.writeln("Updating query window. DB: <?php echo (isset($db) ? $db : 'FALSE'); ?>, Table: <?php echo (isset($table) ? $table : 'FALSE'); ?><br>");
|
||||||
|
document.writeln("Window: " + top.frames.queryframe.querywindow.location + "<br>");
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
|
if (top.frames.queryframe) {
|
||||||
|
<?php echo (isset($db) ? 'top.frames.queryframe.document.queryframeform.db.value = "' . htmlspecialchars($db) . '";' : ''); ?>
|
||||||
|
<?php echo (isset($table) ? 'top.frames.queryframe.document.queryframeform.table.value = "' . htmlspecialchars($table) . '";' : ''); ?>
|
||||||
|
}
|
||||||
|
|
||||||
|
function reload_querywindow () {
|
||||||
|
if (top.frames.queryframe && !top.frames.queryframe.querywindow.closed && top.frames.queryframe.querywindow.location) {
|
||||||
|
<?php echo ($cfg['QueryFrameDebug'] ? 'document.writeln("<a href=\'#\' onClick=\'top.frames.queryframe.querywindow.focus(); return false;\'>Query Window</a> can be updated.<br>");' : ''); ?>
|
||||||
|
|
||||||
|
top.frames.queryframe.querywindow.document.querywindow.db.value = "<?php echo (isset($db) ? htmlspecialchars($db) : '') ?>";
|
||||||
|
top.frames.queryframe.querywindow.document.querywindow.query_history_latest_db.value = "<?php echo (isset($db) ? htmlspecialchars($db) : '') ?>";
|
||||||
|
top.frames.queryframe.querywindow.document.querywindow.table.value = "<?php echo (isset($table) ? htmlspecialchars($table) : '') ?>";
|
||||||
|
top.frames.queryframe.querywindow.document.querywindow.query_history_latest_table.value = "<?php echo (isset($table) ? htmlspecialchars($table) : '') ?>";
|
||||||
|
|
||||||
|
<?php echo (isset($sql_query) ? 'top.frames.queryframe.querywindow.document.querywindow.query_history_latest.value = "' . urlencode($sql_query) . '";' : ''); ?>
|
||||||
|
|
||||||
|
<?php echo ($cfg['QueryFrameDebug'] ? 'alert(\'Querywindow submits. Last chance to check variables.\');' : ''); ?>
|
||||||
|
top.frames.queryframe.querywindow.document.querywindow.submit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function focus_querywindow() {
|
||||||
|
if (top.frames.queryframe.querywindow && !top.frames.queryframe.querywindow.closed && top.frames.queryframe.querywindow.location) {
|
||||||
|
top.frames.queryframe.querywindow.focus();
|
||||||
|
} else {
|
||||||
|
top.frames.queryframe.querywindow=window.open('querywindow.php3?<?php echo PMA_generate_common_url('', ''); ?>&db=<?php echo (isset($db) ? htmlspecialchars($db) : ''); ?>&table=<?php echo (isset($table) ? htmlspecialchars($table) : ''); ?>', 'js_querywindow','toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=yes,resizable=yes,width=<?php echo $cfg['QueryWindowWidth']; ?>,height=<?php echo $cfg['QueryWindowHeight']; ?>');
|
||||||
|
|
||||||
|
if (!top.frames.queryframe.querywindow.opener) {
|
||||||
|
top.frames.queryframe.querywindow.opener = top.frames.queryframe;
|
||||||
|
}
|
||||||
|
|
||||||
|
reload_querywindow();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
reload_querywindow();
|
||||||
|
self.focus();
|
||||||
|
|
||||||
|
|
||||||
|
</script>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
|
11
index.php3
11
index.php3
@@ -56,8 +56,15 @@ body {font-family: <?php echo $right_font_family; ?>; font-size: <?php echo $fo
|
|||||||
</head>
|
</head>
|
||||||
|
|
||||||
<frameset cols="<?php echo $cfg['LeftWidth']; ?>,*" rows="*">
|
<frameset cols="<?php echo $cfg['LeftWidth']; ?>,*" rows="*">
|
||||||
<frame src="left.php3?<?php echo $url_query; ?>" name="nav" frameborder="1" />
|
<?php if ($cfg['QueryFrame']) {?>
|
||||||
<frame src="<?php echo (empty($db)) ? 'main.php3' : $cfg['DefaultTabDatabase']; ?>?<?php echo $url_query; ?>" name="phpmain" />
|
<frameset rows="*, 50" framespacing="0" frameborder="0" border="0">
|
||||||
|
<?php } ?>
|
||||||
|
<frame src="left.php3?<?php echo $url_query; ?>" name="nav" frameborder="0" />
|
||||||
|
<?php if ($cfg['QueryFrame']) { ?>
|
||||||
|
<frame src="queryframe.php3?<?php echo $url_query; ?>" name="queryframe" frameborder="0" />
|
||||||
|
</frameset>
|
||||||
|
<?php } ?>
|
||||||
|
<frame src="<?php echo (empty($db)) ? 'main.php3' : $cfg['DefaultTabDatabase']; ?>?<?php echo $url_query; ?>" name="phpmain" frameborder="1" />
|
||||||
|
|
||||||
<noframes>
|
<noframes>
|
||||||
<body bgcolor="#FFFFFF">
|
<body bgcolor="#FFFFFF">
|
||||||
|
@@ -1265,10 +1265,15 @@ if (typeof(document.getElementById) != 'undefined'
|
|||||||
&& ($cfg['SQLQuery']['Edit'] == TRUE )
|
&& ($cfg['SQLQuery']['Edit'] == TRUE )
|
||||||
&& (!empty($edit_target))) {
|
&& (!empty($edit_target))) {
|
||||||
|
|
||||||
|
$onclick = '';
|
||||||
|
if ($cfg['QueryFrameJS'] && $cfg['QueryFrame']) {
|
||||||
|
$onclick = 'onclick="focus_querywindow(); return false;"';
|
||||||
|
}
|
||||||
|
|
||||||
$edit_link = ' [<a href="'
|
$edit_link = ' [<a href="'
|
||||||
. $edit_target
|
. $edit_target
|
||||||
. $url_qpart
|
. $url_qpart
|
||||||
. '&sql_query=' . urlencode($GLOBALS['sql_query']) . '&show_query=1#querybox">' . $GLOBALS['strEdit'] . '</a>]';
|
. '&sql_query=' . urlencode($GLOBALS['sql_query']) . '&show_query=1#querybox" ' . $onclick . '>' . $GLOBALS['strEdit'] . '</a>]';
|
||||||
} else {
|
} else {
|
||||||
$edit_link = '';
|
$edit_link = '';
|
||||||
}
|
}
|
||||||
|
142
queryframe.php3
Normal file
142
queryframe.php3
Normal file
@@ -0,0 +1,142 @@
|
|||||||
|
<?php
|
||||||
|
/* $Id$ */
|
||||||
|
// vim: expandtab sw=4 ts=4 sts=4:
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the variables sent to this script, retains the db name that may have
|
||||||
|
* been defined as startup option and include a core library
|
||||||
|
*/
|
||||||
|
require('./libraries/grab_globals.lib.php3');
|
||||||
|
if (!empty($db)) {
|
||||||
|
$db_start = $db;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets a core script and starts output buffering work
|
||||||
|
*/
|
||||||
|
require('./libraries/common.lib.php3');
|
||||||
|
require('./libraries/ob.lib.php3');
|
||||||
|
if ($cfg['OBGzip']) {
|
||||||
|
$ob_mode = PMA_outBufferModeGet();
|
||||||
|
if ($ob_mode) {
|
||||||
|
PMA_outBufferPre($ob_mode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Send http headers
|
||||||
|
*/
|
||||||
|
// Don't use cache (required for Opera)
|
||||||
|
$now = gmdate('D, d M Y H:i:s') . ' GMT';
|
||||||
|
header('Expires: ' . $now);
|
||||||
|
header('Last-Modified: ' . $now);
|
||||||
|
header('Cache-Control: no-store, no-cache, must-revalidate, pre-check=0, post-check=0, max-age=0'); // HTTP/1.1
|
||||||
|
header('Pragma: no-cache'); // HTTP/1.0
|
||||||
|
// Define the charset to be used
|
||||||
|
header('Content-Type: text/html; charset=' . $charset);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Displays the frame
|
||||||
|
*/
|
||||||
|
// Gets the font sizes to use
|
||||||
|
PMA_setFontSizes();
|
||||||
|
?>
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||||
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $available_languages[$lang][2]; ?>" lang="<?php echo $available_languages[$lang][2]; ?>" dir="<?php echo $text_dir; ?>">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<title>phpMyAdmin</title>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $charset; ?>" />
|
||||||
|
<base<?php if (!empty($cfg['PmaAbsoluteUri'])) echo ' href="' . $cfg['PmaAbsoluteUri'] . '"'; ?> />
|
||||||
|
<style type="text/css">
|
||||||
|
<!--
|
||||||
|
body {font-family: <?php echo $left_font_family; ?>; font-size: <?php echo $font_size; ?>}
|
||||||
|
div {font-family: <?php echo $left_font_family; ?>; font-size: <?php echo $font_size; ?>; color: #000000}
|
||||||
|
.heada {font-family: <?php echo $left_font_family; ?>; font-size: <?php echo $font_size; ?>; color: #000000}
|
||||||
|
.headaCnt {font-family: <?php echo $left_font_family; ?>; font-size: <?php echo $font_smaller; ?>; color: #000000}
|
||||||
|
.parent {font-family: <?php echo $left_font_family; ?>; color: #000000; text-decoration: none}
|
||||||
|
.child {font-family: <?php echo $left_font_family; ?>; font-size: <?php echo $font_smaller; ?>; color: #333399; text-decoration: none}
|
||||||
|
.item, .item:active, .item:hover, .tblItem, .tblItem:active {font-size: <?php echo $font_smaller; ?>; color: #333399; text-decoration: none}
|
||||||
|
.tblItem:hover {color: #FF0000; text-decoration: underline}
|
||||||
|
//-->
|
||||||
|
</style>
|
||||||
|
<?php
|
||||||
|
if ($cfg['QueryFrame'] && $cfg['QueryFrameJS']) {
|
||||||
|
?>
|
||||||
|
<script type="text/javascript" language="javascript">
|
||||||
|
var querywindow = '';
|
||||||
|
|
||||||
|
function open_querywindow(url) {
|
||||||
|
|
||||||
|
if (!querywindow.closed && querywindow.location) {
|
||||||
|
querywindow.focus();
|
||||||
|
} else {
|
||||||
|
querywindow=window.open(url + '&db=' + document.queryframeform.db.value + '&table=' + document.queryframeform.table.value, 'js_querywindow','toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=yes,resizable=yes,width=750,height=500');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!querywindow.opener) {
|
||||||
|
querywindow.opener = self;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (window.focus) {
|
||||||
|
querywindow.focus();
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body bgcolor="<?php echo $cfg['LeftBgColor']; ?>">
|
||||||
|
<form name="queryframeform" action="queryframe.php3" method="get">
|
||||||
|
<input type="hidden" name="db" value="" />
|
||||||
|
<input type="hidden" name="table" value="" />
|
||||||
|
<input type="hidden" name="framename" value="queryframe" />
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
$anchor = 'querywindow.php3?' . PMA_generate_common_url('', '');
|
||||||
|
if ($cfg['QueryFrameJS']) {
|
||||||
|
$href = '#';
|
||||||
|
$target = '';
|
||||||
|
$onclick = 'onClick="javascript:open_querywindow(\'' . $anchor . '\'); return false;"';
|
||||||
|
} else {
|
||||||
|
$href = $anchor;
|
||||||
|
$target = 'target="phpmain"';
|
||||||
|
$onclick = '';
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<center>
|
||||||
|
<a href="<?php echo $href; ?>" <?php echo $target . ' ' . $onclick; ?>><?php echo $strQueryFrame; ?></a>
|
||||||
|
</center>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Close MySql connections
|
||||||
|
*/
|
||||||
|
if (isset($dbh) && $dbh) {
|
||||||
|
@mysql_close($dbh);
|
||||||
|
}
|
||||||
|
if (isset($userlink) && $userlink) {
|
||||||
|
@mysql_close($userlink);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sends bufferized data
|
||||||
|
*/
|
||||||
|
if (isset($cfg['OBGzip']) && $cfg['OBGzip']
|
||||||
|
&& isset($ob_mode) && $ob_mode) {
|
||||||
|
PMA_outBufferPost($ob_mode);
|
||||||
|
}
|
||||||
|
?>
|
241
querywindow.php3
Normal file
241
querywindow.php3
Normal file
@@ -0,0 +1,241 @@
|
|||||||
|
<?php
|
||||||
|
/* $Id$ */
|
||||||
|
// vim: expandtab sw=4 ts=4 sts=4:
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the variables sent to this script, retains the db name that may have
|
||||||
|
* been defined as startup option and include a core library
|
||||||
|
*/
|
||||||
|
require('./libraries/grab_globals.lib.php3');
|
||||||
|
if (!empty($db)) {
|
||||||
|
$db_start = $db;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets a core script and starts output buffering work
|
||||||
|
*/
|
||||||
|
require('./libraries/common.lib.php3');
|
||||||
|
require('./libraries/ob.lib.php3');
|
||||||
|
if ($cfg['OBGzip']) {
|
||||||
|
$ob_mode = PMA_outBufferModeGet();
|
||||||
|
if ($ob_mode) {
|
||||||
|
PMA_outBufferPre($ob_mode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
require('./libraries/relation.lib.php3');
|
||||||
|
$cfgRelation = PMA_getRelationsParam();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the list and number of available databases.
|
||||||
|
* Skipped if no server selected: in this case no database should be displayed
|
||||||
|
* before the user choose among available ones at the welcome screen.
|
||||||
|
*/
|
||||||
|
if ($server > 0) {
|
||||||
|
PMA_availableDatabases(); // this function is defined in "common.lib.php3"
|
||||||
|
} else {
|
||||||
|
$num_dbs = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Send http headers
|
||||||
|
*/
|
||||||
|
// Don't use cache (required for Opera)
|
||||||
|
$now = gmdate('D, d M Y H:i:s') . ' GMT';
|
||||||
|
header('Expires: ' . $now);
|
||||||
|
header('Last-Modified: ' . $now);
|
||||||
|
header('Cache-Control: no-store, no-cache, must-revalidate, pre-check=0, post-check=0, max-age=0'); // HTTP/1.1
|
||||||
|
header('Pragma: no-cache'); // HTTP/1.0
|
||||||
|
// Define the charset to be used
|
||||||
|
header('Content-Type: text/html; charset=' . $charset);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Displays the frame
|
||||||
|
*/
|
||||||
|
// Gets the font sizes to use
|
||||||
|
PMA_setFontSizes();
|
||||||
|
?>
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||||
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $available_languages[$lang][2]; ?>" lang="<?php echo $available_languages[$lang][2]; ?>" dir="<?php echo $text_dir; ?>">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<title>phpMyAdmin</title>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $charset; ?>" />
|
||||||
|
<base<?php if (!empty($cfg['PmaAbsoluteUri'])) echo ' href="' . $cfg['PmaAbsoluteUri'] . '"'; ?> />
|
||||||
|
<style type="text/css">
|
||||||
|
<!--
|
||||||
|
body {font-family: <?php echo $left_font_family; ?>; font-size: <?php echo $font_size; ?>}
|
||||||
|
div {font-family: <?php echo $left_font_family; ?>; font-size: <?php echo $font_size; ?>; color: #000000}
|
||||||
|
.heada {font-family: <?php echo $left_font_family; ?>; font-size: <?php echo $font_size; ?>; color: #000000}
|
||||||
|
.headaCnt {font-family: <?php echo $left_font_family; ?>; font-size: <?php echo $font_smaller; ?>; color: #000000}
|
||||||
|
.parent {font-family: <?php echo $left_font_family; ?>; color: #000000; text-decoration: none}
|
||||||
|
.child {font-family: <?php echo $left_font_family; ?>; font-size: <?php echo $font_smaller; ?>; color: #333399; text-decoration: none}
|
||||||
|
.item, .item:active, .item:hover, .tblItem, .tblItem:active {font-size: <?php echo $font_smaller; ?>; color: #333399; text-decoration: none}
|
||||||
|
.tblItem:hover {color: #FF0000; text-decoration: underline}
|
||||||
|
//-->
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<script type="text/javascript" language="javascript">
|
||||||
|
<?php
|
||||||
|
if ($cfg['QueryFrame'] && $cfg['QueryFrameJS'] && $cfg['QueryFrameDebug']) {
|
||||||
|
$js_db = (isset($db) ? $db : 'FALSE');
|
||||||
|
$js_table = (isset($table) ? $table : 'FALSE');
|
||||||
|
$js_server = (isset($server) ? $server : 'FALSE');
|
||||||
|
|
||||||
|
$js_true_db = '\' + document.querywindow.db.value + \'';
|
||||||
|
$js_true_table = '\' + document.querywindow.table.value + \'';
|
||||||
|
$js_true_server = '\' + document.querywindow.server.value + \'';
|
||||||
|
|
||||||
|
$js_parent = '\' + opener.location.href + \'';
|
||||||
|
$js_frame = '\' + opener.parent.location.href + \'';
|
||||||
|
?>
|
||||||
|
function debug() {
|
||||||
|
alert('<?php echo sprintf($strQueryFrameDebugBox, $js_db, $js_table, $js_server, $js_true_db, $js_true_table, $js_true_server, $js_parent, $js_frame); ?>');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
function query_auto_commit() {
|
||||||
|
document.sqlform.submit();
|
||||||
|
}
|
||||||
|
|
||||||
|
// js form validation stuff
|
||||||
|
var errorMsg0 = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strFormEmpty']); ?>';
|
||||||
|
var errorMsg1 = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strNotNumber']); ?>';
|
||||||
|
var errorMsg2 = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strNotValidNumber']); ?>';
|
||||||
|
var noDropDbMsg = '<?php echo((!$GLOBALS['cfg']['AllowUserDropDatabase']) ? str_replace('\'', '\\\'', $GLOBALS['strNoDropDatabases']) : ''); ?>';
|
||||||
|
var confirmMsg = '<?php echo(($GLOBALS['cfg']['Confirm']) ? str_replace('\'', '\\\'', $GLOBALS['strDoYouReally']) : ''); ?>';
|
||||||
|
//-->
|
||||||
|
</script>
|
||||||
|
<script src="libraries/functions.js" type="text/javascript" language="javascript"></script>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body bgcolor="<?php echo ($cfg['QueryFrameJS'] ? $cfg['LeftBgColor'] : $cfg['RightBgColor']); ?>">
|
||||||
|
|
||||||
|
<?php
|
||||||
|
// Hidden forms and query frame interaction stuff
|
||||||
|
if ($cfg['QueryFrame'] && $cfg['QueryFrameJS']) {
|
||||||
|
|
||||||
|
$input_query_history = array();
|
||||||
|
$sql_history = array();
|
||||||
|
$dup_sql = array();
|
||||||
|
|
||||||
|
if (isset($query_history_latest) && isset($query_history_latest_db) && $query_history_latest != '' && $query_history_latest_db != '') {
|
||||||
|
$input_query_history[] = '<input type="hidden" name="query_history[]" value="' . $query_history_latest . '" />';
|
||||||
|
$input_query_history[] = '<input type="hidden" name="query_history_db[]" value="' . htmlspecialchars($query_history_latest_db) . '" />';
|
||||||
|
$input_query_history[] = '<input type="hidden" name="query_history_table[]" value="' . (isset($query_history_latest_table) ? htmlspecialchars($query_history_latest_table) : '') . '" />';
|
||||||
|
|
||||||
|
$sql_history[] = '<li><a href="#" onClick="document.querywindow.query_history_latest.value = \'' . htmlspecialchars($query_history_latest) . '\'; document.querywindow.auto_commit.value = \'true\'; document.querywindow.db.value = \'' . htmlspecialchars($query_history_latest_db) . '\'; document.querywindow.query_history_latest_db.value = \'' . htmlspecialchars($query_history_latest_db) . '\'; document.querywindow.table.value = \'' . (isset($query_history_latest_table) ? htmlspecialchars($query_history_latest_table) : '') . '\'; document.querywindow.query_history_latest_table.value = \'' . (isset($query_history_latest_table) ? htmlspecialchars($query_history_latest_table) : '') . '\'; document.querywindow.submit(); return false;">[' . htmlspecialchars($query_history_latest_db) . '] ' . urldecode($query_history_latest) . '</a></li>' . "\n";
|
||||||
|
|
||||||
|
$sql_query = urldecode($query_history_latest);
|
||||||
|
$db = $query_history_latest_db;
|
||||||
|
$table = $query_history_latest_table;
|
||||||
|
$show_query = 1;
|
||||||
|
$dup_sql[$query_history_latest] = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($query_history) && is_array($query_history)) {
|
||||||
|
$current_index = count($query_history);
|
||||||
|
@reset($query_history);
|
||||||
|
while(list($query_no, $query_sql) = each($query_history)) {
|
||||||
|
if (!isset($dup_sql[$query_sql])) {
|
||||||
|
|
||||||
|
$input_query_history[] = '<input type="hidden" name="query_history[]" value="' . $query_sql . '" />';
|
||||||
|
$input_query_history[] = '<input type="hidden" name="query_history_db[]" value="' . htmlspecialchars($query_history_db[$query_no]) . '" />';
|
||||||
|
$input_query_history[] = '<input type="hidden" name="query_history_table[]" value="' . (isset($query_history_table[$query_no]) ? htmlspecialchars($query_history_table[$query_no]) : '') . '" />';
|
||||||
|
|
||||||
|
$sql_history[] = '<li><a href="#" onClick="document.querywindow.query_history_latest.value = \'' . $query_sql . '\'; document.querywindow.auto_commit.value = \'true\'; document.querywindow.db.value = \'' . htmlspecialchars($query_history_db[$query_no]) . '\'; document.querywindow.query_history_latest_db.value = \'' . htmlspecialchars($query_history_db[$query_no]) . '\'; document.querywindow.table.value = \'' . (isset($query_history_table[$query_no]) ? htmlspecialchars($query_history_table[$query_no]) : '') . '\'; document.querywindow.query_history_latest_table.value = \'' . (isset($query_history_table[$query_no]) ? htmlspecialchars($query_history_table[$query_no]) : '') . '\'; document.querywindow.submit(); return false;">[' . htmlspecialchars($query_history_db[$query_no]) . '] ' . urldecode($query_sql) . '</a></li>' . "\n";
|
||||||
|
$dup_sql[$query_sql] = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$url_query = PMA_generate_common_url(isset($db) ? $db : '', isset($table) ? $table : '');
|
||||||
|
if (!isset($goto)) {
|
||||||
|
$goto = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
require './libraries/bookmark.lib.php3';
|
||||||
|
require './tbl_query_box.php3';
|
||||||
|
|
||||||
|
// Hidden forms and query frame interaction stuff
|
||||||
|
if ($cfg['QueryFrame'] && $cfg['QueryFrameJS']) {
|
||||||
|
if (isset($auto_commit) && $auto_commit == 'true') {
|
||||||
|
?>
|
||||||
|
<script type="text/javascript" language="javascript">
|
||||||
|
query_auto_commit();
|
||||||
|
</script>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($sql_history) && is_array($sql_history) && count($sql_history) > 0) {
|
||||||
|
?>
|
||||||
|
<li>
|
||||||
|
<div style="margin-bottom: 10px"><?php echo $strQuerySQLHistory . ' :<br><ul>' . implode('', $sql_history) . '</ul>'; ?></div>
|
||||||
|
</li>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<form action="querywindow.php3" method="post" name="querywindow">
|
||||||
|
<?php
|
||||||
|
echo PMA_generate_common_hidden_inputs('', '');
|
||||||
|
if (count($input_query_history) > 0) {
|
||||||
|
echo implode("\n", $input_query_history);
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<input type="hidden" name="db" value="<?php (isset($db) && $db != '' ? $db : ''); ?>" />
|
||||||
|
<input type="hidden" name="table" value="<?php (isset($table) && $table != '' ? $table : ''); ?>" />
|
||||||
|
|
||||||
|
<input type="hidden" name="query_history_latest" value="" />
|
||||||
|
<input type="hidden" name="query_history_latest_db" value="" />
|
||||||
|
<input type="hidden" name="query_history_latest_table" value="" />
|
||||||
|
|
||||||
|
<input type="hidden" name="previous_db" value="<?php echo htmlspecialchars($db); ?>" />
|
||||||
|
|
||||||
|
<input type="hidden" name="auto_commit" value="false" />
|
||||||
|
</form>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
|
||||||
|
/* REMOVE ME */
|
||||||
|
if ($cfg['QueryFrame'] && $cfg['QueryFrameJS'] && $cfg['QueryFrameDebug']) {
|
||||||
|
?>
|
||||||
|
<br>
|
||||||
|
<center>
|
||||||
|
<a href='#' onClick='return debug();'><?php echo $strQueryFrameDebug; ?></a>
|
||||||
|
</center>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
/* REMOVE ME */
|
||||||
|
?>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Close MySql connections
|
||||||
|
*/
|
||||||
|
if (isset($dbh) && $dbh) {
|
||||||
|
@mysql_close($dbh);
|
||||||
|
}
|
||||||
|
if (isset($userlink) && $userlink) {
|
||||||
|
@mysql_close($userlink);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sends bufferized data
|
||||||
|
*/
|
||||||
|
if (isset($cfg['OBGzip']) && $cfg['OBGzip']
|
||||||
|
&& isset($ob_mode) && $ob_mode) {
|
||||||
|
PMA_outBufferPost($ob_mode);
|
||||||
|
}
|
||||||
|
?>
|
@@ -23,10 +23,11 @@ if (isset($show_query) && $show_query == '1') {
|
|||||||
}
|
}
|
||||||
unset($sql_query);
|
unset($sql_query);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the list and number of fields
|
* Get the list and number of fields
|
||||||
*/
|
*/
|
||||||
|
$fields_cnt = 0;
|
||||||
|
if (isset($db) && isset($table) && $table != '' && $db != '') {
|
||||||
$local_query = 'SHOW FIELDS FROM ' . PMA_backquote($table) . ' FROM ' . PMA_backquote($db);
|
$local_query = 'SHOW FIELDS FROM ' . PMA_backquote($table) . ' FROM ' . PMA_backquote($db);
|
||||||
$result = @PMA_mysql_query($local_query);
|
$result = @PMA_mysql_query($local_query);
|
||||||
if (!$result) {
|
if (!$result) {
|
||||||
@@ -39,7 +40,7 @@ else {
|
|||||||
} // end while
|
} // end while
|
||||||
mysql_free_result($result);
|
mysql_free_result($result);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Work on the table
|
* Work on the table
|
||||||
@@ -53,11 +54,37 @@ $auto_sel = ($cfg['TextareaAutoSelect']
|
|||||||
&& !(PMA_USR_OS == 'Win' && PMA_USR_BROWSER_AGENT == 'OPERA' && PMA_USR_BROWSER_VER >= 7))
|
&& !(PMA_USR_OS == 'Win' && PMA_USR_BROWSER_AGENT == 'OPERA' && PMA_USR_BROWSER_VER >= 7))
|
||||||
? "\n" . ' onfocus="if (typeof(document.layers) == \'undefined\' || typeof(textarea_selected) == \'undefined\') {textarea_selected = 1; this.form.elements[\'sql_query\'].select();}"'
|
? "\n" . ' onfocus="if (typeof(document.layers) == \'undefined\' || typeof(textarea_selected) == \'undefined\') {textarea_selected = 1; this.form.elements[\'sql_query\'].select();}"'
|
||||||
: '';
|
: '';
|
||||||
|
|
||||||
|
// garvin: If non-JS query window is embedded, display a list of databases to choose from.
|
||||||
|
// Apart from that, a non-js query window sucks badly.
|
||||||
|
|
||||||
|
if ($cfg['QueryFrame'] && (!$cfg['QueryFrameJS'] || ($cfg['QueryFrameJS'] && !$db))) {
|
||||||
|
/**
|
||||||
|
* Get the list and number of available databases.
|
||||||
|
*/
|
||||||
|
if ($server > 0) {
|
||||||
|
PMA_availableDatabases(); // this function is defined in "common.lib.php3"
|
||||||
|
} else {
|
||||||
|
$num_dbs = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($num_dbs > 0) {
|
||||||
|
$queryframe_db_list = '<select size=1 name="db">';
|
||||||
|
for ($i = 0; $i < $num_dbs; $i++) {
|
||||||
|
$t_db = $dblist[$i];
|
||||||
|
$queryframe_db_list .= '<option value="' . htmlspecialchars($t_db) . '">' . htmlspecialchars($t_db) . '</option>';
|
||||||
|
}
|
||||||
|
$queryframe_db_list .= '</select>';
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$queryframe_db_list = '';
|
||||||
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<!-- Query box and bookmark support -->
|
<!-- Query box and bookmark support -->
|
||||||
<li>
|
<li>
|
||||||
<a name="querybox"></a>
|
<a name="querybox"></a>
|
||||||
<form method="post" action="read_dump.php3"<?php if ($is_upload) echo ' enctype="multipart/form-data"'; echo "\n"; ?>
|
<form method="post" target="phpmain" action="read_dump.php3"<?php if ($is_upload) echo ' enctype="multipart/form-data"'; echo "\n"; ?>
|
||||||
onsubmit="return checkSqlQuery(this)" name="sqlform">
|
onsubmit="return checkSqlQuery(this)" name="sqlform">
|
||||||
<input type="hidden" name="is_js_confirmed" value="0" />
|
<input type="hidden" name="is_js_confirmed" value="0" />
|
||||||
<?php echo PMA_generate_common_hidden_inputs($db, $table); ?>
|
<?php echo PMA_generate_common_hidden_inputs($db, $table); ?>
|
||||||
@@ -65,7 +92,7 @@ $auto_sel = ($cfg['TextareaAutoSelect']
|
|||||||
<input type="hidden" name="goto" value="<?php echo $goto; ?>" />
|
<input type="hidden" name="goto" value="<?php echo $goto; ?>" />
|
||||||
<input type="hidden" name="zero_rows" value="<?php echo $strSuccess; ?>" />
|
<input type="hidden" name="zero_rows" value="<?php echo $strSuccess; ?>" />
|
||||||
<input type="hidden" name="prev_sql_query" value="<?php echo ((!empty($query_to_display)) ? urlencode($query_to_display) : ''); ?>" />
|
<input type="hidden" name="prev_sql_query" value="<?php echo ((!empty($query_to_display)) ? urlencode($query_to_display) : ''); ?>" />
|
||||||
<?php echo sprintf($strRunSQLQuery, htmlspecialchars($db)) . ' ' . PMA_showMySQLDocu('Reference', 'SELECT') . ' ' . $strFields . ':' . "\n"; ?>
|
<?php echo sprintf($strRunSQLQuery, htmlspecialchars($db)) . $queryframe_db_list . ' ' . PMA_showMySQLDocu('Reference', 'SELECT') . ' ' . $strFields . ':' . "\n"; ?>
|
||||||
<select name="dummy" size="1">
|
<select name="dummy" size="1">
|
||||||
<?php
|
<?php
|
||||||
echo "\n";
|
echo "\n";
|
||||||
@@ -163,7 +190,7 @@ if ($cfg['Bookmark']['db'] && $cfg['Bookmark']['table']) {
|
|||||||
|
|
||||||
<?php
|
<?php
|
||||||
// loic1: displays import dump feature only if file upload available
|
// loic1: displays import dump feature only if file upload available
|
||||||
if ($is_upload) {
|
if ($is_upload && isset($db) && isset($table)) {
|
||||||
?>
|
?>
|
||||||
<!-- Insert a text file -->
|
<!-- Insert a text file -->
|
||||||
<li>
|
<li>
|
||||||
|
Reference in New Issue
Block a user