updated czech translation
[phpmyadmin/crack.git] / tbl_properties_operations.php3
blob4976bf2c5ebbe599dd1d93e1e3a82f373a53f527
1 <?php
2 /* $Id$ */
3 // vim: expandtab sw=4 ts=4 sts=4:
6 /**
7 * Runs common work
8 */
9 require('./tbl_properties_common.php3');
10 //$err_url = 'tbl_properties_operations.php3' . $err_url;
11 $url_query .= '&amp;goto=tbl_properties_operations.php3&amp;back=tbl_properties_operations.php3';
14 /**
15 * Gets relation settings
17 require('./libraries/relation.lib.php3');
18 $cfgRelation = PMA_getRelationsParam();
21 /**
22 * Reordering the table has been requested by the user
24 if (isset($submitorderby) && !empty($order_field)) {
25 $sql_query = 'ALTER TABLE ' . PMA_backquote($table)
26 . ' ORDER BY ' . PMA_backquote(urldecode($order_field));
27 $result = PMA_mysql_query($sql_query) or PMA_mysqlDie('', $sql_query, '', $err_url);
28 PMA_showMessage((get_magic_quotes_gpc()) ? addslashes($strSuccess) : $strSuccess);
29 } // end if
32 /**
33 * Gets tables informations and displays top links
35 require('./tbl_properties_table_info.php3');
38 /**
39 * Get columns names
41 $local_query = 'SHOW COLUMNS FROM ' . PMA_backquote($table) . ' FROM ' . PMA_backquote($db);
42 $result = PMA_mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $error_url);
43 for ($i = 0; $row = PMA_mysql_fetch_array($result); $i++) {
44 $columns[$i] = $row['Field'];
46 mysql_free_result($result);
49 /**
50 * Displays the page
53 <ul>
55 <?php
56 if (PMA_MYSQL_INT_VERSION >= 32334) {
58 <!-- Order the table -->
59 <li>
60 <form method="post" action="tbl_properties_operations.php3">
61 <input type="hidden" name="server" value="<?php echo $server; ?>" />
62 <input type="hidden" name="lang" value="<?php echo $lang; ?>" />
63 <input type="hidden" name="convcharset" value="<?php echo $convcharset; ?>" />
64 <input type="hidden" name="db" value="<?php echo htmlspecialchars($db); ?>" />
65 <input type="hidden" name="table" value="<?php echo htmlspecialchars($table); ?>" />
66 <?php echo $strAlterOrderBy; ?>&nbsp;:
67 <select name="order_field" style="vertical-align: middle">
68 <?php
69 echo "\n";
70 reset($columns);
71 while (list($junk, $fieldname) = each($columns)) {
72 echo ' <option value="' . urlencode($fieldname) . '">' . htmlspecialchars($fieldname) . '</option>' . "\n";
74 unset($columns);
76 </select>
77 <input type="submit" name="submitorderby" value="<?php echo $strGo; ?>" style="vertical-align: middle" />
78 &nbsp;<?php echo $strSingly . "\n"; ?>
79 </form>
80 </li>
81 <?php
83 echo "\n";
86 <!-- Change table name -->
87 <li>
88 <div style="margin-bottom: 10px">
89 <form method="post" action="tbl_rename.php3"
90 onsubmit="return emptyFormElements(this, 'new_name')">
91 <input type="hidden" name="server" value="<?php echo $server; ?>" />
92 <input type="hidden" name="lang" value="<?php echo $lang; ?>" />
93 <input type="hidden" name="convcharset" value="<?php echo $convcharset; ?>" />
94 <input type="hidden" name="db" value="<?php echo htmlspecialchars($db); ?>" />
95 <input type="hidden" name="table" value="<?php echo htmlspecialchars($table); ?>" />
96 <input type="hidden" name="reload" value="1" />
97 <?php echo $strRenameTable; ?>&nbsp;:
98 <input type="text" size="20" name="new_name" value="<?php echo htmlspecialchars($table); ?>" class="textfield" onfocus="this.select()" />&nbsp;
99 <input type="submit" value="<?php echo $strGo; ?>" />
100 </form>
101 </div>
102 </li>
104 <!-- Move and copy table -->
105 <li style="vertical-align: top">
106 <div style="margin-bottom: 10px">
107 <table border="0" cellspacing="0" cellpadding="0" style="vertical-align: top">
108 <tr>
109 <td valign="top">
110 <form method="post" action="tbl_move_copy.php3"
111 onsubmit="return emptyFormElements(this, 'new_name')">
112 <input type="hidden" name="server" value="<?php echo $server; ?>" />
113 <input type="hidden" name="lang" value="<?php echo $lang; ?>" />
114 <input type="hidden" name="convcharset" value="<?php echo $convcharset; ?>" />
115 <input type="hidden" name="db" value="<?php echo htmlspecialchars($db); ?>" />
116 <input type="hidden" name="table" value="<?php echo htmlspecialchars($table); ?>" />
117 <input type="hidden" name="reload" value="1" />
118 <input type="hidden" name="what" value="data" />
119 <table border="0" cellspacing="0" cellpadding="0">
120 <tr>
121 <td nowrap="nowrap">
122 <?php echo $strMoveTable . "\n"; ?>
123 </td>
124 </tr>
125 <tr>
126 <td>
127 <select name="target_db">
128 <option value=""></option>
129 <?php
130 // The function used below is defined in "common.lib.php3"
131 PMA_availableDatabases('main.php3?lang=' . $lang . '&amp;server=' . $server);
132 for ($i = 0; $i < $num_dbs; $i++) {
133 echo ' ';
134 echo '<option value="' . str_replace('"', '&quot;', $dblist[$i]) . '">' . htmlspecialchars($dblist[$i]) . '</option>';
135 echo "\n";
136 } // end for
138 </select>
139 &nbsp;<b>.</b>&nbsp;
140 <input type="text" size="20" name="new_name" value="<?php echo $table; ?>" class="textfield" onfocus="this.select()" />
141 </td>
142 </tr>
143 <tr>
144 <td align="<?php echo $cell_align_right; ?>" valign="top">
145 <input type="submit" name="submit_move" value="<?php echo $strGo; ?>" />
146 </td>
147 </tr>
148 </table>
149 </form>
150 </td>
151 <td width="25">&nbsp;</td>
152 <td valign="top">
153 <form method="post" action="tbl_move_copy.php3"
154 onsubmit="return emptyFormElements(this, 'new_name')">
155 <input type="hidden" name="server" value="<?php echo $server; ?>" />
156 <input type="hidden" name="lang" value="<?php echo $lang; ?>" />
157 <input type="hidden" name="convcharset" value="<?php echo $convcharset; ?>" />
158 <input type="hidden" name="db" value="<?php echo htmlspecialchars($db); ?>" />
159 <input type="hidden" name="table" value="<?php echo htmlspecialchars($table); ?>" />
160 <input type="hidden" name="reload" value="1" />
161 <table border="0" cellspacing="0" cellpadding="0">
162 <tr>
163 <td colspan="2" nowrap="nowrap">
164 <?php echo $strCopyTable . "\n"; ?>
165 </td>
166 </tr>
167 <tr>
168 <td colspan="2">
169 <select name="target_db">
170 <?php
171 for ($i = 0; $i < $num_dbs; $i++) {
172 echo ' ';
173 echo '<option value="' . str_replace('"', '&quot;', $dblist[$i]) . '"';
174 if ($dblist[$i] == $db) {
175 echo ' selected="selected"';
177 echo '>' . htmlspecialchars($dblist[$i]) . '</option>';
178 echo "\n";
179 } // end for
181 </select>
182 &nbsp;<b>.</b>&nbsp;
183 <input type="text" size="20" name="new_name" class="textfield" onfocus="this.select()" />
184 </td>
185 </tr>
186 <tr>
187 <td nowrap="nowrap">
188 <input type="radio" name="what" value="structure" id="radio_copy_structure" checked="checked" />
189 <label for="radio_copy_structure"><?php echo $strStrucOnly; ?></label>&nbsp;&nbsp;<br />
190 <input type="radio" name="what" value="data" id="radio_copy_data" />
191 <label for="radio_copy_data"><?php echo $strStrucData; ?></label>&nbsp;&nbsp;<br />
192 <input type="radio" name="what" value="dataonly" id="radio_copy_data" />
193 <label for="radio_copy_data"><?php echo $strDataOnly; ?></label>&nbsp;&nbsp;
194 </td>
195 <td align="<?php echo $cell_align_right; ?>" valign="top">
196 <input type="submit" name="submit_copy" value="<?php echo $strGo; ?>" />
197 </td>
198 </tr>
199 </table>
200 </form>
201 </td>
202 </tr>
203 </table>
204 </div>
205 </li>
207 <?php
208 if (PMA_MYSQL_INT_VERSION >= 32322) {
209 if ($tbl_type == 'MYISAM' or $tbl_type == 'BDB') {
211 <!-- Table maintenance -->
212 <li style="vertical-align: top">
213 <div style="margin-bottom: 10px">
214 <table border="0" cellspacing="0" cellpadding="0" style="vertical-align: top">
215 <tr>
216 <td><?php echo $strTableMaintenance; ?>&nbsp;:&nbsp;</td>
217 <?php
218 echo "\n";
219 if ($tbl_type == 'MYISAM') {
221 <td>
222 <a href="sql.php3?<?php echo $url_query; ?>&amp;sql_query=<?php echo urlencode('CHECK TABLE ' . PMA_backquote($table)); ?>">
223 <?php echo $strCheckTable; ?></a>&nbsp;
224 <?php echo PMA_showMySQLDocu('MySQL_Database_Administration', 'CHECK_TABLE') . "\n"; ?>
225 </td>
226 <td>&nbsp;-&nbsp;</td>
227 <?php
229 echo "\n";
230 if ($tbl_type == 'MYISAM' || $tbl_type == 'BDB') {
232 <td>
233 <a href="sql.php3?<?php echo $url_query; ?>&amp;sql_query=<?php echo urlencode('ANALYZE TABLE ' . PMA_backquote($table)); ?>">
234 <?php echo $strAnalyzeTable; ?></a>&nbsp;
235 <?php echo PMA_showMySQLDocu('MySQL_Database_Administration', 'ANALYZE_TABLE') . "\n";?>
236 </td>
237 <?php
239 echo "\n";
241 </tr>
242 <tr>
243 <td>&nbsp;</td>
244 <?php
245 echo "\n";
246 if ($tbl_type == 'MYISAM') {
248 <td>
249 <a href="sql.php3?<?php echo $url_query; ?>&amp;sql_query=<?php echo urlencode('REPAIR TABLE ' . PMA_backquote($table)); ?>">
250 <?php echo $strRepairTable; ?></a>&nbsp;
251 <?php echo PMA_showMySQLDocu('MySQL_Database_Administration', 'REPAIR_TABLE') . "\n"; ?>
252 </td>
253 <td>&nbsp;-&nbsp;</td>
254 <?php
256 echo "\n";
257 if ($tbl_type == 'MYISAM' || $tbl_type == 'BDB') {
259 <td>
260 <a href="sql.php3?<?php echo $url_query; ?>&amp;sql_query=<?php echo urlencode('OPTIMIZE TABLE ' . PMA_backquote($table)); ?>">
261 <?php echo $strOptimizeTable; ?></a>&nbsp;
262 <?php echo PMA_showMySQLDocu('MySQL_Database_Administration', 'OPTIMIZE_TABLE') . "\n"; ?>
263 </td>
264 <?php
266 echo "\n";
268 </tr>
269 </table><br />
270 </div>
271 </li>
272 <?php
273 } // end MYISAM or BDB case
274 echo "\n";
275 } // end MySQL >= 3.23.22
277 // loic1: "OPTIMIZE" statement is available for MyISAM and BDB tables only and
278 // MyISAM/BDB tables exists since MySQL 3.23.06/3.23.34
279 else if (PMA_MYSQL_INT_VERSION >= 32306
280 && ($tbl_type == 'MYISAM' or $tbl_type == 'BDB')) {
282 <!-- Table maintenance -->
283 <li style="vertical-align: top">
284 <div style="margin-bottom: 10px">
285 <?php echo $strTableMaintenance; ?>&nbsp;:&nbsp;
286 <a href="sql.php3?<?php echo $url_query; ?>&amp;sql_query=<?php echo urlencode('OPTIMIZE TABLE ' . PMA_backquote($table)); ?>">
287 <?php echo $strOptimizeTable; ?></a>&nbsp;
288 <?php echo PMA_showMySQLDocu('MySQL_Database_Administration', 'OPTIMIZE_TABLE') . "\n"; ?>
289 </div>
290 </li>
291 <?php
292 echo "\n";
293 } // end 3.23.06 < MySQL < 3.23.22
295 // Referential integrity check
296 if ($cfgRelation['relwork']) {
298 // we need this PMA_mysql_select_db if the user has access to more than one db
299 // and $db is not the last of the list, because PMA_availableDatabases()
300 // has made a PMA_mysql_select_db() on the last one
301 PMA_mysql_select_db($db);
302 $foreign = PMA_getForeigners($db, $table);
304 if ($foreign) {
306 <!-- Referential integrity check -->
307 <li style="vertical-align: top">
308 <div style="margin-bottom: 10px">
309 <?php echo $strReferentialIntegrity; ?><br />
310 <?php
311 echo "\n";
312 while (list($master, $arr) = each($foreign)){
313 $join_query = 'SELECT ' . PMA_backquote($table) . '.* FROM '
314 . PMA_backquote($table) . ' LEFT JOIN '
315 . PMA_backquote($arr['foreign_table']);
316 if ($arr['foreign_table'] == $table) {
317 $foreign_table = $table . '1';
318 $join_query .= ' AS ' . PMA_backquote($foreign_table);
319 } else {
320 $foreign_table = $arr['foreign_table'];
322 $join_query .= ' ON '
323 . PMA_backquote($table) . '.' . PMA_backquote($master)
324 . ' = ' . PMA_backquote($foreign_table) . '.' . PMA_backquote($arr['foreign_field'])
325 . ' WHERE '
326 . PMA_backquote($foreign_table) . '.' . PMA_backquote($arr['foreign_field'])
327 . ' IS NULL AND '
328 . PMA_backquote($table) . '.' . PMA_backquote($master)
329 . ' IS NOT NULL';
330 echo ' '
331 . '<a href="sql.php3?' . $url_query
332 . '&amp;sql_query='
333 . urlencode($join_query)
334 . '">' . $master . '&nbsp;->&nbsp;' . $arr['foreign_table'] . '.' . $arr['foreign_field']
335 . '</a><br />' . "\n";
336 unset($foreign_table);
337 unset($join_query);
338 } // end while
340 </div>
341 </li><br />
342 <?php
343 } // end if ($result)
344 echo "\n";
346 } // end if (!empty($cfg['Server']['relation']))
349 <!-- Flushes the table -->
350 <li>
351 <a href="sql.php3?<?php echo $url_query; ?>&amp;sql_query=<?php echo urlencode('FLUSH TABLE ' . PMA_backquote($table)); ?>&amp;zero_rows=<?php echo urlencode(sprintf($strTableHasBeenFlushed, htmlspecialchars($table))); if ($cfg['ShowTooltip']) echo '&amp;reload=1'; ?>">
352 <?php echo $strFlushTable; ?></a>&nbsp;
353 <?php echo PMA_showMySQLDocu('MySQL_Database_Administration', 'FLUSH') . "\n"; ?>
354 <br /><br />
355 </li>
357 </ul>
359 <?php
361 * Displays the footer
363 echo "\n";
364 require('./footer.inc.php3');