Skip to content
Browse files

Fix For Wildcard-containing only_db failure in sidebar

This commit fixes the Bug #4242. The "only_db"directive  now accepts
MySQL LIKE wildcards without errors.Changes have been made to the
function getData() in phpmyadmin/libraries/navigation/Nodes/Node.class.php .
The if-else clause has been removed. The checking of the "only_db"
directive is now performed solely by the function
getWhereClause()in the same class.

Signed-off-by: Vasu Bhardwaj <voodoorapter014@gmail.com>
  • Loading branch information...
1 parent 9ef1e5c commit 45b538b1ec27da10b5748949dc36863772b6cc33 @Vasu014 Vasu014 committed Feb 8, 2014
Showing with 7 additions and 23 deletions.
  1. +7 −23 libraries/navigation/Nodes/Node.class.php
View
30 libraries/navigation/Nodes/Node.class.php
@@ -359,29 +359,13 @@ public function getPaths()
*/
public function getData($type, $pos, $searchClause = '')
{
- if ($type == 'databases'
- && ! empty($GLOBALS['cfg']['Server']['only_db'])
- ) {
- $db_list = $GLOBALS['cfg']['Server']['only_db'];
- $query = "SELECT * FROM ( SELECT '";
-
- if (is_string($db_list)) {
- $db_list = array($db_list);
- }
-
- if (count($db_list)) {
- $query .= implode("' UNION ALL SELECT '", $db_list);
- $query .= "' ";
- }
- return $GLOBALS['dbi']->fetchResult($query . ") as alias");
- } else {
- $query = "SELECT `SCHEMA_NAME` ";
- $query .= "FROM `INFORMATION_SCHEMA`.`SCHEMATA` ";
- $query .= $this->_getWhereClause($searchClause);
- $query .= "ORDER BY `SCHEMA_NAME` ASC ";
- $query .= "LIMIT $pos, {$GLOBALS['cfg']['MaxNavigationItems']}";
- return $GLOBALS['dbi']->fetchResult($query);
- }
+ $query = "SELECT `SCHEMA_NAME` ";
+ $query .= "FROM `INFORMATION_SCHEMA`.`SCHEMATA` ";
+ $query .= $this->_getWhereClause($searchClause);
+ $query .= "ORDER BY `SCHEMA_NAME` ASC ";
+ $query .= "LIMIT $pos, {$GLOBALS['cfg']['MaxNavigationItems']}";
+ return $GLOBALS['dbi']->fetchResult($query);
+
}
/**

0 comments on commit 45b538b

Please sign in to comment.
Something went wrong with that request. Please try again.