diff --git a/adminer/drivers/elastic.inc.php b/adminer/drivers/elastic.inc.php
index e0dcbe0c..97677f3c 100644
--- a/adminer/drivers/elastic.inc.php
+++ b/adminer/drivers/elastic.inc.php
@@ -227,8 +227,11 @@ if (isset($_GET["elastic"])) {
function connect() {
global $adminer;
$connection = new Min_DB;
- $credentials = $adminer->credentials();
- if ($connection->connect($credentials[0], $credentials[1], $credentials[2])) {
+ list($server, $username, $password) = $adminer->credentials();
+ if ($password != "" && $connection->connect($server, $username, "")) {
+ return lang('Database does not support password.');
+ }
+ if ($connection->connect($server, $username, $password)) {
return $connection;
}
return $connection->error;
diff --git a/adminer/drivers/mongo.inc.php b/adminer/drivers/mongo.inc.php
index 6a39e317..6fc01308 100644
--- a/adminer/drivers/mongo.inc.php
+++ b/adminer/drivers/mongo.inc.php
@@ -610,7 +610,7 @@ if (isset($_GET["mongo"])) {
$connection = new Min_DB;
list($server, $username, $password) = $adminer->credentials();
$options = array();
- if ($username != "") {
+ if ($username . $password != "") {
$options["username"] = $username;
$options["password"] = $password;
}
@@ -620,6 +620,15 @@ if (isset($_GET["mongo"])) {
}
try {
$connection->_link = $connection->connect("mongodb://$server", $options);
+ if ($password != "") {
+ $options["password"] = "";
+ try {
+ $connection->connect("mongodb://$server", $options);
+ return lang('Database does not support password.');
+ } catch (Exception $ex) {
+ // this is what we want
+ }
+ }
return $connection;
} catch (Exception $ex) {
return $ex->getMessage();
diff --git a/adminer/drivers/simpledb.inc.php b/adminer/drivers/simpledb.inc.php
index 040309c5..7bf8a780 100644
--- a/adminer/drivers/simpledb.inc.php
+++ b/adminer/drivers/simpledb.inc.php
@@ -248,6 +248,11 @@ if (isset($_GET["simpledb"])) {
function connect() {
+ global $adminer;
+ list(, , $password) = $adminer->credentials();
+ if ($password != "") {
+ return lang('Database does not support password.');
+ }
return new Min_DB;
}
diff --git a/adminer/drivers/sqlite.inc.php b/adminer/drivers/sqlite.inc.php
index c688e774..fbf00c2c 100644
--- a/adminer/drivers/sqlite.inc.php
+++ b/adminer/drivers/sqlite.inc.php
@@ -240,6 +240,11 @@ if (isset($_GET["sqlite"]) || isset($_GET["sqlite2"])) {
}
function connect() {
+ global $adminer;
+ list(, , $password) = $adminer->credentials();
+ if ($password != "") {
+ return lang('Database does not support password.');
+ }
return new Min_DB;
}
diff --git a/adminer/include/adminer.inc.php b/adminer/include/adminer.inc.php
index 4d2f5b3a..733adf7d 100644
--- a/adminer/include/adminer.inc.php
+++ b/adminer/include/adminer.inc.php
@@ -145,9 +145,8 @@ class Adminer {
* @return mixed true for success, string for error message, false for unknown error
*/
function login($login, $password) {
- global $jush;
- if ($jush == "sqlite") {
- return lang('Implement %s method to use SQLite.', target_blank(), 'login()
');
+ if ($password == "") { //! password is optional in Elastic and Mongo
+ return lang('Implement %s method to use password-less database.', target_blank(), 'login()
');
}
return true;
}
diff --git a/adminer/lang/cs.inc.php b/adminer/lang/cs.inc.php
index 20e3095a..6c89f521 100644
--- a/adminer/lang/cs.inc.php
+++ b/adminer/lang/cs.inc.php
@@ -12,7 +12,8 @@ $translations = array(
'Logout successful.' => 'Odhlášení proběhlo v pořádku.',
'Thanks for using Adminer, consider donating.' => 'Díky za použití Admineru, příspějte na vývoj.',
'Invalid credentials.' => 'Neplatné přihlašovací údaje.',
- 'Implement %s method to use SQLite.' => 'Pro přihlášení k SQLite implementujte metodu %s.',
+ 'Implement %s method to use password-less database.' => 'Pro přihlášení bez hesla implementujte metodu %s.',
+ 'Database does not support password.' => 'Databáze nepodporuje heslo.',
'Too many unsuccessful logins, try again in %d minute(s).' => array('Příliš mnoho pokusů o přihlášení, zkuste to znovu za %d minutu.', 'Příliš mnoho pokusů o přihlášení, zkuste to znovu za %d minuty.', 'Příliš mnoho pokusů o přihlášení, zkuste to znovu za %d minut.'),
'Master password expired. Implement %s method to make it permanent.' => 'Platnost hlavního hesla vypršela. Implementujte metodu %s, aby platilo stále.',
'Language' => 'Jazyk',
diff --git a/adminer/lang/he.inc.php b/adminer/lang/he.inc.php
index 57e19d6a..d206af33 100644
--- a/adminer/lang/he.inc.php
+++ b/adminer/lang/he.inc.php
@@ -276,7 +276,6 @@ $translations = array(
'ATTACH queries are not supported.' => 'שאילתת ATTACH אינה נתמכת',
'%d / ' => '%d / ',
'Limit rows' => 'הגבל שורות',
- 'Implement %s method to use SQLite.' => 'התקן את תוסף SQLite בשביל להתחבר',
'Default value' => 'ערך ברירת מחדל',
'Full table scan' => 'סריקה טבלה מלאה',
'Too many unsuccessful logins, try again in %d minute(s).' => 'יותר מידי נסיונות כניסה נכשלו, אנא נסה עוד %d דקות',
diff --git a/adminer/lang/ms.inc.php b/adminer/lang/ms.inc.php
index 84416dd2..58f2141d 100644
--- a/adminer/lang/ms.inc.php
+++ b/adminer/lang/ms.inc.php
@@ -12,7 +12,6 @@ $translations = array(
'Logout successful.' => 'Log keluar berjaya.',
'Thanks for using Adminer, consider donating.' => 'Terima kasih kerana menggunakan Adminer, pertimbangkan untuk menderma.',
'Invalid credentials.' => 'Akses tidak sah.',
- 'Implement %s method to use SQLite.' => 'Gunakan cara %s untuk menggunakan SQLite.',
'Too many unsuccessful logins, try again in %d minute(s).' => 'Terlalu banyak percubaan log masuk yang gagal, sila cuba lagi dalam masa %d minit.',
'Master password expired. Implement %s method to make it permanent.' => 'Kata laluan utama telah luput. Gunakan cara %s untuk mengekalkannya.',
'Language' => 'Bahasa',
diff --git a/adminer/lang/pl.inc.php b/adminer/lang/pl.inc.php
index ac785836..11da20c6 100644
--- a/adminer/lang/pl.inc.php
+++ b/adminer/lang/pl.inc.php
@@ -12,7 +12,6 @@ $translations = array(
'Logout successful.' => 'Wylogowano pomyślnie.',
'Thanks for using Adminer, consider donating.' => 'Dziękujemy za używanie Adminera, rozważ proszę dotację.',
'Invalid credentials.' => 'Nieprawidłowe dane logowania.',
- 'Implement %s method to use SQLite.' => 'Zaimplementuj metodę %s aby użyć SQLite.',
'Too many unsuccessful logins, try again in %d minute(s).' => array('Za dużo nieudanych prób logowania, spróbuj ponownie za %d minutę.', 'Za dużo nieudanych prób logowania, spróbuj ponownie za %d minuty.', 'Za dużo nieudanych prób logowania, spróbuj ponownie za %d minut.'),
'Master password expired. Implement %s method to make it permanent.' => 'Ważność hasła głównego wygasła. Zaimplementuj własną metodę %s, aby ustawić je na stałe.',
'Language' => 'Język',
diff --git a/adminer/lang/ru.inc.php b/adminer/lang/ru.inc.php
index 290ffb55..fab11f98 100644
--- a/adminer/lang/ru.inc.php
+++ b/adminer/lang/ru.inc.php
@@ -276,7 +276,6 @@ $translations = array(
'ATTACH queries are not supported.' => 'ATTACH-запросы не поддерживаются.',
'%d / ' => '%d / ',
'Limit rows' => 'Лимит строк',
- 'Implement %s method to use SQLite.' => 'Реализуйте метод %s, чтобы использовать SQLite.',
'Default value' => 'Значение по умолчанию',
'Full table scan' => 'Анализ полной таблицы',
'Too many unsuccessful logins, try again in %d minute(s).' => array('Слишком много неудачных попыток входа. Попробуйте снова через %d минуту.', 'Слишком много неудачных попыток входа. Попробуйте снова через %d минуты.', 'Слишком много неудачных попыток входа. Попробуйте снова через %d минут.'),
diff --git a/adminer/lang/tr.inc.php b/adminer/lang/tr.inc.php
index d888de93..56818be3 100644
--- a/adminer/lang/tr.inc.php
+++ b/adminer/lang/tr.inc.php
@@ -12,7 +12,6 @@ $translations = array(
'Logout successful.' => 'Oturum başarıyla sonlandı.',
'Thanks for using Adminer, consider donating.' => 'Adminer kullandığınız için teşekkür ederiz bağış yapmayı düşünün.',
'Invalid credentials.' => 'Geçersiz kimlik bilgileri.',
- 'Implement %s method to use SQLite.' => 'SQLite kullanmak için %s metodunu kullanın.',
'Too many unsuccessful logins, try again in %d minute(s).' => array('Çok fazla oturum açma denemesi yapıldı.', '%d Dakika sonra tekrar deneyiniz.'),
'Master password expired. Implement %s method to make it permanent.' => 'Ana şifrenin süresi doldu. Kalıcı olması için %s medodunu kullanın.',
'Language' => 'Dil',
diff --git a/adminer/lang/xx.inc.php b/adminer/lang/xx.inc.php
index a91170bc..ba6d7a01 100644
--- a/adminer/lang/xx.inc.php
+++ b/adminer/lang/xx.inc.php
@@ -12,7 +12,8 @@ $translations = array(
'Logout successful.' => 'Xx.',
'Thanks for using Adminer, consider donating.' => 'Xx xx.',
'Invalid credentials.' => 'Xx.',
- 'Implement %s method to use SQLite.' => 'Xx %s xx.',
+ 'Implement %s method to use password-less database.' => 'Xx %s xx.',
+ 'Database does not support password.' => 'Xx.',
'Too many unsuccessful logins, try again in %d minute(s).' => array('Xx %d.', 'Xx %d.'),
'Master password expired. Implement %s method to make it permanent.' => 'Xx %s xx.',
'Language' => 'Xx',
diff --git a/adminer/sqlite.php b/adminer/sqlite.php
index 5f6f219c..41ff2e20 100644
--- a/adminer/sqlite.php
+++ b/adminer/sqlite.php
@@ -1,8 +1,10 @@
login = $login;
+ function __construct($password_hash) {
$this->password_hash = $password_hash;
}
+
+ function credentials() {
+ $password = get_password();
+ return array(SERVER, $_GET["username"], (password_verify($password, $this->password_hash) ? "" : $password));
+ }
function login($login, $password) {
- if (DRIVER != "sqlite" && DRIVER != "sqlite2") {
+ if ($password != "") {
return true;
}
- return $this->login == $login && password_verify($password, $this->password_hash);
}
}