3 // vim: expandtab sw=4 ts=4 sts=4:
9 require('./db_details_common.php');
10 $url_query .= '&goto=db_details.php';
16 if (isset($show_query) && $show_query == '1') {
17 // This script has been called by read_dump.php
18 if (isset($sql_query_cpy)) {
19 $query_to_display = $sql_query_cpy;
23 $query_to_display = $sql_query;
26 $query_to_display = '';
31 * Gets informations about the database and, if it is empty, move to the
32 * "db_details_structure.php" script where table can be created
35 require('./db_details_db_info.php');
36 if ($num_tables == 0 && empty($db_query_force)) {
38 require('./db_details_structure.php');
42 // loic1: defines wether file upload is available or not
43 // (now defined in common.lib.php)
45 $auto_sel = ($cfg['TextareaAutoSelect']
46 // 2003-02-05 rabus: This causes big trouble with Opera 7 for
47 // Windows, so let's disable it there...
48 && !(PMA_USR_OS
== 'Win' && PMA_USR_BROWSER_AGENT
== 'OPERA' && PMA_USR_BROWSER_VER
>= 7))
49 ?
"\n" . ' onfocus="if (typeof(document.layers) == \'undefined\' || typeof(textarea_selected) == \'undefined\') {textarea_selected = 1; this.form.elements[\'sql_query\'].select();}"'
53 // for better administration
54 $strHiddenFields = ' <input type="hidden" name="is_js_confirmed" value="0" />' ."\n"
55 . ' ' .PMA_generate_common_hidden_inputs($db) . "\n"
56 . ' <input type="hidden" name="pos" value="0" />' . "\n"
57 . ' <input type="hidden" name="goto" value="db_details.php" />' . "\n"
58 . ' <input type="hidden" name="zero_rows" value="' . htmlspecialchars($strSuccess) . '" />' . "\n"
59 . ' <input type="hidden" name="prev_sql_query" value="' . ((!empty($query_to_display)) ?
htmlspecialchars($query_to_display) : '') . '" />' . "\n";
61 <!-- Query box
, sql file loader
and bookmark support
-->
62 <form method
="post" action
="read_dump.php"<?php
if ($is_upload) echo ' enctype="multipart/form-data"'; ?
> onsubmit
="return checkSqlQuery(this)" name
="sqlform">
64 echo $strHiddenFields;
66 <a name
="querybox"></a
>
67 <table border
="0" cellpadding
="2" cellspacing
="0">
68 <tr
><td
class="tblHeaders" colspan
="2">
70 // if you want navigation:
71 $strDBLink = '<a href="' . $GLOBALS['cfg']['DefaultTabDatabase'] . $header_url_qry . '&db=' . urlencode($db) . '">'
72 . htmlspecialchars($db) . '</a>';
74 // $strDBLink = htmlspecialchars($db);
75 echo ' ' . sprintf($strRunSQLQuery, $strDBLink) . ': ' . PMA_showMySQLDocu('Reference', 'SELECT');
79 <tr align
="center" bgcolor
="<?php echo $cfg['BgcolorOne']; ?>"><td colspan
="2">
80 <textarea name
="sql_query" cols
="<?php echo $cfg['TextareaCols'] * 2; ?>" rows
="<?php echo $cfg['TextareaRows']; ?>" dir
="<?php echo $text_dir; ?>"<?php
echo $auto_sel; ?
>>
82 if (!empty($query_to_display)) {
83 echo htmlspecialchars($query_to_display);
85 echo htmlspecialchars(str_replace('%d', PMA_backquote($db), $cfg['DefaultQueryDatabase']));
89 <tr
class="tblFooters">
91 <input type
="checkbox" name
="show_query" value
="1" id
="checkbox_show_query" checked
="checked" /><label
for="checkbox_show_query"><?php
echo $strShowThisQuery; ?
></label
>
93 <td align
="right"><input type
="submit" name
="SQL" value
="<?php echo $strGo; ?>" /></td
>
96 // loic1: displays import dump feature only if file upload available
99 <tr
><td colspan
="2"><img src
="<?php echo $GLOBALS['pmaThemeImage'] . 'spacer.png'; ?>" width
="1" height
="1" border
="0" alt
="" /></td
></tr
>
101 <td colspan
="2" class="tblHeaders">
102 <i
><?php
echo $strOr; ?
></i
>
103 <b
><?php
echo $strLocationTextfile; ?
>:</b
>
106 <tr bgcolor
="<?php echo $cfg['BgcolorOne']; ?>">
107 <td colspan
="2" align
="center">
108 <input type
="file" name
="sql_file" class="textfield" /> 
;
110 echo PMA_displayMaximumUploadSize($max_upload_size) . '<br />';
111 // some browsers should respect this :)
112 echo ' ' . PMA_generateHiddenMaxFileSize($max_upload_size) . "\n";
113 $is_gzip = ($cfg['GZipDump'] && @function_exists
('gzopen'));
114 $is_bzip = ($cfg['BZipDump'] && @function_exists
('bzdecompress'));
115 if ($is_bzip ||
$is_gzip) {
118 . '<tr bgcolor="' . $cfg['BgcolorOne'] . '">' . "\n"
119 . ' <td colspan="2">' . "\n";
120 echo ' ' . $strCompression . ':<br /> ' . "\n"
121 . ' <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"
122 . ' <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";
124 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";
127 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";
131 <input type
="hidden" name
="sql_file_compression" value
="text/plain" />
136 } // end if (is upload)
137 // web-server upload directory
138 $is_upload_dir = false;
139 if (!empty($cfg['UploadDir'])) {
140 if (substr($cfg['UploadDir'], -1) != '/') {
141 $cfg['UploadDir'] .= '/';
143 if ($handle = @opendir
($cfg['UploadDir'])) {
145 while ($file = @readdir
($handle)) {
146 if (is_file($cfg['UploadDir'] . $file) && PMA_checkFileExtensions($file, '.sql')) {
147 if ($is_first == 0) {
148 $is_upload_dir = true;
150 echo ' <tr><td colspan=2" bgcolor="' . $cfg['BgcolorTwo'] . '">' . "\n";
151 echo ' <b>' . $strWebServerUploadDirectory . ':</b> ' . "\n";
152 echo ' </td></tr>' . "\n";
153 echo ' <tr bgcolor="' . $cfg['BgcolorOne'] . '"><td colspan="2">' . "\n";
154 // add 2004-05-08 by mkkeck
155 // todo: building a php script for indexing files in UploadDir
156 //if ($cfg['UploadDirIndex']) {
157 // echo ' <a href="' . $cfg['UploadDir'] . '" target="_blank">' . $cfg['UploadDir'] . '</a> ';
160 echo ' <select size="1" name="sql_localfile">' . "\n";
161 echo ' <option value="" selected="selected"></option>' . "\n";
162 } // end if (is_first)
163 echo ' <option value="' . htmlspecialchars($file) . '">' . htmlspecialchars($file) . '</option>' . "\n";
165 } // end if (is_file)
168 echo ' </select>' . "\n"
171 } // end if (isfirst > 0)
175 $upload_dir_error = '<tr><td colspan="2"><img src="' .$GLOBALS['pmaThemeImage'] . 'spacer.png' . '" width="1" height="1" border="0" alt="" /></td></tr>' . "\n"
176 . '<tr><th colspan="2" class="tblHeadError"><div class="errorhead">' . $strError . '</div></th></tr>' . "\n"
177 . '<tr><td colspan="2" class="tblError">' . $strWebServerUploadDirectoryError
178 . '</td></tr>' . "\n";
180 } // end if (web-server upload directory)
181 // Charset conversion options
182 if ($is_upload ||
$is_upload_dir) {
183 echo ' <tr class="tblFooters"><td>' . "\n";
184 if (PMA_MYSQL_INT_VERSION
< 40100 && $cfg['AllowAnywhereRecoding'] && $allow_recoding) {
185 $temp_charset = reset($cfg['AvailableCharsets']);
186 echo ' ' . $strCharsetOfFile . "\n"
187 . ' <select name="charset_of_file" size="1">' . "\n"
188 . ' <option value="' . $temp_charset . '"';
189 if ($temp_charset == $charset) {
190 echo ' selected="selected"';
192 echo '>' . $temp_charset . '</option>' . "\n";
193 while ($temp_charset = next($cfg['AvailableCharsets'])) {
194 echo ' <option value="' . $temp_charset . '"';
195 if ($temp_charset == $charset) {
196 echo ' selected="selected"';
198 echo '>' . $temp_charset . '</option>' . "\n";
200 echo ' </select><br />' . "\n" . ' ';
201 } elseif (PMA_MYSQL_INT_VERSION
>= 40100) {
202 echo $strCharsetOfFile . "\n";
203 echo PMA_generateCharsetDropdownBox(PMA_CSDROPDOWN_CHARSET
, 'charset_of_file', NULL, 'utf8', FALSE);
204 } // end if (recoding)
205 echo ' </td>' . "\n";
206 echo ' <td align="right"><input type="submit" name="SQL" value="' . $strGo . '" /></td>' . "\n";
207 echo ' </tr>' . "\n";
210 if ($cfg['Bookmark']['db'] && $cfg['Bookmark']['table']) {
211 if (($bookmark_list = PMA_listBookmarks($db, $cfg['Bookmark'])) && count($bookmark_list) > 0) {
212 echo ' <tr><td colspan="2"><img src="' .$GLOBALS['pmaThemeImage'] . 'spacer.png' . '" width="1" height="1" border="0" alt="" /></td></tr>' . "\n";
213 echo ' <tr><td colspan="2" class="tblHeaders"> <i>' . $strOr . '</i></td></tr>' . "\n";
214 echo ' <tr bgcolor="' . $cfg['BgcolorOne'] . '"><td colspan="2">' . "\n";
215 echo ' <b>' . $strBookmarkQuery . ':</b> ' . "\n";
216 echo ' <select name="id_bookmark">' . "\n";
217 echo ' <option value=""></option>' . "\n";
218 foreach ($bookmark_list AS $key => $value) {
219 echo ' <option value="' . htmlspecialchars($key) . '">' . htmlspecialchars($value) . '</option>' . "\n";
221 echo ' </select>' . "\n";
222 echo ' </td></tr><tr bgcolor="' . $cfg['BgcolorOne'] . '"><td colspan="2">';
223 echo ' ' . $strVar . ' ';
224 if ($cfg['ReplaceHelpImg']){
225 echo '<a href="./Documentation.html#faqbookmark" target="documentation">'
226 . '<img src="' .$pmaThemeImage . 'b_help.png" border="0" width="11" height="11" align="middle" alt="' . $strDocu . '" /></a>';
228 echo '(<a href="./Documentation.html#faqbookmark" target="documentation">' . $strDocu . '</a>): ';
230 echo ' <input type="text" name="bookmark_variable" class="textfield" size="10" />' . "\n";
231 echo ' </td></tr><tr bgcolor="' . $cfg['BgcolorOne'] . '"><td>';
232 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";
233 echo ' <input type="radio" name="action_bookmark" value="1" id="radio_bookmark1" style="vertical-align: middle" /><label for="radio_bookmark1">' . $strBookmarkView . '</label>' . "\n";
234 echo ' <input type="radio" name="action_bookmark" value="2" id="radio_bookmark2" style="vertical-align: middle" /><label for="radio_bookmark2">' . $strDelete . '</label>' . "\n";
235 echo ' </td>' . "\n";
236 echo ' <td align="right"><input type="submit" name="SQL" value="' . $strGo . '" /></td>';
237 echo ' </tr>' . "\n";
241 // Encoding setting form appended by Y.Kawada
242 if (function_exists('PMA_set_enc_form')) {
243 echo PMA_set_enc_form(' ');
245 // modified by mkkeck 2004-05-08
246 // showing UploadDir Error at the end of all option for SQL-Queries
247 if (isset($upload_dir_error)) {
248 echo $upload_dir_error;
255 * Displays the footer
258 require_once('./footer.inc.php');