3 // vim: expandtab sw=4 ts=4 sts=4:
9 require('./db_details_common.php3');
10 $url_query .= '&goto=db_details.php3';
16 if (isset($show_query) && $show_query == '1') {
17 // This script has been called by read_dump.php3
18 if (isset($sql_query_cpy)) {
19 $query_to_display = $sql_query_cpy;
22 else if (get_magic_quotes_gpc()) {
23 $query_to_display = stripslashes($sql_query);
26 $query_to_display = $sql_query;
29 $query_to_display = '';
34 * Gets informations about the database and, if it is empty, move to the
35 * "db_details_structure.php3" script where table can be created
38 require('./db_details_db_info.php3');
39 if ($num_tables == 0 && empty($db_query_force)) {
41 include('./db_details_structure.php3');
45 // loic1: defines wether file upload is available or not
46 $is_upload = (PMA_PHP_INT_VERSION
>= 40000 && function_exists('ini_get'))
47 ?
((strtolower(ini_get('file_uploads')) == 'on' ||
ini_get('file_uploads') == 1) && intval(ini_get('upload_max_filesize')))
48 // loic1: php 3.0.15 and lower bug -> always enabled
49 : (PMA_PHP_INT_VERSION
< 30016 ||
intval(@get_cfg_var
('upload_max_filesize')));
51 $auto_sel = ($cfg['TextareaAutoSelect'])
52 ?
"\n" . ' onfocus="if (typeof(document.layers) == \'undefined\' || typeof(textarea_selected) == \'undefined\') {textarea_selected = 1; this.form.elements[\'sql_query\'].select();}"'
55 <!-- Query box
, sql file loader
and bookmark support
-->
56 <a name
="querybox"></a
>
57 <form method
="post" action
="read_dump.php3"<?php
if ($is_upload) echo ' enctype="multipart/form-data"'; echo "\n"; ?
>
58 onsubmit
="return checkSqlQuery(this)">
59 <input type
="hidden" name
="is_js_confirmed" value
="0" />
60 <input type
="hidden" name
="lang" value
="<?php echo $lang; ?>" />
61 <input type
="hidden" name
="convcharset" value
="<?php echo $convcharset; ?>" />
62 <input type
="hidden" name
="server" value
="<?php echo $server; ?>" />
63 <input type
="hidden" name
="db" value
="<?php echo htmlspecialchars($db); ?>" />
64 <input type
="hidden" name
="pos" value
="0" />
65 <input type
="hidden" name
="goto" value
="db_details.php3" />
66 <input type
="hidden" name
="zero_rows" value
="<?php echo htmlspecialchars($strSuccess); ?>" />
67 <input type
="hidden" name
="prev_sql_query" value
="<?php echo ((!empty($query_to_display)) ? urlencode($query_to_display) : ''); ?>" />
68 <?php
echo sprintf($strRunSQLQuery, $db) . ' ' . PMA_showMySQLDocu('Reference', 'SELECT'); ?
> 
;:<br
/>
69 <div style
="margin-bottom: 5px">
70 <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; ?
>>
71 <?php
echo ((!empty($query_to_display)) ?
htmlspecialchars($query_to_display) : ''); ?
>
73 <input type
="checkbox" name
="show_query" value
="1" id
="checkbox_show_query" checked
="checked" /> 
;
74 <label
for="checkbox_show_query"><?php
echo $strShowThisQuery; ?
></label
><br
/>
77 // loic1: displays import dump feature only if file upload available
79 echo ' <i>' . $strOr . '</i> ' . $strLocationTextfile . ' :<br />' . "\n";
81 <div style
="margin-bottom: 5px">
82 <input type
="file" name
="sql_file" class="textfield" /><br
/>
84 if ($cfg['AllowAnywhereRecoding'] && $allow_recoding) {
85 $temp_charset = reset($cfg['AvailableCharsets']);
86 echo $strCharsetOfFile . "\n"
87 . ' <select name="charset_of_file" size="1">' . "\n"
88 . ' <option value="' . $temp_charset . '"';
89 if ($temp_charset == $charset) {
90 echo ' selected="selected"';
92 echo '>' . $temp_charset . '</option>' . "\n";
93 while ($temp_charset = next($cfg['AvailableCharsets'])) {
94 echo ' <option value="' . $temp_charset . '"';
95 if ($temp_charset == $charset) {
96 echo ' selected="selected"';
98 echo '>' . $temp_charset . '</option>' . "\n";
100 echo ' </select><br />' . "\n" . ' ';
101 } // end if (recoding)
102 $is_gzip = ($cfg['GZipDump'] && @function_exists
('gzopen'));
103 $is_bzip = ($cfg['BZipDump'] && @function_exists
('bzdecompress'));
104 if ($is_bzip ||
$is_gzip) {
105 echo ' ' . $strCompression . ':' . "\n"
106 . ' <input type="radio" id="radio_sql_file_compression_plain" name="sql_file_compression" value="text/plain" checked="checked" />' . "\n"
107 . ' <label for="radio_sql_file_compression_plain">' . $strNone . '</label> ' . "\n";
109 echo ' <input type="radio" id="radio_sql_file_compression_gzip" name="sql_file_compression" value="application/x-gzip" />' . "\n"
110 . ' <label for="radio_sql_file_compression_gzip">' . $strGzip . '</label> ' . "\n";
113 echo ' <input type="radio" id="radio_sql_file_compression_bzip" name="sql_file_compression" value="application/x-bzip" />' . "\n"
114 . ' <label for="radio_sql_file_compression_bzip">' . $strBzip . '</label> ' . "\n";
117 echo ' <input type="hidden" name="sql_file_compression" value="text/plain" />' . "\n";
122 } // end if (is upload)
125 // web-server upload directory
126 // (TODO: display the charset selection, even if is_upload == FALSE)
128 if ($cfg['UploadDir'] != '') {
129 if ($handle = @opendir
($cfg['UploadDir'])) {
131 while ($file = @readdir
($handle)) {
132 if (is_file($cfg['UploadDir'] . $file) && substr($file, -4) == '.sql') {
133 if ($is_first == 0) {
135 echo ' <i>' . $strOr . '</i> ' . $strWebServerUploadDirectory . ' :<br />' . "\n";
136 echo ' <div style="margin-bottom: 5px">' . "\n";
137 echo ' <select size="1" name="sql_localfile">' . "\n";
138 echo ' <option value="" selected="selected"></option>' . "\n";
139 } // end if (is_first)
140 echo ' <option value="' . htmlspecialchars($file) . '">' . htmlspecialchars($file) . '</option>' . "\n";
142 } // end if (is_file)
145 echo ' </select>' . "\n"
146 . ' </div>' . "\n\n";
147 } // end if (isfirst > 0)
151 echo ' <div style="margin-bottom: 5px">' . "\n";
152 echo ' <font color="red">' . $strError . '</font><br />' . "\n";
153 echo ' ' . $strWebServerUploadDirectoryError . "\n";
154 echo ' </div>' . "\n";
156 } // end if (web-server upload directory)
159 if ($cfg['Bookmark']['db'] && $cfg['Bookmark']['table']) {
160 if (($bookmark_list = PMA_listBookmarks($db, $cfg['Bookmark'])) && count($bookmark_list) > 0) {
161 echo " <i>$strOr</i> $strBookmarkQuery :<br />\n";
162 echo ' <div style="margin-bottom: 5px">' . "\n";
163 echo ' <select name="id_bookmark">' . "\n";
164 echo ' <option value=""></option>' . "\n";
165 while (list($key, $value) = each($bookmark_list)) {
166 echo ' <option value="' . $value . '">' . htmlentities($key) . '</option>' . "\n";
168 echo ' </select>' . "\n";
169 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";
170 echo ' <input type="radio" name="action_bookmark" value="1" id="radio_bookmark1" style="vertical-align: middle" /><label for="radio_bookmark1">' . $strBookmarkView . '</label>' . "\n";
171 echo ' <input type="radio" name="action_bookmark" value="2" id="radio_bookmark2" style="vertical-align: middle" /><label for="radio_bookmark2">' . $strDelete . '</label>' . "\n";
172 echo ' <br />' . "\n";
173 echo ' </div>' . "\n";
177 // Encoding setting form appended by Y.Kawada
178 if (function_exists('PMA_set_enc_form')) {
179 echo PMA_set_enc_form(' ');
182 <input type
="submit" name
="SQL" value
="<?php echo $strGo; ?>" />
188 * Displays the footer
191 require('./footer.inc.php3');