]> git.joonet.de Git - adminer.git/commitdiff
Update plugins
authorJakub Vrana <jakub@vrana.cz>
Wed, 9 Feb 2011 20:15:34 +0000 (21:15 +0100)
committerJakub Vrana <jakub@vrana.cz>
Wed, 9 Feb 2011 20:15:34 +0000 (21:15 +0100)
adminer/plugin.php
plugins/email-html.php [deleted file]
plugins/login-table.php [new file with mode: 0644]

index 1186815bf3c928497db9e7030b293323690a840d..679384ca0af51e2596ca1c4c4d72bf75da187134 100644 (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,
diff --git a/plugins/email-html.php b/plugins/email-html.php
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/plugins/login-table.php b/plugins/login-table.php
new file mode 100644 (file)
index 0000000..828720e
--- /dev/null
@@ -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)));
+       }
+       
+}