name="sqlform" onsubmit="this.target=window.opener.frames[1].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' && $GLOBALS['is_upload'] ) { PMA_sqlQueryFormUpload(); } // Bookmark Support if ( $display_tab === 'full' || $display_tab === 'history' ) { if ( ! empty( $GLOBALS['cfg']['Bookmark'] ) && $GLOBALS['cfg']['Bookmark']['db'] && $GLOBALS['cfg']['Bookmark']['table'] ) { PMA_sqlQueryFormBookmark(); } } // 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="selectContent( this, sql_box_locked, true )"'; } 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 = ''; // 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 = ''; // 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( 'SQL-Syntax', '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() */ function PMA_sqlQueryFormBookmark() { $bookmark_list = PMA_listBookmarks(isset($GLOBALS['db']) ? $GLOBALS['db'] : '', $GLOBALS['cfg']['Bookmark'] ); if ( ! $bookmark_list || 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_supportedDecompressions() * @uses PMA_getFileSelectOptions() * @uses PMA_displayMaximumUploadSize() * @uses PMA_generateCharsetDropdownBox() * @uses PMA_generateHiddenMaxFileSize() * @uses PMA_MYSQL_INT_VERSION * @uses PMA_CSDROPDOWN_CHARSET * @uses empty() */ function PMA_sqlQueryFormUpload() { $errors = array (); $matcher = '@\.sql(\.(' . PMA_supportedDecompressions() . '))?$@'; // we allow only SQL here if (!empty($GLOBALS['cfg']['UploadDir'])) { $files = PMA_getFileSelectOptions(PMA_userDir($GLOBALS['cfg']['UploadDir']), $matcher, (isset($timeout_passed) && $timeout_passed && isset($local_import_file)) ? $local_import_file : ''); } else { $files = ''; } // 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 ($files === FALSE) { $errors[$GLOBALS['strError']] = $GLOBALS['strWebServerUploadDirectoryError']; } elseif (!empty($files)) { echo '
'; echo '' . $GLOBALS['strWebServerUploadDirectory'] .':' . "\n"; echo '' . "\n"; echo '
'; } 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 . '
'; } } ?>