moved all code for queryboxes into libraries/sql_query_form.lib.php, replaced table with fieldsets, moved styles into css, minor interface changes related to queryboxes
This commit is contained in:
@@ -5,6 +5,13 @@ phpMyAdmin - Changelog
|
||||
$Id$
|
||||
$Source$
|
||||
|
||||
2005-09-26 Sebastian Mendel <cybot_tm@users.sourceforge.net>
|
||||
* libraries/sql_query_form.lib.php, db_details.php, server_sql.php
|
||||
tbl_properties.php, tbl_properties_structure.php, sql.php,
|
||||
querywindow.php, read_dump.php: moved all code for queryboxes into
|
||||
libraries/sql_query_form.lib.php, replaced table with fieldsets, moved
|
||||
styles into css, minor interface changes related to queryboxes
|
||||
|
||||
2005-09-27 Michal Čihař <michal@cihar.com>
|
||||
* lang/czech: Update.
|
||||
* server_status.php, lang/*: Separate some new information on MySQL 5.
|
||||
|
@@ -89,10 +89,80 @@ body#bodyquerywindow {
|
||||
|
||||
div#querywindowcontainer {
|
||||
margin: 0;
|
||||
padding: 0.5em;
|
||||
float: left;
|
||||
padding: 0;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
div#querywindowcontainer fieldset {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
|
||||
/* querybox */
|
||||
|
||||
/* Gecko bug */
|
||||
div[id=queryfieldscontainer] {
|
||||
border: 1px solid transparent;
|
||||
}
|
||||
|
||||
|
||||
div#sqlquerycontainer {
|
||||
float: left;
|
||||
width: 69%;
|
||||
/* height: 15em; */
|
||||
}
|
||||
|
||||
div#tablefieldscontainer {
|
||||
float: right;
|
||||
width: 29%;
|
||||
/* height: 15em; */
|
||||
}
|
||||
|
||||
div#tablefieldscontainer select {
|
||||
width: 100%;
|
||||
/* height: 12em; */
|
||||
}
|
||||
|
||||
textarea#sqlquery {
|
||||
width: 100%;
|
||||
/* height: 100%; */
|
||||
}
|
||||
|
||||
div#queryboxcontainer div#bookmarkoptions {
|
||||
margin-top: 0.5em;
|
||||
}
|
||||
|
||||
fieldset .formelement {
|
||||
line-height: 2.3em;
|
||||
float: left;
|
||||
margin-right: 0.5em;
|
||||
/* IE */
|
||||
white-space: nowrap;
|
||||
}
|
||||
/* revert for Gecko */
|
||||
fieldset div[class=formelement] {
|
||||
white-space: normal;
|
||||
}
|
||||
|
||||
/* IE */
|
||||
fieldset .formelement input,
|
||||
fieldset .formelement select {
|
||||
margin-top: 0.5em;
|
||||
margin-bottom: 0.5em;
|
||||
height: 1.3em;
|
||||
}
|
||||
/* revert for Gecko */
|
||||
fieldset div[class=formelement] input,
|
||||
fieldset div[class=formelement] select {
|
||||
margin-top: auto;
|
||||
margin-bottom: auto;
|
||||
height: auto;
|
||||
}
|
||||
|
||||
|
||||
/* end querybox */
|
||||
|
||||
|
||||
/* Calendar */
|
||||
table.calendar { width: 100%; }
|
||||
table.calendar td { text-align: center; }
|
||||
@@ -115,10 +185,10 @@ form.clock { text-align: center; }
|
||||
/* end Calendar */
|
||||
|
||||
/* Options, eg. on import page */
|
||||
fieldset.options {
|
||||
fieldset {
|
||||
background-color: <?php echo $cfg['BgcolorOne']; ?>;
|
||||
}
|
||||
fieldset.options legend {
|
||||
fieldset legend {
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
|
244
db_details.php
244
db_details.php
@@ -7,253 +7,27 @@
|
||||
* Runs common work
|
||||
*/
|
||||
require('./db_details_common.php');
|
||||
$url_query .= '&goto=db_details.php';
|
||||
|
||||
|
||||
/**
|
||||
* Database work
|
||||
*/
|
||||
if (isset($show_query) && $show_query == '1') {
|
||||
// This script has been called by read_dump.php
|
||||
if (isset($sql_query_cpy)) {
|
||||
$query_to_display = $sql_query_cpy;
|
||||
}
|
||||
// Other cases
|
||||
else {
|
||||
$query_to_display = $sql_query;
|
||||
}
|
||||
} else {
|
||||
$query_to_display = '';
|
||||
}
|
||||
|
||||
require_once './libraries/sql_query_form.lib.php';
|
||||
|
||||
/**
|
||||
* Gets informations about the database and, if it is empty, move to the
|
||||
* "db_details_structure.php" script where table can be created
|
||||
*/
|
||||
$sub_part = '';
|
||||
require('./db_details_db_info.php');
|
||||
if ($num_tables == 0 && empty($db_query_force)) {
|
||||
if ( $num_tables == 0 && empty( $db_query_force ) ) {
|
||||
$sub_part = '';
|
||||
$is_info = TRUE;
|
||||
require('./db_details_structure.php');
|
||||
require './db_details_structure.php';
|
||||
exit();
|
||||
}
|
||||
|
||||
// loic1: defines wether file upload is available or not
|
||||
// (now defined in common.lib.php)
|
||||
/**
|
||||
* Query box, bookmark, insert data from textfile
|
||||
*/
|
||||
PMA_sqlQueryForm();
|
||||
|
||||
$auto_sel = ($cfg['TextareaAutoSelect']
|
||||
// 2003-02-05 rabus: This causes big trouble with Opera 7 for
|
||||
// Windows, so let's disable it there...
|
||||
&& !(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();}"'
|
||||
: '';
|
||||
|
||||
|
||||
// for better administration
|
||||
$strHiddenFields = ' <input type="hidden" name="is_js_confirmed" value="0" />' ."\n"
|
||||
. ' ' .PMA_generate_common_hidden_inputs($db) . "\n"
|
||||
. ' <input type="hidden" name="pos" value="0" />' . "\n"
|
||||
. ' <input type="hidden" name="goto" value="db_details.php" />' . "\n"
|
||||
. ' <input type="hidden" name="zero_rows" value="' . htmlspecialchars($strSuccess) . '" />' . "\n"
|
||||
. ' <input type="hidden" name="prev_sql_query" value="' . ((!empty($query_to_display)) ? htmlspecialchars($query_to_display) : '') . '" />' . "\n";
|
||||
?>
|
||||
<!-- Query box, sql file loader and bookmark support -->
|
||||
<form method="post" action="read_dump.php"<?php if ($is_upload) echo ' enctype="multipart/form-data"'; ?> onsubmit="return checkSqlQuery(this)" name="sqlform">
|
||||
<?php
|
||||
echo $strHiddenFields;
|
||||
?>
|
||||
<a name="querybox"></a>
|
||||
<table border="0" cellpadding="2" cellspacing="0">
|
||||
<tr><td class="tblHeaders" colspan="2">
|
||||
<?php
|
||||
// if you want navigation:
|
||||
$strDBLink = '<a href="' . $GLOBALS['cfg']['DefaultTabDatabase'] . '?' . PMA_generate_common_url() . '&db=' . urlencode($db) . '">'
|
||||
. htmlspecialchars($db) . '</a>';
|
||||
// else use
|
||||
// $strDBLink = htmlspecialchars($db);
|
||||
echo ' ' . sprintf($strRunSQLQuery, $strDBLink) . ': ' . PMA_showMySQLDocu('Reference', 'SELECT');
|
||||
|
||||
?>
|
||||
</td></tr>
|
||||
<tr align="center" bgcolor="<?php echo $cfg['BgcolorOne']; ?>"><td colspan="2">
|
||||
<textarea name="sql_query" cols="<?php echo $cfg['TextareaCols'] * 2; ?>" rows="<?php echo $cfg['TextareaRows']; ?>" dir="<?php echo $text_dir; ?>"<?php echo $auto_sel; ?>>
|
||||
<?php
|
||||
if (!empty($query_to_display)) {
|
||||
echo htmlspecialchars($query_to_display);
|
||||
} else {
|
||||
echo htmlspecialchars(str_replace('%d', PMA_backquote($db), $cfg['DefaultQueryDatabase']));
|
||||
}
|
||||
?></textarea>
|
||||
</td></tr>
|
||||
<tr class="tblFooters">
|
||||
<td>
|
||||
<input type="checkbox" name="show_query" value="1" id="checkbox_show_query" checked="checked" /><label for="checkbox_show_query"><?php echo $strShowThisQuery; ?></label>
|
||||
</td>
|
||||
<td align="right"><input type="submit" name="SQL" value="<?php echo $strGo; ?>" /></td>
|
||||
</tr>
|
||||
<?php
|
||||
// loic1: displays import dump feature only if file upload available
|
||||
if ($is_upload) {
|
||||
?>
|
||||
<tr><td colspan="2"><img src="<?php echo $GLOBALS['pmaThemeImage'] . 'spacer.png'; ?>" width="1" height="1" border="0" alt="" /></td></tr>
|
||||
<tr>
|
||||
<td colspan="2" class="tblHeaders">
|
||||
<i><?php echo $strOr; ?></i>
|
||||
<b><?php echo $strLocationTextfile; ?>:</b>
|
||||
</td>
|
||||
</tr>
|
||||
<tr bgcolor="<?php echo $cfg['BgcolorOne']; ?>">
|
||||
<td colspan="2" align="center">
|
||||
<input type="file" name="sql_file" class="textfield" />
|
||||
<?php
|
||||
echo PMA_displayMaximumUploadSize($max_upload_size) . '<br />';
|
||||
// some browsers should respect this :)
|
||||
echo ' ' . PMA_generateHiddenMaxFileSize($max_upload_size) . "\n";
|
||||
$is_gzip = ($cfg['GZipDump'] && @function_exists('gzopen'));
|
||||
$is_bzip = ($cfg['BZipDump'] && @function_exists('bzdecompress'));
|
||||
if ($is_bzip || $is_gzip) {
|
||||
echo ' </td>' . "\n"
|
||||
. '</tr>' . "\n"
|
||||
. '<tr bgcolor="' . $cfg['BgcolorOne'] . '">' . "\n"
|
||||
. ' <td colspan="2">' . "\n";
|
||||
echo ' ' . $strCompression . ':<br /> ' . "\n"
|
||||
. ' <input type="radio" id="radio_sql_file_compression_auto" name="sql_file_compression" value="" checked="checked" /><label for="radio_sql_file_compression_auto">' . $strAutodetect . '</label> ' . "\n"
|
||||
. ' <input type="radio" id="radio_sql_file_compression_plain" name="sql_file_compression" value="text/plain" /><label for="radio_sql_file_compression_plain">' . $strNone . '</label>  ' . "\n";
|
||||
if ($is_gzip) {
|
||||
echo ' <input type="radio" id="radio_sql_file_compression_gzip" name="sql_file_compression" value="application/x-gzip" /><label for="radio_sql_file_compression_gzip">' . $strGzip . '</label> ' . "\n";
|
||||
}
|
||||
if ($is_bzip) {
|
||||
echo ' <input type="radio" id="radio_sql_file_compression_bzip" name="sql_file_compression" value="application/x-bzip" /><label for="radio_sql_file_compression_bzip">' . $strBzip . '</label> ' . "\n";
|
||||
}
|
||||
} else {
|
||||
?>
|
||||
<input type="hidden" name="sql_file_compression" value="text/plain" />
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
} // end if (is upload)
|
||||
// web-server upload directory
|
||||
$is_upload_dir = false;
|
||||
if (!empty($cfg['UploadDir'])) {
|
||||
if (substr($cfg['UploadDir'], -1) != '/') {
|
||||
$cfg['UploadDir'] .= '/';
|
||||
}
|
||||
if ($handle = @opendir($cfg['UploadDir'])) {
|
||||
$is_first = 0;
|
||||
while ($file = @readdir($handle)) {
|
||||
if (is_file($cfg['UploadDir'] . $file) && PMA_checkFileExtensions($file, '.sql')) {
|
||||
if ($is_first == 0) {
|
||||
$is_upload_dir = true;
|
||||
echo "\n";
|
||||
echo ' <tr><td colspan=2" bgcolor="' . $cfg['BgcolorTwo'] . '">' . "\n";
|
||||
echo ' <b>' . $strWebServerUploadDirectory . ':</b> ' . "\n";
|
||||
echo ' </td></tr>' . "\n";
|
||||
echo ' <tr bgcolor="' . $cfg['BgcolorOne'] . '"><td colspan="2">' . "\n";
|
||||
// add 2004-05-08 by mkkeck
|
||||
// todo: building a php script for indexing files in UploadDir
|
||||
//if ($cfg['UploadDirIndex']) {
|
||||
// echo ' <a href="' . $cfg['UploadDir'] . '" target="_blank">' . $cfg['UploadDir'] . '</a> ';
|
||||
//}
|
||||
// end indexing
|
||||
echo ' <select size="1" name="sql_localfile">' . "\n";
|
||||
echo ' <option value="" selected="selected"></option>' . "\n";
|
||||
} // end if (is_first)
|
||||
echo ' <option value="' . htmlspecialchars($file) . '">' . htmlspecialchars($file) . '</option>' . "\n";
|
||||
$is_first++;
|
||||
} // end if (is_file)
|
||||
} // end while
|
||||
if ($is_first > 0) {
|
||||
echo ' </select>' . "\n"
|
||||
. ' </td>'
|
||||
. ' </tr>' . "\n\n";
|
||||
} // end if (isfirst > 0)
|
||||
@closedir($handle);
|
||||
}
|
||||
else {
|
||||
$upload_dir_error = '<tr><td colspan="2"><img src="' .$GLOBALS['pmaThemeImage'] . 'spacer.png' . '" width="1" height="1" border="0" alt="" /></td></tr>' . "\n"
|
||||
. '<tr><th colspan="2" class="tblHeadError"><div class="errorhead">' . $strError . '</div></th></tr>' . "\n"
|
||||
. '<tr><td colspan="2" class="tblError">' . $strWebServerUploadDirectoryError
|
||||
. '</td></tr>' . "\n";
|
||||
}
|
||||
} // end if (web-server upload directory)
|
||||
// Charset conversion options
|
||||
if ($is_upload || $is_upload_dir) {
|
||||
echo ' <tr class="tblFooters"><td>' . "\n";
|
||||
if (PMA_MYSQL_INT_VERSION < 40100 && $cfg['AllowAnywhereRecoding'] && $allow_recoding) {
|
||||
$temp_charset = reset($cfg['AvailableCharsets']);
|
||||
echo ' ' . $strCharsetOfFile . "\n"
|
||||
. ' <select name="charset_of_file" size="1">' . "\n"
|
||||
. ' <option value="' . $temp_charset . '"';
|
||||
if ($temp_charset == $charset) {
|
||||
echo ' selected="selected"';
|
||||
}
|
||||
echo '>' . $temp_charset . '</option>' . "\n";
|
||||
while ($temp_charset = next($cfg['AvailableCharsets'])) {
|
||||
echo ' <option value="' . $temp_charset . '"';
|
||||
if ($temp_charset == $charset) {
|
||||
echo ' selected="selected"';
|
||||
}
|
||||
echo '>' . $temp_charset . '</option>' . "\n";
|
||||
}
|
||||
echo ' </select><br />' . "\n" . ' ';
|
||||
} elseif (PMA_MYSQL_INT_VERSION >= 40100) {
|
||||
echo $strCharsetOfFile . "\n";
|
||||
echo PMA_generateCharsetDropdownBox(PMA_CSDROPDOWN_CHARSET, 'charset_of_file', NULL, 'utf8', FALSE);
|
||||
} // end if (recoding)
|
||||
echo ' </td>' . "\n";
|
||||
echo ' <td align="right"><input type="submit" name="SQL" value="' . $strGo . '" /></td>' . "\n";
|
||||
echo ' </tr>' . "\n";
|
||||
}
|
||||
// Bookmark Support
|
||||
if ($cfg['Bookmark']['db'] && $cfg['Bookmark']['table']) {
|
||||
if (($bookmark_list = PMA_listBookmarks($db, $cfg['Bookmark'])) && count($bookmark_list) > 0) {
|
||||
echo ' <tr><td colspan="2"><img src="' .$GLOBALS['pmaThemeImage'] . 'spacer.png' . '" width="1" height="1" border="0" alt="" /></td></tr>' . "\n";
|
||||
echo ' <tr><td colspan="2" class="tblHeaders"> <i>' . $strOr . '</i></td></tr>' . "\n";
|
||||
echo ' <tr bgcolor="' . $cfg['BgcolorOne'] . '"><td colspan="2">' . "\n";
|
||||
echo ' <b>' . $strBookmarkQuery . ':</b> ' . "\n";
|
||||
echo ' <select name="id_bookmark">' . "\n";
|
||||
echo ' <option value=""></option>' . "\n";
|
||||
foreach ($bookmark_list AS $key => $value) {
|
||||
echo ' <option value="' . htmlspecialchars($key) . '">' . htmlspecialchars($value) . '</option>' . "\n";
|
||||
}
|
||||
echo ' </select>' . "\n";
|
||||
echo ' </td></tr><tr bgcolor="' . $cfg['BgcolorOne'] . '"><td colspan="2">';
|
||||
echo ' ' . $strVar . ' ';
|
||||
if ($cfg['ReplaceHelpImg']){
|
||||
echo '<a href="./Documentation.html#faqbookmark" target="documentation">'
|
||||
. '<img src="' .$pmaThemeImage . 'b_help.png" border="0" width="11" height="11" align="middle" alt="' . $strDocu . '" /></a>';
|
||||
}else{
|
||||
echo '(<a href="./Documentation.html#faqbookmark" target="documentation">' . $strDocu . '</a>): ';
|
||||
}
|
||||
echo ' <input type="text" name="bookmark_variable" class="textfield" size="10" />' . "\n";
|
||||
echo ' </td></tr><tr bgcolor="' . $cfg['BgcolorOne'] . '"><td>';
|
||||
echo ' <input type="radio" name="action_bookmark" value="0" id="radio_bookmark0" checked="checked" style="vertical-align: middle" /><label for="radio_bookmark0">' . $strSubmit . '</label>' . "\n";
|
||||
echo ' <input type="radio" name="action_bookmark" value="1" id="radio_bookmark1" style="vertical-align: middle" /><label for="radio_bookmark1">' . $strBookmarkView . '</label>' . "\n";
|
||||
echo ' <input type="radio" name="action_bookmark" value="2" id="radio_bookmark2" style="vertical-align: middle" /><label for="radio_bookmark2">' . $strDelete . '</label>' . "\n";
|
||||
echo ' </td>' . "\n";
|
||||
echo ' <td align="right"><input type="submit" name="SQL" value="' . $strGo . '" /></td>';
|
||||
echo ' </tr>' . "\n";
|
||||
}
|
||||
}
|
||||
|
||||
// Encoding setting form appended by Y.Kawada
|
||||
if (function_exists('PMA_set_enc_form')) {
|
||||
echo PMA_set_enc_form(' ');
|
||||
}
|
||||
// modified by mkkeck 2004-05-08
|
||||
// showing UploadDir Error at the end of all option for SQL-Queries
|
||||
if (isset($upload_dir_error)) {
|
||||
echo $upload_dir_error;
|
||||
}
|
||||
?>
|
||||
</table>
|
||||
</form>
|
||||
<?php
|
||||
/**
|
||||
* Displays the footer
|
||||
*/
|
||||
echo "\n";
|
||||
require_once('./footer.inc.php');
|
||||
require_once './footer.inc.php';
|
||||
?>
|
||||
|
515
libraries/sql_query_form.lib.php
Normal file
515
libraries/sql_query_form.lib.php
Normal file
@@ -0,0 +1,515 @@
|
||||
<?php
|
||||
/* $Id */
|
||||
// vim: expandtab sw=4 ts=4 sts=4:
|
||||
/**
|
||||
* functions for displaying the sql query form
|
||||
*/
|
||||
|
||||
/**
|
||||
* @uses $GLOBALS['table']
|
||||
* @uses $GLOBALS['db']
|
||||
* @uses $GLOBALS['server']
|
||||
* @uses $GLOBALS['goto']
|
||||
* @uses $GLOBALS['is_upload'] from common.lib.php
|
||||
* @uses $GLOBALS['sql_query'] from grab_globals.lib.php
|
||||
* @uses $GLOBALS['cfg']['DefaultQueryTable']
|
||||
* @uses $GLOBALS['cfg']['DefaultQueryDatabase']
|
||||
* @uses $GLOBALS['cfg']['QueryFrame']
|
||||
* @uses $GLOBALS['cfg']['QueryFrameJS']
|
||||
* @uses $GLOBALS['cfg']['Servers']
|
||||
* @uses $GLOBALS['cfg']['DefaultTabDatabase']
|
||||
* @uses $GLOBALS['cfg']['DefaultQueryDatabase']
|
||||
* @uses $GLOBALS['cfg']['DefaultQueryTable']
|
||||
* @uses $GLOBALS['cfg']['Bookmark']['db']
|
||||
* @uses $GLOBALS['cfg']['Bookmark']['table']
|
||||
* @uses $GLOBALS['strSuccess']
|
||||
* @uses PMA_generate_common_url()
|
||||
* @uses PMA_backquote()
|
||||
* @uses PMA_DBI_fetch_result()
|
||||
* @uses PMA_showMySQLDocu()
|
||||
* @uses PMA_generate_common_hidden_inputs()
|
||||
* @uses PMA_sqlQueryFormBookmark()
|
||||
* @uses PMA_sqlQueryFormInsert()
|
||||
* @uses PMA_sqlQueryFormUpload()
|
||||
* @uses PMA_DBI_QUERY_STORE
|
||||
* @uses PMA_set_enc_form()
|
||||
* @uses sprintf()
|
||||
* @uses htmlspecialchars()
|
||||
* @uses str_replace()
|
||||
* @uses md5()
|
||||
* @uses function_exists()
|
||||
* @param boolean|string $query query to display in the textarea
|
||||
* or true to display last executed
|
||||
* @param boolean|string $display_tab sql|files|history|full|FALSE
|
||||
* what part to display
|
||||
* false if not inside querywindow
|
||||
*/
|
||||
function PMA_sqlQueryForm( $query = true, $display_tab = false ) {
|
||||
// check tab to display if inside querywindow
|
||||
if ( ! $display_tab ) {
|
||||
$display_tab = 'full';
|
||||
$is_querywindow = false;
|
||||
} else {
|
||||
$is_querywindow = true;
|
||||
}
|
||||
|
||||
// query to show
|
||||
if ( true === $query ) {
|
||||
$query = empty( $GLOBALS['sql_query'] ) ? '' : $GLOBALS['sql_query'];
|
||||
}
|
||||
|
||||
// we dont need to check booth variables each time
|
||||
if ( false == $GLOBALS['cfg']['QueryFrame'] ) {
|
||||
$GLOBALS['cfg']['QueryFrameJS'] = false;
|
||||
}
|
||||
|
||||
// set enctype to multipart for file uploads
|
||||
if ( $GLOBALS['is_upload'] ) {
|
||||
$enctype = ' enctype="multipart/form-data"';
|
||||
} else {
|
||||
$enctype = '';
|
||||
}
|
||||
|
||||
$table = '';
|
||||
$db = '';
|
||||
if ( empty( $GLOBALS['db'] ) ) {
|
||||
// prepare for server related
|
||||
$goto = empty( $GLOBALS['goto'] ) ?
|
||||
'server_sql.php' : $GLOBALS['goto'];
|
||||
}
|
||||
elseif ( empty( $GLOBALS['table'] ) ) {
|
||||
// prepare for db related
|
||||
$db = $GLOBALS['db'];
|
||||
$goto = empty( $GLOBALS['goto'] ) ?
|
||||
'db_details.php' : $GLOBALS['goto'];
|
||||
} else {
|
||||
$table = $GLOBALS['table'];
|
||||
$db = $GLOBALS['db'];
|
||||
$goto = empty( $GLOBALS['goto'] ) ?
|
||||
'tbl_properties.php' : $GLOBALS['goto'];
|
||||
}
|
||||
|
||||
|
||||
// start output
|
||||
if ( $GLOBALS['cfg']['QueryFrameJS'] && $is_querywindow ) {
|
||||
?>
|
||||
<form method="post" id="sqlqueryform"
|
||||
target="phpmain<?php echo md5( $GLOBALS['cfg']['PmaAbsoluteUri'] ); ?>"
|
||||
action="read_dump.php"<?php echo $enctype; ?> name="sqlform"
|
||||
onsubmit="this.target=window.opener.parent.frames[2].name;
|
||||
return checkSqlQuery(this);" >
|
||||
<?php
|
||||
} else {
|
||||
echo '<form method="post" action="read_dump.php" ' . $enctype
|
||||
.' onsubmit="return checkSqlQuery(this)" name="sqlform">' . "\n";
|
||||
}
|
||||
|
||||
if ( $is_querywindow ) {
|
||||
echo '<input type="hidden" name="focus_querywindow" value="true" />'
|
||||
."\n";
|
||||
if ( $display_tab != 'sql' && $display_tab != 'full' ) {
|
||||
echo '<input type="hidden" name="sql_query" value="" />' . "\n";
|
||||
echo '<input type="hidden" name="show_query" value="1" />' . "\n";
|
||||
}
|
||||
}
|
||||
echo '<input type="hidden" name="is_js_confirmed" value="0" />' . "\n"
|
||||
.PMA_generate_common_hidden_inputs( $db, $table ) . "\n"
|
||||
.'<input type="hidden" name="pos" value="0" />' . "\n"
|
||||
.'<input type="hidden" name="goto" value="'
|
||||
.htmlspecialchars( $goto ) . '" />' . "\n"
|
||||
.'<input type="hidden" name="zero_rows" value="'
|
||||
. htmlspecialchars( $GLOBALS['strSuccess'] ) . '" />' . "\n"
|
||||
.'<input type="hidden" name="prev_sql_query" value="'
|
||||
. htmlspecialchars( $query ) . '" />' . "\n";
|
||||
|
||||
// display querybox
|
||||
if ( $display_tab === 'full' || $display_tab === 'sql' ) {
|
||||
PMA_sqlQueryFormInsert( $query, $is_querywindow );
|
||||
}
|
||||
|
||||
// display uploads
|
||||
if ( $display_tab === 'full' || $display_tab === 'files' ) {
|
||||
if ( $GLOBALS['is_upload'] ) {
|
||||
PMA_sqlQueryFormUpload( $display_tab );
|
||||
}
|
||||
}
|
||||
|
||||
// Bookmark Support
|
||||
if ( $display_tab === 'full' || $display_tab === 'history' ) {
|
||||
if ( ! empty( $GLOBALS['cfg']['Bookmark'] )
|
||||
&& $GLOBALS['cfg']['Bookmark']['db']
|
||||
&& $GLOBALS['cfg']['Bookmark']['table'] ) {
|
||||
PMA_sqlQueryFormBookmark( $display_tab );
|
||||
}
|
||||
}
|
||||
|
||||
// Encoding setting form appended by Y.Kawada
|
||||
if ( function_exists('PMA_set_enc_form') ) {
|
||||
echo PMA_set_enc_form(' ');
|
||||
}
|
||||
|
||||
echo '</form>' . "\n";
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param string $query query to display in the textarea
|
||||
* @uses $GLOBALS['text_dir']
|
||||
* @uses $GLOBALS['cfg']['QueryFrameJS']
|
||||
* @uses $GLOBALS['cfg']['TextareaAutoSelect']
|
||||
* @uses $GLOBALS['cfg']['TextareaCols']
|
||||
* @uses $GLOBALS['cfg']['TextareaRows']
|
||||
* @uses $GLOBALS['strShowThisQuery']
|
||||
* @uses $GLOBALS['strGo']
|
||||
* @uses PMA_availableDatabases()
|
||||
* @uses PMA_USR_OS
|
||||
* @uses PMA_USR_BROWSER_AGENT
|
||||
* @uses PMA_USR_BROWSER_VER
|
||||
* @uses PMA_availableDatabases()
|
||||
* @uses htmlspecialchars()
|
||||
*/
|
||||
function PMA_sqlQueryFormInsert( $query = '', $is_querywindow = false ) {
|
||||
|
||||
// enable auto select text in textarea
|
||||
if ( $GLOBALS['cfg']['TextareaAutoSelect'] ) {
|
||||
$auto_sel = ' onfocus="if (typeof(document.layers) == \'undefined\' || '
|
||||
.' typeof(textarea_selected) == \'undefined\') {textarea_selected '
|
||||
.'= 1; this.form.elements[\'sql_query\'].select();}"';
|
||||
} else {
|
||||
$auto_sel = '';
|
||||
}
|
||||
|
||||
// enable locking if inside query window
|
||||
if ( $GLOBALS['cfg']['QueryFrameJS'] && $is_querywindow ) {
|
||||
$locking = ' onkeypress="document.sqlform.elements[\'LockFromUpdate\'].'
|
||||
.'checked = true;"';
|
||||
} else {
|
||||
$locking = '';
|
||||
}
|
||||
|
||||
$table = '';
|
||||
$db = '';
|
||||
$fields_list = array();
|
||||
if ( empty( $GLOBALS['db'] ) ) {
|
||||
// prepare for server related
|
||||
$legend = sprintf( $GLOBALS['strRunSQLQueryOnServer'],
|
||||
htmlspecialchars(
|
||||
$GLOBALS['cfg']['Servers'][$GLOBALS['server']]['host'] ) );
|
||||
}
|
||||
elseif ( empty( $GLOBALS['table'] ) ) {
|
||||
// prepare for db related
|
||||
$db = $GLOBALS['db'];
|
||||
// if you want navigation:
|
||||
$strDBLink = '<a href="' . $GLOBALS['cfg']['DefaultTabDatabase']
|
||||
. '?' . PMA_generate_common_url( $db ) . '">'
|
||||
. htmlspecialchars( $db ) . '</a>';
|
||||
// else use
|
||||
// $strDBLink = htmlspecialchars( $db );
|
||||
$legend = sprintf( $GLOBALS['strRunSQLQuery'], $strDBLink );
|
||||
if ( empty( $query ) ) {
|
||||
$query = str_replace( '%d',
|
||||
PMA_backquote( $db ), $GLOBALS['cfg']['DefaultQueryDatabase'] );
|
||||
}
|
||||
} else {
|
||||
$table = $GLOBALS['table'];
|
||||
$db = $GLOBALS['db'];
|
||||
// Get the list and number of fields
|
||||
// we do a try_query here, because we could be in the query window,
|
||||
// trying to synchonize and the table has not yet been created
|
||||
$fields_list = PMA_DBI_fetch_result(
|
||||
'SHOW FULL COLUMNS FROM ' . PMA_backquote( $db )
|
||||
. '.' . PMA_backquote( $GLOBALS['table'] ));
|
||||
|
||||
$strDBLink = '<a href="' . $GLOBALS['cfg']['DefaultTabDatabase']
|
||||
. '?' . PMA_generate_common_url( $db ) . '">'
|
||||
. htmlspecialchars( $db ) . '</a>';
|
||||
// else use
|
||||
// $strDBLink = htmlspecialchars( $db );
|
||||
$legend = sprintf( $GLOBALS['strRunSQLQuery'], $strDBLink );
|
||||
if ( empty( $query ) && count( $fields_list ) ) {
|
||||
$query =
|
||||
str_replace( '%d', PMA_backquote( $db ),
|
||||
str_replace( '%t', PMA_backquote( $table ),
|
||||
str_replace( '%f',
|
||||
implode( ', ', PMA_backquote( $fields_list ) ),
|
||||
$GLOBALS['cfg']['DefaultQueryTable'] ) ) );
|
||||
}
|
||||
}
|
||||
$legend .= ': ' . PMA_showMySQLDocu( 'Reference', 'SELECT' );
|
||||
|
||||
if ( count( $fields_list ) ) {
|
||||
$sqlquerycontainer_id = 'sqlquerycontainer';
|
||||
} else {
|
||||
$sqlquerycontainer_id = 'sqlquerycontainerfull';
|
||||
}
|
||||
|
||||
echo '<a name="querybox"></a>' . "\n"
|
||||
.'<div id="queryboxcontainer">' . "\n"
|
||||
.'<fieldset id="querybox">' . "\n";
|
||||
echo '<legend>' . $legend . '</legend>' . "\n";
|
||||
echo '<div id="queryfieldscontainer">' . "\n";
|
||||
echo '<div id="' . $sqlquerycontainer_id . '">' . "\n"
|
||||
.'<textarea name="sql_query" id="sqlquery"'
|
||||
.' cols="' . $GLOBALS['cfg']['TextareaCols'] . '"'
|
||||
.' rows="' . $GLOBALS['cfg']['TextareaRows'] . '"'
|
||||
.' dir="' . $GLOBALS['text_dir'] . '"'
|
||||
.$auto_sel . $locking . '>' . $query . '</textarea>' . "\n";
|
||||
echo '</div>' . "\n";
|
||||
|
||||
if ( count( $fields_list ) ) {
|
||||
echo '<div id="tablefieldscontainer">' . "\n"
|
||||
.'<label>' . $GLOBALS['strFields'] . '</label>' . "\n"
|
||||
.'<select id="tablefields" name="dummy" '
|
||||
.'size="' . ($GLOBALS['cfg']['TextareaRows'] - 2) . '" '
|
||||
.'multiple="multiple" ondblclick="insertValueQuery()">' . "\n";
|
||||
foreach ( $fields_list as $field ) {
|
||||
echo '<option value="'
|
||||
.PMA_backquote( htmlspecialchars( $field['Field'] ) ) . '"';
|
||||
if ( ! empty( $field['Field'] ) ) {
|
||||
echo ' title="' . htmlspecialchars( $field['Comment'] ) . '"';
|
||||
}
|
||||
echo '>' . htmlspecialchars( $field['Field'] ) . '</option>' . "\n";
|
||||
}
|
||||
echo '</select>' . "\n"
|
||||
.'<div id="tablefieldinsertbuttoncontainer">' . "\n";
|
||||
if ( $GLOBALS['cfg']['PropertiesIconic'] ) {
|
||||
echo '<input type="button" name="insert" value="<<"'
|
||||
.' onclick="insertValueQuery()"'
|
||||
.' title="' . $GLOBALS['strInsert'] . '" />' . "\n";
|
||||
} else {
|
||||
echo '<input type="button" name="insert"'
|
||||
.' value="' . $GLOBALS['strInsert'] . '"'
|
||||
.' onclick="insertValueQuery()" />' . "\n";
|
||||
}
|
||||
echo '</div>' . "\n"
|
||||
.'</div>' . "\n";
|
||||
}
|
||||
|
||||
echo '<div class="clearfloat"></div>' . "\n";
|
||||
echo '</div>' . "\n";
|
||||
|
||||
if ( ! empty( $GLOBALS['cfg']['Bookmark'] )
|
||||
&& $GLOBALS['cfg']['Bookmark']['db']
|
||||
&& $GLOBALS['cfg']['Bookmark']['table'] ) {
|
||||
?>
|
||||
<div id="bookmarkoptions">
|
||||
<div class="formelement">
|
||||
<label for="bkm_label">
|
||||
<?php echo $GLOBALS['strBookmarkThis']; ?>:</label>
|
||||
<input type="text" name="bkm_label" id="bkm_label" value="" />
|
||||
</div>
|
||||
<div class="formelement">
|
||||
<input type="checkbox" name="bkm_all_users" id="id_bkm_all_users"
|
||||
value="true" />
|
||||
<label for="id_bkm_all_users">
|
||||
<?php echo $GLOBALS['strBookmarkAllUsers']; ?></label>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
echo '<div class="clearfloat"></div>' . "\n";
|
||||
echo '</fieldset>' . "\n"
|
||||
.'</div>' . "\n";
|
||||
|
||||
echo '<fieldset id="" class="tblFooters">' . "\n";
|
||||
echo '<div class="formelement">' . "\n";
|
||||
if ( $is_querywindow ) {
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
document.writeln(' <input type="checkbox" name="LockFromUpdate"'
|
||||
+ ' value="1" id="checkbox_lock" /> <label for="checkbox_lock">'
|
||||
+ '<?php echo $GLOBALS['strQueryWindowLock']; ?></label> ');
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
echo '</div>' . "\n";
|
||||
echo '<div class="formelement">' . "\n";
|
||||
echo '<input type="checkbox" name="show_query" value="1" '
|
||||
.'id="checkbox_show_query" checked="checked" />' . "\n"
|
||||
.'<label for="checkbox_show_query">' . $GLOBALS['strShowThisQuery']
|
||||
.'</label>' . "\n";
|
||||
echo '</div>' . "\n";
|
||||
echo '<input type="submit" name="SQL" value="' . $GLOBALS['strGo'] . '" />'
|
||||
."\n";
|
||||
echo '<div class="clearfloat"></div>' . "\n";
|
||||
echo '</fieldset>' . "\n";
|
||||
}
|
||||
|
||||
function PMA_sqlQueryFormBookmark( $display_tab = 'full' ) {
|
||||
$bookmark_list = PMA_listBookmarks(
|
||||
$GLOBALS['db'], $GLOBALS['cfg']['Bookmark'] );
|
||||
if ( count( $bookmark_list ) < 1 ) {
|
||||
return;
|
||||
}
|
||||
|
||||
echo '<fieldset>';
|
||||
echo '<legend>';
|
||||
if ( $display_tab == 'full' ) {
|
||||
echo '<em>' . $GLOBALS['strOr'] . '</em> ';
|
||||
}
|
||||
echo $GLOBALS['strBookmarkQuery'] . '</legend>' . "\n";
|
||||
echo '<div class="formelement">';
|
||||
echo '<select name="id_bookmark">' . "\n";
|
||||
echo '<option value=""></option>' . "\n";
|
||||
foreach ( $bookmark_list as $key => $value ) {
|
||||
echo '<option value="' . htmlspecialchars( $key ) . '">'
|
||||
.htmlspecialchars( $value ) . '</option>' . "\n";
|
||||
}
|
||||
// is required for correct display with styles/line height
|
||||
echo '</select> ' . "\n";
|
||||
echo '</div>' . "\n";
|
||||
echo '<div class="formelement">' . "\n";
|
||||
echo $GLOBALS['strVar'];
|
||||
if ( $GLOBALS['cfg']['ReplaceHelpImg'] ) {
|
||||
echo ' <a href="./Documentation.html#faqbookmark"'
|
||||
.' target="documentation">'
|
||||
.'<img src="' .$GLOBALS['pmaThemeImage'] . 'b_help.png"'
|
||||
.' border="0" width="11" height="11" align="middle"'
|
||||
.' alt="' . $GLOBALS['strDocu'] . '" /></a> ';
|
||||
} else {
|
||||
echo ' (<a href="./Documentation.html#faqbookmark"'
|
||||
.' target="documentation">' . $GLOBALS['strDocu'] . '</a>): ';
|
||||
}
|
||||
echo '<input type="text" name="bookmark_variable" class="textfield"'
|
||||
.' size="10" />' . "\n";
|
||||
echo '</div>' . "\n";
|
||||
echo '<div class="formelement">' . "\n";
|
||||
echo '<input type="radio" name="action_bookmark" value="0"'
|
||||
.' id="radio_bookmark_exe" checked="checked" />'
|
||||
.'<label for="radio_bookmark_exe">' . $GLOBALS['strSubmit']
|
||||
.'</label>' . "\n";
|
||||
echo '<input type="radio" name="action_bookmark" value="1"'
|
||||
.' id="radio_bookmark_view" />'
|
||||
.'<label for="radio_bookmark_view">' . $GLOBALS['strBookmarkView']
|
||||
.'</label>' . "\n";
|
||||
echo '<input type="radio" name="action_bookmark" value="2"'
|
||||
.' id="radio_bookmark_del" />'
|
||||
.'<label for="radio_bookmark_del">' . $GLOBALS['strDelete']
|
||||
.'</label>' . "\n";
|
||||
echo '</div>' . "\n";
|
||||
echo '<div class="clearfloat"></div>' . "\n";
|
||||
echo '</fieldset>' . "\n";
|
||||
|
||||
echo '<fieldset id="" class="tblFooters">' . "\n";
|
||||
echo '<input type="submit" name="SQL" value="' . $GLOBALS['strGo'] . '" />';
|
||||
echo '<div class="clearfloat"></div>' . "\n";
|
||||
echo '</fieldset>' . "\n";
|
||||
}
|
||||
|
||||
function PMA_sqlQueryFormUpload( $display_tab = 'full' ) {
|
||||
$uploaded_files = array();
|
||||
$errors = array();
|
||||
$is_gzip = ($GLOBALS['cfg']['GZipDump'] && @function_exists('gzopen'));
|
||||
$is_bzip = ($GLOBALS['cfg']['BZipDump'] && @function_exists('bzdecompress'));
|
||||
|
||||
if ( ! empty( $GLOBALS['cfg']['UploadDir'] ) ) {
|
||||
if ( substr($GLOBALS['cfg']['UploadDir'], -1) != '/' ) {
|
||||
$GLOBALS['cfg']['UploadDir'] .= '/';
|
||||
}
|
||||
if ( $handle = @opendir( $GLOBALS['cfg']['UploadDir'] ) ) {
|
||||
while ( $file = @readdir( $handle ) ) {
|
||||
if ( is_file( $GLOBALS['cfg']['UploadDir'] . $file )
|
||||
&& PMA_checkFileExtensions( $file, '.sql' ) )
|
||||
{
|
||||
$uploaded_files[] = $file;
|
||||
}
|
||||
} // end while
|
||||
@closedir( $handle );
|
||||
}
|
||||
else {
|
||||
$errors[$GLOBALS['strError']] =
|
||||
$GLOBALS['strWebServerUploadDirectoryError'];
|
||||
}
|
||||
} // end if (web-server upload directory)
|
||||
|
||||
// start output
|
||||
echo '<fieldset id="">';
|
||||
echo '<legend>';
|
||||
if ( $display_tab == 'full' ) {
|
||||
echo '<em>' . $GLOBALS['strOr'] . '</em> ';
|
||||
}
|
||||
echo $GLOBALS['strLocationTextfile'] . '</legend>';
|
||||
echo '<div class="formelement">';
|
||||
echo '<input type="file" name="sql_file" class="textfield" /> ';
|
||||
echo PMA_displayMaximumUploadSize( $GLOBALS['max_upload_size'] );
|
||||
// some browsers should respect this :)
|
||||
echo PMA_generateHiddenMaxFileSize( $GLOBALS['max_upload_size'] ) . "\n";
|
||||
echo '</div>';
|
||||
|
||||
if ( $is_bzip || $is_gzip ) {
|
||||
echo '<div class="formelement">';
|
||||
echo $GLOBALS['strCompression'] . ': ' . "\n"
|
||||
.'<input type="radio" value=""'
|
||||
.' id="radio_sql_file_compression_auto"'
|
||||
.' name="sql_file_compression" checked="checked" />'
|
||||
.'<label for="radio_sql_file_compression_auto">'
|
||||
.$GLOBALS['strAutodetect'] . '</label>' . "\n"
|
||||
.'<input type="radio" id="radio_sql_file_compression_plain"'
|
||||
.' name="sql_file_compression" value="text/plain" />'
|
||||
.'<label for="radio_sql_file_compression_plain">'
|
||||
.$GLOBALS['strNone'] . '</label>' . "\n";
|
||||
if ( $is_gzip ) {
|
||||
echo '<input type="radio" id="radio_sql_file_compression_gzip"'
|
||||
.' name="sql_file_compression" value="application/x-gzip" />'
|
||||
.'<label for="radio_sql_file_compression_gzip">'
|
||||
.$GLOBALS['strGzip'] . '</label>' . "\n";
|
||||
}
|
||||
if ( $is_bzip ) {
|
||||
echo '<input type="radio" id="radio_sql_file_compression_bzip"'
|
||||
.' name="sql_file_compression" value="application/x-bzip" />'
|
||||
.'<label for="radio_sql_file_compression_bzip">'
|
||||
.$GLOBALS['strBzip'] . '</label>' . "\n";
|
||||
}
|
||||
echo '</div>';
|
||||
} else {
|
||||
echo '<input type="hidden" name="sql_file_compression"'
|
||||
.' value="text/plain" />';
|
||||
}
|
||||
|
||||
if ( count( $uploaded_files ) > 0 ) {
|
||||
echo '<strong>' . $GLOBALS['strWebServerUploadDirectory']
|
||||
.':</strong>' . "\n";
|
||||
echo '<select size="1" name="sql_localfile">' . "\n";
|
||||
echo '<option value="" selected="selected"></option>' . "\n";
|
||||
foreach ( $uploaded_files as $file ) {
|
||||
echo '<option value="' . htmlspecialchars( $file ) . '">'
|
||||
.htmlspecialchars( $file ) . '</option>' . "\n";
|
||||
}
|
||||
echo '</select>' . "\n";
|
||||
}
|
||||
echo '<div class="clearfloat"></div>' . "\n";
|
||||
echo '</fieldset>';
|
||||
|
||||
|
||||
echo '<fieldset id="" class="tblFooters">';
|
||||
if ( PMA_MYSQL_INT_VERSION < 40100
|
||||
&& $GLOBALS['cfg']['AllowAnywhereRecoding']
|
||||
&& $GLOBALS['allow_recoding'] ) {
|
||||
echo $GLOBALS['strCharsetOfFile'] . "\n"
|
||||
. '<select name="charset_of_file" size="1">' . "\n";
|
||||
foreach( $GLOBALS['cfg']['AvailableCharsets'] as $temp_charset ) {
|
||||
echo '<option value="' . $temp_charset . '"';
|
||||
if ( $temp_charset == $GLOBALS['charset'] ) {
|
||||
echo ' selected="selected"';
|
||||
}
|
||||
echo '>' . $temp_charset . '</option>' . "\n";
|
||||
}
|
||||
echo '</select>' . "\n";
|
||||
} elseif ( PMA_MYSQL_INT_VERSION >= 40100 ) {
|
||||
echo $GLOBALS['strCharsetOfFile'] . "\n";
|
||||
echo PMA_generateCharsetDropdownBox( PMA_CSDROPDOWN_CHARSET,
|
||||
'charset_of_file', NULL, 'utf8', FALSE );
|
||||
} // end if (recoding)
|
||||
echo '<input type="submit" name="SQL" value="' . $GLOBALS['strGo']
|
||||
.'" />' . "\n";
|
||||
echo '<div class="clearfloat"></div>' . "\n";
|
||||
echo '</fieldset>';
|
||||
|
||||
foreach( $errors as $error => $message ) {
|
||||
echo '<div>' . $error . '</div>';
|
||||
echo '<div>' . $message . '</div>';
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@@ -17,6 +17,7 @@ if (!empty($db)) {
|
||||
* Gets a core script and starts output buffering work
|
||||
*/
|
||||
require_once('./libraries/common.lib.php');
|
||||
require_once './libraries/sql_query_form.lib.php';
|
||||
require_once('./libraries/ob.lib.php');
|
||||
if ($cfg['OBGzip']) {
|
||||
$ob_mode = PMA_outBufferModeGet();
|
||||
@@ -68,24 +69,29 @@ var confirmMsg = '<?php echo(($GLOBALS['cfg']['Confirm']) ? str_replace('\'', '
|
||||
/**/
|
||||
|
||||
<?php
|
||||
if ( empty( $querydisplay_tab ) || $querydisplay_tab == 'sql' ) {
|
||||
if ( empty( $querydisplay_tab ) ) {
|
||||
?>
|
||||
|
||||
function resize() {
|
||||
if( typeof( self.sizeToContent ) == 'function' ) {
|
||||
|
||||
// for Gecko
|
||||
if ( typeof( self.sizeToContent ) == 'function' ) {
|
||||
self.sizeToContent();
|
||||
self.scrollbars.visible = false;
|
||||
//self.scrollbars.visible = false;
|
||||
// give some more space ... to prevent 'fli(pp/ck)ing'
|
||||
self.resizeBy( 10, 50 );
|
||||
return;
|
||||
}
|
||||
|
||||
// for IE, Opera
|
||||
if (document.getElementById && typeof(document.getElementById('querywindowcontainer')) != 'undefined' ) {
|
||||
|
||||
// get content size
|
||||
var newWidth = document.getElementById('querywindowcontainer').offsetWidth;
|
||||
var newHeight = document.getElementById('querywindowcontainer').offsetHeight;
|
||||
|
||||
// set size to contentsize + offsetsize
|
||||
self.resizeTo( newWidth + 50, newHeight + 150 );
|
||||
// set size to contentsize
|
||||
// plus some offset for scrollbars, borders, statusbar, menus ...
|
||||
self.resizeTo( newWidth + 45, newHeight + 75 );
|
||||
}
|
||||
}
|
||||
<?php
|
||||
@@ -99,7 +105,7 @@ function resize() {
|
||||
<body id="bodyquerywindow" onload="resize();" bgcolor="<?php echo ($cfg['QueryFrameJS'] ? $cfg['LeftBgColor'] : $cfg['RightBgColor']); ?>">
|
||||
<div id="querywindowcontainer">
|
||||
<?php
|
||||
if ($cfg['QueryFrameJS'] && !isset($no_js)) {
|
||||
if ( $cfg['QueryFrameJS'] && !isset($no_js) ) {
|
||||
$querydisplay_tab = (isset($querydisplay_tab) ? $querydisplay_tab : $cfg['QueryWindowDefTab']);
|
||||
|
||||
$tabs = array();
|
||||
@@ -107,22 +113,22 @@ if ($cfg['QueryFrameJS'] && !isset($no_js)) {
|
||||
$tabs['sql']['text'] = $strSQL;
|
||||
$tabs['sql']['link'] = '#';
|
||||
$tabs['sql']['attr'] = 'onclick="javascript:query_tab_commit(\'sql\');return false;"';
|
||||
$tabs['sql']['active'] = (bool) (isset($querydisplay_tab) && $querydisplay_tab == 'sql');
|
||||
$tabs['sql']['active'] = (bool) ( $querydisplay_tab == 'sql' );
|
||||
$tabs['import']['icon'] = 'b_import.png';
|
||||
$tabs['import']['text'] = $strImportFiles;
|
||||
$tabs['import']['link'] = '#';
|
||||
$tabs['import']['attr'] = 'onclick="javascript:query_tab_commit(\'files\');return false;"';
|
||||
$tabs['import']['active'] = (bool) (isset($querydisplay_tab) && $querydisplay_tab == 'files');
|
||||
$tabs['import']['active'] = (bool) ( $querydisplay_tab == 'files' );
|
||||
$tabs['history']['text'] = $strQuerySQLHistory;
|
||||
$tabs['history']['link'] = '#';
|
||||
$tabs['history']['attr'] = 'onclick="javascript:query_tab_commit(\'history\');return false;"';
|
||||
$tabs['history']['active'] = (bool) (isset($querydisplay_tab) && $querydisplay_tab == 'history');
|
||||
$tabs['history']['active'] = (bool) ( $querydisplay_tab == 'history' );
|
||||
|
||||
if ($cfg['QueryWindowDefTab'] == 'full') {
|
||||
if ( $cfg['QueryWindowDefTab'] == 'full' ) {
|
||||
$tabs['all']['text'] = $strAll;
|
||||
$tabs['all']['link'] = '#';
|
||||
$tabs['all']['attr'] = 'onclick="javascript:query_tab_commit(\'full\');return false;"';
|
||||
$tabs['all']['active'] = (bool) (isset($querydisplay_tab) && $querydisplay_tab == 'full');
|
||||
$tabs['all']['active'] = (bool) ( $querydisplay_tab == 'full' );
|
||||
}
|
||||
|
||||
echo PMA_getTabs( $tabs );
|
||||
@@ -131,9 +137,6 @@ if ($cfg['QueryFrameJS'] && !isset($no_js)) {
|
||||
$querydisplay_tab = 'full';
|
||||
}
|
||||
|
||||
?>
|
||||
<br />
|
||||
<?php
|
||||
if ($cfg['PropertiesIconic'] == true) {
|
||||
// We need to copy the value or else the == 'both' check will always return true
|
||||
$propicon = (string)$cfg['PropertiesIconic'];
|
||||
@@ -230,8 +233,34 @@ if (!isset($goto)) {
|
||||
}
|
||||
|
||||
require_once './libraries/bookmark.lib.php';
|
||||
$is_inside_querywindow = TRUE;
|
||||
require './tbl_query_box.php';
|
||||
|
||||
// in case of javascript disabled in queryframe ...
|
||||
if ( $GLOBALS['cfg']['QueryFrame'] && ! $GLOBALS['cfg']['QueryFrameJS'] ) {
|
||||
// ... we redirect to appropriate query sql page
|
||||
// works only full if $db and $table is also stored/grabbed from $_COOKIE
|
||||
if ( ! empty( $table ) ) {
|
||||
require 'tbl_properties.php';
|
||||
}
|
||||
elseif ( ! empty( $db ) ) {
|
||||
require 'db_details.php';
|
||||
}
|
||||
else {
|
||||
require 'server_sql.php';
|
||||
}
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines the query to be displayed in the query textarea
|
||||
*/
|
||||
if ( ! empty( $show_query ) ) {
|
||||
$query_to_display = $sql_query;
|
||||
} else {
|
||||
$query_to_display = '';
|
||||
}
|
||||
unset( $sql_query );
|
||||
|
||||
PMA_sqlQueryForm( $query_to_display, $querydisplay_tab );
|
||||
|
||||
// Hidden forms and query frame interaction stuff
|
||||
if ($cfg['QueryFrame'] && $cfg['QueryFrameJS']) {
|
||||
|
@@ -175,9 +175,9 @@ if (!$cfg['AllowUserDropDatabase']
|
||||
define('PMA_CHK_DROP', 1);
|
||||
|
||||
/**
|
||||
* Store a query as a bookmark before executing it?
|
||||
* Store the query as a bookmark before executing it if bookmarklabel was given
|
||||
*/
|
||||
if (isset($SQLbookmark) && $sql_query != '') {
|
||||
if ( ! empty( $bkm_label ) && ! empty( $sql_query ) ) {
|
||||
require_once('./libraries/bookmark.lib.php');
|
||||
$bfields = array(
|
||||
'dbase' => $db,
|
||||
|
200
server_sql.php
200
server_sql.php
@@ -6,211 +6,23 @@
|
||||
/**
|
||||
* Does the common work
|
||||
*/
|
||||
require('./server_common.inc.php');
|
||||
require_once './server_common.inc.php';
|
||||
require_once './libraries/sql_query_form.lib.php';
|
||||
|
||||
|
||||
/**
|
||||
* Displays the links
|
||||
*/
|
||||
require('./server_links.inc.php');
|
||||
|
||||
require './server_links.inc.php';
|
||||
|
||||
|
||||
/**
|
||||
* Database work
|
||||
* Query box, bookmark, insert data from textfile
|
||||
*/
|
||||
if (isset($show_query) && $show_query == '1') {
|
||||
// This script has been called by read_dump.php
|
||||
if (isset($sql_query_cpy)) {
|
||||
$query_to_display = $sql_query_cpy;
|
||||
}
|
||||
// Other cases
|
||||
else {
|
||||
$query_to_display = $sql_query;
|
||||
}
|
||||
} else {
|
||||
$query_to_display = '';
|
||||
}
|
||||
PMA_sqlQueryForm();
|
||||
|
||||
|
||||
// loic1: defines wether file upload is available or not
|
||||
// (now defined in common.lib.php)
|
||||
|
||||
$auto_sel = ($cfg['TextareaAutoSelect']
|
||||
// 2003-02-05 rabus: This causes big trouble with Opera 7 for
|
||||
// Windows, so let's disable it there...
|
||||
&& !(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();}"'
|
||||
: '';
|
||||
|
||||
|
||||
// for better administration
|
||||
$strHiddenFields = ' <input type="hidden" name="is_js_confirmed" value="0" />' ."\n"
|
||||
. ' ' .PMA_generate_common_hidden_inputs() . "\n"
|
||||
. ' <input type="hidden" name="pos" value="0" />' . "\n"
|
||||
. ' <input type="hidden" name="goto" value="server_sql.php" />' . "\n"
|
||||
. ' <input type="hidden" name="zero_rows" value="' . htmlspecialchars($strSuccess) . '" />' . "\n"
|
||||
. ' <input type="hidden" name="prev_sql_query" value="' . ((!empty($query_to_display)) ? htmlspecialchars($query_to_display) : '') . '" />' . "\n";
|
||||
?>
|
||||
<!-- Query box, sql file loader and bookmark support -->
|
||||
<form method="post" action="read_dump.php"<?php if ($is_upload) echo ' enctype="multipart/form-data"'; ?> onsubmit="return checkSqlQuery(this)" name="sqlform">
|
||||
<?php
|
||||
echo $strHiddenFields;
|
||||
?>
|
||||
<a name="querybox"></a>
|
||||
<table border="0" cellpadding="2" cellspacing="0">
|
||||
<tr><td class="tblHeaders" colspan="2">
|
||||
<?php
|
||||
echo ' ' . sprintf($strRunSQLQueryOnServer, htmlspecialchars($GLOBALS['cfg']['Servers'][$server]['host'])) . ': ' . PMA_showMySQLDocu('Reference', 'SELECT');
|
||||
|
||||
?>
|
||||
</td></tr>
|
||||
<tr align="center" bgcolor="<?php echo $cfg['BgcolorOne']; ?>"><td colspan="2">
|
||||
<textarea name="sql_query" cols="<?php echo $cfg['TextareaCols'] * 2; ?>" rows="<?php echo $cfg['TextareaRows']; ?>" dir="<?php echo $text_dir; ?>"<?php echo $auto_sel; ?>>
|
||||
<?php
|
||||
if (!empty($query_to_display)) {
|
||||
echo htmlspecialchars($query_to_display);
|
||||
}
|
||||
?></textarea>
|
||||
</td></tr>
|
||||
<tr class="tblFooters">
|
||||
<td>
|
||||
<input type="checkbox" name="show_query" value="1" id="checkbox_show_query" checked="checked" /><label for="checkbox_show_query"><?php echo $strShowThisQuery; ?></label>
|
||||
</td>
|
||||
<td align="right"><input type="submit" name="SQL" value="<?php echo $strGo; ?>" /></td>
|
||||
</tr>
|
||||
<?php
|
||||
// loic1: displays import dump feature only if file upload available
|
||||
if ($is_upload) {
|
||||
?>
|
||||
<tr><td colspan="2"><img src="<?php echo $GLOBALS['pmaThemeImage'] . 'spacer.png'; ?>" width="1" height="1" border="0" alt="" /></td></tr>
|
||||
<tr>
|
||||
<td colspan="2" class="tblHeaders">
|
||||
<i><?php echo $strOr; ?></i>
|
||||
<b><?php echo $strLocationTextfile; ?>:</b>
|
||||
</td>
|
||||
</tr>
|
||||
<tr bgcolor="<?php echo $cfg['BgcolorOne']; ?>">
|
||||
<td colspan="2" align="center">
|
||||
<input type="file" name="sql_file" class="textfield" />
|
||||
<?php
|
||||
echo PMA_displayMaximumUploadSize($max_upload_size) . '<br />';
|
||||
// some browsers should respect this :)
|
||||
echo ' ' . PMA_generateHiddenMaxFileSize($max_upload_size) . "\n";
|
||||
$is_gzip = ($cfg['GZipDump'] && @function_exists('gzopen'));
|
||||
$is_bzip = ($cfg['BZipDump'] && @function_exists('bzdecompress'));
|
||||
if ($is_bzip || $is_gzip) {
|
||||
echo ' </td>' . "\n"
|
||||
. '</tr>' . "\n"
|
||||
. '<tr bgcolor="' . $cfg['BgcolorOne'] . '">' . "\n"
|
||||
. ' <td colspan="2">' . "\n";
|
||||
echo ' ' . $strCompression . ':<br /> ' . "\n"
|
||||
. ' <input type="radio" id="radio_sql_file_compression_auto" name="sql_file_compression" value="" checked="checked" /><label for="radio_sql_file_compression_auto">' . $strAutodetect . '</label> ' . "\n"
|
||||
. ' <input type="radio" id="radio_sql_file_compression_plain" name="sql_file_compression" value="text/plain" /><label for="radio_sql_file_compression_plain">' . $strNone . '</label>  ' . "\n";
|
||||
if ($is_gzip) {
|
||||
echo ' <input type="radio" id="radio_sql_file_compression_gzip" name="sql_file_compression" value="application/x-gzip" /><label for="radio_sql_file_compression_gzip">' . $strGzip . '</label> ' . "\n";
|
||||
}
|
||||
if ($is_bzip) {
|
||||
echo ' <input type="radio" id="radio_sql_file_compression_bzip" name="sql_file_compression" value="application/x-bzip" /><label for="radio_sql_file_compression_bzip">' . $strBzip . '</label> ' . "\n";
|
||||
}
|
||||
} else {
|
||||
?>
|
||||
<input type="hidden" name="sql_file_compression" value="text/plain" />
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
} // end if (is upload)
|
||||
// web-server upload directory
|
||||
$is_upload_dir = false;
|
||||
if (!empty($cfg['UploadDir'])) {
|
||||
if (substr($cfg['UploadDir'], -1) != '/') {
|
||||
$cfg['UploadDir'] .= '/';
|
||||
}
|
||||
if ($handle = @opendir($cfg['UploadDir'])) {
|
||||
$is_first = 0;
|
||||
while ($file = @readdir($handle)) {
|
||||
if (is_file($cfg['UploadDir'] . $file) && PMA_checkFileExtensions($file, '.sql')) {
|
||||
if ($is_first == 0) {
|
||||
$is_upload_dir = true;
|
||||
echo "\n";
|
||||
echo ' <tr><td colspan=2" bgcolor="' . $cfg['BgcolorTwo'] . '">' . "\n";
|
||||
echo ' <b>' . $strWebServerUploadDirectory . ':</b> ' . "\n";
|
||||
echo ' </td></tr>' . "\n";
|
||||
echo ' <tr bgcolor="' . $cfg['BgcolorOne'] . '"><td colspan="2">' . "\n";
|
||||
// add 2004-05-08 by mkkeck
|
||||
// todo: building a php script for indexing files in UploadDir
|
||||
//if ($cfg['UploadDirIndex']) {
|
||||
// echo ' <a href="' . $cfg['UploadDir'] . '" target="_blank">' . $cfg['UploadDir'] . '</a> ';
|
||||
//}
|
||||
// end indexing
|
||||
echo ' <select size="1" name="sql_localfile">' . "\n";
|
||||
echo ' <option value="" selected="selected"></option>' . "\n";
|
||||
} // end if (is_first)
|
||||
echo ' <option value="' . htmlspecialchars($file) . '">' . htmlspecialchars($file) . '</option>' . "\n";
|
||||
$is_first++;
|
||||
} // end if (is_file)
|
||||
} // end while
|
||||
if ($is_first > 0) {
|
||||
echo ' </select>' . "\n"
|
||||
. ' </td>'
|
||||
. ' </tr>' . "\n\n";
|
||||
} // end if (isfirst > 0)
|
||||
@closedir($handle);
|
||||
}
|
||||
else {
|
||||
$upload_dir_error = '<tr><td colspan="2"><img src="' .$GLOBALS['pmaThemeImage'] . 'spacer.png' . '" width="1" height="1" border="0" alt="" /></td></tr>' . "\n"
|
||||
. '<tr><th colspan="2" class="tblHeadError"><div class="errorhead">' . $strError . '</div></th></tr>' . "\n"
|
||||
. '<tr><td colspan="2" class="tblError">' . $strWebServerUploadDirectoryError
|
||||
. '</td></tr>' . "\n";
|
||||
}
|
||||
} // end if (web-server upload directory)
|
||||
// Charset conversion options
|
||||
if ($is_upload || $is_upload_dir) {
|
||||
echo ' <tr class="tblFooters"><td>' . "\n";
|
||||
if (PMA_MYSQL_INT_VERSION < 40100 && $cfg['AllowAnywhereRecoding'] && $allow_recoding) {
|
||||
$temp_charset = reset($cfg['AvailableCharsets']);
|
||||
echo ' ' . $strCharsetOfFile . "\n"
|
||||
. ' <select name="charset_of_file" size="1">' . "\n"
|
||||
. ' <option value="' . $temp_charset . '"';
|
||||
if ($temp_charset == $charset) {
|
||||
echo ' selected="selected"';
|
||||
}
|
||||
echo '>' . $temp_charset . '</option>' . "\n";
|
||||
while ($temp_charset = next($cfg['AvailableCharsets'])) {
|
||||
echo ' <option value="' . $temp_charset . '"';
|
||||
if ($temp_charset == $charset) {
|
||||
echo ' selected="selected"';
|
||||
}
|
||||
echo '>' . $temp_charset . '</option>' . "\n";
|
||||
}
|
||||
echo ' </select><br />' . "\n" . ' ';
|
||||
} elseif (PMA_MYSQL_INT_VERSION >= 40100) {
|
||||
echo $strCharsetOfFile . "\n";
|
||||
echo PMA_generateCharsetDropdownBox(PMA_CSDROPDOWN_CHARSET, 'charset_of_file', NULL, 'utf8', FALSE);
|
||||
} // end if (recoding)
|
||||
echo ' </td>' . "\n";
|
||||
echo ' <td align="right"><input type="submit" name="SQL" value="' . $strGo . '" /></td>' . "\n";
|
||||
echo ' </tr>' . "\n";
|
||||
}
|
||||
|
||||
|
||||
// Encoding setting form appended by Y.Kawada
|
||||
if (function_exists('PMA_set_enc_form')) {
|
||||
echo PMA_set_enc_form(' ');
|
||||
}
|
||||
// modified by mkkeck 2004-05-08
|
||||
// showing UploadDir Error at the end of all option for SQL-Queries
|
||||
if (isset($upload_dir_error)) {
|
||||
echo $upload_dir_error;
|
||||
}
|
||||
?>
|
||||
</table>
|
||||
</form>
|
||||
<?php
|
||||
/**
|
||||
* Displays the footer
|
||||
*/
|
||||
echo "\n";
|
||||
require_once('./footer.inc.php');
|
||||
require_once './footer.inc.php';
|
||||
?>
|
||||
|
5
sql.php
5
sql.php
@@ -103,6 +103,7 @@ if (isset($btnDrop) || isset($navig)) {
|
||||
$GLOBALS['unparsed_sql'] = $sql_query;
|
||||
$parsed_sql = PMA_SQP_parse($sql_query);
|
||||
$analyzed_sql = PMA_SQP_analyze($parsed_sql);
|
||||
|
||||
// Bug #641765 - Robbat2 - 12 January 2003, 10:49PM
|
||||
// Reverted - Robbat2 - 13 January 2003, 2:40PM
|
||||
|
||||
@@ -627,8 +628,8 @@ else {
|
||||
$message = $strAffectedRows . ' ' . $num_rows;
|
||||
|
||||
// Ok, here is an explanation for the !$is_select.
|
||||
// The form generated
|
||||
// by tbl_query_box.php and db_details.php has many submit buttons
|
||||
// The form generated by sql_query_form.lib.php
|
||||
// and db_details.php has many submit buttons
|
||||
// on the same form, and some confusion arises from the
|
||||
// fact that $zero_rows is sent for every case.
|
||||
// The $zero_rows containing $strSuccess and sent with
|
||||
|
@@ -6,32 +6,30 @@
|
||||
/**
|
||||
* Runs common work
|
||||
*/
|
||||
require('./tbl_properties_common.php');
|
||||
require './tbl_properties_common.php';
|
||||
require_once './libraries/sql_query_form.lib.php';
|
||||
|
||||
$err_url = 'tbl_properties.php' . $err_url;
|
||||
$url_query .= '&goto=tbl_properties.php&back=tbl_properties.php';
|
||||
$goto = 'tbl_properties.php';
|
||||
$back = 'tbl_properties.php';
|
||||
|
||||
/**
|
||||
* Get table information
|
||||
*/
|
||||
require('./tbl_properties_table_info.php');
|
||||
require './tbl_properties_table_info.php';
|
||||
|
||||
/**
|
||||
* Displays top menu links
|
||||
*/
|
||||
require('./tbl_properties_links.php');
|
||||
require './tbl_properties_links.php';
|
||||
|
||||
?>
|
||||
<!-- TABLE WORK -->
|
||||
<?php
|
||||
/**
|
||||
* Query box, bookmark, insert data from textfile
|
||||
*/
|
||||
$goto = 'tbl_properties.php';
|
||||
require('./tbl_query_box.php');
|
||||
PMA_sqlQueryForm();
|
||||
|
||||
/**
|
||||
* Displays the footer
|
||||
*/
|
||||
echo "\n";
|
||||
require_once('./footer.inc.php');
|
||||
require_once './footer.inc.php';
|
||||
?>
|
||||
|
@@ -5,6 +5,7 @@
|
||||
require_once('./libraries/grab_globals.lib.php');
|
||||
require_once('./libraries/common.lib.php');
|
||||
require_once('./libraries/mysql_charsets.lib.php');
|
||||
require_once './libraries/sql_query_form.lib.php';
|
||||
|
||||
/**
|
||||
* Drop multiple fields if required
|
||||
@@ -807,7 +808,8 @@ if (!$tbl_is_view) {
|
||||
* Query box, bookmark, insert data from textfile
|
||||
*/
|
||||
$goto = 'tbl_properties_structure.php';
|
||||
require('./tbl_query_box.php');
|
||||
PMA_sqlQueryForm();
|
||||
|
||||
|
||||
/**
|
||||
* Displays the footer
|
||||
|
@@ -1,547 +1,55 @@
|
||||
<?php
|
||||
/* $Id$ */
|
||||
// vim: expandtab sw=4 ts=4 sts=4:
|
||||
/**
|
||||
* provides the sql form
|
||||
*
|
||||
* @usedby server_sql.php server SQL-tab
|
||||
* @usedby db_details.php database SQL-tab
|
||||
* @usedby server_sql.php server SQL-tab
|
||||
*/
|
||||
|
||||
// Check parameters
|
||||
|
||||
require_once('./libraries/grab_globals.lib.php');
|
||||
require_once('./libraries/common.lib.php');
|
||||
require_once('./libraries/bookmark.lib.php');
|
||||
require_once './libraries/sql_query_form.lib.php';
|
||||
|
||||
$upload_dir_error='';
|
||||
// we dont need to check booth variables each time
|
||||
if ( false == $cfg['QueryFrame'] ) {
|
||||
$cfg['QueryFrameJS'] = false;
|
||||
}
|
||||
|
||||
// I don't see the purpose of the first 2 conditions
|
||||
//if (!($cfg['QueryFrame'] && $cfg['QueryFrameJS'] && isset($is_inside_querywindow) && $is_inside_querywindow == TRUE && isset($querydisplay_tab) && ($querydisplay_tab == 'sql' || $querydisplay_tab == 'full'))) {
|
||||
if ( empty( $querydisplay_tab ) ) {
|
||||
$querydisplay_tab = '';
|
||||
}
|
||||
|
||||
if (!(isset($is_inside_querywindow) && $is_inside_querywindow == TRUE && isset($querydisplay_tab) && ($querydisplay_tab == 'sql' || $querydisplay_tab == 'full'))) {
|
||||
PMA_checkParameters(array('db','table','url_query'));
|
||||
// in case of javascript disabled in queryframe ...
|
||||
if ( $GLOBALS['cfg']['QueryFrame'] && ! $GLOBALS['cfg']['QueryFrameJS']
|
||||
&& $is_inside_querywindow ) {
|
||||
// ... we redirect to appropriate query sql page
|
||||
// works only full if $db and $table is also stored/grabbed from $_COOKIE
|
||||
if ( ! empty( $table ) ) {
|
||||
require 'tbl_properties.php';
|
||||
}
|
||||
elseif ( ! empty( $db ) ) {
|
||||
require 'db_details.php';
|
||||
}
|
||||
else {
|
||||
require 'server_sql.php';
|
||||
}
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines the query to be displayed in the query textarea
|
||||
*/
|
||||
if (isset($show_query) && $show_query == '1') {
|
||||
// This script has been called by read_dump.php
|
||||
if (isset($sql_query_cpy)) {
|
||||
$query_to_display = $sql_query_cpy;
|
||||
}
|
||||
// Other cases
|
||||
else {
|
||||
if ( ! empty( $show_query ) ) {
|
||||
$query_to_display = $sql_query;
|
||||
}
|
||||
} else {
|
||||
$query_to_display = '';
|
||||
}
|
||||
unset($sql_query);
|
||||
unset( $sql_query );
|
||||
|
||||
/**
|
||||
* Get the list and number of fields
|
||||
*/
|
||||
$fields_cnt = 0;
|
||||
if (isset($db) && isset($table) && $table != '' && $db != '') {
|
||||
// we do a try_query here, because we could be in the query window,
|
||||
// trying to synchonize and the table has not yet been created
|
||||
$result = PMA_DBI_try_query('SHOW FIELDS FROM ' . PMA_backquote($table) . ' FROM ' . PMA_backquote($db) . ';', NULL, PMA_DBI_QUERY_STORE);
|
||||
if ($result) {
|
||||
$fields_cnt = PMA_DBI_num_rows($result);
|
||||
while ($row = PMA_DBI_fetch_assoc($result)) {
|
||||
$fields_list[] = $row['Field'];
|
||||
} // end while
|
||||
PMA_DBI_free_result($result);
|
||||
} // end if
|
||||
}
|
||||
|
||||
/**
|
||||
* Work on the table
|
||||
*/
|
||||
|
||||
if ($cfg['QueryFrame'] && $cfg['QueryFrameJS'] && isset($is_inside_querywindow) && $is_inside_querywindow == TRUE && isset($querydisplay_tab) && ($querydisplay_tab == 'sql' || $querydisplay_tab == 'full')) {
|
||||
$locking = 'onkeypress="document.sqlform.elements[\'LockFromUpdate\'].checked = true;"';
|
||||
} else {
|
||||
$locking = '';
|
||||
}
|
||||
|
||||
$auto_sel = ($cfg['TextareaAutoSelect']
|
||||
// 2003-02-05 rabus: This causes big trouble with Opera 7 for
|
||||
// Windows, so let's disable it there...
|
||||
&& !(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; document.sqlform.elements[\'sql_query\'].select();}"'
|
||||
: '';
|
||||
$auto_sel .= ' ' . $locking;
|
||||
|
||||
// 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.
|
||||
/**
|
||||
* Get the list and number of available databases.
|
||||
*/
|
||||
if ($server > 0) {
|
||||
PMA_availableDatabases(); // this function is defined in "common.lib.php"
|
||||
} else {
|
||||
$num_dbs = 0;
|
||||
}
|
||||
if ($cfg['QueryFrame'] && (!$cfg['QueryFrameJS'] && !$db || ($cfg['QueryFrameJS'] && !$db))) {
|
||||
if ($num_dbs > 0) {
|
||||
$queryframe_db_list = '<select size=1 name="db" style="vertical-align: middle;">';
|
||||
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> ';
|
||||
$queryframe_thcolspan = ' colspan="2"';
|
||||
$queryframe_tdcolspan = '';
|
||||
} else {
|
||||
$queryframe_db_list = '';
|
||||
$queryframe_thcolspan = ' colspan="3"';
|
||||
$queryframe_tdcolspan = ' colspan="2"';
|
||||
}
|
||||
} else {
|
||||
$queryframe_db_list = '';
|
||||
if ($num_dbs > 0) {
|
||||
$queryframe_thcolspan = ' colspan="3"';
|
||||
$queryframe_tdcolspan = ' colspan="2"';
|
||||
} else {
|
||||
$queryframe_thcolspan = ' colspan="2"';
|
||||
$queryframe_tdcolspan = '';
|
||||
}
|
||||
}
|
||||
$form_items = 0;
|
||||
// ($is_upload defined in common.lib.php)
|
||||
|
||||
if ($cfg['QueryFrame'] && $cfg['QueryFrameJS'] && isset($is_inside_querywindow) && $is_inside_querywindow) {
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
<!--
|
||||
document.writeln('<form method="post" target="phpmain' + <?php echo ((isset($is_inside_querywindow) && $is_inside_querywindow == TRUE) ? 'opener.' : '');?>parent.frames.queryframe.document.hashform.hash.value + '" action="read_dump.php"<?php if ($is_upload) echo ' enctype="multipart/form-data"'; ?> onsubmit="return checkSqlQuery(this)" name="sqlform">');
|
||||
//-->
|
||||
</script>
|
||||
<?php
|
||||
echo ' <noscript>' . "\n"
|
||||
. ' <form method="post" target="phpmain' . md5($cfg['PmaAbsoluteUri']) . '" ' . "\n"
|
||||
. ' action="read_dump.php"' . ($is_upload ? ' enctype="multipart/form-data"' : '' ) . ' name="sqlform">' . "\n"
|
||||
. ' </noscript>';
|
||||
} else {
|
||||
?>
|
||||
<form method="post" action="read_dump.php"<?php if ($is_upload) echo ' enctype="multipart/form-data"'; ?> onsubmit="return checkSqlQuery(this)" name="sqlform" style="padding: 0px; magin: 0px;">
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<table border="0" cellpadding="2" cellspacing="0" id="sqlcontainer" name="sqlcontainer">
|
||||
<?php
|
||||
// for better administration
|
||||
$querybox_hidden_fields = ' <input type="hidden" name="is_js_confirmed" value="0" />' . "\n"
|
||||
. ' ' . PMA_generate_common_hidden_inputs($db, $table) . "\n"
|
||||
. ' <input type="hidden" name="pos" value="0" />'. "\n"
|
||||
. ' <input type="hidden" name="goto" value="' . $goto . '" />'. "\n"
|
||||
. ' <input type="hidden" name="zero_rows" value="' . $strSuccess . '" />'. "\n"
|
||||
. ' <input type="hidden" name="prev_sql_query" value="' . ((!empty($query_to_display)) ? urlencode($query_to_display) : '') . '" />'. "\n";
|
||||
if (!isset($is_inside_querywindow) ||
|
||||
(isset($is_inside_querywindow) && $is_inside_querywindow == TRUE && isset($querydisplay_tab) && ($querydisplay_tab == 'sql' || $querydisplay_tab == 'full'))) {
|
||||
?>
|
||||
<!-- Query box and bookmark support -->
|
||||
<?php
|
||||
if (isset($is_inside_querywindow) && $is_inside_querywindow == TRUE) {
|
||||
$querybox_hidden_fields .= ' <input type="hidden" name="focus_querywindow" value="true" />' . "\n";
|
||||
}
|
||||
?>
|
||||
<tr class="tblHeaders">
|
||||
<td nowrap="nowrap"<?php if ($queryframe_tdcolspan == '') { echo ' colspan="2"'; } ?>>
|
||||
<a name="querybox"></a>
|
||||
<?php echo sprintf($strRunSQLQuery, htmlspecialchars($db) . $queryframe_db_list) . PMA_showMySQLDocu('Reference', 'SELECT'); ?>
|
||||
</td>
|
||||
<?php
|
||||
if (isset($table) && $fields_cnt > 0) { ?>
|
||||
<td nowrap="nowrap"> </td>
|
||||
<td nowrap="nowrap"><?php echo $strFields; ?>: </td>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</tr>
|
||||
<tr bgcolor="<?php echo $cfg['BgcolorOne']; ?>">
|
||||
<td valign="top"<?php if ($queryframe_tdcolspan == '') { echo ' colspan="2"'; } ?>>
|
||||
<textarea name="sql_query" rows="<?php echo $cfg['TextareaRows']; ?>" cols="<?php echo ((isset($is_inside_querywindow) && $is_inside_querywindow == TRUE && $queryframe_tdcolspan != '') ? ceil($cfg['TextareaCols'] * 1.25) : $cfg['TextareaCols'] * 2); ?>" dir="<?php echo $text_dir; ?>"<?php echo $auto_sel; ?>><?php
|
||||
if (!empty($query_to_display)) {
|
||||
echo htmlspecialchars($query_to_display);
|
||||
} elseif (isset($table) && !empty($table) && isset($fields_list)) {
|
||||
echo htmlspecialchars(
|
||||
str_replace('%d', PMA_backquote($db),
|
||||
str_replace('%t', PMA_backquote($table),
|
||||
str_replace('%f', implode(', ', PMA_backquote($fields_list)),
|
||||
$cfg['DefaultQueryTable']))));
|
||||
} else {
|
||||
echo htmlspecialchars(str_replace('%d', PMA_backquote($db), $cfg['DefaultQueryDatabase']));
|
||||
}
|
||||
?></textarea>
|
||||
</td>
|
||||
<?php
|
||||
if (isset($table) && $fields_cnt > 0) {
|
||||
?>
|
||||
<td valign="middle">
|
||||
<?php
|
||||
if ($cfg['PropertiesIconic']) {
|
||||
echo '<input type="button" name="insert" value="<<" onclick="insertValueQuery()" title="' . $strInsert. '" />';
|
||||
} else {
|
||||
echo '<input type="button" name="insert" value="' . $strInsert . '" onclick="insertValueQuery()" />';
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
<td valign="top">
|
||||
<select name="dummy" size="<?php echo $cfg['TextareaRows']; ?>" multiple="multiple" class="textfield">
|
||||
<?php
|
||||
echo "\n";
|
||||
for ($i = 0 ; $i < $fields_cnt; $i++) {
|
||||
echo ' '
|
||||
. '<option value="' . PMA_backquote(htmlspecialchars($fields_list[$i])) . '">' . htmlspecialchars($fields_list[$i]) . '</option>' . "\n";
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</td>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</tr>
|
||||
<tr class="tblFooters">
|
||||
<td<?php if ($queryframe_tdcolspan != '') { echo ' colspan="2"'; } //echo $queryframe_tdcolspan; ?>>
|
||||
<input type="checkbox" name="show_query" value="1" id="checkbox_show_query" checked="checked" /><label for="checkbox_show_query"><?php echo $strShowThisQuery; ?></label>
|
||||
<?php
|
||||
if (isset($is_inside_querywindow) && $is_inside_querywindow == TRUE) {
|
||||
?>
|
||||
<br />
|
||||
<script type="text/javascript">
|
||||
document.writeln('<input type="checkbox" name="LockFromUpdate" value="1" id="checkbox_lock" /><label for="checkbox_lock"><?php echo $strQueryWindowLock; ?></label><br />');
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
|
||||
$form_items++;
|
||||
?>
|
||||
</td>
|
||||
<td align="right" valign="bottom"><input type="submit" name="SQL" value="<?php echo $strGo; ?>" /></td>
|
||||
</tr>
|
||||
<?php
|
||||
} else {
|
||||
$querybox_hidden_fields .= ' <input type="hidden" name="sql_query" value="" />' . "\n";
|
||||
$querybox_hidden_fields .= ' <input type="hidden" name="show_query" value="1" />' . "\n";
|
||||
}
|
||||
|
||||
// loic1: displays import dump feature only if file upload available
|
||||
if ($is_upload && (!isset($is_inside_querywindow) ||
|
||||
(isset($is_inside_querywindow) && $is_inside_querywindow == TRUE && isset($querydisplay_tab) && ($querydisplay_tab == 'files' || $querydisplay_tab == 'full')))) {
|
||||
$form_items++;
|
||||
?>
|
||||
<tr>
|
||||
<td<?php echo $queryframe_thcolspan; ?>><img src="<?php echo $GLOBALS['pmaThemeImage'] . 'spacer.png'; ?>" width="1" height="1" border="0" alt="" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tblHeaders"<?php echo $queryframe_thcolspan; ?>>
|
||||
<?php
|
||||
echo ' '
|
||||
. ((isset($is_inside_querywindow) && $is_inside_querywindow == TRUE && isset($querydisplay_tab) && $querydisplay_tab == 'full') || !isset($is_inside_querywindow) ? '<i>' . $strOr . '</i>' : '')
|
||||
. ' ' . $strLocationTextfile . ': ' . "\n";
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr bgcolor="<?php echo $cfg['BgcolorOne']; ?>">
|
||||
<td<?php echo $queryframe_thcolspan; ?>>
|
||||
<input type="file" name="sql_file" class="textfield" /> <?php echo PMA_displayMaximumUploadSize($max_upload_size);?><br />
|
||||
<?php
|
||||
// some browsers should respect this :)
|
||||
echo ' ' . PMA_generateHiddenMaxFileSize($max_upload_size) . "\n";
|
||||
|
||||
if (isset($is_inside_querywindow) && $is_inside_querywindow == TRUE) {
|
||||
$querybox_hidden_fields .= ' <input type="hidden" name="focus_querywindow" value="true" />' . "\n";
|
||||
}
|
||||
|
||||
$is_gzip = ($cfg['GZipDump'] && @function_exists('gzopen'));
|
||||
$is_bzip = ($cfg['BZipDump'] && @function_exists('bzdecompress'));
|
||||
if ($is_bzip || $is_gzip) {
|
||||
echo ' </td>' . "\n"
|
||||
. ' </tr>' . "\n"
|
||||
. ' <tr bgcolor="' . $cfg['BgcolorOne'] .'">' . "\n"
|
||||
. ' <td' . $queryframe_thcolspan . '>' . "\n"
|
||||
. ' '. $strCompression . ':<br /> ' . "\n"
|
||||
. ' <input type="radio" id="radio_sql_file_compression_auto" name="sql_file_compression" value="" checked="checked" />'
|
||||
. '<label for="radio_sql_file_compression_auto">' . $strAutodetect . '</label> ' . "\n"
|
||||
. ' <input type="radio" id="radio_sql_file_compression_plain" name="sql_file_compression" value="text/plain" />'
|
||||
. '<label for="radio_sql_file_compression_plain">' . $strNone . '</label> ' . "\n";
|
||||
if ($is_gzip) {
|
||||
echo ' <input type="radio" id="radio_sql_file_compression_gzip" name="sql_file_compression" value="application/x-gzip" />'
|
||||
. '<label for="radio_sql_file_compression_gzip">' . $strGzip . '</label> ' . "\n";
|
||||
}
|
||||
if ($is_bzip) {
|
||||
echo ' <input type="radio" id="radio_sql_file_compression_bzip" name="sql_file_compression" value="application/x-bzip" />'
|
||||
. '<label for="radio_sql_file_compression_bzip">' . $strBzip . '</label> ' . "\n";
|
||||
}
|
||||
} else {
|
||||
$querybox_hidden_fields .= ' <input type="hidden" name="sql_file_compression" value="text/plain" />' . "\n";
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
} // end if
|
||||
echo "\n";
|
||||
|
||||
// web-server upload directory
|
||||
$is_upload_dir = false;
|
||||
if (!empty($cfg['UploadDir']) && !isset($is_inside_querywindow) ||
|
||||
(!empty($cfg['UploadDir']) && isset($is_inside_querywindow) && $is_inside_querywindow == TRUE && isset($querydisplay_tab) && ($querydisplay_tab == 'files' || $querydisplay_tab == 'full'))) {
|
||||
|
||||
if (substr($cfg['UploadDir'], -1) != '/') {
|
||||
$cfg['UploadDir'] .= '/';
|
||||
}
|
||||
if ($handle = @opendir($cfg['UploadDir'])) {
|
||||
if (isset($is_inside_querywindow) && $is_inside_querywindow == TRUE) {
|
||||
$querybox_hidden_fields .= ' <input type="hidden" name="focus_querywindow" value="true" />' . "\n";
|
||||
}
|
||||
|
||||
$is_first = 0;
|
||||
while ($file = @readdir($handle)) {
|
||||
if (is_file($cfg['UploadDir'] . $file) && PMA_checkFileExtensions($file, '.sql')) {
|
||||
if ($is_first == 0) {
|
||||
$is_upload_dir = true;
|
||||
echo "\n";
|
||||
echo ' ' . "\n"
|
||||
. ' <tr bgcolor="' .$cfg['BgcolorTwo'].'"><td' . $queryframe_thcolspan . '>';
|
||||
echo ' <b> ' . $strWebServerUploadDirectory . ': </b>' . "\n";
|
||||
echo ' </td></tr>' . "\n"
|
||||
. ' <tr bgcolor="' . $cfg['BgcolorOne'] . '"><td' . $queryframe_thcolspan . '>';
|
||||
// add 2004-05-08 by mkkeck
|
||||
// todo: building a php script for indexing files in UploadDir
|
||||
//if ($cfg['UploadDirIndex']) {
|
||||
// echo ' <a href="' . $cfg['UploadDir'] . '" target="_blank">' . $cfg['UploadDir'] . '</a> ';
|
||||
//}
|
||||
// end indexing
|
||||
echo ' <select size="1" name="sql_localfile">' . "\n";
|
||||
echo ' <option value="" selected="selected"></option>' . "\n";
|
||||
$form_items++;
|
||||
} // end if (is_first)
|
||||
echo ' <option value="' . htmlspecialchars($file) . '">' . htmlspecialchars($file) . '</option>' . "\n";
|
||||
$is_first++;
|
||||
} // end if (is_file)
|
||||
} // end while
|
||||
if ($is_first > 0) {
|
||||
echo ' </select>' . "\n"
|
||||
. ' </td></tr>' . "\n";
|
||||
} // end if (isfirst > 0)
|
||||
@closedir($handle);
|
||||
$upload_dir_error=''; // please see 'else {' below ;)
|
||||
}
|
||||
else {
|
||||
// modified by mkkeck 2004-05-08
|
||||
// showing UploadDir Error at the end of all option for SQL-Queries
|
||||
$upload_dir_error.= ' <tr><td' . $queryframe_thcolspan . '><img src="' . $GLOBALS['pmaThemeImage'] . 'spacer.png' . '" width="1" height="1" border="0" alt="" /></td></tr>' . "\n"
|
||||
. ' <tr>' . "\n"
|
||||
. ' <th' . $queryframe_thcolspan . ' class="tblHeadError"><div class="errorhead">' . $strError . '</div></th>' . "\n"
|
||||
. ' </tr>' . "\n"
|
||||
. ' <tr>' . "\n"
|
||||
. ' <td' . $queryframe_thcolspan . ' class="tblError">' . wordwrap($strWebServerUploadDirectoryError,80,'<br /> ') . '</td>' . "\n"
|
||||
. ' </tr>' . "\n"
|
||||
. ' <tr><td' . $queryframe_thcolspan . '><img src="' . $GLOBALS['pmaThemeImage'] . 'spacer.png' . '" width="1" height="1" border="0" alt="" /></td></tr>' . "\n";
|
||||
}
|
||||
} // end if (web-server upload directory)
|
||||
echo "\n";
|
||||
|
||||
// Encoding setting form appended by Y.Kawada
|
||||
if (function_exists('PMA_set_enc_form')) {
|
||||
echo PMA_set_enc_form(' ');
|
||||
$form_items++;
|
||||
}
|
||||
|
||||
// Charset conversion options and submit button
|
||||
if (($is_upload || $is_upload_dir) &&
|
||||
(!isset($is_inside_querywindow) ||
|
||||
(isset($is_inside_querywindow) && $is_inside_querywindow == TRUE && isset($querydisplay_tab) && ($querydisplay_tab == 'files' || $querydisplay_tab == 'full')))
|
||||
// It's possible that $db is empty: no db was selected on the left
|
||||
// panel and the user wants to execute a .sql file to create one)
|
||||
// && isset($db) && $db != ''){
|
||||
){
|
||||
/*
|
||||
if ($cfg['AllowAnywhereRecoding'] && $allow_recoding) {
|
||||
$form_items++;
|
||||
echo ' <div style="margin-bottom: 5px">' . "\n";
|
||||
$temp_charset = reset($cfg['AvailableCharsets']);
|
||||
echo $strCharsetOfFile . "\n"
|
||||
. ' <select name="charset_of_file" size="1">' . "\n"
|
||||
. ' <option value="' . $temp_charset . '"';
|
||||
if ($temp_charset == $charset) {
|
||||
echo ' selected="selected"';
|
||||
}
|
||||
echo '>' . $temp_charset . '</option>' . "\n";
|
||||
while ($temp_charset = next($cfg['AvailableCharsets'])) {
|
||||
echo ' <option value="' . $temp_charset . '"';
|
||||
if ($temp_charset == $charset) {
|
||||
echo ' selected="selected"';
|
||||
}
|
||||
echo '>' . $temp_charset . '</option>' . "\n";
|
||||
}
|
||||
echo ' </select><br />' . "\n" . ' ';
|
||||
echo ' </div>' . "\n";
|
||||
} // end if (recoding)
|
||||
*/
|
||||
echo ' <tr class="tblFooters"><td' . $queryframe_tdcolspan . '>' . "\n";
|
||||
if (PMA_MYSQL_INT_VERSION < 40100 && $cfg['AllowAnywhereRecoding'] && $allow_recoding) {
|
||||
$temp_charset = reset($cfg['AvailableCharsets']);
|
||||
echo ' ' . $strCharsetOfFile
|
||||
. ' <select name="charset_of_file" size="1">' . "\n"
|
||||
. ' <option value="' . $temp_charset . '"';
|
||||
if ($temp_charset == $charset) {
|
||||
echo ' selected="selected"';
|
||||
}
|
||||
echo '>' . $temp_charset . '</option>' . "\n";
|
||||
while ($temp_charset = next($cfg['AvailableCharsets'])) {
|
||||
echo ' <option value="' . $temp_charset . '"';
|
||||
if ($temp_charset == $charset) {
|
||||
echo ' selected="selected"';
|
||||
}
|
||||
echo '>' . $temp_charset . '</option>' . "\n";
|
||||
}
|
||||
echo ' </select>' . "\n" . ' ';
|
||||
} // end if (recoding)
|
||||
else if (PMA_MYSQL_INT_VERSION >= 40100) {
|
||||
echo $strCharsetOfFile . "\n"
|
||||
. PMA_generateCharsetDropdownBox(PMA_CSDROPDOWN_CHARSET, 'charset_of_file', NULL, 'utf8', FALSE);
|
||||
}
|
||||
echo ' </td>' . "\n"
|
||||
. ' <td align="right"' . $queryframe_thcolspan . '><input type="submit" name="SQL" value="' . $strGo . '" /></td>' . "\n"
|
||||
. ' </tr>' . "\n\n";
|
||||
}
|
||||
|
||||
// Bookmark Support
|
||||
$bookmark_go = FALSE;
|
||||
if (!isset($is_inside_querywindow) ||
|
||||
(isset($is_inside_querywindow) && $is_inside_querywindow == TRUE && isset($querydisplay_tab) && ($querydisplay_tab == 'history' || $querydisplay_tab == 'full'))) {
|
||||
if ($cfg['Bookmark']['db'] && $cfg['Bookmark']['table']) {
|
||||
if (($bookmark_list = PMA_listBookmarks($db, $cfg['Bookmark'])) && count($bookmark_list) > 0) {
|
||||
$form_items++;
|
||||
echo ' <tr><td' . $queryframe_thcolspan . '><img src="' . $GLOBALS['pmaThemeImage'] . 'spacer.png' . '" width="1" height="1" border="0" alt="" /></td></tr>' . "\n";
|
||||
echo ' <tr><td' . $queryframe_thcolspan . ' class="tblHeaders">' . "\n";
|
||||
echo " " . ((isset($is_inside_querywindow) && $is_inside_querywindow == TRUE && isset($querydisplay_tab) && $querydisplay_tab == 'full') || !isset($is_inside_querywindow) ? "<i>$strOr</i>" : '') . " $strBookmarkQuery: \n";
|
||||
echo ' </td></tr>' . "\n";
|
||||
if (isset($is_inside_querywindow) && $is_inside_querywindow == TRUE) {
|
||||
$querybox_hidden_fields .= ' <input type="hidden" name="focus_querywindow" value="true" />' . "\n";
|
||||
}
|
||||
|
||||
echo ' <tr bgcolor="' .$cfg['BgcolorOne'] . '"><td' . $queryframe_tdcolspan . '>' . "\n";
|
||||
echo ' <select name="id_bookmark" style="vertical-align: middle">' . "\n";
|
||||
echo ' <option value=""></option>' . "\n";
|
||||
foreach($bookmark_list AS $key => $value) {
|
||||
echo ' <option value="' . htmlspecialchars($key) . '">' . htmlspecialchars($value) . '</option>' . "\n";
|
||||
}
|
||||
echo ' </select>' . " \n";
|
||||
echo ' ' . $strVar;
|
||||
echo ' ' . $cfg['ReplaceHelpImg'] ? '<a href="./Documentation.html#faqbookmark" target="documentation"><img src="' . $pmaThemeImage . 'b_help.png" width="11" height="11" align="middle" alt="' . $strDocu . '" hspace="2" border="0" /></a>' : '(<a href="./Documentation.html#faqbookmark" target="documentation">' . $strDocu . '</a>)';
|
||||
echo ': <input type="text" name="bookmark_variable" class="textfield" size="10" style="vertical-align: middle" /><br />' . "\n";
|
||||
echo ' <input type="radio" name="action_bookmark" value="0" id="radio_bookmark0" checked="checked" style="vertical-align: middle" /><label for="radio_bookmark0">' . $strSubmit . '</label>' . "\n";
|
||||
echo ' <input type="radio" name="action_bookmark" value="1" id="radio_bookmark1" style="vertical-align: middle" /><label for="radio_bookmark1">' . $strBookmarkView . '</label>' . "\n";
|
||||
echo ' <input type="radio" name="action_bookmark" value="2" id="radio_bookmark2" style="vertical-align: middle" /><label for="radio_bookmark2">' . $strDelete . '</label>' . "\n";
|
||||
echo ' <br />' . "\n";
|
||||
echo ' </td>' . "\n";
|
||||
echo ' <td valign="bottom" align="right">' . "\n";
|
||||
echo ' <input type="submit" name="SQL" value="' . $strGo . '" />';
|
||||
echo ' </td></tr>' . "\n";
|
||||
$bookmark_go = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!isset($is_inside_querywindow) || (isset($is_inside_querywindow) && $is_inside_querywindow == TRUE && isset($querydisplay_tab) && (($querydisplay_tab == 'files') || $querydisplay_tab == 'sql' || $querydisplay_tab == 'full' || ($querydisplay_tab == 'history' && $bookmark_go)))) {
|
||||
if ($form_items > 0) {
|
||||
if ( $cfg['Bookmark']['db']
|
||||
&& $cfg['Bookmark']['table']
|
||||
&& (!isset($is_inside_querywindow)
|
||||
|| ( isset($is_inside_querywindow)
|
||||
&& $is_inside_querywindow == TRUE
|
||||
&& isset($querydisplay_tab)
|
||||
//&& $querydisplay_tab != 'history'))) {
|
||||
&& $querydisplay_tab == 'sql'))) {
|
||||
?>
|
||||
<tr><td<?php echo $queryframe_thcolspan; ?>><img src="<?php echo $GLOBALS['pmaThemeImage'] . 'spacer.png'; ?>" border="0" width="1" height="1" alt="" /></td></tr>
|
||||
<tr><th<?php echo $queryframe_thcolspan; ?> align="left"><?php echo $strBookmarkThis; ?>:</th></tr>
|
||||
<tr bgcolor="<?php echo $cfg['BgcolorTwo']; ?>">
|
||||
<td<?php echo $queryframe_thcolspan; ?>>
|
||||
<b><?php echo $strBookmarkOptions; ?>:</b>
|
||||
</td>
|
||||
</tr>
|
||||
<tr bgcolor="<?php echo $cfg['BgcolorOne']; ?>">
|
||||
<td<?php echo $queryframe_thcolspan; ?>>
|
||||
<?php echo $strBookmarkLabel; ?>: <input type="text" name="bkm_label" value="" /><br />
|
||||
<input type="checkbox" name="bkm_all_users" id="id_bkm_all_users" value="true" /><label for="id_bkm_all_users"><?php echo $strBookmarkAllUsers; ?></label>
|
||||
</td>
|
||||
</tr>
|
||||
<tr bgcolor="<?php echo $cfg['BgcolorOne']; ?>">
|
||||
<td align="right"<?php echo $queryframe_thcolspan; ?>>
|
||||
<input type="submit" name="SQLbookmark" value="<?php echo $strGo . ' & ' . $strBookmarkThis; ?>" onclick="if(document.forms['sqlform'].elements['bkm_label'].value==''){ alert('<?php echo addslashes($strInsertBookmarkTitle); ?>');forms['sqlform'].elements['bkm_label'].focus();return false; }"/>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
} else {
|
||||
echo ' <tr><td' . $queryframe_thcolspan . '>' . "\n";
|
||||
// TODO: Add a more complete warning that no items (like for file import) where found.
|
||||
// (After 2.5.2 release!)
|
||||
echo $strWebServerUploadDirectoryError;
|
||||
echo ' </td></tr>' . "\n";
|
||||
}
|
||||
}
|
||||
echo ' <tr><td' . $queryframe_thcolspan . ' height="1">' . "\n";
|
||||
echo $querybox_hidden_fields;
|
||||
echo ' </td></tr>';
|
||||
if ($upload_dir_error!='') {
|
||||
echo $upload_dir_error;
|
||||
}
|
||||
?>
|
||||
</table>
|
||||
</form>
|
||||
|
||||
<?php
|
||||
//if (!isset($is_inside_querywindow) || !$is_inside_querywindow) echo "</li>\n";
|
||||
if (!isset($is_inside_querywindow) ||
|
||||
(isset($is_inside_querywindow) && $is_inside_querywindow == TRUE && isset($querydisplay_tab) && ($querydisplay_tab == 'files' || $querydisplay_tab == 'full')) && isset($db) && $db != '') {
|
||||
|
||||
// loic1: displays import dump feature only if file upload available
|
||||
$ldi_target = 'ldi_table.php?' . $url_query . (isset($is_inside_querywindow) && $is_inside_querywindow == TRUE ? '&focus_querywindow=true' : '');
|
||||
|
||||
if ($is_upload && isset($db) && isset($table)) {
|
||||
//if (!isset($is_inside_querywindow) || !$is_inside_querywindow) echo "<li>\n";
|
||||
if ($cfg['PropertiesIconic']) {
|
||||
$imgInsertTextfiles = '<img src="' . $pmaThemeImage. 'b_tblimport.png" '
|
||||
. 'width="16" height="16" hspace="2" border="0" align="middle" alt="' . $strInsertTextfiles. '" />';
|
||||
}else{
|
||||
$imgInsertTextfiles = '';
|
||||
}
|
||||
?>
|
||||
<!-- Insert a text file -->
|
||||
<?php
|
||||
if ($cfg['QueryFrame'] && $cfg['QueryFrameJS']) {
|
||||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
<!--
|
||||
document.writeln('<a href="<?php echo (isset($is_inside_querywindow) && $is_inside_querywindow == TRUE ? '#' : $ldi_target); ?>" <?php echo (isset($is_inside_querywindow) && $is_inside_querywindow == TRUE ? 'onclick="opener.parent.frames.phpmain\' + opener.parent.frames.queryframe.document.hashform.hash.value + \'.location.href = \\\'' . $ldi_target . '\\\'; return false;"' : ''); ?>><?php echo addslashes($imgInsertTextfiles . $strInsertTextfiles); ?></a>');
|
||||
//-->
|
||||
</script>
|
||||
|
||||
<?php
|
||||
} else {
|
||||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
<!--
|
||||
document.writeln('<a href="<?php echo (isset($is_inside_querywindow) && $is_inside_querywindow == TRUE ? '#' : $ldi_target); ?>" <?php echo (isset($is_inside_querywindow) && $is_inside_querywindow == TRUE ? 'onclick="opener.parent.frames.phpmain' . md5($cfg['PmaAbsoluteUri']) . '.location.href = \\\'' . $ldi_target . '\\\'; return false;"' : ''); ?>><?php echo addslashes($imgInsertTextfiles . $strInsertTextfiles); ?></a>');
|
||||
//-->
|
||||
</script>
|
||||
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
<noscript>
|
||||
<a href="<?php echo $ldi_target; ?>"><?php
|
||||
echo $imgInsertTextfiles . $strInsertTextfiles;
|
||||
?></a>
|
||||
</noscript>
|
||||
<?php
|
||||
//if (!isset($is_inside_querywindow) || !$is_inside_querywindow) echo "</li>\n";
|
||||
}
|
||||
}
|
||||
echo "\n";
|
||||
PMA_sqlQueryForm( $query_to_display, $querydisplay_tab );
|
||||
?>
|
||||
|
Reference in New Issue
Block a user