Fixed edit link.
[phpmyadmin/crack.git] / db_details.php3
blob51788bbcd4b536868102c212343e436e882f81ec
1 <?php
2 /* $Id$ */
3 // vim: expandtab sw=4 ts=4 sts=4:
6 /**
7 * Runs common work
8 */
9 require('./db_details_common.php3');
10 $url_query .= '&amp;goto=db_details.php3';
13 /**
14 * Database work
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;
21 // Other cases
22 else if (get_magic_quotes_gpc()) {
23 $query_to_display = stripslashes($sql_query);
25 else {
26 $query_to_display = $sql_query;
28 } else {
29 $query_to_display = '';
33 /**
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
37 $sub_part = '';
38 require('./db_details_db_info.php3');
39 if ($num_tables == 0 && empty($db_query_force)) {
40 $is_info = TRUE;
41 include('./db_details_structure.php3');
42 exit();
45 // loic1: defines wether file upload is available or not
46 // (now defined in common.lib.php3)
48 $auto_sel = ($cfg['TextareaAutoSelect']
49 // 2003-02-05 rabus: This causes big trouble with Opera 7 for
50 // Windows, so let's disable it there...
51 && !(PMA_USR_OS == 'Win' && PMA_USR_BROWSER_AGENT == 'OPERA' && PMA_USR_BROWSER_VER >= 7))
52 ? "\n" . ' onfocus="if (typeof(document.layers) == \'undefined\' || typeof(textarea_selected) == \'undefined\') {textarea_selected = 1; this.form.elements[\'sql_query\'].select();}"'
53 : '';
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 <?php echo PMA_generate_common_hidden_inputs($db); ?>
61 <input type="hidden" name="pos" value="0" />
62 <input type="hidden" name="goto" value="db_details.php3" />
63 <input type="hidden" name="zero_rows" value="<?php echo htmlspecialchars($strSuccess); ?>" />
64 <input type="hidden" name="prev_sql_query" value="<?php echo ((!empty($query_to_display)) ? urlencode($query_to_display) : ''); ?>" />
65 <?php echo sprintf($strRunSQLQuery, $db) . ' ' . PMA_showMySQLDocu('Reference', 'SELECT'); ?>&nbsp;:<br />
66 <div style="margin-bottom: 5px">
67 <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; ?>>
68 <?php echo ((!empty($query_to_display)) ? htmlspecialchars($query_to_display) : ''); ?>
69 </textarea><br />
70 <input type="checkbox" name="show_query" value="1" id="checkbox_show_query" checked="checked" />&nbsp;
71 <label for="checkbox_show_query"><?php echo $strShowThisQuery; ?></label><br />
72 </div>
73 <?php
74 // loic1: displays import dump feature only if file upload available
75 if ($is_upload) {
76 echo ' <i>' . $strOr . '</i> ' . $strLocationTextfile . '&nbsp;:<br />' . "\n";
78 <div style="margin-bottom: 5px">
79 <input type="file" name="sql_file" class="textfield" /><br />
80 <?php
81 if ($cfg['AllowAnywhereRecoding'] && $allow_recoding) {
82 $temp_charset = reset($cfg['AvailableCharsets']);
83 echo $strCharsetOfFile . "\n"
84 . ' <select name="charset_of_file" size="1">' . "\n"
85 . ' <option value="' . $temp_charset . '"';
86 if ($temp_charset == $charset) {
87 echo ' selected="selected"';
89 echo '>' . $temp_charset . '</option>' . "\n";
90 while ($temp_charset = next($cfg['AvailableCharsets'])) {
91 echo ' <option value="' . $temp_charset . '"';
92 if ($temp_charset == $charset) {
93 echo ' selected="selected"';
95 echo '>' . $temp_charset . '</option>' . "\n";
97 echo ' </select><br />' . "\n" . ' ';
98 } // end if (recoding)
99 $is_gzip = ($cfg['GZipDump'] && @function_exists('gzopen'));
100 $is_bzip = ($cfg['BZipDump'] && @function_exists('bzdecompress'));
101 if ($is_bzip || $is_gzip) {
102 echo ' ' . $strCompression . ':' . "\n"
103 . ' <input type="radio" id="radio_sql_file_compression_plain" name="sql_file_compression" value="text/plain" checked="checked" />' . "\n"
104 . ' <label for="radio_sql_file_compression_plain">' . $strNone . '</label>&nbsp;&nbsp;&nbsp;' . "\n";
105 if ($is_gzip) {
106 echo ' <input type="radio" id="radio_sql_file_compression_gzip" name="sql_file_compression" value="application/x-gzip" />' . "\n"
107 . ' <label for="radio_sql_file_compression_gzip">' . $strGzip . '</label>&nbsp;&nbsp;&nbsp;' . "\n";
109 if ($is_bzip) {
110 echo ' <input type="radio" id="radio_sql_file_compression_bzip" name="sql_file_compression" value="application/x-bzip" />' . "\n"
111 . ' <label for="radio_sql_file_compression_bzip">' . $strBzip . '</label>&nbsp;&nbsp;&nbsp;' . "\n";
113 } else {
114 echo ' <input type="hidden" name="sql_file_compression" value="text/plain" />' . "\n";
117 </div>
118 <?php
119 } // end if (is upload)
120 echo "\n";
122 // web-server upload directory
123 // (TODO: display the charset selection, even if is_upload == FALSE)
125 if ($cfg['UploadDir'] != '') {
126 if ($handle = @opendir($cfg['UploadDir'])) {
127 $is_first = 0;
128 while ($file = @readdir($handle)) {
129 if (is_file($cfg['UploadDir'] . $file) && substr($file, -4) == '.sql') {
130 if ($is_first == 0) {
131 echo "\n";
132 echo ' <i>' . $strOr . '</i> ' . $strWebServerUploadDirectory . '&nbsp;:<br />' . "\n";
133 echo ' <div style="margin-bottom: 5px">' . "\n";
134 echo ' <select size="1" name="sql_localfile">' . "\n";
135 echo ' <option value="" selected="selected"></option>' . "\n";
136 } // end if (is_first)
137 echo ' <option value="' . htmlspecialchars($file) . '">' . htmlspecialchars($file) . '</option>' . "\n";
138 $is_first++;
139 } // end if (is_file)
140 } // end while
141 if ($is_first > 0) {
142 echo ' </select>' . "\n"
143 . ' </div>' . "\n\n";
144 } // end if (isfirst > 0)
145 @closedir($handle);
147 else {
148 echo ' <div style="margin-bottom: 5px">' . "\n";
149 echo ' <font color="red">' . $strError . '</font><br />' . "\n";
150 echo ' ' . $strWebServerUploadDirectoryError . "\n";
151 echo ' </div>' . "\n";
153 } // end if (web-server upload directory)
155 // Bookmark Support
156 if ($cfg['Bookmark']['db'] && $cfg['Bookmark']['table']) {
157 if (($bookmark_list = PMA_listBookmarks($db, $cfg['Bookmark'])) && count($bookmark_list) > 0) {
158 echo " <i>$strOr</i> $strBookmarkQuery&nbsp;:<br />\n";
159 echo ' <div style="margin-bottom: 5px">' . "\n";
160 echo ' <select name="id_bookmark">' . "\n";
161 echo ' <option value=""></option>' . "\n";
162 while (list($key, $value) = each($bookmark_list)) {
163 echo ' <option value="' . $value . '">' . htmlentities($key) . '</option>' . "\n";
165 echo ' </select>' . "\n";
166 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";
167 echo ' &nbsp;<input type="radio" name="action_bookmark" value="1" id="radio_bookmark1" style="vertical-align: middle" /><label for="radio_bookmark1">' . $strBookmarkView . '</label>' . "\n";
168 echo ' &nbsp;<input type="radio" name="action_bookmark" value="2" id="radio_bookmark2" style="vertical-align: middle" /><label for="radio_bookmark2">' . $strDelete . '</label>' . "\n";
169 echo ' <br />' . "\n";
170 echo ' </div>' . "\n";
174 // Encoding setting form appended by Y.Kawada
175 if (function_exists('PMA_set_enc_form')) {
176 echo PMA_set_enc_form(' ');
179 <input type="submit" name="SQL" value="<?php echo $strGo; ?>" />
180 </form>
183 <?php
185 * Displays the footer
187 echo "\n";
188 require('./footer.inc.php3');