updated plugins and version; added table filter
This commit is contained in:
parent
b92f7a0a63
commit
8c7fe51582
9 changed files with 1153 additions and 1107 deletions
19
adminer.css
19
adminer.css
|
|
@ -28,6 +28,11 @@ a,a:visited {
|
|||
color:white;
|
||||
}
|
||||
|
||||
.footer {
|
||||
position: initial;
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
#content table thead span, #content table thead a {
|
||||
font-weight:bold;
|
||||
color:#FFF;
|
||||
|
|
@ -248,6 +253,20 @@ tr.odd td {
|
|||
padding: .8em 0;
|
||||
}
|
||||
|
||||
#tables a.select {
|
||||
/* display: none; */
|
||||
/* text-indent: -10000; */
|
||||
width: 10px;
|
||||
display: inline-block;
|
||||
overflow: hidden;
|
||||
height: 5px;
|
||||
background: white;
|
||||
}
|
||||
|
||||
#tables a.select:before {
|
||||
content: ' ';
|
||||
}
|
||||
|
||||
#menu a{
|
||||
color:#FFF;
|
||||
}
|
||||
|
|
|
|||
1916
adminer.php
1916
adminer.php
File diff suppressed because one or more lines are too long
47
plugin.php
47
plugin.php
|
|
@ -2,9 +2,9 @@
|
|||
|
||||
/** Adminer customization allowing usage of plugins
|
||||
* @link https://www.adminer.org/plugins/#use
|
||||
* @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)
|
||||
* @author Jakub Vrana, https://www.vrana.cz/
|
||||
* @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)
|
||||
*/
|
||||
class AdminerPlugin extends Adminer {
|
||||
/** @access protected */
|
||||
|
|
@ -62,7 +62,10 @@ class AdminerPlugin extends Adminer {
|
|||
$return = $this->_callParent($function, $args);
|
||||
foreach ($this->plugins as $plugin) {
|
||||
if (method_exists($plugin, $function)) {
|
||||
$return += call_user_func_array(array($plugin, $function), $args);
|
||||
$value = call_user_func_array(array($plugin, $function), $args);
|
||||
if ($value) {
|
||||
$return += $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
return $return;
|
||||
|
|
@ -97,11 +100,21 @@ class AdminerPlugin extends Adminer {
|
|||
return $this->_applyPlugin(__FUNCTION__, $args);
|
||||
}
|
||||
|
||||
function connectSsl() {
|
||||
$args = func_get_args();
|
||||
return $this->_applyPlugin(__FUNCTION__, $args);
|
||||
}
|
||||
|
||||
function permanentLogin($create = false) {
|
||||
$args = func_get_args();
|
||||
return $this->_applyPlugin(__FUNCTION__, $args);
|
||||
}
|
||||
|
||||
function serverName($server) {
|
||||
$args = func_get_args();
|
||||
return $this->_applyPlugin(__FUNCTION__, $args);
|
||||
}
|
||||
|
||||
function database() {
|
||||
$args = func_get_args();
|
||||
return $this->_applyPlugin(__FUNCTION__, $args);
|
||||
|
|
@ -127,11 +140,21 @@ class AdminerPlugin extends Adminer {
|
|||
return $this->_applyPlugin(__FUNCTION__, $args);
|
||||
}
|
||||
|
||||
function csp() {
|
||||
$args = func_get_args();
|
||||
return $this->_applyPlugin(__FUNCTION__, $args);
|
||||
}
|
||||
|
||||
function head() {
|
||||
$args = func_get_args();
|
||||
return $this->_applyPlugin(__FUNCTION__, $args);
|
||||
}
|
||||
|
||||
function css() {
|
||||
$args = func_get_args();
|
||||
return $this->_applyPlugin(__FUNCTION__, $args);
|
||||
}
|
||||
|
||||
function loginForm() {
|
||||
$args = func_get_args();
|
||||
return $this->_applyPlugin(__FUNCTION__, $args);
|
||||
|
|
@ -172,7 +195,7 @@ class AdminerPlugin extends Adminer {
|
|||
return $this->_applyPlugin(__FUNCTION__, $args);
|
||||
}
|
||||
|
||||
function selectQuery($query, $time) {
|
||||
function selectQuery($query, $start, $failed = false) {
|
||||
$args = func_get_args();
|
||||
return $this->_applyPlugin(__FUNCTION__, $args);
|
||||
}
|
||||
|
|
@ -297,7 +320,7 @@ class AdminerPlugin extends Adminer {
|
|||
return $this->_applyPlugin(__FUNCTION__, $args);
|
||||
}
|
||||
|
||||
function messageQuery($query, $time) {
|
||||
function messageQuery($query, $time, $failed = false) {
|
||||
$args = func_get_args();
|
||||
return $this->_applyPlugin(__FUNCTION__, $args);
|
||||
}
|
||||
|
|
@ -307,6 +330,11 @@ class AdminerPlugin extends Adminer {
|
|||
return $this->_applyPlugin(__FUNCTION__, $args);
|
||||
}
|
||||
|
||||
function editHint($table, $field, $value) {
|
||||
$args = func_get_args();
|
||||
return $this->_applyPlugin(__FUNCTION__, $args);
|
||||
}
|
||||
|
||||
function processInput($field, $value, $function = "") {
|
||||
$args = func_get_args();
|
||||
return $this->_applyPlugin(__FUNCTION__, $args);
|
||||
|
|
@ -337,6 +365,11 @@ class AdminerPlugin extends Adminer {
|
|||
return $this->_applyPlugin(__FUNCTION__, $args);
|
||||
}
|
||||
|
||||
function importServerPath() {
|
||||
$args = func_get_args();
|
||||
return $this->_applyPlugin(__FUNCTION__, $args);
|
||||
}
|
||||
|
||||
function homepage() {
|
||||
$args = func_get_args();
|
||||
return $this->_applyPlugin(__FUNCTION__, $args);
|
||||
|
|
@ -357,4 +390,4 @@ class AdminerPlugin extends Adminer {
|
|||
return $this->_applyPlugin(__FUNCTION__, $args);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,17 +2,17 @@
|
|||
|
||||
/** Select foreign key in edit form
|
||||
* @link https://www.adminer.org/plugins/#use
|
||||
* @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)
|
||||
* @author Jakub Vrana, https://www.vrana.cz/
|
||||
* @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)
|
||||
*/
|
||||
class AdminerEditForeign {
|
||||
var $_limit;
|
||||
|
||||
|
||||
function __construct($limit = 0) {
|
||||
$this->_limit = $limit;
|
||||
}
|
||||
|
||||
|
||||
function editInput($table, $field, $attrs, $value) {
|
||||
static $foreignTables = array();
|
||||
static $values = array();
|
||||
|
|
@ -39,5 +39,5 @@ class AdminerEditForeign {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -2,26 +2,29 @@
|
|||
|
||||
/** Use <select><option> for enum edit instead of <input type="radio">
|
||||
* @link https://www.adminer.org/plugins/#use
|
||||
* @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)
|
||||
* @author Jakub Vrana, https://www.vrana.cz/
|
||||
* @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)
|
||||
*/
|
||||
class AdminerEnumOption {
|
||||
|
||||
|
||||
function editInput($table, $field, $attrs, $value) {
|
||||
if ($field["type"] == "enum") {
|
||||
$options = array("" => array());
|
||||
$options = array();
|
||||
$selected = $value;
|
||||
if (isset($_GET["select"])) {
|
||||
$options[""][-1] = lang('original');
|
||||
$options[-1] = lang('original');
|
||||
if ($selected === null) {
|
||||
$selected = -1;
|
||||
}
|
||||
}
|
||||
if ($field["null"]) {
|
||||
$options[""][""] = "NULL";
|
||||
$options[""] = "NULL";
|
||||
if ($value === null && !isset($_GET["select"])) {
|
||||
$selected = "";
|
||||
}
|
||||
}
|
||||
$options[""][0] = lang('empty');
|
||||
$options[0] = lang('empty');
|
||||
preg_match_all("~'((?:[^']|'')*)'~", $field["length"], $matches);
|
||||
foreach ($matches[1] as $i => $val) {
|
||||
$val = stripcslashes(str_replace("''", "'", $val));
|
||||
|
|
@ -33,5 +36,5 @@ class AdminerEnumOption {
|
|||
return "<select$attrs>" . optionlist($options, (string) $selected, 1) . "</select>"; // 1 - use keys
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,9 +2,9 @@
|
|||
|
||||
/** Allow using Adminer inside a frame (disables ClickJacking protection)
|
||||
* @link https://www.adminer.org/plugins/#use
|
||||
* @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)
|
||||
* @author Jakub Vrana, https://www.vrana.cz/
|
||||
* @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)
|
||||
*/
|
||||
class AdminerFrames {
|
||||
/** @access protected */
|
||||
|
|
@ -20,9 +20,9 @@ class AdminerFrames {
|
|||
function headers() {
|
||||
if ($this->sameOrigin) {
|
||||
header("X-Frame-Options: SameOrigin");
|
||||
} elseif (function_exists('header_remove')) {
|
||||
header_remove("X-Frame-Options");
|
||||
}
|
||||
header("X-XSS-Protection: 0");
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,10 +2,10 @@
|
|||
|
||||
/** Display JSON values as table in edit
|
||||
* @link https://www.adminer.org/plugins/#use
|
||||
* @author Jakub Vrana, http://www.vrana.cz/
|
||||
* @author Jakub Vrana, https://www.vrana.cz/
|
||||
* @author Martin Zeman (Zemistr), http://www.zemistr.eu/
|
||||
* @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)
|
||||
* @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)
|
||||
*/
|
||||
class AdminerJsonColumn {
|
||||
private function _testJson($value) {
|
||||
|
|
|
|||
|
|
@ -1,138 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Displays only one prefered action in table list.
|
||||
*
|
||||
* Get rid of schizophrenic decisions between selecting data and showing table structure.
|
||||
* Optimize your workflow!
|
||||
*
|
||||
* @author Peter Knut
|
||||
* @copyright 2014-2015 Pematon, s.r.o. (http://www.pematon.com/)
|
||||
*/
|
||||
class AdminerSimpleMenu
|
||||
{
|
||||
/** @var bool */
|
||||
private $preferSelect;
|
||||
|
||||
/** @var bool */
|
||||
private $reorderLinks;
|
||||
|
||||
/**
|
||||
* @param bool $preferSelect Whether to prefer table selection before editing structure.
|
||||
* @param bool $reorderLinks Whether links above data table will be reordered to reflect workflow priority.
|
||||
*/
|
||||
public function AdminerSimpleMenu($preferSelect = true, $reorderLinks = true)
|
||||
{
|
||||
$this->preferSelect = $preferSelect;
|
||||
$this->reorderLinks = $reorderLinks;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prints HTML code inside <head>.
|
||||
*/
|
||||
public function head()
|
||||
{
|
||||
?>
|
||||
|
||||
<style>
|
||||
#tables {
|
||||
margin: 0;
|
||||
padding: 0.8em 1em;
|
||||
border-bottom: 1px solid #ccc;
|
||||
list-style: none;
|
||||
}
|
||||
</style>
|
||||
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* Prints table list in menu.
|
||||
*
|
||||
* @param array $tables Table list.
|
||||
* @return bool|null
|
||||
*/
|
||||
public function tablesPrint($tables)
|
||||
{
|
||||
if (defined("PMTN_ADMINER_THEME")) {
|
||||
echo "<ul id='tables' class='simple'>\n";
|
||||
} else {
|
||||
echo "<ul id='tables' onmouseover='menuOver(this, event);' onmouseout='menuOut(this);' class='simple'>\n";
|
||||
}
|
||||
|
||||
foreach ($tables as $table => $status) {
|
||||
$name = Adminer::tableName($status);
|
||||
$active = in_array($table, array($_GET["select"], $_GET["edit"], $_GET["table"], $_GET["create"], $_GET["indexes"], $_GET["foreign"], $_GET["trigger"]));
|
||||
|
||||
if ($this->preferSelect) {
|
||||
$action = "select";
|
||||
$title = "Select data";
|
||||
} else {
|
||||
$action = "table";
|
||||
$title = "Show structure";
|
||||
}
|
||||
|
||||
echo "<li>";
|
||||
if ($this->preferSelect || support("table") || support("indexes")) {
|
||||
echo '<a href="' . h(ME) . $action . '=' . urlencode($table) . '"' . bold($active, (is_view($status) ? "view" : "")) . " title='" . lang($title) . "'>$name</a>";
|
||||
} else {
|
||||
echo "<span>$name</span>";
|
||||
}
|
||||
echo "</li>\n";
|
||||
}
|
||||
|
||||
echo "</ul>\n";
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
* Prints links after select heading.
|
||||
*
|
||||
* @param array $tableStatus Result of SHOW TABLE STATUS.
|
||||
* @param string $set New item options, NULL for no new item.
|
||||
*
|
||||
* @return bool|null
|
||||
*/
|
||||
public function selectLinks($tableStatus, $set = "")
|
||||
{
|
||||
if (!$this->reorderLinks) {
|
||||
return null; // null has to be returned to force Adminer print original links.
|
||||
}
|
||||
|
||||
echo '<p class="links">';
|
||||
|
||||
$links = array();
|
||||
|
||||
if ($this->preferSelect) {
|
||||
$links["select"] = lang('Select data');
|
||||
}
|
||||
|
||||
if (support("table") || support("indexes")) {
|
||||
$links["table"] = lang('Show structure');
|
||||
}
|
||||
|
||||
if (!$this->preferSelect) {
|
||||
$links["select"] = lang('Select data');
|
||||
}
|
||||
|
||||
if (support("table")) {
|
||||
if (is_view($tableStatus)) {
|
||||
$links["view"] = lang('Alter view');
|
||||
} else {
|
||||
$links["create"] = lang('Alter table');
|
||||
}
|
||||
}
|
||||
|
||||
if ($set !== null) {
|
||||
$links["edit"] = lang('New item');
|
||||
}
|
||||
|
||||
foreach ($links as $key => $val) {
|
||||
echo " <a href='" . h(ME) . "$key=" . urlencode($tableStatus["Name"]) . ($key == "edit" ? $set : "") . "'" . bold(isset($_GET[$key])) . ">$val</a>";
|
||||
}
|
||||
|
||||
echo "\n";
|
||||
return true;
|
||||
}
|
||||
}
|
||||
87
plugins/FasterTablesFilter.php
Normal file
87
plugins/FasterTablesFilter.php
Normal file
|
|
@ -0,0 +1,87 @@
|
|||
<?php
|
||||
/**
|
||||
* Faster tables filter plugin
|
||||
* ===========================
|
||||
* Useful when there's way too many tables than it shoud be and Adminer Tables Filter is slow
|
||||
*
|
||||
* @author Martin Macko, https://github.com/linkedlist
|
||||
* @license http://http://opensource.org/licenses/MIT, The MIT License (MIT)
|
||||
*
|
||||
* Modified 201802 - updated for Adminer 4.6.0 compatibility
|
||||
*/
|
||||
class FasterTablesFilter {
|
||||
function tablesPrint($tables) { ?>
|
||||
|
||||
<p class="jsonly"><input id="filter-field">
|
||||
<style>
|
||||
.select-text {
|
||||
margin-right: 5px;
|
||||
}
|
||||
</style>
|
||||
<p id='tables'></p>
|
||||
<script<?php echo nonce(); ?>>
|
||||
function readCookie(name) {
|
||||
name = name.replace(/([.*+?^=!:${}()|[\]\/\\])/g, '\\$1');
|
||||
var regex = new RegExp('(?:^|;)\\s?' + name + '=(.*?)(?:;|$)','i'),
|
||||
match = document.cookie.match(regex);
|
||||
return match && unescape(match[1]);
|
||||
}
|
||||
var filterf = function () {
|
||||
var liProto = document.createElement('li');
|
||||
var space = document.createTextNode('\u00A0')
|
||||
var aProto = document.createElement('a');
|
||||
var tableList = document.getElementById("tables");
|
||||
function appendTables() {
|
||||
var fragment = document.createDocumentFragment();
|
||||
var item;
|
||||
for (var i = 0, len = tempTables.length; i < len; i++) {
|
||||
item = tempTables[i];
|
||||
var li = liProto.cloneNode();
|
||||
var aSelect = aProto.cloneNode();
|
||||
aSelect.href = hMe+"select="+item;
|
||||
aSelect.text = langSelect;
|
||||
aSelect.className = "select";
|
||||
var aName = aProto.cloneNode();
|
||||
aName.href = hMe+"table="+item;
|
||||
aName.text = item;
|
||||
li.appendChild(aSelect);
|
||||
li.appendChild(space.cloneNode());
|
||||
li.appendChild(aName);
|
||||
fragment.appendChild(li);
|
||||
}
|
||||
tableList.appendChild(fragment);
|
||||
}
|
||||
var tables = [<?php foreach($tables as $table => $type) { echo "'".urlencode($table) ."'". ",";}?>];
|
||||
var tempTables = tables;
|
||||
var hMe = "<?php echo h(ME) ?>";
|
||||
hMe = hMe.replace(/&/g, '&');
|
||||
var langSelect = "<?php echo lang('select');?>";
|
||||
var filterCookie = readCookie('tableFilter');
|
||||
var filter = document.getElementById("filter-field");
|
||||
if(filterCookie!='') {
|
||||
filter.value=filterCookie;
|
||||
}
|
||||
function filterTableList() {
|
||||
document.cookie = "tableFilter="+filter.value
|
||||
while(tableList.firstChild) {
|
||||
tableList.removeChild(tableList.firstChild);
|
||||
}
|
||||
tempTables = [];
|
||||
var value = filter.value.toLowerCase();
|
||||
var item;
|
||||
for (var i = 0, len = tables.length; i < len; i++) {
|
||||
item = tables[i];
|
||||
if(item.toLowerCase().indexOf(value) > -1) {
|
||||
tempTables.push(item);
|
||||
}
|
||||
}
|
||||
appendTables();
|
||||
};
|
||||
filter.onkeyup = function(event) {
|
||||
filterTableList();
|
||||
}
|
||||
filterTableList();
|
||||
}
|
||||
window.onload=filterf;
|
||||
</script>
|
||||
<?php return true;}} ?>
|
||||
Loading…
Add table
Add a link
Reference in a new issue