diff --git a/adminer/include/driver.inc.php b/adminer/include/driver.inc.php index 210f0998..ae9289cf 100644 --- a/adminer/include/driver.inc.php +++ b/adminer/include/driver.inc.php @@ -13,12 +13,13 @@ function add_driver($id, $name) { $drivers[$id] = $name; } -/** Get driver -* @return Driver +/** Get driver name +* @param string +* @return string */ -function get_driver() { - global $driver; - return $driver; +function get_driver($id) { + global $drivers; + return $drivers[$id]; } abstract class SqlDriver { diff --git a/adminer/include/functions.inc.php b/adminer/include/functions.inc.php index 109c60cd..03ca625b 100644 --- a/adminer/include/functions.inc.php +++ b/adminer/include/functions.inc.php @@ -20,6 +20,14 @@ function adminer() { return $adminer; } +/** Get Driver object +* @return Driver +*/ +function driver() { + global $driver; + return $driver; +} + /** Get Adminer version * @return string */ diff --git a/plugins/drivers/elastic.php b/plugins/drivers/elastic.php index 03a359d2..01922eff 100644 --- a/plugins/drivers/elastic.php +++ b/plugins/drivers/elastic.php @@ -61,7 +61,7 @@ if (isset($_GET["elastic"])) { function query($path, array $content = null, $method = 'GET') { // Support for global search through all tables if ($path != "" && $path[0] == "S" && preg_match('/SELECT 1 FROM ([^ ]+) WHERE (.+) LIMIT ([0-9]+)/', $path, $matches)) { - $driver = get_driver(); + $driver = driver(); $where = explode(" AND ", $matches[2]); diff --git a/plugins/drivers/mongo.php b/plugins/drivers/mongo.php index ac7912fd..f4a497bb 100644 --- a/plugins/drivers/mongo.php +++ b/plugins/drivers/mongo.php @@ -166,7 +166,7 @@ if (isset($_GET["mongo"])) { } function fields($table) { - $driver = get_driver(); + $driver = driver(); $fields = fields_from_edit(); if (!$fields) { $result = $driver->select($table, array("*"), null, null, array(), 10);