PageRenderTime 62ms CodeModel.GetById 20ms RepoModel.GetById 0ms app.codeStats 1ms

/pma/db_structure.php

https://bitbucket.org/StasPiv/playzone
PHP | 654 lines | 493 code | 64 blank | 97 comment | 83 complexity | 4fd1f9df7335b19aa4481c7be8a0efc3 MD5 | raw file
Possible License(s): Apache-2.0, BSD-3-Clause, GPL-2.0, LGPL-2.1
  1. <?php
  2. /* vim: set expandtab sw=4 ts=4 sts=4: */
  3. /**
  4. *
  5. * @version $Id: db_structure.php 12242 2009-02-20 09:22:20Z lem9 $
  6. * @package phpMyAdmin
  7. */
  8. /**
  9. *
  10. */
  11. require_once './libraries/common.inc.php';
  12. require_once './libraries/Table.class.php';
  13. $GLOBALS['js_include'][] = 'mootools.js';
  14. /**
  15. * Prepares the tables list if the user where not redirected to this script
  16. * because there is no table in the database ($is_info is true)
  17. */
  18. if (empty($is_info)) {
  19. // Drops/deletes/etc. multiple tables if required
  20. if ((!empty($submit_mult) && isset($selected_tbl))
  21. || isset($mult_btn)) {
  22. $action = 'db_structure.php';
  23. $err_url = 'db_structure.php?'. PMA_generate_common_url($db);
  24. require './libraries/mult_submits.inc.php';
  25. if (empty($message)) {
  26. $message = PMA_Message::success();
  27. }
  28. }
  29. require './libraries/db_common.inc.php';
  30. $url_query .= '&amp;goto=db_structure.php';
  31. // Gets the database structure
  32. $sub_part = '_structure';
  33. require './libraries/db_info.inc.php';
  34. }
  35. // 1. No tables
  36. if ($num_tables == 0) {
  37. echo '<p>' . $strNoTablesFound . '</p>' . "\n";
  38. if (empty($db_is_information_schema)) {
  39. require './libraries/display_create_table.lib.php';
  40. } // end if (Create Table dialog)
  41. /**
  42. * Displays the footer
  43. */
  44. require_once './libraries/footer.inc.php';
  45. exit;
  46. }
  47. // else
  48. // 2. Shows table informations - staybyte - 11 June 2001
  49. require_once './libraries/bookmark.lib.php';
  50. require_once './libraries/mysql_charsets.lib.php';
  51. $db_collation = PMA_getDbCollation($db);
  52. // Display function
  53. /**
  54. * void PMA_TableHeader([bool $db_is_information_schema = false])
  55. * display table header (<table><thead>...</thead><tbody>)
  56. *
  57. * @uses PMA_showHint()
  58. * @uses $GLOBALS['cfg']['PropertiesNumColumns']
  59. * @uses $GLOBALS['is_show_stats']
  60. * @uses $GLOBALS['strTable']
  61. * @uses $GLOBALS['strAction']
  62. * @uses $GLOBALS['strRecords']
  63. * @uses $GLOBALS['strApproximateCount']
  64. * @uses $GLOBALS['strType']
  65. * @uses $GLOBALS['strCollation']
  66. * @uses $GLOBALS['strSize']
  67. * @uses $GLOBALS['strOverhead']
  68. * @uses $GLOBALS['structure_tbl_col_cnt']
  69. * @uses PMA_SortableTableHeader()
  70. * @param boolean $db_is_information_schema
  71. */
  72. function PMA_TableHeader($db_is_information_schema = false)
  73. {
  74. $cnt = 0; // Let's count the columns...
  75. if ($db_is_information_schema) {
  76. $action_colspan = 3;
  77. } else {
  78. $action_colspan = 6;
  79. }
  80. echo '<table class="data" style="float: left;">' . "\n"
  81. .'<thead>' . "\n"
  82. .'<tr><th></th>' . "\n"
  83. .' <th>' . PMA_SortableTableHeader($GLOBALS['strTable'], 'table') . '</th>' . "\n"
  84. .' <th colspan="' . $action_colspan . '">' . "\n"
  85. .' ' . $GLOBALS['strAction'] . "\n"
  86. .' </th>'
  87. .' <th>' . PMA_SortableTableHeader($GLOBALS['strRecords'], 'records')
  88. .PMA_showHint(PMA_sanitize($GLOBALS['strApproximateCount'])) . "\n"
  89. .' </th>' . "\n";
  90. if (!($GLOBALS['cfg']['PropertiesNumColumns'] > 1)) {
  91. echo ' <th>' . PMA_SortableTableHeader($GLOBALS['strType'], 'type') . '</th>' . "\n";
  92. $cnt++;
  93. echo ' <th>' . PMA_SortableTableHeader($GLOBALS['strCollation'], 'collation') . '</th>' . "\n";
  94. $cnt++;
  95. }
  96. if ($GLOBALS['is_show_stats']) {
  97. echo ' <th>' . PMA_SortableTableHeader($GLOBALS['strSize'], 'size') . '</th>' . "\n"
  98. . ' <th>' . PMA_SortableTableHeader($GLOBALS['strOverhead'], 'overhead') . '</th>' . "\n";
  99. $cnt += 2;
  100. }
  101. echo '</tr>' . "\n";
  102. echo '</thead>' . "\n";
  103. echo '<tbody>' . "\n";
  104. $GLOBALS['structure_tbl_col_cnt'] = $cnt + $action_colspan + 3;
  105. } // end function PMA_TableHeader()
  106. /**
  107. * Creates a clickable column header for table information
  108. *
  109. * @param string title to use for the link
  110. * @param string corresponds to sortable data name mapped in libraries/db_info.inc.php
  111. * @returns string link to be displayed in the table header
  112. */
  113. function PMA_SortableTableHeader($title, $sort)
  114. {
  115. // Set some defaults
  116. $requested_sort = 'table';
  117. $requested_sort_order = 'ASC';
  118. $sort_order = 'ASC';
  119. // If the user requested a sort
  120. if (isset($_REQUEST['sort'])) {
  121. $requested_sort = $_REQUEST['sort'];
  122. if (isset($_REQUEST['sort_order'])) {
  123. $requested_sort_order = $_REQUEST['sort_order'];
  124. }
  125. }
  126. $order_img = '';
  127. $order_link_params = array();
  128. $order_link_params['title'] = $GLOBALS['strSort'];
  129. // If this column was requested to be sorted.
  130. if ($requested_sort == $sort) {
  131. if ($requested_sort_order == 'ASC') {
  132. $sort_order = 'DESC';
  133. $order_img = ' <img class="icon" src="' . $GLOBALS['pmaThemeImage'] . 's_desc.png" width="11" height="9" alt="'. $GLOBALS['strDescending'] . '" title="'. $GLOBALS['strDescending'] . '" id="sort_arrow" />';
  134. $order_link_params['onmouseover'] = 'if(document.getElementById(\'sort_arrow\')){ document.getElementById(\'sort_arrow\').src=\'' . $GLOBALS['pmaThemeImage'] . 's_asc.png\'; }';
  135. $order_link_params['onmouseout'] = 'if(document.getElementById(\'sort_arrow\')){ document.getElementById(\'sort_arrow\').src=\'' . $GLOBALS['pmaThemeImage'] . 's_desc.png\'; }';
  136. } else {
  137. $order_img = ' <img class="icon" src="' . $GLOBALS['pmaThemeImage'] . 's_asc.png" width="11" height="9" alt="'. $GLOBALS['strAscending'] . '" title="'. $GLOBALS['strAscending'] . '" id="sort_arrow" />';
  138. $order_link_params['onmouseover'] = 'if(document.getElementById(\'sort_arrow\')){ document.getElementById(\'sort_arrow\').src=\'' . $GLOBALS['pmaThemeImage'] . 's_desc.png\'; }';
  139. $order_link_params['onmouseout'] = 'if(document.getElementById(\'sort_arrow\')){ document.getElementById(\'sort_arrow\').src=\'' . $GLOBALS['pmaThemeImage'] . 's_asc.png\'; }';
  140. }
  141. }
  142. $_url_params = array(
  143. 'db' => $_REQUEST['db'],
  144. );
  145. $url = 'db_structure.php'.PMA_generate_common_url($_url_params);
  146. // We set the position back to 0 every time they sort.
  147. $url .= "&amp;pos=0&amp;sort=$sort&amp;sort_order=$sort_order";
  148. return PMA_linkOrButton($url, $title . $order_img, $order_link_params);
  149. }
  150. $titles = array();
  151. if (true == $cfg['PropertiesIconic']) {
  152. $titles['Browse'] = '<img class="icon" width="16" height="16" src="' .$pmaThemeImage . 'b_browse.png" alt="' . $strBrowse . '" title="' . $strBrowse . '" />';
  153. $titles['NoBrowse'] = '<img class="icon" width="16" height="16" src="' .$pmaThemeImage . 'bd_browse.png" alt="' . $strBrowse . '" title="' . $strBrowse . '" />';
  154. $titles['Search'] = '<img class="icon" width="16" height="16" src="' .$pmaThemeImage . 'b_select.png" alt="' . $strSearch . '" title="' . $strSearch . '" />';
  155. $titles['NoSearch'] = '<img class="icon" width="16" height="16" src="' .$pmaThemeImage . 'bd_select.png" alt="' . $strSearch . '" title="' . $strSearch . '" />';
  156. $titles['Insert'] = '<img class="icon" width="16" height="16" src="' .$pmaThemeImage . 'b_insrow.png" alt="' . $strInsert . '" title="' . $strInsert . '" />';
  157. $titles['NoInsert'] = '<img class="icon" width="16" height="16" src="' .$pmaThemeImage . 'bd_insrow.png" alt="' . $strInsert . '" title="' . $strInsert . '" />';
  158. $titles['Structure'] = '<img class="icon" width="16" height="16" src="' .$pmaThemeImage . 'b_props.png" alt="' . $strStructure . '" title="' . $strStructure . '" />';
  159. $titles['Drop'] = '<img class="icon" width="16" height="16" src="' .$pmaThemeImage . 'b_drop.png" alt="' . $strDrop . '" title="' . $strDrop . '" />';
  160. $titles['NoDrop'] = '<img class="icon" width="16" height="16" src="' .$pmaThemeImage . 'bd_drop.png" alt="' . $strDrop . '" title="' . $strDrop . '" />';
  161. $titles['Empty'] = '<img class="icon" width="16" height="16" src="' .$pmaThemeImage . 'b_empty.png" alt="' . $strEmpty . '" title="' . $strEmpty . '" />';
  162. $titles['NoEmpty'] = '<img class="icon" width="16" height="16" src="' .$pmaThemeImage . 'bd_empty.png" alt="' . $strEmpty . '" title="' . $strEmpty . '" />';
  163. if ('both' === $cfg['PropertiesIconic']) {
  164. $titles['Browse'] .= $strBrowse;
  165. $titles['Search'] .= $strSearch;
  166. $titles['NoBrowse'] .= $strBrowse;
  167. $titles['NoSearch'] .= $strSearch;
  168. $titles['Insert'] .= $strInsert;
  169. $titles['NoInsert'] .= $strInsert;
  170. $titles['Structure'] .= $strStructure;
  171. $titles['Drop'] .= $strDrop;
  172. $titles['NoDrop'] .= $strDrop;
  173. $titles['Empty'] .= $strEmpty;
  174. $titles['NoEmpty'] .= $strEmpty;
  175. }
  176. } else {
  177. $titles['Browse'] = $strBrowse;
  178. $titles['Search'] = $strSearch;
  179. $titles['NoBrowse'] = $strBrowse;
  180. $titles['NoSearch'] = $strSearch;
  181. $titles['Insert'] = $strInsert;
  182. $titles['NoInsert'] = $strInsert;
  183. $titles['Structure'] = $strStructure;
  184. $titles['Drop'] = $strDrop;
  185. $titles['NoDrop'] = $strDrop;
  186. $titles['Empty'] = $strEmpty;
  187. $titles['NoEmpty'] = $strEmpty;
  188. }
  189. /**
  190. * Displays the tables list
  191. */
  192. $_url_params = array(
  193. 'pos' => $pos,
  194. 'db' => $db);
  195. // Add the sort options if they exists
  196. if (isset($_REQUEST['sort'])) {
  197. $_url_params['sort'] = $_REQUEST['sort'];
  198. }
  199. if (isset($_REQUEST['sort_order'])) {
  200. $_url_params['sort_order'] = $_REQUEST['sort_order'];
  201. }
  202. PMA_listNavigator($total_num_tables, $pos, $_url_params, 'db_structure.php', 'frame_content', $GLOBALS['cfg']['MaxTableList']);
  203. ?>
  204. <form method="post" action="db_structure.php" name="tablesForm" id="tablesForm">
  205. <?php
  206. echo PMA_generate_common_hidden_inputs($db);
  207. PMA_TableHeader($db_is_information_schema);
  208. $i = $sum_entries = 0;
  209. $sum_size = (double) 0;
  210. $overhead_size = (double) 0;
  211. $overhead_check = '';
  212. $checked = !empty($checkall) ? ' checked="checked"' : '';
  213. $num_columns = $cfg['PropertiesNumColumns'] > 1 ? ceil($num_tables / $cfg['PropertiesNumColumns']) + 1 : 0;
  214. $row_count = 0;
  215. $hidden_fields = array();
  216. $odd_row = true;
  217. $sum_row_count_pre = '';
  218. // added by rajk - for blobstreaming
  219. $PMA_Config = $_SESSION['PMA_Config'];
  220. if (!empty($PMA_Config))
  221. $session_bs_tables = $PMA_Config->get('BLOBSTREAMING_TABLES'); // list of blobstreaming tables
  222. $tableReductionCount = 0; // the amount to reduce the table count by
  223. foreach ($tables as $keyname => $each_table) {
  224. if (isset($session_bs_tables))
  225. {
  226. // compare table name against blobstreaming tables
  227. foreach ($session_bs_tables as $table_key=>$table_val)
  228. // if the table is a blobstreaming table, reduce table count and skip outer foreach loop
  229. if ($table_key == $keyname)
  230. {
  231. $tableReductionCount++;
  232. continue 2;
  233. }
  234. }
  235. // loic1: Patch from Joshua Nye <josh at boxcarmedia.com> to get valid
  236. // statistics whatever is the table type
  237. $table_is_view = false;
  238. $table_encoded = urlencode($each_table['TABLE_NAME']);
  239. // Sets parameters for links
  240. $tbl_url_query = $url_query . '&amp;table=' . $table_encoded;
  241. // do not list the previous table's size info for a view
  242. $formatted_size = '-';
  243. $unit = '';
  244. switch ( $each_table['ENGINE']) {
  245. // MyISAM, ISAM or Heap table: Row count, data size and index size
  246. // are accurate.
  247. case 'MyISAM' :
  248. case 'ISAM' :
  249. case 'HEAP' :
  250. case 'MEMORY' :
  251. if ($db_is_information_schema) {
  252. $each_table['Rows'] = PMA_Table::countRecords($db,
  253. $each_table['Name'], $return = true);
  254. }
  255. if ($is_show_stats) {
  256. $tblsize = doubleval($each_table['Data_length']) + doubleval($each_table['Index_length']);
  257. $sum_size += $tblsize;
  258. list($formatted_size, $unit) = PMA_formatByteDown($tblsize, 3, ($tblsize > 0) ? 1 : 0);
  259. if (isset($each_table['Data_free']) && $each_table['Data_free'] > 0) {
  260. list($formatted_overhead, $overhead_unit) = PMA_formatByteDown($each_table['Data_free'], 3, ($each_table['Data_free'] > 0) ? 1 : 0);
  261. $overhead_size += $each_table['Data_free'];
  262. }
  263. }
  264. break;
  265. case 'InnoDB' :
  266. // InnoDB table: Row count is not accurate but data and index
  267. // sizes are.
  268. if ($each_table['TABLE_ROWS'] < $GLOBALS['cfg']['MaxExactCount']) {
  269. $each_table['COUNTED'] = true;
  270. $each_table['TABLE_ROWS'] = PMA_Table::countRecords($db,
  271. $each_table['TABLE_NAME'], $return = true, $force_exact = true,
  272. $is_view = false);
  273. } else {
  274. $each_table['COUNTED'] = false;
  275. }
  276. if ($is_show_stats) {
  277. $tblsize = $each_table['Data_length'] + $each_table['Index_length'];
  278. $sum_size += $tblsize;
  279. list($formatted_size, $unit) = PMA_formatByteDown($tblsize, 3, ($tblsize > 0) ? 1 : 0);
  280. }
  281. //$display_rows = ' - ';
  282. break;
  283. case 'MRG_MyISAM' :
  284. case 'BerkeleyDB' :
  285. // Merge or BerkleyDB table: Only row count is accurate.
  286. if ($is_show_stats) {
  287. $formatted_size = ' - ';
  288. $unit = '';
  289. }
  290. break;
  291. // for a view, the ENGINE is null
  292. case null :
  293. case 'SYSTEM VIEW' :
  294. // countRecords() takes care of $cfg['MaxExactCountViews']
  295. $each_table['TABLE_ROWS'] = PMA_Table::countRecords($db,
  296. $each_table['TABLE_NAME'], $return = true, $force_exact = true,
  297. $is_view = true);
  298. $table_is_view = true;
  299. break;
  300. default :
  301. // Unknown table type.
  302. if ($is_show_stats) {
  303. $formatted_size = 'unknown';
  304. $unit = '';
  305. }
  306. } // end switch
  307. $sum_entries += $each_table['TABLE_ROWS'];
  308. if (isset($each_table['Collation'])) {
  309. $collation = '<dfn title="'
  310. . PMA_getCollationDescr($each_table['Collation']) . '">'
  311. . $each_table['Collation'] . '</dfn>';
  312. } else {
  313. $collation = '---';
  314. }
  315. if ($is_show_stats) {
  316. if (isset($formatted_overhead)) {
  317. $overhead = '<a href="tbl_structure.php?'
  318. . $tbl_url_query . '#showusage">' . $formatted_overhead
  319. . ' ' . $overhead_unit . '</a>' . "\n";
  320. unset($formatted_overhead);
  321. $overhead_check .=
  322. "document.getElementById('checkbox_tbl_" . ($i + 1) . "').checked = true;";
  323. } else {
  324. $overhead = '-';
  325. }
  326. } // end if
  327. $alias = (!empty($tooltip_aliasname) && isset($tooltip_aliasname[$each_table['TABLE_NAME']]))
  328. ? str_replace(' ', '&nbsp;', htmlspecialchars($tooltip_truename[$each_table['TABLE_NAME']]))
  329. : str_replace(' ', '&nbsp;', htmlspecialchars($each_table['TABLE_NAME']));
  330. $truename = (!empty($tooltip_truename) && isset($tooltip_truename[$each_table['TABLE_NAME']]))
  331. ? str_replace(' ', '&nbsp;', htmlspecialchars($tooltip_truename[$each_table['TABLE_NAME']]))
  332. : str_replace(' ', '&nbsp;', htmlspecialchars($each_table['TABLE_NAME']));
  333. $i++;
  334. $row_count++;
  335. if ($table_is_view) {
  336. $hidden_fields[] = '<input type="hidden" name="views[]" value="' . $each_table['TABLE_NAME'] . '" />';
  337. }
  338. if ($each_table['TABLE_ROWS'] > 0) {
  339. $browse_table = '<a href="sql.php?' . $tbl_url_query . '&amp;pos=0">' . $titles['Browse'] . '</a>';
  340. $search_table = '<a href="tbl_select.php?' . $tbl_url_query . '">' . $titles['Search'] . '</a>';
  341. } else {
  342. $browse_table = $titles['NoBrowse'];
  343. $search_table = $titles['NoSearch'];
  344. }
  345. if (! $db_is_information_schema) {
  346. if (! empty($each_table['TABLE_ROWS'])) {
  347. $empty_table = '<a href="sql.php?' . $tbl_url_query
  348. . '&amp;sql_query=';
  349. $empty_table .= urlencode('TRUNCATE ' . PMA_backquote($each_table['TABLE_NAME']))
  350. . '&amp;zero_rows='
  351. . urlencode(sprintf($strTableHasBeenEmptied, htmlspecialchars($each_table['TABLE_NAME'])))
  352. . '" onclick="return confirmLink(this, \'TRUNCATE ';
  353. $empty_table .= PMA_jsFormat($each_table['TABLE_NAME']) . '\')">' . $titles['Empty'] . '</a>';
  354. } else {
  355. $empty_table = $titles['NoEmpty'];
  356. }
  357. $drop_query = 'DROP '
  358. . ($table_is_view ? 'VIEW' : 'TABLE')
  359. . ' ' . PMA_backquote($each_table['TABLE_NAME']);
  360. $drop_message = sprintf(
  361. $table_is_view ? $strViewHasBeenDropped : $strTableHasBeenDropped,
  362. str_replace(' ', '&nbsp;', htmlspecialchars($each_table['TABLE_NAME'])));
  363. }
  364. if ($num_columns > 0 && $num_tables > $num_columns
  365. && (($row_count % $num_columns) == 0)) {
  366. $row_count = 1;
  367. $odd_row = true;
  368. ?>
  369. </tr>
  370. </tbody>
  371. </table>
  372. <?php
  373. PMA_TableHeader();
  374. }
  375. ?>
  376. <tr class="<?php echo $odd_row ? 'odd' : 'even'; $odd_row = ! $odd_row; ?>">
  377. <td align="center">
  378. <input type="checkbox" name="selected_tbl[]"
  379. value="<?php echo $each_table['TABLE_NAME']; ?>"
  380. id="checkbox_tbl_<?php echo $i; ?>"<?php echo $checked; ?> /></td>
  381. <th><label for="checkbox_tbl_<?php echo $i; ?>"
  382. title="<?php echo $alias; ?>"><?php echo $truename; ?></label>
  383. </th>
  384. <td align="center"><?php echo $browse_table; ?></td>
  385. <td align="center">
  386. <a href="tbl_structure.php?<?php echo $tbl_url_query; ?>">
  387. <?php echo $titles['Structure']; ?></a></td>
  388. <td align="center"><?php echo $search_table; ?></td>
  389. <?php if (! $db_is_information_schema) { ?>
  390. <td align="center">
  391. <a href="tbl_change.php?<?php echo $tbl_url_query; ?>">
  392. <?php echo $titles['Insert']; ?></a></td>
  393. <td align="center"><?php echo $empty_table; ?></td>
  394. <td align="center">
  395. <a href="sql.php?<?php echo $tbl_url_query;
  396. ?>&amp;reload=1&amp;purge=1&amp;sql_query=<?php
  397. echo urlencode($drop_query); ?>&amp;zero_rows=<?php
  398. echo urlencode($drop_message); ?>"
  399. onclick="return confirmLink(this, '<?php echo PMA_jsFormat($drop_query, false); ?>')">
  400. <?php echo $titles['Drop']; ?></a></td>
  401. <?php } // end if (! $db_is_information_schema)
  402. // there is a null value in the ENGINE
  403. // - when the table needs to be repaired, or
  404. // - when it's a view
  405. // so ensure that we'll display "in use" below for a table
  406. // that needs to be repaired
  407. if (isset($each_table['TABLE_ROWS']) && ($each_table['ENGINE'] != null || $table_is_view)) {
  408. if ($table_is_view) {
  409. if ($each_table['TABLE_ROWS'] >= $GLOBALS['cfg']['MaxExactCountViews']){
  410. $row_count_pre = '~';
  411. $sum_row_count_pre = '~';
  412. $show_superscript = PMA_showHint(PMA_sanitize(sprintf($strViewHasAtLeast, '[a@./Documentation.html#cfg_MaxExactCountViews@_blank]', '[/a]')));
  413. }
  414. } elseif($each_table['ENGINE'] == 'InnoDB' && (! $each_table['COUNTED'])) {
  415. // InnoDB table: we did not get an accurate row count
  416. $row_count_pre = '~';
  417. $sum_row_count_pre = '~';
  418. $show_superscript = '';
  419. } else {
  420. $row_count_pre = '';
  421. $show_superscript = '';
  422. }
  423. ?>
  424. <td class="value"><?php echo $row_count_pre . PMA_formatNumber($each_table['TABLE_ROWS'], 0) . $show_superscript; ?></td>
  425. <?php if (!($cfg['PropertiesNumColumns'] > 1)) { ?>
  426. <td nowrap="nowrap"><?php echo ($table_is_view ? $strView : $each_table['ENGINE']); ?></td>
  427. <?php if (isset($collation)) { ?>
  428. <td nowrap="nowrap"><?php echo $collation ?></td>
  429. <?php } ?>
  430. <?php } ?>
  431. <?php if ($is_show_stats) { ?>
  432. <td class="value"><a
  433. href="tbl_structure.php?<?php echo $tbl_url_query; ?>#showusage"
  434. ><?php echo $formatted_size . ' ' . $unit; ?></a></td>
  435. <td class="value"><?php echo $overhead; ?></td>
  436. <?php } // end if ?>
  437. <?php } elseif ($table_is_view) { ?>
  438. <td class="value">-</td>
  439. <td><?php echo $strView; ?></td>
  440. <td>---</td>
  441. <?php if ($is_show_stats) { ?>
  442. <td class="value">-</td>
  443. <td class="value">-</td>
  444. <?php } ?>
  445. <?php } else { ?>
  446. <td colspan="<?php echo ($structure_tbl_col_cnt - ($db_is_information_schema ? 5 : 8)) ?>"
  447. align="center">
  448. <?php echo $strInUse; ?></td>
  449. <?php } // end if (isset($each_table['TABLE_ROWS'])) else ?>
  450. </tr>
  451. <?php
  452. } // end foreach
  453. // Show Summary
  454. if ($is_show_stats) {
  455. list($sum_formatted, $unit) = PMA_formatByteDown($sum_size, 3, 1);
  456. list($overhead_formatted, $overhead_unit) =
  457. PMA_formatByteDown($overhead_size, 3, 1);
  458. }
  459. ?>
  460. </tbody>
  461. <tbody>
  462. <tr><th></th>
  463. <th align="center" nowrap="nowrap">
  464. <?php
  465. // for blobstreaming - if the number of tables is 0, set tableReductionCount to 0
  466. // (we don't want negative numbers here) - rajk
  467. if ($num_tables == 0)
  468. $tableReductionCount = 0;
  469. echo sprintf($strTables, PMA_formatNumber($num_tables - $tableReductionCount, 0));
  470. ?>
  471. </th>
  472. <th colspan="<?php echo ($db_is_information_schema ? 3 : 6) ?>" align="center">
  473. <?php echo $strSum; ?></th>
  474. <th class="value"><?php echo $sum_row_count_pre . PMA_formatNumber($sum_entries, 0); ?></th>
  475. <?php
  476. if (!($cfg['PropertiesNumColumns'] > 1)) {
  477. $default_engine = PMA_DBI_get_default_engine();
  478. echo ' <th align="center">' . "\n"
  479. . ' <dfn title="'
  480. . sprintf($strDefaultEngine, $default_engine) . '">' .$default_engine . '</dfn></th>' . "\n";
  481. // we got a case where $db_collation was empty
  482. echo ' <th align="center">' . "\n";
  483. if (! empty($db_collation)) {
  484. echo ' <dfn title="'
  485. . PMA_getCollationDescr($db_collation) . ' (' . $strDefault . ')">' . $db_collation
  486. . '</dfn>';
  487. }
  488. echo '</th>';
  489. }
  490. if ($is_show_stats) {
  491. ?>
  492. <th class="value"><?php echo $sum_formatted . ' ' . $unit; ?></th>
  493. <th class="value"><?php echo $overhead_formatted . ' ' . $overhead_unit; ?></th>
  494. <?php
  495. }
  496. ?>
  497. </tr>
  498. </tbody>
  499. </table>
  500. <div class="clearfloat">
  501. <?php
  502. // Check all tables url
  503. $checkall_url = 'db_structure.php?' . PMA_generate_common_url($db);
  504. ?>
  505. <img class="selectallarrow" src="<?php echo $pmaThemeImage .'arrow_'.$text_dir.'.png'; ?>"
  506. width="38" height="22" alt="<?php echo $strWithChecked; ?>" />
  507. <a href="<?php echo $checkall_url; ?>&amp;checkall=1"
  508. onclick="if (markAllRows('tablesForm')) return false;">
  509. <?php echo $strCheckAll; ?></a>
  510. /
  511. <a href="<?php echo $checkall_url; ?>"
  512. onclick="if (unMarkAllRows('tablesForm')) return false;">
  513. <?php echo $strUncheckAll; ?></a>
  514. <?php if ($overhead_check != '') { ?>
  515. /
  516. <a href="#" onclick="unMarkAllRows('tablesForm');
  517. <?php echo $overhead_check; ?> return false;">
  518. <?php echo $strCheckOverhead; ?></a>
  519. <?php } ?>
  520. <select name="submit_mult" onchange="this.form.submit();" style="margin: 0 3em 0 3em;">
  521. <?php
  522. echo ' <option value="' . $strWithChecked . '" selected="selected">'
  523. . $strWithChecked . '</option>' . "\n";
  524. echo ' <option value="' . $strEmpty . '" >'
  525. . $strEmpty . '</option>' . "\n";
  526. echo ' <option value="' . $strDrop . '" >'
  527. . $strDrop . '</option>' . "\n";
  528. echo ' <option value="' . $strPrintView . '" >'
  529. . $strPrintView . '</option>' . "\n";
  530. echo ' <option value="' . $strCheckTable . '" >'
  531. . $strCheckTable . '</option>' . "\n";
  532. echo ' <option value="' . $strOptimizeTable . '" >'
  533. . $strOptimizeTable . '</option>' . "\n";
  534. echo ' <option value="' . $strRepairTable . '" >'
  535. . $strRepairTable . '</option>' . "\n";
  536. echo ' <option value="' . $strAnalyzeTable . '" >'
  537. . $strAnalyzeTable . '</option>' . "\n";
  538. ?>
  539. </select>
  540. <script type="text/javascript">
  541. <!--
  542. // Fake js to allow the use of the <noscript> tag
  543. //-->
  544. </script>
  545. <noscript>
  546. <input type="submit" value="<?php echo $strGo; ?>" />
  547. </noscript>
  548. <?php echo implode("\n", $hidden_fields) . "\n"; ?>
  549. </div>
  550. </form>
  551. <?php
  552. // display again the table list navigator
  553. PMA_listNavigator($total_num_tables, $pos, $_url_params, 'db_structure.php', 'frame_content', $GLOBALS['cfg']['MaxTableList']);
  554. ?>
  555. <hr />
  556. <?php
  557. // Routines
  558. require './libraries/db_routines.inc.php';
  559. // Events
  560. if (PMA_MYSQL_INT_VERSION > 50100) {
  561. require './libraries/db_events.inc.php';
  562. }
  563. /**
  564. * Work on the database
  565. * redesigned 2004-05-08 by mkkeck
  566. */
  567. /* DATABASE WORK */
  568. /* Printable view of a table */
  569. echo '<p>';
  570. echo '<a href="db_printview.php?' . $url_query . '">';
  571. if ($cfg['PropertiesIconic']) {
  572. echo '<img class="icon" src="' . $pmaThemeImage
  573. .'b_print.png" width="16" height="16" alt="" />';
  574. }
  575. echo $strPrintView . '</a> ';
  576. echo '<a href="./db_datadict.php?' . $url_query . '">';
  577. if ($cfg['PropertiesIconic']) {
  578. echo '<img class="icon" src="' . $pmaThemeImage
  579. .'b_tblanalyse.png" width="16" height="16" alt="" />';
  580. }
  581. echo $strDataDict . '</a>';
  582. echo '</p>';
  583. if (empty($db_is_information_schema)) {
  584. require './libraries/display_create_table.lib.php';
  585. } // end if (Create Table dialog)
  586. /**
  587. * Displays the footer
  588. */
  589. require_once './libraries/footer.inc.php';
  590. ?>