3 // vim: expandtab sw=4 ts=4 sts=4:
7 * Defines the query to be displayed in the query textarea
9 if (isset($show_query) && $show_query == '1') {
10 // This script has been called by read_dump.php3
11 if (isset($sql_query_cpy)) {
12 $query_to_display = $sql_query_cpy;
15 else if (get_magic_quotes_gpc()) {
16 $query_to_display = stripslashes($sql_query);
19 $query_to_display = $sql_query;
22 $query_to_display = '';
28 * Get the list and number of fields
30 $local_query = 'SHOW FIELDS FROM ' . PMA_backquote($table) . ' FROM ' . PMA_backquote($db);
31 $result = @PMA_mysql_query
($local_query);
33 PMA_mysqlDie('', $local_query, '', $err_url);
36 $fields_cnt = mysql_num_rows($result);
37 while ($row = PMA_mysql_fetch_array($result)) {
38 $fields_list[] = $row['Field'];
40 mysql_free_result($result);
47 // loic1: defines wether file upload is available or not
48 // lem9: we should check if PHP 4.0.0 really implements the "file_uploads"
49 // variable, because I got a support request and his 4.0.0 did not have it
51 $is_upload = (PMA_PHP_INT_VERSION
>= 40000 && function_exists('ini_get'))
52 ?
((strtolower(ini_get('file_uploads')) == 'on' ||
ini_get('file_uploads') == 1) && intval(ini_get('upload_max_filesize')))
53 // loic1: php 3.0.15 and lower bug -> always enabled
54 : (PMA_PHP_INT_VERSION
< 30016 ||
intval(@get_cfg_var
('upload_max_filesize')));
56 $auto_sel = ($cfg['TextareaAutoSelect'])
57 ?
"\n" . ' onfocus="if (typeof(document.layers) == \'undefined\' || typeof(textarea_selected) == \'undefined\') {textarea_selected = 1; this.form.elements[\'sql_query\'].select();}"'
60 <!-- Query box
and bookmark support
-->
62 <a name
="querybox"></a
>
63 <form method
="post" action
="read_dump.php3"<?php
if ($is_upload) echo ' enctype="multipart/form-data"'; echo "\n"; ?
>
64 onsubmit
="return checkSqlQuery(this)" name
="sqlform">
65 <input type
="hidden" name
="is_js_confirmed" value
="0" />
66 <input type
="hidden" name
="lang" value
="<?php echo $lang; ?>" />
67 <input type
="hidden" name
="convcharset" value
="<?php echo $convcharset; ?>" />
68 <input type
="hidden" name
="server" value
="<?php echo $server; ?>" />
69 <input type
="hidden" name
="db" value
="<?php echo htmlspecialchars($db); ?>" />
70 <input type
="hidden" name
="table" value
="<?php echo htmlspecialchars($table); ?>" />
71 <input type
="hidden" name
="pos" value
="0" />
72 <input type
="hidden" name
="goto" value
="<?php echo $goto; ?>" />
73 <input type
="hidden" name
="zero_rows" value
="<?php echo $strSuccess; ?>" />
74 <input type
="hidden" name
="prev_sql_query" value
="<?php echo ((!empty($query_to_display)) ? urlencode($query_to_display) : ''); ?>" />
75 <?php
echo sprintf($strRunSQLQuery, htmlspecialchars($db)) . ' ' . PMA_showMySQLDocu('Reference', 'SELECT') . ' ' . $strFields . ':' . "\n"; ?
>
76 <select name
="dummy" size
="1">
79 for ($i = 0 ; $i < $fields_cnt; $i++
) {
81 . '<option value="' . urlencode($fields_list[$i]) . '">' . htmlspecialchars($fields_list[$i]) . '</option>' . "\n";
85 <input type
="button" name
="insert" value
="<?php echo($strInsert); ?>" onclick
="sqlform.sql_query.value = sqlform.sql_query.value + sqlform.dummy.value" />
87 <div style
="margin-bottom: 5px">
88 <textarea name
="sql_query" rows
="<?php echo $cfg['TextareaRows']; ?>" cols
="<?php echo $cfg['TextareaCols'] * 2; ?>" wrap
="virtual" dir
="<?php echo $text_dir; ?>"<?php
echo $auto_sel; ?
>>
89 <?php
echo ((!empty($query_to_display)) ?
htmlspecialchars($query_to_display) : 'SELECT * FROM ' . PMA_backquote($table) . ' WHERE 1'); ?
>
91 <input type
="checkbox" name
="show_query" value
="1" id
="checkbox_show_query" checked
="checked" /> 
;
92 <label
for="checkbox_show_query"><?php
echo $strShowThisQuery; ?
></label
><br
/>
95 // loic1: displays import dump feature only if file upload available
97 echo ' <i>' . $strOr . '</i> ' . $strLocationTextfile . ' :<br />' . "\n";
99 <div style
="margin-bottom: 5px">
100 <input type
="file" name
="sql_file" class="textfield" /><br
/>
102 if ($cfg['AllowAnywhereRecoding'] && $allow_recoding) {
103 $temp_charset = reset($cfg['AvailableCharsets']);
104 echo $strCharsetOfFile . "\n"
105 . ' <select name="charset_of_file" size="1">' . "\n"
106 . ' <option value="' . $temp_charset . '"';
107 if ($temp_charset == $charset) {
108 echo ' selected="selected"';
110 echo '>' . $temp_charset . '</option>' . "\n";
111 while ($temp_charset = next($cfg['AvailableCharsets'])) {
112 echo ' <option value="' . $temp_charset . '"';
113 if ($temp_charset == $charset) {
114 echo ' selected="selected"';
116 echo '>' . $temp_charset . '</option>' . "\n";
118 echo ' </select><br />' . "\n" . ' ';
120 $is_gzip = ($cfg['GZipDump'] && @function_exists
('gzopen'));
121 $is_bzip = ($cfg['BZipDump'] && @function_exists
('bzdecompress'));
122 if ($is_bzip ||
$is_gzip) {
123 echo ' ' . $strCompression . ':' . "\n"
124 . ' <input type="radio" id="radio_sql_file_compression_plain" name="sql_file_compression" value="text/plain" checked="checked" />' . "\n"
125 . ' <label for="radio_sql_file_compression_plain">' . $strNone . '</label> ' . "\n";
127 echo ' <input type="radio" id="radio_sql_file_compression_gzip" name="sql_file_compression" value="application/x-gzip" />' . "\n"
128 . ' <label for="radio_sql_file_compression_gzip">' . $strGzip . '</label> ' . "\n";
131 echo ' <input type="radio" id="radio_sql_file_compression_bzip" name="sql_file_compression" value="application/x-bzip" />' . "\n"
132 . ' <label for="radio_sql_file_compression_bzip">' . $strBzip . '</label> ' . "\n";
135 echo ' <input type="hidden" name="sql_file_compression" value="text/plain" />' . "\n";
143 // Encoding setting form appended by Y.Kawada
144 if (function_exists('PMA_set_enc_form')) {
145 echo PMA_set_enc_form(' ');
149 if ($cfg['Bookmark']['db'] && $cfg['Bookmark']['table']) {
150 if (($bookmark_list = PMA_listBookmarks($db, $cfg['Bookmark'])) && count($bookmark_list) > 0) {
151 echo " <i>$strOr</i> $strBookmarkQuery :<br />\n";
152 echo ' <div style="margin-bottom: 5px">' . "\n";
153 echo ' <select name="id_bookmark" style="vertical-align: middle">' . "\n";
154 echo ' <option value=""></option>' . "\n";
155 while (list($key, $value) = each($bookmark_list)) {
156 echo ' <option value="' . $value . '">' . htmlentities($key) . '</option>' . "\n";
158 echo ' </select>' . "\n";
159 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";
160 echo ' <input type="radio" name="action_bookmark" value="1" id="radio_bookmark1" style="vertical-align: middle" /><label for="radio_bookmark1">' . $strBookmarkView . '</label>' . "\n";
161 echo ' <input type="radio" name="action_bookmark" value="2" id="radio_bookmark2" style="vertical-align: middle" /><label for="radio_bookmark2">' . $strDelete . '</label>' . "\n";
162 echo ' <br />' . "\n";
163 echo ' </div>' . "\n";
167 <input type
="submit" name
="SQL" value
="<?php echo $strGo; ?>" />
172 // loic1: displays import dump feature only if file upload available
175 <!-- Insert a text file
-->
177 <div style
="margin-bottom: 10px"><a href
="ldi_table.php3?<?php echo $url_query; ?>"><?php
echo $strInsertTextfiles; ?
></a
></div
>