1
0
mirror of https://github.com/vrana/adminer.git synced 2025-08-06 22:56:46 +02:00

Update plugins

This commit is contained in:
Jakub Vrana
2011-02-09 21:15:34 +01:00
parent cd6d2fc7a3
commit 26b475312d
3 changed files with 36 additions and 1 deletions

View File

@@ -7,7 +7,13 @@ function adminer_object() {
foreach (glob("../plugins/*.php") as $filename) {
include_once $filename;
}
/* It is possible to combine customization and plugins:
class AdminerCustomization extends AdminerPlugin {
}
return new AdminerCustomization($plugins);
*/
return new AdminerPlugin(array(
// specify enabled plugins here
new AdminerDumpXml,

View File

29
plugins/login-table.php Normal file
View File

@@ -0,0 +1,29 @@
<?php
/* Requires this table:
CREATE TABLE login (
id int NOT NULL AUTO_INCREMENT, -- optional
login varchar(30) NOT NULL, -- any length
password_sha1 char(40) NOT NULL,
UNIQUE (login),
PRIMARY KEY (id)
);
*/
/** Authenticate a user from the login table
* @author Jakub Vrana, http://www.vrana.cz/
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License, version 2 (one or other)
*/
class AdminerLoginTable {
var $database;
function AdminerLoginTable($database) {
$this->database = $database;
}
function login($login, $password) {
$connection = connection();
return (bool) $connection->result($q = "SELECT COUNT(*) FROM " . idf_escape($this->database) . ".login WHERE login = " . $connection->quote($login) . " AND password_sha1 = " . $connection->quote(sha1($password)));
}
}