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();}"'
52 <!-- Query box
, sql file loader
and bookmark support
-->
53 <a name
="querybox"></a
>
54 <form method
="post" action
="read_dump.php"<?php
if ($is_upload) echo ' enctype="multipart/form-data"'; echo "\n"; ?
>
55 onsubmit
="return checkSqlQuery(this)">
56 <input type
="hidden" name
="is_js_confirmed" value
="0" />
57 <?php
echo PMA_generate_common_hidden_inputs($db); ?
>
58 <input type
="hidden" name
="pos" value
="0" />
59 <input type
="hidden" name
="goto" value
="db_details.php" />
60 <input type
="hidden" name
="zero_rows" value
="<?php echo htmlspecialchars($strSuccess); ?>" />
61 <input type
="hidden" name
="prev_sql_query" value
="<?php echo ((!empty($query_to_display)) ? htmlspecialchars($query_to_display) : ''); ?>" />
62 <?php
echo sprintf($strRunSQLQuery, htmlspecialchars($db)) . ' ' . PMA_showMySQLDocu('Reference', 'SELECT'); ?
> 
;:<br
/>
63 <div style
="margin-bottom: 5px">
64 <textarea name
="sql_query" cols
="<?php echo $cfg['TextareaCols'] * 2; ?>" rows
="<?php echo $cfg['TextareaRows']; ?>" wrap
="virtual" dir
="<?php echo $text_dir; ?>"<?php
echo $auto_sel; ?
>>
66 if (!empty($query_to_display)) {
67 echo htmlspecialchars($query_to_display);
69 echo htmlspecialchars(str_replace('%d', PMA_backquote($db), $cfg['DefaultQueryDatabase']));
72 <input type
="checkbox" name
="show_query" value
="1" id
="checkbox_show_query" checked
="checked" /> 
;
73 <label
for="checkbox_show_query"><?php
echo $strShowThisQuery; ?
></label
><br
/>
76 // loic1: displays import dump feature only if file upload available
78 echo ' <i>' . $strOr . '</i> ' . $strLocationTextfile . ' :<br />' . "\n";
80 <div style
="margin-bottom: 5px">
81 <input type
="file" name
="sql_file" class="textfield" /><br
/>
83 $is_gzip = ($cfg['GZipDump'] && @function_exists
('gzopen'));
84 $is_bzip = ($cfg['BZipDump'] && @function_exists
('bzdecompress'));
85 if ($is_bzip ||
$is_gzip) {
86 echo ' ' . $strCompression . ':' . "\n"
87 . ' <input type="radio" id="radio_sql_file_compression_auto" name="sql_file_compression" value="" checked="checked" />' . "\n"
88 . ' <label for="radio_sql_file_compression_auto">' . $strAutodetect . '</label> ' . "\n"
89 . ' <input type="radio" id="radio_sql_file_compression_plain" name="sql_file_compression" value="text/plain" />' . "\n"
90 . ' <label for="radio_sql_file_compression_plain">' . $strNone . '</label> ' . "\n";
92 echo ' <input type="radio" id="radio_sql_file_compression_gzip" name="sql_file_compression" value="application/x-gzip" />' . "\n"
93 . ' <label for="radio_sql_file_compression_gzip">' . $strGzip . '</label> ' . "\n";
96 echo ' <input type="radio" id="radio_sql_file_compression_bzip" name="sql_file_compression" value="application/x-bzip" />' . "\n"
97 . ' <label for="radio_sql_file_compression_bzip">' . $strBzip . '</label> ' . "\n";
100 echo ' <input type="hidden" name="sql_file_compression" value="text/plain" />' . "\n";
105 } // end if (is upload)
108 // web-server upload directory
110 $is_upload_dir = false;
111 if (!empty($cfg['UploadDir'])) {
112 if (substr($cfg['UploadDir'], -1) != '/') {
113 $cfg['UploadDir'] .= '/';
115 if ($handle = @opendir
($cfg['UploadDir'])) {
117 while ($file = @readdir
($handle)) {
118 if (is_file($cfg['UploadDir'] . $file) && PMA_checkFileExtensions($file, '.sql')) {
119 if ($is_first == 0) {
120 $is_upload_dir = true;
122 echo ' <i>' . $strOr . '</i> ' . $strWebServerUploadDirectory . ' :<br />' . "\n";
123 echo ' <div style="margin-bottom: 5px">' . "\n";
124 echo ' <select size="1" name="sql_localfile">' . "\n";
125 echo ' <option value="" selected="selected"></option>' . "\n";
126 } // end if (is_first)
127 echo ' <option value="' . htmlspecialchars($file) . '">' . htmlspecialchars($file) . '</option>' . "\n";
129 } // end if (is_file)
132 echo ' </select>' . "\n"
133 . ' </div>' . "\n\n";
134 } // end if (isfirst > 0)
138 echo ' <div style="margin-bottom: 5px">' . "\n";
139 echo ' <font color="red">' . $strError . '</font><br />' . "\n";
140 echo ' ' . $strWebServerUploadDirectoryError . "\n";
141 echo ' </div>' . "\n";
143 } // end if (web-server upload directory)
145 // Charset conversion options
146 if ($is_upload ||
$is_upload_dir) {
147 if ($cfg['AllowAnywhereRecoding'] && $allow_recoding) {
148 echo ' <div style="margin-bottom: 5px">' . "\n";
149 $temp_charset = reset($cfg['AvailableCharsets']);
150 echo $strCharsetOfFile . "\n"
151 . ' <select name="charset_of_file" size="1">' . "\n"
152 . ' <option value="' . $temp_charset . '"';
153 if ($temp_charset == $charset) {
154 echo ' selected="selected"';
156 echo '>' . $temp_charset . '</option>' . "\n";
157 while ($temp_charset = next($cfg['AvailableCharsets'])) {
158 echo ' <option value="' . $temp_charset . '"';
159 if ($temp_charset == $charset) {
160 echo ' selected="selected"';
162 echo '>' . $temp_charset . '</option>' . "\n";
164 echo ' </select><br />' . "\n" . ' ';
165 echo ' </div>' . "\n";
166 } // end if (recoding)
170 if ($cfg['Bookmark']['db'] && $cfg['Bookmark']['table']) {
171 if (($bookmark_list = PMA_listBookmarks($db, $cfg['Bookmark'])) && count($bookmark_list) > 0) {
172 echo " <i>$strOr</i> $strBookmarkQuery :<br />\n";
173 echo ' <div style="margin-bottom: 5px">' . "\n";
174 echo ' <select name="id_bookmark">' . "\n";
175 echo ' <option value=""></option>' . "\n";
176 foreach($bookmark_list AS $key => $value) {
177 echo ' <option value="' . htmlspecialchars($value) . '">' . htmlspecialchars($key) . '</option>' . "\n";
179 echo ' </select>' . "<br />\n";
180 echo ' ' . $strVar . ' (<a href="./Documentation.html#faqbookmark" target="documentation">' . $strDocu . '</a>): <input type="text" name="bookmark_variable" class="textfield" size="10" />' . "\n";
181 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";
182 echo ' <input type="radio" name="action_bookmark" value="1" id="radio_bookmark1" style="vertical-align: middle" /><label for="radio_bookmark1">' . $strBookmarkView . '</label>' . "\n";
183 echo ' <input type="radio" name="action_bookmark" value="2" id="radio_bookmark2" style="vertical-align: middle" /><label for="radio_bookmark2">' . $strDelete . '</label>' . "\n";
184 echo ' <br />' . "\n";
185 echo ' </div>' . "\n";
189 // Encoding setting form appended by Y.Kawada
190 if (function_exists('PMA_set_enc_form')) {
191 echo PMA_set_enc_form(' ');
194 <input type
="submit" name
="SQL" value
="<?php echo $strGo; ?>" />
200 * Displays the footer
203 require_once('./footer.inc.php');