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 // ($is_upload now defined in common.lib.php3)
50 $auto_sel = ($cfg['TextareaAutoSelect']
51 // 2003-02-05 rabus: This causes big trouble with Opera 7 for
52 // Windows, so let's disable it there...
53 && !(PMA_USR_OS
== 'Win' && PMA_USR_BROWSER_AGENT
== 'OPERA' && PMA_USR_BROWSER_VER
>= 7))
54 ?
"\n" . ' onfocus="if (typeof(document.layers) == \'undefined\' || typeof(textarea_selected) == \'undefined\') {textarea_selected = 1; this.form.elements[\'sql_query\'].select();}"'
57 <!-- Query box
and bookmark support
-->
59 <a name
="querybox"></a
>
60 <form method
="post" action
="read_dump.php3"<?php
if ($is_upload) echo ' enctype="multipart/form-data"'; echo "\n"; ?
>
61 onsubmit
="return checkSqlQuery(this)" name
="sqlform">
62 <input type
="hidden" name
="is_js_confirmed" value
="0" />
63 <?php
echo PMA_generate_common_hidden_inputs($db, $table); ?
>
64 <input type
="hidden" name
="pos" value
="0" />
65 <input type
="hidden" name
="goto" value
="<?php echo $goto; ?>" />
66 <input type
="hidden" name
="zero_rows" value
="<?php echo $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, htmlspecialchars($db)) . ' ' . PMA_showMySQLDocu('Reference', 'SELECT') . ' ' . $strFields . ':' . "\n"; ?
>
69 <select name
="dummy" size
="1">
72 for ($i = 0 ; $i < $fields_cnt; $i++
) {
74 . '<option value="' . urlencode($fields_list[$i]) . '">' . htmlspecialchars($fields_list[$i]) . '</option>' . "\n";
78 <input type
="button" name
="insert" value
="<?php echo($strInsert); ?>" onclick
="sqlform.sql_query.value = sqlform.sql_query.value + sqlform.dummy.value" />
80 <div style
="margin-bottom: 5px">
81 <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; ?
>>
82 <?php
echo ((!empty($query_to_display)) ?
htmlspecialchars($query_to_display) : 'SELECT * FROM ' . PMA_backquote($table) . ' WHERE 1'); ?
>
84 <input type
="checkbox" name
="show_query" value
="1" id
="checkbox_show_query" checked
="checked" /> 
;
85 <label
for="checkbox_show_query"><?php
echo $strShowThisQuery; ?
></label
><br
/>
88 // loic1: displays import dump feature only if file upload available
90 echo ' <i>' . $strOr . '</i> ' . $strLocationTextfile . ' :<br />' . "\n";
92 <div style
="margin-bottom: 5px">
93 <input type
="file" name
="sql_file" class="textfield" /><br
/>
95 if ($cfg['AllowAnywhereRecoding'] && $allow_recoding) {
96 $temp_charset = reset($cfg['AvailableCharsets']);
97 echo $strCharsetOfFile . "\n"
98 . ' <select name="charset_of_file" size="1">' . "\n"
99 . ' <option value="' . $temp_charset . '"';
100 if ($temp_charset == $charset) {
101 echo ' selected="selected"';
103 echo '>' . $temp_charset . '</option>' . "\n";
104 while ($temp_charset = next($cfg['AvailableCharsets'])) {
105 echo ' <option value="' . $temp_charset . '"';
106 if ($temp_charset == $charset) {
107 echo ' selected="selected"';
109 echo '>' . $temp_charset . '</option>' . "\n";
111 echo ' </select><br />' . "\n" . ' ';
113 $is_gzip = ($cfg['GZipDump'] && @function_exists
('gzopen'));
114 $is_bzip = ($cfg['BZipDump'] && @function_exists
('bzdecompress'));
115 if ($is_bzip ||
$is_gzip) {
116 echo ' ' . $strCompression . ':' . "\n"
117 . ' <input type="radio" id="radio_sql_file_compression_plain" name="sql_file_compression" value="text/plain" checked="checked" />' . "\n"
118 . ' <label for="radio_sql_file_compression_plain">' . $strNone . '</label> ' . "\n";
120 echo ' <input type="radio" id="radio_sql_file_compression_gzip" name="sql_file_compression" value="application/x-gzip" />' . "\n"
121 . ' <label for="radio_sql_file_compression_gzip">' . $strGzip . '</label> ' . "\n";
124 echo ' <input type="radio" id="radio_sql_file_compression_bzip" name="sql_file_compression" value="application/x-bzip" />' . "\n"
125 . ' <label for="radio_sql_file_compression_bzip">' . $strBzip . '</label> ' . "\n";
128 echo ' <input type="hidden" name="sql_file_compression" value="text/plain" />' . "\n";
136 // Encoding setting form appended by Y.Kawada
137 if (function_exists('PMA_set_enc_form')) {
138 echo PMA_set_enc_form(' ');
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" style="vertical-align: middle">' . "\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 <input type
="submit" name
="SQL" value
="<?php echo $strGo; ?>" />
165 // loic1: displays import dump feature only if file upload available
168 <!-- Insert a text file
-->
170 <div style
="margin-bottom: 10px"><a href
="ldi_table.php3?<?php echo $url_query; ?>"><?php
echo $strInsertTextfiles; ?
></a
></div
>