8 require('./db_details_common.php3');
9 $url_query .= '&goto=db_details.php3';
15 if (isset($show_query) && $show_query == '1') {
16 // This script has been called by read_dump.php3
17 if (isset($sql_query_cpy)) {
18 $query_to_display = $sql_query_cpy;
21 else if (get_magic_quotes_gpc()) {
22 $query_to_display = stripslashes($sql_query);
25 $query_to_display = $sql_query;
28 $query_to_display = '';
33 * Gets informations about the database and, if it is empty, move to the
34 * "db_details_structure.php3" script where table can be created
37 require('./db_details_db_info.php3');
38 if ($num_tables == 0 && empty($db_query_force)) {
40 include('./db_details_structure.php3');
44 // loic1: defines wether file upload is available or not
45 $is_upload = (PMA_PHP_INT_VERSION
>= 40000 && function_exists('ini_get'))
46 ?
((strtolower(ini_get('file_uploads')) == 'on' ||
ini_get('file_uploads') == 1) && intval(ini_get('upload_max_filesize')))
47 // loic1: php 3.0.15 and lower bug -> always enabled
48 : (PMA_PHP_INT_VERSION
< 30016 ||
intval(@get_cfg_var
('upload_max_filesize')));
50 $auto_sel = ($cfg['TextareaAutoSelect'])
51 ?
"\n" . ' onfocus="if (typeof(document.layers) == \'undefined\' || typeof(textarea_selected) == \'undefined\') {textarea_selected = 1; this.form.elements[\'sql_query\'].select();}"'
54 <!-- Query box
, sql file loader
and bookmark support
-->
55 <a name
="querybox"></a
>
56 <form method
="post" action
="read_dump.php3"<?php
if ($is_upload) echo ' enctype="multipart/form-data"'; echo "\n"; ?
>
57 onsubmit
="return checkSqlQuery(this)">
58 <input type
="hidden" name
="is_js_confirmed" value
="0" />
59 <input type
="hidden" name
="lang" value
="<?php echo $lang; ?>" />
60 <input type
="hidden" name
="convcharset" value
="<?php echo $convcharset; ?>" />
61 <input type
="hidden" name
="server" value
="<?php echo $server; ?>" />
62 <input type
="hidden" name
="db" value
="<?php echo $db; ?>" />
63 <input type
="hidden" name
="pos" value
="0" />
64 <input type
="hidden" name
="goto" value
="db_details.php3" />
65 <input type
="hidden" name
="zero_rows" value
="<?php echo htmlspecialchars($strSuccess); ?>" />
66 <input type
="hidden" name
="prev_sql_query" value
="<?php echo ((!empty($query_to_display)) ? urlencode($query_to_display) : ''); ?>" />
67 <?php
echo sprintf($strRunSQLQuery, $db) . ' ' . PMA_showMySQLDocu('Reference', 'SELECT'); ?
> 
;:<br
/>
68 <div style
="margin-bottom: 5px">
69 <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; ?
>>
70 <?php
echo ((!empty($query_to_display)) ?
htmlspecialchars($query_to_display) : ''); ?
>
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 if ($cfg['AllowAnywhereRecoding'] && $allow_recoding) {
84 $temp_charset = reset($cfg['AvailableCharsets']);
85 echo $strCharsetOfFile . "\n"
86 . ' <select name="charset_of_file" size="1">' . "\n"
87 . ' <option value="' . $temp_charset . '"';
88 if ($temp_charset == $charset) {
89 echo ' selected="selected"';
91 echo '>' . $temp_charset . '</option>' . "\n";
92 while ($temp_charset = next($cfg['AvailableCharsets'])) {
93 echo ' <option value="' . $temp_charset . '"';
94 if ($temp_charset == $charset) {
95 echo ' selected="selected"';
97 echo '>' . $temp_charset . '</option>' . "\n";
100 } // end if (recoding)
105 } // end if (is upload)
108 // web-server upload directory
109 // (TODO: display the charset selection, even if is_upload == FALSE)
111 if ($cfg['UploadDir'] != '') {
112 if ($handle = @opendir
($cfg['UploadDir'])) {
114 while ($file = @readdir
($handle)) {
115 if (is_file($cfg['UploadDir'] . $file) && substr($file, -4) == '.sql') {
116 if ($is_first == 0) {
118 echo ' <i>' . $strOr . '</i> ' . $strWebServerUploadDirectory . ' :<br />' . "\n";
119 echo ' <div style="margin-bottom: 5px">' . "\n";
120 echo ' <select size="1" name="sql_localfile">' . "\n";
121 echo ' <option value="" selected="selected"></option>' . "\n";
122 } // end if (is_first)
123 echo ' <option value="' . htmlspecialchars($file) . '">' . htmlspecialchars($file) . '</option>' . "\n";
125 } // end if (is_file)
128 echo ' </select>' . "\n"
129 . ' </div>' . "\n\n";
130 } // end if (isfirst > 0)
134 echo ' <div style="margin-bottom: 5px">' . "\n";
135 echo ' <font color="red">' . $strError . '</font><br />' . "\n";
136 echo ' ' . $strWebServerUploadDirectoryError . "\n";
137 echo ' </div>' . "\n";
139 } // end if (web-server upload directory)
142 if ($cfg['Bookmark']['db'] && $cfg['Bookmark']['table']) {
143 if (($bookmark_list = PMA_listBookmarks($db, $cfg['Bookmark'])) && count($bookmark_list) > 0) {
144 echo " <i>$strOr</i> $strBookmarkQuery :<br />\n";
145 echo ' <div style="margin-bottom: 5px">' . "\n";
146 echo ' <select name="id_bookmark">' . "\n";
147 echo ' <option value=""></option>' . "\n";
148 while (list($key, $value) = each($bookmark_list)) {
149 echo ' <option value="' . $value . '">' . htmlentities($key) . '</option>' . "\n";
151 echo ' </select>' . "\n";
152 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";
153 echo ' <input type="radio" name="action_bookmark" value="1" id="radio_bookmark1" style="vertical-align: middle" /><label for="radio_bookmark1">' . $strBookmarkView . '</label>' . "\n";
154 echo ' <input type="radio" name="action_bookmark" value="2" id="radio_bookmark2" style="vertical-align: middle" /><label for="radio_bookmark2">' . $strDelete . '</label>' . "\n";
155 echo ' <br />' . "\n";
156 echo ' </div>' . "\n";
160 // Encoding setting form appended by Y.Kawada
161 if (function_exists('PMA_set_enc_form')) {
162 echo PMA_set_enc_form(' ');
165 <input type
="submit" name
="SQL" value
="<?php echo $strGo; ?>" />
171 * Displays the footer
174 require('./footer.inc.php3');