adminerevo/plugins/login-sqlite.php

37 lines
906 B
PHP
Raw Normal View History

2016-11-28 18:09:51 +00:00
<?php
/** Enable auto-login for SQLite
* @link https://www.adminer.org/plugins/#use
2017-02-27 12:43:33 +00:00
* @author Jakub Vrana, https://www.vrana.cz/
2016-11-28 18:09:51 +00:00
* @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 AdminerLoginSqlite {
function login($login, $password) {
return true;
}
function loginForm() {
?>
2018-01-13 21:17:00 +00:00
<script<?php echo nonce(); ?>>
2016-11-28 18:09:51 +00:00
addEventListener('load', function () {
2018-01-11 11:07:33 +00:00
var driver = qs('name="auth[driver]"');
2016-11-28 18:09:51 +00:00
if (isTag(driver, 'select')) {
driver.onchange = function () {
var trs = parentTag(driver, 'table').rows;
for (var i=1; i < trs.length - 1; i++) {
var disabled = /sqlite/.test(driver.value);
alterClass(trs[i], 'hidden', disabled);
2018-01-11 11:07:33 +00:00
trs[i].querySelector('input').disabled = disabled;
2016-11-28 18:09:51 +00:00
}
};
}
driver.onchange();
});
</script>
<?php
}
}