name="sqlform" onsubmit="this.target=window.opener.parent.frames[2].name; return checkSqlQuery(this);" > ' . "\n"; } if ( $is_querywindow ) { echo '' ."\n"; if ( $display_tab != 'sql' && $display_tab != 'full' ) { echo '' . "\n"; echo '' . "\n"; } } echo '' . "\n" .PMA_generate_common_hidden_inputs( $db, $table ) . "\n" .'' . "\n" .'' . "\n" .'' . "\n" .'' . "\n"; // display querybox if ( $display_tab === 'full' || $display_tab === 'sql' ) { PMA_sqlQueryFormInsert( $query, $is_querywindow ); } // display uploads if ( $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 '
' . "\n"; } /** * prints querybox fieldset * * @usedby PMA_sqlQueryForm() * @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() * @param string $query query to display in the textarea * @param boolean $is_querywindow if inside querywindow or not */ 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 = '' . htmlspecialchars( $db ) . ''; // 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 = '' . htmlspecialchars( $db ) . ''; // 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 '' . "\n" .'
' . "\n" .'
' . "\n"; echo '' . $legend . '' . "\n"; echo '
' . "\n"; echo '
' . "\n" .'' . "\n"; echo '
' . "\n"; if ( count( $fields_list ) ) { echo '
' . "\n" .'' . "\n" .'' . "\n" .'
' . "\n"; if ( $GLOBALS['cfg']['PropertiesIconic'] ) { echo '' . "\n"; } else { echo '' . "\n"; } echo '
' . "\n" .'
' . "\n"; } echo '
' . "\n"; echo '
' . "\n"; if ( ! empty( $GLOBALS['cfg']['Bookmark'] ) && $GLOBALS['cfg']['Bookmark']['db'] && $GLOBALS['cfg']['Bookmark']['table'] ) { ?>
' . "\n"; echo '' . "\n" .'' . "\n"; echo '
' . "\n"; echo '
' . "\n"; if ( $is_querywindow ) { ?> ' . "\n"; echo '
' . "\n"; echo '' . "\n" .'' . "\n"; echo '
' . "\n"; echo '' ."\n"; echo '
' . "\n"; echo '
' . "\n"; } /** * prints bookmark fieldset * * @usedby PMA_sqlQueryForm() * @uses PMA_listBookmarks() * @uses $GLOBALS['db'] * @uses $GLOBALS['pmaThemeImage'] * @uses $GLOBALS['cfg']['Bookmark'] * @uses $GLOBALS['cfg']['ReplaceHelpImg'] * @uses $GLOBALS['strBookmarkQuery'] * @uses $GLOBALS['strBookmarkView'] * @uses $GLOBALS['strDelete'] * @uses $GLOBALS['strDocu'] * @uses $GLOBALS['strGo'] * @uses $GLOBALS['strSubmit'] * @uses $GLOBALS['strVar'] * @uses count() * @uses htmlspecialchars() * @param string $display_tab current tab displayed if in querywindow */ function PMA_sqlQueryFormBookmark( $display_tab = 'full' ) { $bookmark_list = PMA_listBookmarks( $GLOBALS['db'], $GLOBALS['cfg']['Bookmark'] ); if ( count( $bookmark_list ) < 1 ) { return; } echo '
'; echo ''; echo $GLOBALS['strBookmarkQuery'] . '' . "\n"; echo '
'; echo ' ' . "\n"; echo '
' . "\n"; echo '
' . "\n"; echo $GLOBALS['strVar']; if ( $GLOBALS['cfg']['ReplaceHelpImg'] ) { echo ' ' .'' . $GLOBALS['strDocu'] . ' '; } else { echo ' (' . $GLOBALS['strDocu'] . '): '; } echo '' . "\n"; echo '
' . "\n"; echo '
' . "\n"; echo '' .'' . "\n"; echo '' .'' . "\n"; echo '' .'' . "\n"; echo '
' . "\n"; echo '
' . "\n"; echo '
' . "\n"; echo '
' . "\n"; echo ''; echo '
' . "\n"; echo '
' . "\n"; } /** * prints bookmark fieldset * * @usedby PMA_sqlQueryForm() * @uses $GLOBALS['cfg']['GZipDump'] * @uses $GLOBALS['cfg']['BZipDump'] * @uses $GLOBALS['cfg']['UploadDir'] * @uses $GLOBALS['cfg']['AvailableCharsets'] * @uses $GLOBALS['cfg']['AllowAnywhereRecoding'] * @uses $GLOBALS['strAutodetect'] * @uses $GLOBALS['strBzip'] * @uses $GLOBALS['strCharsetOfFile'] * @uses $GLOBALS['strCompression'] * @uses $GLOBALS['strError'] * @uses $GLOBALS['strGo'] * @uses $GLOBALS['strGzip'] * @uses $GLOBALS['strLocationTextfile'] * @uses $GLOBALS['strWebServerUploadDirectory'] * @uses $GLOBALS['strWebServerUploadDirectoryError'] * @uses $GLOBALS['allow_recoding'] * @uses $GLOBALS['charset'] * @uses $GLOBALS['max_upload_size'] * @uses PMA_checkFileExtensions() * @uses PMA_displayMaximumUploadSize() * @uses PMA_generateCharsetDropdownBox() * @uses PMA_generateHiddenMaxFileSize() * @uses PMA_MYSQL_INT_VERSION * @uses PMA_CSDROPDOWN_CHARSET * @uses closedir() * @uses count() * @uses function_exists() * @uses htmlspecialchars() * @uses opendir() * @uses readdir() * @param string $display_tab current tab displayed if in querywindow */ 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 '
'; echo ''; echo $GLOBALS['strLocationTextfile'] . ''; echo '
'; echo ' '; echo PMA_displayMaximumUploadSize( $GLOBALS['max_upload_size'] ); // some browsers should respect this :) echo PMA_generateHiddenMaxFileSize( $GLOBALS['max_upload_size'] ) . "\n"; echo '
'; if ( $is_bzip || $is_gzip ) { echo '
'; echo $GLOBALS['strCompression'] . ': ' . "\n" .'' .'' . "\n" .'' .'' . "\n"; if ( $is_gzip ) { echo '' .'' . "\n"; } if ( $is_bzip ) { echo '' .'' . "\n"; } echo '
'; } else { echo ''; } if ( count( $uploaded_files ) > 0 ) { echo '' . $GLOBALS['strWebServerUploadDirectory'] .':' . "\n"; echo '' . "\n"; } echo '
' . "\n"; echo '
'; echo '
'; if ( PMA_MYSQL_INT_VERSION < 40100 && $GLOBALS['cfg']['AllowAnywhereRecoding'] && $GLOBALS['allow_recoding'] ) { echo $GLOBALS['strCharsetOfFile'] . "\n" . '' . "\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 '' . "\n"; echo '
' . "\n"; echo '
'; foreach( $errors as $error => $message ) { echo '
' . $error . '
'; echo '
' . $message . '
'; } } ?>