diff --git a/ChangeLog b/ChangeLog index c1e2e10e66..24a7d8498d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -19,7 +19,8 @@ phpMyAdmin - ChangeLog - bug #4209 Missing compression in one case - bug #4208 Can't browse tables after sorting on columns with fieldnames that have a '-' - bug #4184 Switch to wrong page after adding an index -- bug #3885 Additional fix for this bug +- bug #3885 Additional fix for this bug +- bug #4212 Table "disappears" if it has the same name as its tablegroup 4.1.3.0 (2013-12-31) - bug #3938 PDFDefaultPageSize doc and easy configurability diff --git a/libraries/db_info.inc.php b/libraries/db_info.inc.php index c3d66b7b07..83e5aa654e 100644 --- a/libraries/db_info.inc.php +++ b/libraries/db_info.inc.php @@ -76,11 +76,17 @@ if (true === $cfg['SkipLockedTables'] && ! PMA_DRIZZLE) { $tblGroupSql = ""; $whereAdded = false; if (PMA_isValid($_REQUEST['tbl_group'])) { - $tblGroupSql .= " WHERE " + $group = PMA_Util::escapeMysqlWildcards($_REQUEST['tbl_group']); + $groupWithSeperator = PMA_Util::escapeMysqlWildcards( + $_REQUEST['tbl_group'] + . $GLOBALS['cfg']['NavigationTreeTableSeparator'] + ); + $tblGroupSql .= " WHERE (" . PMA_Util::backquote('Tables_in_' . $db) - . " LIKE '" - . PMA_Util::escapeMysqlWildcards($_REQUEST['tbl_group']) - . "%'"; + . " LIKE '^" . $groupWithSeperator . "%'" + . " OR " + . PMA_Util::backquote('Tables_in_' . $db) + . " LIKE '^" . $group . "$')"; $whereAdded = true; } if (PMA_isValid($_REQUEST['tbl_type'], array('table', 'view'))) { @@ -167,19 +173,28 @@ if (! isset($sot_ready)) { } $tbl_group = false; + $groupWithSeperator = false; $tbl_type = null; $limit_offset = 0; $limit_count = false; + $groupTable = array(); if (! empty($_REQUEST['tbl_group']) || ! empty($_REQUEST['tbl_type'])) { - if (! empty($_REQUEST['tbl_group'])) { - // only tables for selected group - $tbl_group = $_REQUEST['tbl_group']; - } if (! empty($_REQUEST['tbl_type'])) { // only tables for selected type $tbl_type = $_REQUEST['tbl_type']; } + if (! empty($_REQUEST['tbl_group'])) { + // only tables for selected group + $tbl_group = $_REQUEST['tbl_group']; + // include the table with the exact name of the group if such exists + $groupTable = $GLOBALS['dbi']->getTablesFull( + $db, $tbl_group, false, null, $limit_offset, + $limit_count, $sort, $sort_order, $tbl_type + ); + $groupWithSeperator = $tbl_group + . $GLOBALS['cfg']['NavigationTreeTableSeparator']; + } } else { // all tables in db // - get the total number of tables @@ -200,9 +215,12 @@ if (! isset($sot_ready)) { $limit_count = true; } } - $tables = $GLOBALS['dbi']->getTablesFull( - $db, $tbl_group, ($tbl_group != false), null, $limit_offset, - $limit_count, $sort, $sort_order, $tbl_type + $tables = array_merge( + $groupTable, + $GLOBALS['dbi']->getTablesFull( + $db, $groupWithSeperator, ($groupWithSeperator != false), null, + $limit_offset, $limit_count, $sort, $sort_order, $tbl_type + ) ); } diff --git a/libraries/navigation/NavigationTree.class.php b/libraries/navigation/NavigationTree.class.php index a23c79af91..c897089b31 100644 --- a/libraries/navigation/NavigationTree.class.php +++ b/libraries/navigation/NavigationTree.class.php @@ -584,8 +584,7 @@ class PMA_NavigationTree if ($node instanceof Node_Table_Container || $node instanceof Node_View_Container ) { - $tblGroup = '&tbl_group=' - . urlencode($key . $node->separator); + $tblGroup = '&tbl_group=' . urlencode($key); $groups[$key]->links = array( 'text' => $node->links['text'] . $tblGroup, 'icon' => $node->links['icon'] . $tblGroup diff --git a/libraries/pmd_common.php b/libraries/pmd_common.php index 8538fbb48c..8b2dfdb2a1 100644 --- a/libraries/pmd_common.php +++ b/libraries/pmd_common.php @@ -4,7 +4,7 @@ * @package PhpMyAdmin-Designer */ /** - * block attempts to directly run this script + * Block attempts to directly run this script */ if (getcwd() == dirname(__FILE__)) { die('Attack stopped'); @@ -22,7 +22,7 @@ $GLOBALS['PMD']['STYLE'] = 'default'; $cfgRelation = PMA_getRelationsParam(); /** - * retrieves table info and stores it in $GLOBALS['PMD'] + * Retrieves table info and stores it in $GLOBALS['PMD'] * * @return array with table info */ @@ -74,7 +74,7 @@ function PMA_getTablesInfo() } /** - * retrieves table column info + * Retrieves table column info * * @return array table column nfo */ @@ -107,7 +107,7 @@ function PMA_getColumnsInfo() } /** - * returns JavaScript code for initializing vars + * Returns JavaScript code for initializing vars * * @return string JavaScript code */ @@ -186,7 +186,7 @@ function PMA_getPKOrUniqueKeys() } /** - * returns all indices + * Returns all indices * * @param bool $unique_only whether to include only unique ones *