Always display all drivers (bug #3097666)
This commit is contained in:
parent
753909ecea
commit
a2443670f8
|
@ -5,13 +5,10 @@
|
|||
* @author Jakub Vrana
|
||||
*/
|
||||
|
||||
$possible_drivers[] = "SQLSRV";
|
||||
$possible_drivers[] = "MSSQL";
|
||||
if (extension_loaded("sqlsrv") || extension_loaded("mssql")) {
|
||||
$drivers["mssql"] = "MS SQL";
|
||||
}
|
||||
$drivers["mssql"] = "MS SQL";
|
||||
|
||||
if (isset($_GET["mssql"])) {
|
||||
$possible_drivers = array("SQLSRV", "MSSQL");
|
||||
define("DRIVER", "mssql");
|
||||
if (extension_loaded("sqlsrv")) {
|
||||
class Min_DB {
|
||||
|
|
|
@ -1,12 +1,8 @@
|
|||
<?php
|
||||
$possible_drivers[] = "MySQLi";
|
||||
$possible_drivers[] = "MySQL";
|
||||
$possible_drivers[] = "PDO_MySQL";
|
||||
if (extension_loaded("mysqli") || extension_loaded("mysql") || extension_loaded("pdo_mysql")) {
|
||||
$drivers = array("server" => "MySQL") + $drivers;
|
||||
}
|
||||
$drivers = array("server" => "MySQL") + $drivers;
|
||||
|
||||
if (!defined("DRIVER")) {
|
||||
$possible_drivers = array("MySQLi", "MySQL", "PDO_MySQL");
|
||||
define("DRIVER", "server"); // server - backwards compatibility
|
||||
// MySQLi supports everything, MySQL doesn't support multiple result sets, PDO_MySQL doesn't support orgtable
|
||||
if (extension_loaded("mysqli")) {
|
||||
|
|
|
@ -1,11 +1,8 @@
|
|||
<?php
|
||||
$possible_drivers[] = "OCI8";
|
||||
$possible_drivers[] = "PDO_OCI";
|
||||
if (extension_loaded("oci8") || extension_loaded("pdo_oci")) {
|
||||
$drivers["oracle"] = "Oracle";
|
||||
}
|
||||
$drivers["oracle"] = "Oracle";
|
||||
|
||||
if (isset($_GET["oracle"])) {
|
||||
$possible_drivers = array("OCI8", "PDO_OCI");
|
||||
define("DRIVER", "oracle");
|
||||
if (extension_loaded("oci8")) {
|
||||
class Min_DB {
|
||||
|
|
|
@ -1,11 +1,8 @@
|
|||
<?php
|
||||
$possible_drivers[] = "PgSQL";
|
||||
$possible_drivers[] = "PDO_PgSQL";
|
||||
if (extension_loaded("pgsql") || extension_loaded("pdo_pgsql")) {
|
||||
$drivers["pgsql"] = "PostgreSQL";
|
||||
}
|
||||
$drivers["pgsql"] = "PostgreSQL";
|
||||
|
||||
if (isset($_GET["pgsql"])) {
|
||||
$possible_drivers = array("PgSQL", "PDO_PgSQL");
|
||||
define("DRIVER", "pgsql");
|
||||
if (extension_loaded("pgsql")) {
|
||||
class Min_DB {
|
||||
|
|
|
@ -1,18 +1,83 @@
|
|||
<?php
|
||||
$possible_drivers[] = "SQLite";
|
||||
$possible_drivers[] = "SQLite3";
|
||||
$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";
|
||||
}
|
||||
$drivers["sqlite"] = "SQLite 3";
|
||||
$drivers["sqlite2"] = "SQLite 2";
|
||||
|
||||
if (isset($_GET["sqlite"]) || isset($_GET["sqlite2"])) {
|
||||
$possible_drivers = array((isset($_GET["sqlite"]) ? "SQLite3" : "SQLite"), "PDO_SQLite");
|
||||
define("DRIVER", (isset($_GET["sqlite"]) ? "sqlite" : "sqlite2"));
|
||||
if (extension_loaded(isset($_GET["sqlite2"]) ? "sqlite" : "sqlite3")) {
|
||||
if (isset($_GET["sqlite2"])) {
|
||||
if (extension_loaded(isset($_GET["sqlite"]) ? "sqlite3" : "sqlite")) {
|
||||
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 {
|
||||
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")) {
|
||||
|
|
|
@ -1,12 +1,6 @@
|
|||
<?php
|
||||
$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"];
|
||||
if (!$_SESSION["token"]) {
|
||||
$_SESSION["token"] = rand(1, 1e6); // defense against cross-site request forgery
|
||||
|
@ -89,7 +83,12 @@ function auth_error($exception = null) {
|
|||
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();
|
||||
}
|
||||
if (is_string($connection) || !$adminer->login($_GET["username"], get_session("pwds"))) {
|
||||
|
|
|
@ -79,5 +79,4 @@ if (extension_loaded('pdo')) {
|
|||
}
|
||||
}
|
||||
|
||||
$possible_drivers = array();
|
||||
$drivers = array();
|
||||
|
|
|
@ -7,6 +7,7 @@ Link to bookmark SQL command
|
|||
Support for virtual foreign keys
|
||||
Immunity against zend.ze1_compatibility_mode
|
||||
Fix last page with empty result set
|
||||
Always display all drivers
|
||||
|
||||
Adminer 3.0.1 (released 2010-10-18):
|
||||
Send the form by Ctrl+Enter in all textareas
|
||||
|
|
Loading…
Reference in a new issue