2011-03-21 09:16:01 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/** Display constant list of servers in login form
|
2015-09-08 16:23:25 +00:00
|
|
|
* @link https://www.adminer.org/plugins/#use
|
2017-02-27 12:43:33 +00:00
|
|
|
* @author Jakub Vrana, https://www.vrana.cz/
|
2018-01-14 10:03:54 +00:00
|
|
|
* @license https://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
|
|
|
|
* @license https://www.gnu.org/licenses/gpl-2.0.html GNU General Public License, version 2 (one or other)
|
2011-03-21 09:16:01 +00:00
|
|
|
*/
|
|
|
|
class AdminerLoginServers {
|
2011-08-11 15:06:42 +00:00
|
|
|
/** @access protected */
|
2018-02-22 11:38:22 +00:00
|
|
|
var $servers;
|
2011-03-21 09:16:01 +00:00
|
|
|
|
|
|
|
/** Set supported servers
|
2018-02-22 11:38:22 +00:00
|
|
|
* @param array array($description => array("server" => , "driver" => "server|pgsql|sqlite|..."))
|
2011-03-21 09:16:01 +00:00
|
|
|
*/
|
2018-02-22 11:38:22 +00:00
|
|
|
function __construct($servers) {
|
2011-03-21 09:16:01 +00:00
|
|
|
$this->servers = $servers;
|
2018-02-22 11:38:22 +00:00
|
|
|
if ($_POST["auth"]) {
|
|
|
|
$key = $_POST["auth"]["server"];
|
|
|
|
$_POST["auth"]["driver"] = $this->servers[$key]["driver"];
|
|
|
|
}
|
2011-03-21 09:16:01 +00:00
|
|
|
}
|
|
|
|
|
2018-02-22 11:38:22 +00:00
|
|
|
function credentials() {
|
|
|
|
return array($this->servers[SERVER]["server"], $_GET["username"], get_password());
|
2018-02-08 13:27:44 +00:00
|
|
|
}
|
|
|
|
|
2011-03-21 09:16:01 +00:00
|
|
|
function login($login, $password) {
|
2018-02-22 11:38:22 +00:00
|
|
|
if (!$this->servers[SERVER]) {
|
|
|
|
return false;
|
2011-03-21 09:16:01 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-02-22 11:38:22 +00:00
|
|
|
function loginFormField($name, $heading, $value) {
|
|
|
|
if ($name == 'driver') {
|
|
|
|
return '';
|
|
|
|
} elseif ($name == 'server') {
|
|
|
|
return $heading . "<select name='auth[server]'>" . optionlist(array_keys($this->servers), SERVER) . "</select>\n";
|
|
|
|
}
|
2011-03-21 09:16:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|