]> git.joonet.de Git - adminer.git/commitdiff
Allow specifying database in login form (bug #3499359)
authorJakub Vrana <jakub@vrana.cz>
Mon, 14 May 2012 07:24:23 +0000 (00:24 -0700)
committerJakub Vrana <jakub@vrana.cz>
Mon, 14 May 2012 08:11:09 +0000 (01:11 -0700)
adminer/include/adminer.inc.php
adminer/include/auth.inc.php
adminer/include/functions.inc.php
adminer/static/editing.js
changes.txt

index 81fd02be2525d88664e38244b838f6bfdd7ee4fb..4ace7fa54106ac18b47efbc86a024d2c38cdf9ab 100644 (file)
@@ -67,6 +67,7 @@ class Adminer {
 <tr><th><?php echo lang('Server'); ?><td><input name="auth[server]" value="<?php echo h(SERVER); ?>" title="hostname[:port]">
 <tr><th><?php echo lang('Username'); ?><td><input id="username" name="auth[username]" value="<?php echo h($_GET["username"]); ?>">
 <tr><th><?php echo lang('Password'); ?><td><input type="password" name="auth[password]">
+<tr><th><?php echo lang('Database'); ?><td><input name="auth[db]" value="<?php echo h($_GET["db"]); ?>">
 </table>
 <script type="text/javascript">
 var username = document.getElementById('username');
index a8f04d9db5403932930d12a2f31658a866533a6d..7731f53174af4b453b6286e0797966f534ca4430 100644 (file)
@@ -28,8 +28,9 @@ if ($auth) {
                || DRIVER != $auth["driver"]
                || SERVER != $auth["server"]
                || $_GET["username"] !== $auth["username"] // "0" == "00"
+               || DB != $auth["db"]
        ) {
-               redirect(auth_url($auth["driver"], $auth["server"], $auth["username"]));
+               redirect(auth_url($auth["driver"], $auth["server"], $auth["username"], $auth["db"]));
        }
 } elseif ($_POST["logout"]) {
        if ($token && $_POST["token"] != $token) {
index 1f27ced639c076babad5d52e1f739e4a7e853ac7..2d440aee24299a14b4a3674251387acfd1d85a13 100644 (file)
@@ -418,15 +418,17 @@ function set_session($key, $val) {
 * @param string
 * @param string
 * @param string
+* @param string
 * @return string
 */
-function auth_url($driver, $server, $username) {
+function auth_url($driver, $server, $username, $db = null) {
        global $drivers;
-       preg_match('~([^?]*)\\??(.*)~', remove_from_uri(implode("|", array_keys($drivers)) . "|username|" . session_name()), $match);
+       preg_match('~([^?]*)\\??(.*)~', remove_from_uri(implode("|", array_keys($drivers)) . "|username|" . ($db !== null ? "db|" : "") . session_name()), $match);
        return "$match[1]?"
                . (sid() ? SID . "&" : "")
                . ($driver != "server" || $server != "" ? urlencode($driver) . "=" . urlencode($server) . "&" : "")
                . "username=" . urlencode($username)
+               . ($db != "" ? "&db=" . urlencode($db) : "")
                . ($match[2] ? "&$match[2]" : "")
        ;
 }
index c9a51cf2542a19acc286b9260e52865c5a5d6f92..da04dc89533ac79a7652a7238b0eb0bcdb3486f4 100644 (file)
@@ -59,7 +59,7 @@ function typePassword(el, disable) {
 
 function loginDriver(driver) {
        var trs = driver.parentNode.parentNode.parentNode.rows;
-       for (var i=1; i < trs.length; i++) {
+       for (var i=1; i < trs.length - 1; i++) {
                trs[i].className = (/sqlite/.test(driver.value) ? 'hidden' : '');
        }
 }
index 4462ad91d8186830f05ae9ae1e5e7b906bc3b31d..bff4c4b88a2fc340fd044c563a878ff37e4c9993 100644 (file)
@@ -2,6 +2,7 @@ Adminer 3.4.0-dev:
 Print current time next to executed SQL queries
 Highlight code in SQL command by CodeMirror
 Link to descending order
+Allow specifying database in login form
 Link to original table in EXPLAIN of SELECT * FROM table t
 MySQL: inform about disabled event_scheduler
 SQLite: support binary data