' . "\n"; } if ($is_querywindow) { $html .= '' . "\n"; if ($display_tab != 'sql' && $display_tab != 'full') { $html .= '' . "\n"; $html .= '' . "\n"; } } $html .= '' . "\n" . PMA_URL_getHiddenInputs($db, $table) . "\n" .'' . "\n" .'' . "\n" .'' . "\n" .'' . "\n"; // display querybox if ($display_tab === 'full' || $display_tab === 'sql') { $html .= PMA_getHtmlForSqlQueryFormInsert( $query, $is_querywindow, $delimiter ); } // display uploads if ($display_tab === 'files' && $GLOBALS['is_upload']) { $html .= PMA_getHtmlForSqlQueryFormUpload(); } // Bookmark Support if ($display_tab === 'full' || $display_tab === 'history') { if (! empty($GLOBALS['cfg']['Bookmark'])) { $html .= PMA_getHtmlForSqlQueryFormBookmark(); } } // Encoding setting form appended by Y.Kawada if (function_exists('PMA_Kanji_encodingForm')) { $html .= PMA_Kanji_encodingForm(); } $html .= '' . "\n"; // print an empty div, which will be later filled with // the sql query results by ajax $html .= '
'; return $html; } /** * return HTML for Sql Query Form Insert * * @param string $query query to display in the textarea * @param boolean $is_querywindow if inside querywindow or not * @param string $delimiter default delimiter to use * * @return string * * @usedby PMA_getHtmlForSqlQueryForm() */ function PMA_getHtmlForSqlQueryFormInsert( $query = '', $is_querywindow = false, $delimiter = ';' ) { // enable auto select text in textarea if ($GLOBALS['cfg']['TextareaAutoSelect']) { $auto_sel = ' onclick="selectContent(this, sql_box_locked, true);"'; } else { $auto_sel = ''; } // enable locking if inside query window if ($is_querywindow) { $locking = ' onkeypress="document.sqlform.elements[\'LockFromUpdate\'].' .'checked = true;"'; $height = $GLOBALS['cfg']['TextareaRows'] * 1.25; } else { $locking = ''; $height = $GLOBALS['cfg']['TextareaRows'] * 2; } $table = ''; $db = ''; $fields_list = array(); if (! strlen($GLOBALS['db'])) { // prepare for server related $legend = sprintf( __('Run SQL query/queries on server %s'), '"' . htmlspecialchars( ! empty($GLOBALS['cfg']['Servers'][$GLOBALS['server']]['verbose']) ? $GLOBALS['cfg']['Servers'][$GLOBALS['server']]['verbose'] : $GLOBALS['cfg']['Servers'][$GLOBALS['server']]['host'] ) . '"' ); } elseif (! strlen($GLOBALS['table'])) { // prepare for db related $db = $GLOBALS['db']; // if you want navigation: $tmp_db_link = ''; // else use // $tmp_db_link = htmlspecialchars($db); $legend = sprintf(__('Run SQL query/queries on database %s'), $tmp_db_link); if (empty($query)) { $query = PMA_Util::expandUserString( $GLOBALS['cfg']['DefaultQueryDatabase'], 'backquote' ); } } 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 = $GLOBALS['dbi']->getColumns( $db, $GLOBALS['table'], null, true ); $tmp_db_link = ''; // else use // $tmp_db_link = htmlspecialchars($db); $legend = sprintf(__('Run SQL query/queries on database %s'), $tmp_db_link); if (empty($query)) { $query = PMA_Util::expandUserString( $GLOBALS['cfg']['DefaultQueryTable'], 'backquote' ); } } $legend .= ': ' . PMA_Util::showMySQLDocu('SELECT'); if (count($fields_list)) { $sqlquerycontainer_id = 'sqlquerycontainer'; } else { $sqlquerycontainer_id = 'sqlquerycontainerfull'; } $html = '' . '
' . '
'; $html .= '' . $legend . ''; $html .= '
'; $html .= '
' . ''; // Add buttons to generate query easily for // select all, single select, insert, update and delete if (count($fields_list)) { $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; } $html .= ''; $html .= '
' . "\n"; if (count($fields_list)) { $html .= '
' . '' . '' . '
'; if (PMA_Util::showIcons('ActionLinksMode')) { $html .= ''; } else { $html .= ''; } $html .= '
' . "\n" .'
' . "\n"; } $html .= '
' . "\n"; $html .= '
' . "\n"; if (! empty($GLOBALS['cfg']['Bookmark'])) { $html .= '
'; $html .= '
'; $html .= ''; $html .= ''; $html .= '
'; $html .= '
'; $html .= ''; $html .= ''; $html .= '
'; $html .= '
'; $html .= ''; $html .= ''; $html .= '
'; $html .= '
'; } $html .= '
' . "\n"; $html .= '
' . "\n" .'
' . "\n"; $html .= '
' . "\n"; $html .= '
' . "\n"; if ($is_querywindow) { $html .= ' '; } $html .= '
' . "\n"; $html .= '
' . "\n"; $html .= '' . "\n"; $html .= ' ]'; $html .= '' . ''; if (! $is_querywindow) { $html .= '' . ''; } $html .= '
' . "\n"; $html .= '' . "\n"; $html .= '
' . "\n"; $html .= '
' . "\n"; return $html; } /** * return HTML for sql Query Form Bookmark * * @return string|void * * @usedby PMA_getHtmlForSqlQueryForm() */ function PMA_getHtmlForSqlQueryFormBookmark() { $bookmark_list = PMA_Bookmark_getList($GLOBALS['db']); if (! $bookmark_list || count($bookmark_list) < 1) { return; } $html = '
'; $html .= ''; $html .= __('Bookmarked SQL query') . '' . "\n"; $html .= '
'; $html .= ' ' . "\n"; $html .= '
' . "\n"; $html .= '
' . "\n"; $html .= __('Variable'); $html .= PMA_Util::showDocu('faq', 'faqbookmark'); $html .= '' . "\n"; $html .= '
' . "\n"; $html .= '
' . "\n"; $html .= '' .'' . "\n"; $html .= '' .'' . "\n"; $html .= '' .'' . "\n"; $html .= '
' . "\n"; $html .= '
' . "\n"; $html .= '
' . "\n"; $html .= '
' . "\n"; $html .= ''; $html .= '
' . "\n"; $html .= '
' . "\n"; return $html; } /** * return HTML for Sql Query Form Upload * * @return string * * @usedby PMA_getHtmlForSqlQueryForm() */ function PMA_getHtmlForSqlQueryFormUpload() { global $timeout_passed, $local_import_file; $errors = array(); // we allow only SQL here $matcher = '@\.sql(\.(' . PMA_supportedDecompressions() . '))?$@'; if (!empty($GLOBALS['cfg']['UploadDir'])) { $files = PMA_getFileSelectOptions( PMA_Util::userDir($GLOBALS['cfg']['UploadDir']), $matcher, (isset($timeout_passed) && $timeout_passed && isset($local_import_file)) ? $local_import_file : '' ); } else { $files = ''; } // start output $html = '
'; $html .= ''; $html .= __('Browse your computer:') . ''; $html .= '
'; $html .= ' '; $html .= PMA_Util::getFormattedMaximumUploadSize($GLOBALS['max_upload_size']); // some browsers should respect this :) $html .= PMA_Util::generateHiddenMaxFileSize($GLOBALS['max_upload_size']) . "\n"; $html .= '
'; if ($files === false) { $errors[] = PMA_Message::error( __('The directory you set for upload work cannot be reached.') ); } elseif (!empty($files)) { $html .= '
'; $html .= '' . __('web server upload directory:') .'' . "\n"; $html .= '' . "\n"; $html .= '
'; } $html .= '
' . "\n"; $html .= '
'; $html .= '
'; $html .= __('Character set of the file:') . "\n"; $html .= PMA_generateCharsetDropdownBox( PMA_CSDROPDOWN_CHARSET, 'charset_of_file', null, 'utf8', false ); $html .= '' . "\n"; $html .= '
' . "\n"; $html .= '
'; foreach ($errors as $error) { $html .= $error->getDisplay(); } return $html; } ?>