Fix left frame reloading after dropping table (bug #1034531).
[phpmyadmin/crack.git] / db_details_db_info.php
blobabb07dc5e775a92cab8213418573d9f70479fc7a
1 <?php
2 /* $Id$ */
3 // vim: expandtab sw=4 ts=4 sts=4:
6 // Check parameters
8 require_once('./libraries/common.lib.php');
10 PMA_checkParameters(array('db'));
12 function fillTooltip(&$tooltip_truename, &$tooltip_aliasname, &$tmp) {
13 $tooltip_truename[$tmp['Name']] = ($GLOBALS['cfg']['ShowTooltipAliasTB'] && $GLOBALS['cfg']['ShowTooltipAliasTB'] != 'nested' ? (!empty($tmp['Comment']) ? $tmp['Comment'] . ' ' : $tmp['Name']) : $tmp['Name']);
14 $tooltip_aliasname[$tmp['Name']] = ($GLOBALS['cfg']['ShowTooltipAliasTB'] && $GLOBALS['cfg']['ShowTooltipAliasTB'] != 'nested' ? $tmp['Name'] : (!empty($tmp['Comment']) ? $tmp['Comment'] . ' ' : $tmp['Name']));
15 if (isset($tmp['Create_time']) && !empty($tmp['Create_time'])) {
16 $tooltip_aliasname[$tmp['Name']] .= ', ' . $GLOBALS['strStatCreateTime'] . ': ' . PMA_localisedDate(strtotime($tmp['Create_time']));
19 if (isset($tmp['Update_time']) && !empty($tmp['Update_time'])) {
20 $tooltip_aliasname[$tmp['Name']] .= ', ' . $GLOBALS['strStatUpdateTime'] . ': ' . PMA_localisedDate(strtotime($tmp['Update_time']));
23 if (isset($tmp['Check_time']) && !empty($tmp['Check_time'])) {
24 $tooltip_aliasname[$tmp['Name']] .= ', ' . $GLOBALS['strStatCheckTime'] . ': ' . PMA_localisedDate(strtotime($tmp['Check_time']));
27 return true;
30 /**
31 * Gets the list of the table in the current db and informations about these
32 * tables if possible
34 // staybyte: speedup view on locked tables - 11 June 2001
35 $tables = array();
37 // When used in Nested table group mode, only show tables matching the given groupname
38 if (!empty($tbl_group) && !$cfg['ShowTooltipAliasTB']) {
39 $tbl_group_sql = ' LIKE \'' . $tbl_group . '%\'';
40 } else {
41 $tbl_group_sql = '';
44 if ($cfg['ShowTooltip']) {
45 $tooltip_truename = array();
46 $tooltip_aliasname = array();
49 // Special speedup for newer MySQL Versions (in 4.0 format changed)
50 if ($cfg['SkipLockedTables'] == TRUE) {
51 $db_info_result = PMA_DBI_query('SHOW OPEN TABLES FROM ' . PMA_backquote($db) . ';');
52 // Blending out tables in use
53 if ($db_info_result != FALSE && PMA_DBI_num_rows($db_info_result) > 0) {
54 while ($tmp = PMA_DBI_fetch_row($db_info_result)) {
55 // if in use memorize tablename
56 if (preg_match('@in_use=[1-9]+@i', $tmp[1])) {
57 $sot_cache[$tmp[0]] = TRUE;
60 PMA_DBI_free_result($db_info_result);
62 if (isset($sot_cache)) {
63 $db_info_result = PMA_DBI_query('SHOW TABLES FROM ' . PMA_backquote($db) . $tbl_group_sql . ';', NULL, PMA_DBI_QUERY_STORE);
64 if ($db_info_result != FALSE && PMA_DBI_num_rows($db_info_result) > 0) {
65 while ($tmp = PMA_DBI_fetch_row($db_info_result)) {
66 if (!isset($sot_cache[$tmp[0]])) {
67 $sts_result = PMA_DBI_query('SHOW TABLE STATUS FROM ' . PMA_backquote($db) . ' LIKE \'' . addslashes($tmp[0]) . '\';');
68 $sts_tmp = PMA_DBI_fetch_assoc($sts_result);
69 PMA_DBI_free_result($sts_result);
70 unset($sts_result);
72 if (!isset($sts_tmp['Type']) && isset($sts_tmp['Engine'])) {
73 $sts_tmp['Type'] =& $sts_tmp['Engine'];
76 if (!empty($tbl_group) && $cfg['ShowTooltipAliasTB'] && !preg_match('@' . preg_quote($tbl_group, '@') . '@i', $sts_tmp['Comment'])) {
77 continue;
80 if ($cfg['ShowTooltip']) {
81 fillTooltip($tooltip_truename, $tooltip_aliasname, $sts_tmp);
84 $tables[] = $sts_tmp;
85 } else { // table in use
86 $tables[] = array('Name' => $tmp[0]);
89 PMA_DBI_free_result($db_info_result);
90 $sot_ready = TRUE;
93 } else {
94 PMA_DBI_free_result($db_info_result);
95 unset($db_info_result);
98 if (!isset($sot_ready)) {
99 $db_info_result = PMA_DBI_query('SHOW TABLE STATUS FROM ' . PMA_backquote($db) . $tbl_group_sql . ';', NULL, PMA_DBI_QUERY_STORE);
100 if ($db_info_result != FALSE && PMA_DBI_num_rows($db_info_result) > 0) {
101 while ($sts_tmp = PMA_DBI_fetch_assoc($db_info_result)) {
102 if (!isset($sts_tmp['Type']) && isset($sts_tmp['Engine'])) {
103 $sts_tmp['Type'] =& $sts_tmp['Engine'];
105 if (!empty($tbl_group) && $cfg['ShowTooltipAliasTB'] && !preg_match('@' . preg_quote($tbl_group, '@') . '@i', $sts_tmp['Comment'])) {
106 continue;
109 if ($cfg['ShowTooltip']) {
110 fillTooltip($tooltip_truename, $tooltip_aliasname, $sts_tmp);
113 $tables[] = $sts_tmp;
116 @PMA_DBI_free_result($db_info_result);
117 unset($db_info_result);
119 $num_tables = (isset($tables) ? count($tables) : 0);
122 * Displays top menu links
124 echo '<!-- Top menu links -->' . "\n";
125 require('./db_details_links.php');