Always display all drivers (bug #3097666)
This commit is contained in:
parent
753909ecea
commit
a2443670f8
|
@ -5,13 +5,10 @@
|
||||||
* @author Jakub Vrana
|
* @author Jakub Vrana
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$possible_drivers[] = "SQLSRV";
|
$drivers["mssql"] = "MS SQL";
|
||||||
$possible_drivers[] = "MSSQL";
|
|
||||||
if (extension_loaded("sqlsrv") || extension_loaded("mssql")) {
|
|
||||||
$drivers["mssql"] = "MS SQL";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset($_GET["mssql"])) {
|
if (isset($_GET["mssql"])) {
|
||||||
|
$possible_drivers = array("SQLSRV", "MSSQL");
|
||||||
define("DRIVER", "mssql");
|
define("DRIVER", "mssql");
|
||||||
if (extension_loaded("sqlsrv")) {
|
if (extension_loaded("sqlsrv")) {
|
||||||
class Min_DB {
|
class Min_DB {
|
||||||
|
|
|
@ -1,12 +1,8 @@
|
||||||
<?php
|
<?php
|
||||||
$possible_drivers[] = "MySQLi";
|
$drivers = array("server" => "MySQL") + $drivers;
|
||||||
$possible_drivers[] = "MySQL";
|
|
||||||
$possible_drivers[] = "PDO_MySQL";
|
|
||||||
if (extension_loaded("mysqli") || extension_loaded("mysql") || extension_loaded("pdo_mysql")) {
|
|
||||||
$drivers = array("server" => "MySQL") + $drivers;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!defined("DRIVER")) {
|
if (!defined("DRIVER")) {
|
||||||
|
$possible_drivers = array("MySQLi", "MySQL", "PDO_MySQL");
|
||||||
define("DRIVER", "server"); // server - backwards compatibility
|
define("DRIVER", "server"); // server - backwards compatibility
|
||||||
// MySQLi supports everything, MySQL doesn't support multiple result sets, PDO_MySQL doesn't support orgtable
|
// MySQLi supports everything, MySQL doesn't support multiple result sets, PDO_MySQL doesn't support orgtable
|
||||||
if (extension_loaded("mysqli")) {
|
if (extension_loaded("mysqli")) {
|
||||||
|
|
|
@ -1,11 +1,8 @@
|
||||||
<?php
|
<?php
|
||||||
$possible_drivers[] = "OCI8";
|
$drivers["oracle"] = "Oracle";
|
||||||
$possible_drivers[] = "PDO_OCI";
|
|
||||||
if (extension_loaded("oci8") || extension_loaded("pdo_oci")) {
|
|
||||||
$drivers["oracle"] = "Oracle";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset($_GET["oracle"])) {
|
if (isset($_GET["oracle"])) {
|
||||||
|
$possible_drivers = array("OCI8", "PDO_OCI");
|
||||||
define("DRIVER", "oracle");
|
define("DRIVER", "oracle");
|
||||||
if (extension_loaded("oci8")) {
|
if (extension_loaded("oci8")) {
|
||||||
class Min_DB {
|
class Min_DB {
|
||||||
|
|
|
@ -1,11 +1,8 @@
|
||||||
<?php
|
<?php
|
||||||
$possible_drivers[] = "PgSQL";
|
$drivers["pgsql"] = "PostgreSQL";
|
||||||
$possible_drivers[] = "PDO_PgSQL";
|
|
||||||
if (extension_loaded("pgsql") || extension_loaded("pdo_pgsql")) {
|
|
||||||
$drivers["pgsql"] = "PostgreSQL";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset($_GET["pgsql"])) {
|
if (isset($_GET["pgsql"])) {
|
||||||
|
$possible_drivers = array("PgSQL", "PDO_PgSQL");
|
||||||
define("DRIVER", "pgsql");
|
define("DRIVER", "pgsql");
|
||||||
if (extension_loaded("pgsql")) {
|
if (extension_loaded("pgsql")) {
|
||||||
class Min_DB {
|
class Min_DB {
|
||||||
|
|
|
@ -1,18 +1,83 @@
|
||||||
<?php
|
<?php
|
||||||
$possible_drivers[] = "SQLite";
|
$drivers["sqlite"] = "SQLite 3";
|
||||||
$possible_drivers[] = "SQLite3";
|
$drivers["sqlite2"] = "SQLite 2";
|
||||||
$possible_drivers[] = "PDO_SQLite";
|
|
||||||
if (extension_loaded("sqlite3") || extension_loaded("pdo_sqlite")) {
|
|
||||||
$drivers["sqlite"] = "SQLite 3";
|
|
||||||
}
|
|
||||||
if (extension_loaded("sqlite") || extension_loaded("pdo_sqlite")) {
|
|
||||||
$drivers["sqlite2"] = "SQLite 2";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset($_GET["sqlite"]) || isset($_GET["sqlite2"])) {
|
if (isset($_GET["sqlite"]) || isset($_GET["sqlite2"])) {
|
||||||
|
$possible_drivers = array((isset($_GET["sqlite"]) ? "SQLite3" : "SQLite"), "PDO_SQLite");
|
||||||
define("DRIVER", (isset($_GET["sqlite"]) ? "sqlite" : "sqlite2"));
|
define("DRIVER", (isset($_GET["sqlite"]) ? "sqlite" : "sqlite2"));
|
||||||
if (extension_loaded(isset($_GET["sqlite2"]) ? "sqlite" : "sqlite3")) {
|
if (extension_loaded(isset($_GET["sqlite"]) ? "sqlite3" : "sqlite")) {
|
||||||
if (isset($_GET["sqlite2"])) {
|
if (isset($_GET["sqlite"])) {
|
||||||
|
|
||||||
|
class Min_SQLite {
|
||||||
|
var $extension = "SQLite3", $server_info, $affected_rows, $error, $_link;
|
||||||
|
|
||||||
|
function Min_SQLite($filename) {
|
||||||
|
$this->_link = new SQLite3($filename);
|
||||||
|
$version = $this->_link->version();
|
||||||
|
$this->server_info = $version["versionString"];
|
||||||
|
}
|
||||||
|
|
||||||
|
function query($query) {
|
||||||
|
$result = @$this->_link->query($query);
|
||||||
|
if (!$result) {
|
||||||
|
$this->error = $this->_link->lastErrorMsg();
|
||||||
|
return false;
|
||||||
|
} elseif ($result->numColumns()) {
|
||||||
|
return new Min_Result($result);
|
||||||
|
}
|
||||||
|
$this->affected_rows = $this->_link->changes();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function quote($string) {
|
||||||
|
return "'" . $this->_link->escapeString($string) . "'";
|
||||||
|
}
|
||||||
|
|
||||||
|
function store_result() {
|
||||||
|
return $this->_result;
|
||||||
|
}
|
||||||
|
|
||||||
|
function result($query, $field = 0) {
|
||||||
|
$result = $this->query($query);
|
||||||
|
if (!is_object($result)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
$row = $result->_result->fetchArray();
|
||||||
|
return $row[$field];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class Min_Result {
|
||||||
|
var $_result, $_offset = 0, $num_rows;
|
||||||
|
|
||||||
|
function Min_Result($result) {
|
||||||
|
$this->_result = $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
function fetch_assoc() {
|
||||||
|
return $this->_result->fetchArray(SQLITE3_ASSOC);
|
||||||
|
}
|
||||||
|
|
||||||
|
function fetch_row() {
|
||||||
|
return $this->_result->fetchArray(SQLITE3_NUM);
|
||||||
|
}
|
||||||
|
|
||||||
|
function fetch_field() {
|
||||||
|
$column = $this->_offset++;
|
||||||
|
$type = $this->_result->columnType($column);
|
||||||
|
return (object) array(
|
||||||
|
"name" => $this->_result->columnName($column),
|
||||||
|
"type" => $type,
|
||||||
|
"charsetnr" => ($type == SQLITE3_BLOB ? 63 : 0), // 63 - binary
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function __desctruct() {
|
||||||
|
return $this->_result->finalize();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
class Min_SQLite {
|
class Min_SQLite {
|
||||||
var $extension = "SQLite", $server_info, $affected_rows, $error, $_link;
|
var $extension = "SQLite", $server_info, $affected_rows, $error, $_link;
|
||||||
|
@ -95,77 +160,6 @@ if (isset($_GET["sqlite"]) || isset($_GET["sqlite2"])) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
class Min_SQLite {
|
|
||||||
var $extension = "SQLite3", $server_info, $affected_rows, $error, $_link;
|
|
||||||
|
|
||||||
function Min_SQLite($filename) {
|
|
||||||
$this->_link = new SQLite3($filename);
|
|
||||||
$version = $this->_link->version();
|
|
||||||
$this->server_info = $version["versionString"];
|
|
||||||
}
|
|
||||||
|
|
||||||
function query($query) {
|
|
||||||
$result = @$this->_link->query($query);
|
|
||||||
if (!$result) {
|
|
||||||
$this->error = $this->_link->lastErrorMsg();
|
|
||||||
return false;
|
|
||||||
} elseif ($result->numColumns()) {
|
|
||||||
return new Min_Result($result);
|
|
||||||
}
|
|
||||||
$this->affected_rows = $this->_link->changes();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
function quote($string) {
|
|
||||||
return "'" . $this->_link->escapeString($string) . "'";
|
|
||||||
}
|
|
||||||
|
|
||||||
function store_result() {
|
|
||||||
return $this->_result;
|
|
||||||
}
|
|
||||||
|
|
||||||
function result($query, $field = 0) {
|
|
||||||
$result = $this->query($query);
|
|
||||||
if (!is_object($result)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
$row = $result->_result->fetchArray();
|
|
||||||
return $row[$field];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class Min_Result {
|
|
||||||
var $_result, $_offset = 0, $num_rows;
|
|
||||||
|
|
||||||
function Min_Result($result) {
|
|
||||||
$this->_result = $result;
|
|
||||||
}
|
|
||||||
|
|
||||||
function fetch_assoc() {
|
|
||||||
return $this->_result->fetchArray(SQLITE3_ASSOC);
|
|
||||||
}
|
|
||||||
|
|
||||||
function fetch_row() {
|
|
||||||
return $this->_result->fetchArray(SQLITE3_NUM);
|
|
||||||
}
|
|
||||||
|
|
||||||
function fetch_field() {
|
|
||||||
$column = $this->_offset++;
|
|
||||||
$type = $this->_result->columnType($column);
|
|
||||||
return (object) array(
|
|
||||||
"name" => $this->_result->columnName($column),
|
|
||||||
"type" => $type,
|
|
||||||
"charsetnr" => ($type == SQLITE3_BLOB ? 63 : 0), // 63 - binary
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
function __desctruct() {
|
|
||||||
return $this->_result->finalize();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} elseif (extension_loaded("pdo_sqlite")) {
|
} elseif (extension_loaded("pdo_sqlite")) {
|
||||||
|
|
|
@ -1,12 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
$connection = '';
|
$connection = '';
|
||||||
|
|
||||||
if (!$drivers) {
|
|
||||||
page_header(lang('No extension'), lang('None of the supported PHP extensions (%s) are available.', implode(", ", $possible_drivers)), null);
|
|
||||||
page_footer("auth");
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
$token = $_SESSION["token"];
|
$token = $_SESSION["token"];
|
||||||
if (!$_SESSION["token"]) {
|
if (!$_SESSION["token"]) {
|
||||||
$_SESSION["token"] = rand(1, 1e6); // defense against cross-site request forgery
|
$_SESSION["token"] = rand(1, 1e6); // defense against cross-site request forgery
|
||||||
|
@ -89,7 +83,12 @@ function auth_error($exception = null) {
|
||||||
page_footer("auth");
|
page_footer("auth");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($_GET["username"]) && class_exists("Min_DB")) { // doesn't exists with passing wrong driver
|
if (isset($_GET["username"])) {
|
||||||
|
if (!class_exists("Min_DB")) {
|
||||||
|
page_header(lang('No extension'), lang('None of the supported PHP extensions (%s) are available.', implode(", ", $possible_drivers)), null);
|
||||||
|
page_footer("auth");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
$connection = connect();
|
$connection = connect();
|
||||||
}
|
}
|
||||||
if (is_string($connection) || !$adminer->login($_GET["username"], get_session("pwds"))) {
|
if (is_string($connection) || !$adminer->login($_GET["username"], get_session("pwds"))) {
|
||||||
|
|
|
@ -79,5 +79,4 @@ if (extension_loaded('pdo')) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$possible_drivers = array();
|
|
||||||
$drivers = array();
|
$drivers = array();
|
||||||
|
|
|
@ -7,6 +7,7 @@ Link to bookmark SQL command
|
||||||
Support for virtual foreign keys
|
Support for virtual foreign keys
|
||||||
Immunity against zend.ze1_compatibility_mode
|
Immunity against zend.ze1_compatibility_mode
|
||||||
Fix last page with empty result set
|
Fix last page with empty result set
|
||||||
|
Always display all drivers
|
||||||
|
|
||||||
Adminer 3.0.1 (released 2010-10-18):
|
Adminer 3.0.1 (released 2010-10-18):
|
||||||
Send the form by Ctrl+Enter in all textareas
|
Send the form by Ctrl+Enter in all textareas
|
||||||
|
|
Loading…
Reference in a new issue