clarify
[phpmyadmin/crack.git] / db_details_structure.php3
blob87ab1ae459ab310bbda1a64ceb617c04a8478e9f
1 <?php
2 /* $Id$ */
3 // vim: expandtab sw=4 ts=4 sts=4:
6 /**
7 * Prepares the tables list if the user where not redirected to this script
8 * because there is no table in the database ($is_info is TRUE)
9 */
10 if (empty($is_info)) {
11 if (!defined('PMA_GRAB_GLOBALS_INCLUDED')) {
12 include('./libraries/grab_globals.lib.php3');
14 if (!defined('PMA_COMMON_LIB_INCLUDED')) {
15 include('./libraries/common.lib.php3');
18 // Drops/deletes/etc. multiple tables if required
19 if ((!empty($submit_mult) && isset($selected_tbl))
20 || isset($mult_btn)) {
21 $action = 'db_details_structure.php3';
22 $err_url = 'db_details_structure.php3?'. PMA_generate_common_url($db);
23 include('./mult_submits.inc.php3');
25 include('./db_details_common.php3');
26 $url_query .= '&amp;goto=db_details_structure.php3';
28 // Gets the database structure
29 $sub_part = '_structure';
30 include('./db_details_db_info.php3');
31 echo "\n";
33 /**
34 * Show result of multi submit operation
36 if ((!empty($submit_mult) && isset($selected_tbl))
37 || isset($mult_btn)) {
38 PMA_showMessage($strSuccess);
42 // Display function
43 function pma_TableHeader($alternate = FALSE) {
44 if ($alternate) {
46 <table border="<?php echo $GLOBALS['cfg']['Border']; ?>">
47 <tr>
48 <td></td>
49 <th>&nbsp;<?php echo $GLOBALS['strTable']; ?>&nbsp;</th>
50 <th colspan="6"><?php echo $GLOBALS['strAction']; ?></th>
51 <th><?php echo $GLOBALS['strRecords']; ?></th>
52 </tr>
53 <?php
54 } else {
56 <table border="<?php echo $GLOBALS['cfg']['Border']; ?>">
57 <tr>
58 <td></td>
59 <th>&nbsp;<?php echo $GLOBALS['strTable']; ?>&nbsp;</th>
60 <th colspan="6"><?php echo $GLOBALS['strAction']; ?></th>
61 <th><?php echo $GLOBALS['strRecords']; ?></th>
62 <?php
63 if (!($GLOBALS['cfg']['PropertiesNumColumns'] > 1)) {
65 <th><?php echo $GLOBALS['strType']; ?></th>
66 <?php
69 <?php
70 if ($GLOBALS['cfg']['ShowStats']) {
71 echo '<th>' . $GLOBALS['strSize'] . '</th>';
73 echo "\n";
75 </tr>
76 <?php
81 /**
82 * Settings for relations stuff
84 require('./libraries/relation.lib.php3');
85 $cfgRelation = PMA_getRelationsParam();
87 /**
88 * Check if comments were updated
90 if ($cfgRelation['commwork'] && isset($db_comment) && $db_comment == 'true') {
91 PMA_SetComment($db, '', '(db_comment)', $comment);
94 /**
95 * Displays the tables list
99 <!-- TABLE LIST -->
101 <?php
102 $titles = array();
103 if ($cfg['PropertiesIconic'] == true) {
104 // We need to copy the value or else the == 'both' check will always return true
105 $propicon = (string)$cfg['PropertiesIconic'];
107 if ($propicon == 'both') {
108 $iconic_spacer = '<nobr>';
109 } else {
110 $iconic_spacer = '';
113 $titles['Browse'] = $iconic_spacer . '<img width="12" height="13" src="images/button_browse.png" alt="' . $strBrowse . '" title="' . $strBrowse . '" border="0" />';
114 $titles['Select'] = $iconic_spacer . '<img width="14" height="13" src="images/button_select.png" alt="' . $strSelect . '" title="' . $strSelect . '" border="0" />';
115 $titles['NoBrowse'] = $iconic_spacer . '<img width="12" height="13" src="images/button_nobrowse.png" alt="' . $strBrowse . '" title="' . $strBrowse . '" border="0" />';
116 $titles['NoSelect'] = $iconic_spacer . '<img width="14" height="13" src="images/button_noselect.png" alt="' . $strSelect . '" title="' . $strSelect . '" border="0" />';
117 $titles['Insert'] = $iconic_spacer . '<img width="13" height="13" src="images/button_insert.png" alt="' . $strInsert . '" title="' . $strInsert . '" border="0" />';
118 $titles['Properties'] = $iconic_spacer . '<img width="18" height="13" src="images/button_properties.png" alt="' . $strProperties . '" title="' . $strProperties . '" border="0" />';
119 $titles['Drop'] = $iconic_spacer . '<img width="11" height="13" src="images/button_drop.png" alt="' . $strDrop . '" title="' . $strDrop . '" border="0" />';
120 $titles['Empty'] = $iconic_spacer . '<img width="11" height="13" src="images/button_empty.png" alt="' . $strEmpty . '" title="' . $strEmpty . '" border="0" />';
121 $titles['NoEmpty'] = $iconic_spacer . '<img width="11" height="13" src="images/button_noempty.png" alt="' . $strEmpty . '" title="' . $strEmpty . '" border="0" />';
123 if ($propicon == 'both') {
124 $titles['Browse'] .= '&nbsp;' . $strBrowse . '</nobr>';
125 $titles['Select'] .= '&nbsp;' . $strSelect . '</nobr>';
126 $titles['NoBrowse'] .= '&nbsp;' . $strBrowse . '</nobr>';
127 $titles['NoSelect'] .= '&nbsp;' . $strSelect . '</nobr>';
128 $titles['Insert'] .= '&nbsp;' . $strInsert . '</nobr>';
129 $titles['Properties'] .= '&nbsp;' . $strProperties . '</nobr>';
130 $titles['Drop'] .= '&nbsp;' . $strDrop . '</nobr>';
131 $titles['Empty'] .= '&nbsp;' . $strEmpty . '</nobr>';
132 $titles['NoEmpty'] .= '&nbsp;' . $strEmpty . '</nobr>';
134 } else {
135 $titles['Browse'] = $strBrowse;
136 $titles['Select'] = $strSelect;
137 $titles['NoBrowse'] = $strBrowse;
138 $titles['NoSelect'] = $strSelect;
139 $titles['Insert'] = $strInsert;
140 $titles['Properties'] = $strProperties;
141 $titles['Drop'] = $strDrop;
142 $titles['Empty'] = $strEmpty;
143 $titles['NoEmpty'] = $strEmpty;
146 // 1. No tables
147 if ($num_tables == 0) {
148 echo $strNoTablesFound . "\n";
150 // 2. Shows table informations on mysql >= 3.23.03 - staybyte - 11 June 2001
151 else if (PMA_MYSQL_INT_VERSION >= 32303) {
152 // Get additional information about tables for tooltip
153 if ($cfg['ShowTooltip']) {
154 $tooltip_truename = array();
155 $tooltip_aliasname = array();
157 $result = PMA_mysql_query('SHOW TABLE STATUS FROM ' . PMA_backquote($db));
158 while ($tmp = PMA_mysql_fetch_array($result)) {
159 $tooltip_truename[$tmp['Name']] = ($cfg['ShowTooltipAliasTB'] ? (!empty($tmp['Comment']) ? $tmp['Comment'] . ' ' : $tmp['Name']) : $tmp['Name']);
160 $tooltip_aliasname[$tmp['Name']] = ($cfg['ShowTooltipAliasTB'] ? $tmp['Name'] : (!empty($tmp['Comment']) ? $tmp['Comment'] . ' ' : ''));
161 if (isset($tmp['Create_time']) && !empty($tmp['Create_time'])) {
162 $tooltip_aliasname[$tmp['Name']] .= ', ' . $strStatCreateTime . ': ' . PMA_localisedDate(strtotime($tmp['Create_time']));
165 if (isset($tmp['Update_time']) && !empty($tmp['Update_time'])) {
166 $tooltip_aliasname[$tmp['Name']] .= ', ' . $strStatUpdateTime . ': ' . PMA_localisedDate(strtotime($tmp['Update_time']));
169 if (isset($tmp['Check_time']) && !empty($tmp['Check_time'])) {
170 $tooltip_aliasname[$tmp['Name']] .= ', ' . $strStatCheckTime . ': ' . PMA_localisedDate(strtotime($tmp['Check_time']));
173 } // end while
174 } // end if
176 if ($cfgRelation['commwork']) {
177 $comment = PMA_getComments($db);
180 * Displays table comment
182 if (is_array($comment)) {
184 <!-- DB comment -->
185 <p><i>
186 <?php echo htmlspecialchars(implode(' ', $comment)) . "\n"; ?>
187 </i></p>
188 <?php
189 } // end if
192 <form method="post" action="db_details_structure.php3" name="tablesForm">
193 <?php echo PMA_generate_common_hidden_inputs($db); ?>
195 <?php
196 if ($cfg['PropertiesNumColumns'] > 1) {
198 <table cellspacing="0" cellpadding="0" border="0">
199 <tr>
200 <td valign="top">
201 <?php
204 pma_TableHeader();
206 $i = $sum_entries = 0;
207 (double) $sum_size = 0;
208 $checked = (!empty($checkall) ? ' checked="checked"' : '');
209 $num_columns = ($cfg['PropertiesNumColumns'] > 1 ? (ceil($num_tables / $cfg['PropertiesNumColumns']) + 1) : 0);
210 $row_count = 0;
211 while (list($keyname, $sts_data) = each($tables)) {
212 $table = $sts_data['Name'];
213 $table_encoded = urlencode($table);
214 $table_name = htmlspecialchars($table);
216 $alias = (!empty($tooltip_aliasname) && isset($tooltip_aliasname[$table]))
217 ? htmlspecialchars($tooltip_aliasname[$table])
218 : htmlspecialchars($sts_data['Name']);
219 $truename = (!empty($tooltip_truename) && isset($tooltip_truename[$table]))
220 ? htmlspecialchars($tooltip_truename[$table])
221 : htmlspecialchars($sts_data['Name']);
223 // Sets parameters for links
224 $tbl_url_query = $url_query . '&amp;table=' . $table_encoded;
225 $bgcolor = ($i++ % 2) ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo'];
226 echo "\n";
228 $row_count++;
229 if($num_columns > 0 && $num_tables > $num_columns && (($row_count % ($num_columns)) == 0)) {
230 $bgcolor = $cfg['BgcolorTwo'];
231 $row_count = 1;
233 </tr>
234 </table>
235 </td>
236 <td><img src="./images/spacer.gif" border="0" width="10" height="1" alt="" /></td>
237 <td valign="top">
238 <?php
239 pma_TableHeader();
242 <tr>
243 <td align="center" bgcolor="<?php echo $bgcolor; ?>">
244 <input type="checkbox" name="selected_tbl[]" value="<?php echo $table_encoded; ?>" id="checkbox_tbl_<?php echo $i; ?>"<?php echo $checked; ?> />
245 </td>
246 <td bgcolor="<?php echo $bgcolor; ?>" nowrap="nowrap">
247 &nbsp;<b><label for="checkbox_tbl_<?php echo $i; ?>" title="<?php echo $alias; ?>"><?php echo $truename; ?></label>&nbsp;</b>&nbsp;
248 </td>
249 <td align="center" bgcolor="<?php echo $bgcolor; ?>">
250 <?php
251 include('./libraries/bookmark.lib.php3');
252 $book_sql_query = PMA_queryBookmarks($db, $cfg['Bookmark'], '\'' . PMA_sqlAddslashes($table) . '\'', 'label');
254 if (!empty($sts_data['Rows'])) {
255 echo '<a href="sql.php3?' . $tbl_url_query . '&amp;sql_query='
256 . (isset($book_sql_query) && $book_sql_query != FALSE ? urlencode($book_sql_query) : urlencode('SELECT * FROM ' . PMA_backquote($table)))
257 . '&amp;pos=0">' . $titles['Browse'] . '</a>';
258 } else {
259 echo $titles['NoBrowse'];
262 </td>
263 <td bgcolor="<?php echo $bgcolor; ?>">
264 <?php
265 if (!empty($sts_data['Rows'])) {
266 echo '<a href="tbl_select.php3?' . $tbl_url_query . '">'
267 . $titles['Select'] . '</a>';
268 } else {
269 echo $titles['NoSelect'];
272 </td>
273 <td align="center" bgcolor="<?php echo $bgcolor; ?>">
274 <a href="tbl_change.php3?<?php echo $tbl_url_query; ?>">
275 <?php echo $titles['Insert']; ?></a>
276 </td>
277 <td align="center" bgcolor="<?php echo $bgcolor; ?>">
278 <a href="tbl_properties_structure.php3?<?php echo $tbl_url_query; ?>">
279 <?php echo $titles['Properties']; ?></a>
280 </td>
281 <td align="center" bgcolor="<?php echo $bgcolor; ?>">
282 <a href="sql.php3?<?php echo $tbl_url_query; ?>&amp;reload=1&amp;purge=1&amp;sql_query=<?php echo urlencode('DROP TABLE ' . PMA_backquote($table)); ?>&amp;zero_rows=<?php echo urlencode(sprintf($strTableHasBeenDropped, htmlspecialchars($table))); ?>"
283 onclick="return confirmLink(this, 'DROP TABLE <?php echo PMA_jsFormat($table); ?>')">
284 <?php echo $titles['Drop']; ?></a>
285 </td>
286 <td align="center" bgcolor="<?php echo $bgcolor; ?>">
287 <?php
288 if (!empty($sts_data['Rows'])) {
289 echo '<a href="sql.php3?' . $tbl_url_query
290 . '&amp;sql_query=';
291 if (PMA_MYSQL_INT_VERSION >= 40000) {
292 echo urlencode('TRUNCATE ' . PMA_backquote($table))
293 . '&amp;zero_rows='
294 . urlencode(sprintf($strTableHasBeenEmptied, htmlspecialchars($table)))
295 . '" onclick="return confirmLink(this, \'TRUNCATE ';
296 } else {
297 echo urlencode('DELETE FROM ' . PMA_backquote($table))
298 . '&amp;zero_rows='
299 . urlencode(sprintf($strTableHasBeenEmptied, htmlspecialchars($table)))
300 . '" onclick="return confirmLink(this, \'DELETE FROM ';
302 echo PMA_jsFormat($table) . '\')">' . $titles['Empty'] . '</a>';
303 } else {
304 echo $titles['NoEmpty'];
307 </td>
308 <?php
309 echo "\n";
311 // loic1: Patch from Joshua Nye <josh at boxcarmedia.com> to get valid
312 // statistics whatever is the table type
313 if (isset($sts_data['Rows'])) {
314 // MyISAM, ISAM or Heap table: Row count, data size and index size
315 // is accurate.
316 if (isset($sts_data['Type']) && ereg('^(MyISAM|ISAM|HEAP)$', $sts_data['Type'])) {
317 if ($cfg['ShowStats']) {
318 $tblsize = doubleval($sts_data['Data_length']) + doubleval($sts_data['Index_length']);
319 $sum_size += $tblsize;
320 list($formated_size, $unit) = PMA_formatByteDown($tblsize, 3, ($tblsize > 0) ? 1 : 0);
322 $sum_entries += $sts_data['Rows'];
323 $display_rows = number_format($sts_data['Rows'], 0, $number_decimal_separator, $number_thousands_separator);
326 // InnoDB table: Row count is not accurate but data and index
327 // sizes are.
328 else if (isset($sts_data['Type']) && $sts_data['Type'] == 'InnoDB') {
329 if ($cfg['ShowStats']) {
330 $tblsize = $sts_data['Data_length'] + $sts_data['Index_length'];
331 $sum_size += $tblsize;
332 list($formated_size, $unit) = PMA_formatByteDown($tblsize, 3, ($tblsize > 0) ? 1 : 0);
334 //$display_rows = '&nbsp;-&nbsp;';
335 // get row count with another method
336 if ($sts_data['Rows'] < $cfg['MaxExactCount']) {
337 $local_query = 'SELECT COUNT(*) AS count FROM '
338 . PMA_backquote($db) . '.'
339 . PMA_backquote($table);
340 $table_info_result = PMA_mysql_query($local_query)
341 or PMA_mysqlDie('', $local_query, '', $err_url_0);
342 $row_count = PMA_mysql_result($table_info_result, 0, 'count');
343 $sum_entries += $row_count;
344 } else {
345 $row_count = $sts_data['Rows'];
346 $sum_entries += $sts_data['Rows'];
348 $display_rows = number_format($row_count, 0, $number_decimal_separator, $number_thousands_separator);
351 // Merge or BerkleyDB table: Only row count is accurate.
352 else if (isset($sts_data['Type']) && ereg('^(MRG_MyISAM|BerkeleyDB)$', $sts_data['Type'])) {
353 if ($cfg['ShowStats']) {
354 $formated_size = '&nbsp;-&nbsp;';
355 $unit = '';
357 $sum_entries += $sts_data['Rows'];
358 $display_rows = number_format($sts_data['Rows'], 0, $number_decimal_separator, $number_thousands_separator);
361 // Unknown table type.
362 else {
363 if ($cfg['ShowStats']) {
364 $formated_size = 'unknown';
365 $unit = '';
367 $display_rows = 'unknown';
370 <td align="right" bgcolor="<?php echo $bgcolor; ?>">
371 <?php
372 echo "\n" . ' ' . $display_rows . "\n";
374 </td>
375 <?php
376 if (!($cfg['PropertiesNumColumns'] > 1)) {
378 <td bgcolor="<?php echo $bgcolor; ?>" nowrap="nowrap">
379 &nbsp;<?php echo (isset($sts_data['Type']) ? $sts_data['Type'] : '&nbsp;'); ?>&nbsp;
380 </td>
381 <?php
384 if ($cfg['ShowStats']) {
385 echo "\n";
387 <td align="right" bgcolor="<?php echo $bgcolor; ?>" nowrap="nowrap">
388 &nbsp;&nbsp;
389 <a href="tbl_properties_structure.php3?<?php echo $tbl_url_query; ?>#showusage"><?php echo $formated_size . ' ' . $unit; ?></a>
390 </td>
391 <?php
392 echo "\n";
393 } // end if
394 } else {
396 <td colspan="3" align="center" bgcolor="<?php echo $bgcolor; ?>">
397 <?php echo $strInUse . "\n"; ?>
398 </td>
399 <?php
401 echo "\n";
403 </tr>
404 <?php
406 // Show Summary
407 if ($cfg['ShowStats']) {
408 list($sum_formated, $unit) = PMA_formatByteDown($sum_size, 3, 1);
410 echo "\n";
412 <tr>
413 <td></td>
414 <th align="center" nowrap="nowrap">
415 &nbsp;<b><?php echo sprintf($strTables, number_format($num_tables, 0, $number_decimal_separator, $number_thousands_separator)); ?></b>&nbsp;
416 </th>
417 <th colspan="6" align="center">
418 <b><?php echo $strSum; ?></b>
419 </th>
420 <th align="right" nowrap="nowrap">
421 <b><?php echo number_format($sum_entries, 0, $number_decimal_separator, $number_thousands_separator); ?></b>
422 </th>
423 <?php
424 if (!($cfg['PropertiesNumColumns'] > 1)) {
426 <th align="center">
427 <b>--</b>
428 </th>
429 <?php
432 if ($cfg['ShowStats']) {
433 echo "\n";
435 <th align="right" nowrap="nowrap">
436 &nbsp;
437 <b><?php echo $sum_formated . ' ' . $unit; ?></b>
438 </th>
439 <?php
441 echo "\n";
443 </tr>
445 <?php
446 // Check all tables url
447 $checkall_url = 'db_details_structure.php3?' . PMA_generate_common_url($db);
448 echo "\n";
450 <tr>
451 <td colspan="<?php echo (($cfg['ShowStats']) ? '11' : '10'); ?>" valign="bottom">
452 <img src="./images/arrow_<?php echo $text_dir; ?>.gif" border="0" width="38" height="22" alt="<?php echo $strWithChecked; ?>" />
453 <a href="<?php echo $checkall_url; ?>&amp;checkall=1" onclick="setCheckboxes('tablesForm', true); return false;">
454 <?php echo $strCheckAll; ?></a>
455 &nbsp;/&nbsp;
456 <a href="<?php echo $checkall_url; ?>" onclick="setCheckboxes('tablesForm', false); return false;">
457 <?php echo $strUncheckAll; ?></a>
458 &nbsp;&nbsp;&nbsp;
459 <img src="./images/spacer.gif" border="0" width="38" height="1" alt="" />
460 <select name="submit_mult" dir="ltr" onchange="this.form.submit();">
461 <?php
462 echo "\n";
463 echo ' <option value="' . $strWithChecked . '" selected="selected">'
464 . $strWithChecked . '</option>' . "\n";
465 echo ' <option value="' . $strDrop . '" >'
466 . $strDrop . '</option>' . "\n";
467 echo ' <option value="' . $strEmpty . '" >'
468 . $strEmpty . '</option>' . "\n";
469 echo ' <option value="' . $strPrintView . '" >'
470 . $strPrintView . '</option>' . "\n";
471 echo ' <option value="' . $strCheckTable . '" >'
472 . $strCheckTable . '</option>' . "\n";
473 echo ' <option value="' . $strOptimizeTable . '" >'
474 . $strOptimizeTable . '</option>' . "\n";
475 echo ' <option value="' . $strRepairTable . '" >'
476 . $strRepairTable . '</option>' . "\n";
477 echo ' <option value="' . $strAnalyzeTable . '" >'
478 . $strAnalyzeTable . '</option>' . "\n";
480 </select>
481 <script type="text/javascript" language="javascript">
482 <!--
483 // Fake js to allow the use of the <noscript> tag
484 //-->
485 </script>
486 <noscript>
487 <input type="submit" value="<?php echo $strGo; ?>" />
488 </noscript>
489 </td>
490 </tr>
491 </table>
492 <?php
493 if ($cfg['PropertiesNumColumns'] > 1) {
495 </td>
496 </tr>
497 </table>
498 <?php
501 </form>
502 <?php
503 } // end case mysql >= 3.23.03
505 // 3. Shows tables list mysql < 3.23.03
506 else {
507 if ($cfgRelation['commwork']) {
508 $comment = PMA_getComments($db);
511 * Displays table comment
513 if (is_array($comment)) {
515 <!-- DB comment -->
516 <p><i>
517 <?php echo htmlspecialchars(implode(' ', $comment)) . "\n"; ?>
518 </i></p>
519 <?php
520 } // end if
523 $i = 0;
524 echo "\n";
526 <form action="db_details_structure.php3">
527 <?php PMA_generate_common_hidden_inputs($db); ?>
529 <?php
530 if ($cfg['PropertiesNumColumns'] > 1) {
532 <table cellspacing="0" cellpadding="0" border="0">
533 <tr>
534 <td valign="top">
535 <?php
538 pma_TableHeader(true);
540 $checked = (!empty($checkall) ? ' checked="checked"' : '');
541 $num_columns = ($cfg['PropertiesNumColumns'] > 1 ? (ceil($num_tables / $cfg['PropertiesNumColumns']) + 1) : 0);
542 $row_count = 0;
543 while ($i < $num_tables) {
544 $table = $tables[$i];
545 $table_encoded = urlencode($table);
546 $table_name = htmlspecialchars($table);
548 // Sets parameters for links
549 $tbl_url_query = $url_query . '&amp;table=' . $table_encoded;
550 $bgcolor = ($i % 2) ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo'];
551 echo "\n";
552 $row_count++;
553 if($num_columns > 0 && $num_tables > $num_columns && (($row_count % ($num_columns)) == 0)) {
554 $bgcolor = $cfg['BgcolorTwo'];
555 $row_count = 1;
557 </tr>
558 </table>
559 </td>
560 <td><img src="./images/spacer.gif" border="0" width="10" height="1" alt="" /></td>
561 <td valign="top">
562 <?php
563 pma_TableHeader(true);
566 <tr>
567 <td align="center" bgcolor="<?php echo $bgcolor; ?>">
568 <input type="checkbox" name="selected_tbl[]" value="<?php echo $table_encoded; ?>" id="checkbox_tbl_<?php echo $i; ?>"<?php echo $checked; ?> />
569 </td>
570 <td bgcolor="<?php echo $bgcolor; ?>" class="data">
571 <b>&nbsp;<label for="checkbox_tbl_<?php echo $i; ?>"><?php echo $table_name; ?></label>&nbsp;</b>
572 </td>
573 <td bgcolor="<?php echo $bgcolor; ?>">
574 <a href="sql.php3?<?php echo $tbl_url_query; ?>&amp;sql_query=<?php echo urlencode('SELECT * FROM ' . PMA_backquote($table)); ?>&amp;pos=0"><?php echo $strBrowse; ?></a>
575 </td>
576 <td align="center" bgcolor="<?php echo $bgcolor; ?>">
577 <a href="tbl_select.php3?<?php echo $tbl_url_query; ?>"><?php echo $titles['Select']; ?></a>
578 </td>
579 <td bgcolor="<?php echo $bgcolor; ?>">
580 <a href="tbl_change.php3?<?php echo $tbl_url_query; ?>"><?php echo $titles['Insert']; ?></a>
581 </td>
582 <td bgcolor="<?php echo $bgcolor; ?>">
583 <a href="tbl_properties.php3?<?php echo $tbl_url_query; ?>"><?php echo $titles['Properties']; ?></a>
584 </td>
585 <td bgcolor="<?php echo $bgcolor; ?>">
586 <a href="sql.php3?<?php echo $tbl_url_query; ?>&amp;reload=1&amp;purge=1&amp;sql_query=<?php echo urlencode('DROP TABLE ' . PMA_backquote($table)); ?>&amp;zero_rows=<?php echo urlencode(sprintf($strTableHasBeenDropped, $table_name)); ?>"><?php echo $titles['Drop']; ?></a>
587 </td>
588 <td bgcolor="<?php echo $bgcolor; ?>">
589 <a href="sql.php3?<?php echo $tbl_url_query; ?>&amp;sql_query=<?php echo urlencode('DELETE FROM ' . PMA_backquote($table)); ?>&amp;zero_rows=<?php echo urlencode(sprintf($strTableHasBeenEmptied, $table_name)); ?>"><?php echo $titles['Empty']; ?></a>
590 </td>
591 <td align="right" bgcolor="<?php echo $bgcolor; ?>">
592 <?php PMA_countRecords($db, $table); echo "\n"; ?>
593 </td>
594 </tr>
595 <?php
596 $i++;
597 } // end while
598 echo "\n";
600 // Check all tables url
601 $checkall_url = 'db_details_structure.php3?' . PMA_generate_common_url($db);
603 <tr>
604 <td colspan="9">
605 <img src="./images/arrow_<?php echo $text_dir; ?>.gif" border="0" width="38" height="22" alt="<?php echo $strWithChecked; ?>" />
606 <a href="<?php echo $checkall_url; ?>&amp;checkall=1" onclick="setCheckboxes('tablesForm', true); return false;">
607 <?php echo $strCheckAll; ?></a>
608 &nbsp;/&nbsp;
609 <a href="<?php echo $checkall_url; ?>" onclick="setCheckboxes('tablesForm', false); return false;">
610 <?php echo $strUncheckAll; ?></a>
611 </td>
612 </tr>
614 <tr>
615 <td colspan="9">
616 <img src="./images/spacer.gif" border="0" width="38" height="1" alt="" />
617 <i><?php echo $strWithChecked; ?></i>&nbsp;&nbsp;
618 <input type="submit" name="submit_mult" value="<?php echo $strDrop; ?>" />
619 &nbsp;<?php $strOr . "\n"; ?>&nbsp;
620 <input type="submit" name="submit_mult" value="<?php echo $strEmpty; ?>" />
621 </td>
622 </tr>
623 </table>
624 <?php
625 if ($cfg['PropertiesNumColumns'] > 1) {
627 </td>
628 </tr>
629 </table>
630 <?php
633 </form>
634 <?php
635 } // end case mysql < 3.23.03
637 echo "\n";
639 <hr />
642 <?php
644 * Work on the database
647 <!-- DATABASE WORK -->
648 <ul>
650 <?php
651 if ($num_tables > 0) {
653 <!-- Printable view of a table -->
654 <li>
655 <div style="margin-bottom: 10px"><a href="db_printview.php3?<?php echo $url_query; ?>"><?php echo $strPrintView; ?></a></div>
656 </li>
657 <li>
658 <div style="margin-bottom: 10px"><a href="./db_datadict.php3?<?php echo $url_query; ?>"><?php echo $strDataDict; ?></a></div>
659 </li>
660 <?php
661 } // end if
664 <?php
665 if ($cfgRelation['commwork']) {
667 <!-- Alter/Enter db-comment -->
668 <li>
669 <form method="post" action="db_details_structure.php3">
670 <?php echo $strDBComment; ?>
671 <input type="hidden" name="db_comment" value="true" />
672 <?php echo PMA_generate_common_hidden_inputs($db); ?>
673 <input type="text" name="comment" class="textfield" value="<?php echo (isset($comment) && is_array($comment) ? htmlspecialchars(implode(' ', $comment)) : ''); ?>" />
674 <input type="submit" value="<?php echo $strGo; ?>" />
675 </form>
676 </li>
677 <?php
681 <!-- Create a new table -->
682 <li>
683 <form method="post" action="tbl_create.php3"
684 onsubmit="return (emptyFormElements(this, 'table') && checkFormElementInRange(this, 'num_fields', 1))">
685 <?php echo PMA_generate_common_hidden_inputs($db); ?>
686 <?php
687 echo ' ' . sprintf($strCreateNewTable, htmlspecialchars($db)) . '&nbsp;:<br />' . "\n";
688 echo ' ' . $strName . '&nbsp;:&nbsp;' . "\n";
689 echo ' ' . '<input type="text" name="table" maxlength="64" class="textfield" />' . "\n";
690 echo ' ' . '<br />' . "\n";
691 echo ' ' . $strFields . '&nbsp;:&nbsp;' . "\n";
692 echo ' ' . '<input type="text" name="num_fields" size="2" class="textfield" />' . "\n";
693 echo ' ' . '&nbsp;<input type="submit" value="' . $strGo . '" />' . "\n";
695 </form>
696 </li>
698 <?php
699 if ($num_tables > 0
700 && !$cfgRelation['allworks'] && $cfg['PmaNoRelation_DisableWarning'] == FALSE) {
701 echo ' <li>' . "\n";
702 echo ' <div style="margin-bottom: 10px">' . "\n";
703 echo ' <font color="red">' . $strError . '</font><br />' . "\n";
704 $url_to_goto = '<a href="' . $cfg['PmaAbsoluteUri'] . 'chk_rel.php3?' . $url_query . '">';
705 echo ' ' . sprintf($strRelationNotWorking, $url_to_goto, '</a>') . "\n";
706 echo ' </div>' . "\n";
707 echo ' </li>' . "\n";
708 } // end if
710 // is this OK to check for 'class' support?
711 if ($num_tables > 0) {
712 $takeaway = $url_query . '&amp;table=' . urlencode($table);
715 if ($cfgRelation['pdfwork'] && $num_tables > 0) {
717 <!-- Work on PDF Pages -->
718 <li>
719 <div style="margin-bottom: 10px"><a href="pdf_pages.php3?<?php echo $takeaway; ?>"><?php echo $strEditPDFPages; ?></a></div>
720 </li>
722 <!-- PDF schema -->
723 <?php
724 // We only show this if we find something in the new pdf_pages table
726 $test_query = 'SELECT * FROM ' . PMA_backquote($cfgRelation['pdf_pages'])
727 . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\'';
728 $test_rs = PMA_query_as_cu($test_query);
729 if ($test_rs && mysql_num_rows($test_rs) > 0) {
730 echo "\n";
732 <li>
733 <form method="post" action="pdf_schema.php3">
734 <?php echo PMA_generate_common_hidden_inputs($db); ?>
735 <?php echo $strDisplayPDF; ?>&nbsp;:<br />
736 <?php echo $strPageNumber; ?>&nbsp;
737 <select name="pdf_page_number">
738 <?php
739 while ($pages = @PMA_mysql_fetch_array($test_rs)) {
740 echo "\n" . ' '
741 . '<option value="' . $pages['page_nr'] . '">' . $pages['page_nr'] . ': ' . $pages['page_descr'] . '</option>';
742 } // end while
743 echo "\n";
745 </select><br />
746 <input type="checkbox" name="show_grid" id="show_grid_opt" />
747 <label for="show_grid_opt"><?php echo $strShowGrid; ?></label><br />
748 <input type="checkbox" name="show_color" id="show_color_opt" checked="checked" />
749 <label for="show_color_opt"><?php echo $strShowColor; ?></label><br />
750 <input type="checkbox" name="show_table_dimension" id="show_table_dim_opt" />
751 <label for="show_table_dim_opt"><?php echo $strShowTableDimension; ?></label><br />
752 <input type="checkbox" name="all_tab_same_wide" id="all_tab_same_wide" />
753 <label for="all_tab_same_wide"><?php echo $strAllTableSameWidth; ?></label> <br />
754 <input type="checkbox" name="with_doc" id="with_doc" checked="checked" />
755 <label for="with_doc"><?php echo $strDataDict; ?></label> <br />
756 <?php echo $strShowDatadictAs; ?>
757 <select name="orientation">
758 <option value="L"><?php echo $strLandscape;?></option>
759 <option value="P"><?php echo $strPortrait;?></option>
760 </select><br />
761 <?php echo $strPaperSize; ?>
762 <select name="paper">
763 <?php
764 while (list($key,$val) = each($cfg['PDFPageSizes'])) {
765 echo '<option value="' . $val . '"';
766 if ($val == $cfg['PDFDefaultPageSize']) {
767 echo ' selected="selected"';
769 echo ' >' . $val . '</option>' . "\n";
772 </select><br />
773 &nbsp;&nbsp;<input type="submit" value="<?php echo $strGo; ?>" />
774 </form>
775 </li>
776 <?php
777 } // end if
778 } // end if
780 if ($num_tables > 0
781 && $cfgRelation['relwork'] && $cfgRelation['commwork']) {
783 <!-- import docSQL files -->
784 <li>
785 <div style="margin-bottom: 10px"><a href="db_details_importdocsql.php3?<?php echo $takeaway . '">' . $strImportDocSQL; ?></a></div>
786 </li>
787 <?php
789 echo "\n" . '</ul>';
793 * Displays the footer
795 echo "\n";
796 require('./footer.inc.php3');