This commit is contained in:
Pau Capó 2017-03-05 01:29:57 +01:00
commit d7ffb7a30a
6 changed files with 2730 additions and 0 deletions

380
adminer.css Normal file
View file

@ -0,0 +1,380 @@
/*
FLAT UI Flavored Adminer Theme by M. Mahbubur Rahman (mahbub@mahbubblog.com)
Screenshot : http://d.pr/i/cznH
Based on work by : Lukáš Brandejs
https://raw.github.com/vrana/adminer/master/designs/ng9/adminer.css
*/
@import url(https://fonts.googleapis.com/css?family=Roboto:400,600);
* {
font: 13px/1.7 "Roboto","Proxima Nova Rg","Source Sans Pro","Droid Sans",Arial,Helvetica, sans-serif;
color:#333333;
margin:0px;
padding:0px;
}
body {
background-color: #f0f0f0;
}
a,a:visited {
color:#2980b9;
text-decoration:none;
padding:3px 1px;
}
#dbs span{
color:white;
}
#content table thead span, #content table thead a {
font-weight:bold;
color:#FFF;
text-shadow:0px 01px 0px #000;
}
#content table thead a:hover {
background:none;
text-decoration:underline;
color:black;
}
a:hover {
text-decoration:underline;
}
h1 {
font-size:1.9em;
font-weight:normal;
background:white;
color:#1e5eb6;
border-bottom:1px solid rgb(85, 112, 139);
padding:20px;
margin:0px;
}
#menu h1 {
padding:0px 0px 5px 20px;
background:none;
display: none;
}
h2,h3 {
font-size:1.7em;
font-weight:bold;
background:transparent;
color:#34495e;
border-bottom:1px solid #f4f4f4;
padding:10px 0px;
margin:0px;
}
fieldset {
padding:5px;
border:1px solid #DEDEDE;
}
input,select,textarea {
border:1px solid #e5e5e5;
margin:1px;
padding:0px;
}
select{
padding:7px 4px;
background-color:#FFFFFF;
}
input[type=submit] {
color:white;
background:#27ae60;
padding:4px 10px;
cursor:pointer;
border:0px solid;
}
input[type=submit]:hover{
background:#2c3e50;
}
input[type=checkbox]{
margin-right:5px;
}
input[type=image] {
border:1px solid #d0cdc4;
}
input[type=checkbox],input[type=radio]{
border:1px solid #e5e5e5;
padding:2px 5px;
}
code{
background:#f0ffe1;
border:1px dashed #d5f1b9;
padding:2px 4px;
font-family:"Monaco","Courier New";
}
code a:hover{background:transparent}
table{
margin:10px 0px;
border:1px solid #E6E6E6;
background-color:#FFFFFF;
}
tbody tr:hover td,tbody tr:hover th{
background:#edf4ff
}
thead th, thead td {
text-align:center;
vertical-align:middle;
font-weight:bold;
white-space:nowrap;
border-right:1px solid #34495e;
background:#34495e;
color:#FFFFFF;
padding-right:10px;
}
thead th acronym, thead td acronym, thead th sup, thead td sup{
color:#CCDDFF;
}
th,td{
border:1px solid rgba(233,233,233,.3);
padding:3px 6px;
vertical-align:top;
}
th a {
font-weight:bold;
padding-bottom:0px;
text-shadow:1px 1px 1px #FFF;
}
th {
background:white;
}
tr.odd td {
background:#fcfaf5;
}
#content tbody tr.checked td, tr.checked.odd td {
background:#fbe2e2;
color:red;
}
.hidden{
display:none
}
.error,.message{
padding:0px;
background:transparent;
font-weight:bold
}
.error{
color:#c00
}
.message{
color:#090
}
#content{
margin:0px 0px 0px 320px;
padding:50px 20px 40px 0px;
height:100%;
}
#lang {
/* background:#ecf0f1; */
color:#fff;
position:fixed;
top:auto;
bottom: 0px;
left:0px;
width: 242px;
padding:10px 20px;
z-index:1;
}
#breadcrumb {
position:fixed;
top:0px;
left:300px;
background:#48A5BF;
z-index:2;
width:100%;
color:#ecf0f1;
padding:10px;
font-size:15px;
font-weight:bold;
}
#breadcrumb a{
color:#ecf0f1;
font-size:15px;
font-weight:bold;
}
#menu {
background:#34495e;
position:fixed;
top:-10px;
color:#FFF;
padding:20px;
/* padding-top:40px; */
bottom:0px;
overflow:auto;
left:0px;
width:240px;
border-right:2px solid #34495e;
}
#menu p, #tables{
border-bottom:1px solid rgb(85, 112, 139);
}
#menu a{
color:#FFF;
}
#schema .table {
padding:5px;
background:#fcfaf5;
border:1px solid #d0cdc4;
}
#schema .table b {
color:#006aeb;
font-weight:bold;
text-decoration:underline;
}
#schema .table b:hover {
color:white;
}
input[name=logout] {
color:#fce2e2;
background:#d73e3e;
}
input[name=drop] {
background-color:#c0392b;
}
input[name=logout]:hover {
background:#ea0202;
}
#logins a, #tables a {
background:none;
}
#logins a:hover, #tables a:hover {
}
#logout {
color:#FFF;
text-decoration:none;
}
#logout:hover {
color:red;
}
.logout {
z-index:3;
}
.js .column {
background:#ecf0f1;
}
#content table thead a.text:hover {
text-decoration:none;
}
#version, .version {
font-size:50%;
}
#h1:hover {
color:white;
}
input[type=submit] {
font-size:13px;
font-weight:normal;
-moz-border-radius:1px;
-webkit-border-radius:1px;
border-radius:1px;
border:0px solid #469df5;
padding:4px 12px;
text-decoration:none;
background-color:#65ADC3;
color:#ffffff;
display:inline-block;
text-shadow:0px 01px 0px #287ace;
-webkit-box-shadow:inset 0px 0px 0px 0px #cae3fc;
-moz-box-shadow:inset 0px 0px 0px 0px #cae3fc;
box-shadow:inset 0px 0px 0px 0px #cae3fc;
}
input[type=submit]:hover {
background-color:#34495e;
text-shadow:0px 1px 0px #000;
}
input[type=submit]:active {
position:relative;
top:1px;
}
table
{
position: relative;
}
table:before, table:after
{
z-index: -1;
position: absolute;
content: "";
bottom: 15px;
left: 10px;
width: 50%;
top: 80%;
max-width:300px;
background: #777;
-webkit-box-shadow: 0 15px 10px #777;
-moz-box-shadow: 0 15px 10px #777;
box-shadow: 0 15px 10px #777;
-webkit-transform: rotate(-3deg);
-moz-transform: rotate(-3deg);
-o-transform: rotate(-3deg);
-ms-transform: rotate(-3deg);
transform: rotate(-3deg);
}
table:after
{
-webkit-transform: rotate(3deg);
-moz-transform: rotate(3deg);
-o-transform: rotate(3deg);
-ms-transform: rotate(3deg);
transform: rotate(3deg);
right: 10px;
left: auto;
}
i {
font-style: italic;
color: gray;
font-size: 90%;
font-family: monospace;
border: 1px silver solid;
}

1807
adminer.php Normal file

File diff suppressed because one or more lines are too long

17
index.php Normal file
View file

@ -0,0 +1,17 @@
<?php
function adminer_object() {
include_once "./plugin.php";
$plugins = array();
foreach (glob("plugins/*.php") as $filename) {
include_once "./$filename";
$plugin = str_replace('plugins/', '', $filename);
$plugin = str_replace('.php', '', $plugin);
$plugins[] = new $plugin();
}
return new AdminerPlugin($plugins);
}
include "./adminer.php";

360
plugin.php Normal file
View file

@ -0,0 +1,360 @@
<?php
/** 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)
*/
class AdminerPlugin extends Adminer {
/** @access protected */
var $plugins;
function _findRootClass($class) { // is_subclass_of(string, string) is available since PHP 5.0.3
do {
$return = $class;
} while ($class = get_parent_class($class));
return $return;
}
/** Register plugins
* @param array object instances or null to register all classes starting by 'Adminer'
*/
function __construct($plugins) {
if ($plugins === null) {
$plugins = array();
foreach (get_declared_classes() as $class) {
if (preg_match('~^Adminer.~i', $class) && strcasecmp($this->_findRootClass($class), 'Adminer')) { //! can use interface
$plugins[$class] = new $class;
}
}
}
$this->plugins = $plugins;
//! it is possible to use ReflectionObject to find out which plugins defines which methods at once
}
function _callParent($function, $args) {
return call_user_func_array(array('parent', $function), $args);
}
function _applyPlugin($function, $args) {
foreach ($this->plugins as $plugin) {
if (method_exists($plugin, $function)) {
switch (count($args)) { // call_user_func_array() doesn't work well with references
case 0: $return = $plugin->$function(); break;
case 1: $return = $plugin->$function($args[0]); break;
case 2: $return = $plugin->$function($args[0], $args[1]); break;
case 3: $return = $plugin->$function($args[0], $args[1], $args[2]); break;
case 4: $return = $plugin->$function($args[0], $args[1], $args[2], $args[3]); break;
case 5: $return = $plugin->$function($args[0], $args[1], $args[2], $args[3], $args[4]); break;
case 6: $return = $plugin->$function($args[0], $args[1], $args[2], $args[3], $args[4], $args[5]); break;
default: trigger_error('Too many parameters.', E_USER_WARNING);
}
if ($return !== null) {
return $return;
}
}
}
return $this->_callParent($function, $args);
}
function _appendPlugin($function, $args) {
$return = $this->_callParent($function, $args);
foreach ($this->plugins as $plugin) {
if (method_exists($plugin, $function)) {
$return += call_user_func_array(array($plugin, $function), $args);
}
}
return $return;
}
// appendPlugin
function dumpFormat() {
$args = func_get_args();
return $this->_appendPlugin(__FUNCTION__, $args);
}
function dumpOutput() {
$args = func_get_args();
return $this->_appendPlugin(__FUNCTION__, $args);
}
function editFunctions($field) {
$args = func_get_args();
return $this->_appendPlugin(__FUNCTION__, $args);
}
// applyPlugin
function name() {
$args = func_get_args();
return $this->_applyPlugin(__FUNCTION__, $args);
}
function credentials() {
$args = func_get_args();
return $this->_applyPlugin(__FUNCTION__, $args);
}
function permanentLogin($create = false) {
$args = func_get_args();
return $this->_applyPlugin(__FUNCTION__, $args);
}
function database() {
$args = func_get_args();
return $this->_applyPlugin(__FUNCTION__, $args);
}
function schemas() {
$args = func_get_args();
return $this->_applyPlugin(__FUNCTION__, $args);
}
function databases($flush = true) {
$args = func_get_args();
return $this->_applyPlugin(__FUNCTION__, $args);
}
function queryTimeout() {
$args = func_get_args();
return $this->_applyPlugin(__FUNCTION__, $args);
}
function headers() {
$args = func_get_args();
return $this->_applyPlugin(__FUNCTION__, $args);
}
function head() {
$args = func_get_args();
return $this->_applyPlugin(__FUNCTION__, $args);
}
function loginForm() {
$args = func_get_args();
return $this->_applyPlugin(__FUNCTION__, $args);
}
function login($login, $password) {
$args = func_get_args();
return $this->_applyPlugin(__FUNCTION__, $args);
}
function tableName($tableStatus) {
$args = func_get_args();
return $this->_applyPlugin(__FUNCTION__, $args);
}
function fieldName($field, $order = 0) {
$args = func_get_args();
return $this->_applyPlugin(__FUNCTION__, $args);
}
function selectLinks($tableStatus, $set = "") {
$args = func_get_args();
return $this->_applyPlugin(__FUNCTION__, $args);
}
function foreignKeys($table) {
$args = func_get_args();
return $this->_applyPlugin(__FUNCTION__, $args);
}
function backwardKeys($table, $tableName) {
$args = func_get_args();
return $this->_applyPlugin(__FUNCTION__, $args);
}
function backwardKeysPrint($backwardKeys, $row) {
$args = func_get_args();
return $this->_applyPlugin(__FUNCTION__, $args);
}
function selectQuery($query, $time) {
$args = func_get_args();
return $this->_applyPlugin(__FUNCTION__, $args);
}
function sqlCommandQuery($query) {
$args = func_get_args();
return $this->_applyPlugin(__FUNCTION__, $args);
}
function rowDescription($table) {
$args = func_get_args();
return $this->_applyPlugin(__FUNCTION__, $args);
}
function rowDescriptions($rows, $foreignKeys) {
$args = func_get_args();
return $this->_applyPlugin(__FUNCTION__, $args);
}
function selectLink($val, $field) {
$args = func_get_args();
return $this->_applyPlugin(__FUNCTION__, $args);
}
function selectVal($val, $link, $field, $original) {
$args = func_get_args();
return $this->_applyPlugin(__FUNCTION__, $args);
}
function editVal($val, $field) {
$args = func_get_args();
return $this->_applyPlugin(__FUNCTION__, $args);
}
function tableStructurePrint($fields) {
$args = func_get_args();
return $this->_applyPlugin(__FUNCTION__, $args);
}
function tableIndexesPrint($indexes) {
$args = func_get_args();
return $this->_applyPlugin(__FUNCTION__, $args);
}
function selectColumnsPrint($select, $columns) {
$args = func_get_args();
return $this->_applyPlugin(__FUNCTION__, $args);
}
function selectSearchPrint($where, $columns, $indexes) {
$args = func_get_args();
return $this->_applyPlugin(__FUNCTION__, $args);
}
function selectOrderPrint($order, $columns, $indexes) {
$args = func_get_args();
return $this->_applyPlugin(__FUNCTION__, $args);
}
function selectLimitPrint($limit) {
$args = func_get_args();
return $this->_applyPlugin(__FUNCTION__, $args);
}
function selectLengthPrint($text_length) {
$args = func_get_args();
return $this->_applyPlugin(__FUNCTION__, $args);
}
function selectActionPrint($indexes) {
$args = func_get_args();
return $this->_applyPlugin(__FUNCTION__, $args);
}
function selectCommandPrint() {
$args = func_get_args();
return $this->_applyPlugin(__FUNCTION__, $args);
}
function selectImportPrint() {
$args = func_get_args();
return $this->_applyPlugin(__FUNCTION__, $args);
}
function selectEmailPrint($emailFields, $columns) {
$args = func_get_args();
return $this->_applyPlugin(__FUNCTION__, $args);
}
function selectColumnsProcess($columns, $indexes) {
$args = func_get_args();
return $this->_applyPlugin(__FUNCTION__, $args);
}
function selectSearchProcess($fields, $indexes) {
$args = func_get_args();
return $this->_applyPlugin(__FUNCTION__, $args);
}
function selectOrderProcess($fields, $indexes) {
$args = func_get_args();
return $this->_applyPlugin(__FUNCTION__, $args);
}
function selectLimitProcess() {
$args = func_get_args();
return $this->_applyPlugin(__FUNCTION__, $args);
}
function selectLengthProcess() {
$args = func_get_args();
return $this->_applyPlugin(__FUNCTION__, $args);
}
function selectEmailProcess($where, $foreignKeys) {
$args = func_get_args();
return $this->_applyPlugin(__FUNCTION__, $args);
}
function selectQueryBuild($select, $where, $group, $order, $limit, $page) {
$args = func_get_args();
return $this->_applyPlugin(__FUNCTION__, $args);
}
function messageQuery($query, $time) {
$args = func_get_args();
return $this->_applyPlugin(__FUNCTION__, $args);
}
function editInput($table, $field, $attrs, $value) {
$args = func_get_args();
return $this->_applyPlugin(__FUNCTION__, $args);
}
function processInput($field, $value, $function = "") {
$args = func_get_args();
return $this->_applyPlugin(__FUNCTION__, $args);
}
function dumpDatabase($db) {
$args = func_get_args();
return $this->_applyPlugin(__FUNCTION__, $args);
}
function dumpTable($table, $style, $is_view = 0) {
$args = func_get_args();
return $this->_applyPlugin(__FUNCTION__, $args);
}
function dumpData($table, $style, $query) {
$args = func_get_args();
return $this->_applyPlugin(__FUNCTION__, $args);
}
function dumpFilename($identifier) {
$args = func_get_args();
return $this->_applyPlugin(__FUNCTION__, $args);
}
function dumpHeaders($identifier, $multi_table = false) {
$args = func_get_args();
return $this->_applyPlugin(__FUNCTION__, $args);
}
function homepage() {
$args = func_get_args();
return $this->_applyPlugin(__FUNCTION__, $args);
}
function navigation($missing) {
$args = func_get_args();
return $this->_applyPlugin(__FUNCTION__, $args);
}
function databasesPrint($missing) {
$args = func_get_args();
return $this->_applyPlugin(__FUNCTION__, $args);
}
function tablesPrint($tables) {
$args = func_get_args();
return $this->_applyPlugin(__FUNCTION__, $args);
}
}

28
plugins/AdminerFrames.php Normal file
View file

@ -0,0 +1,28 @@
<?php
/** 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)
*/
class AdminerFrames {
/** @access protected */
var $sameOrigin;
/**
* @param bool allow running from the same origin only
*/
function __construct($sameOrigin = false) {
$this->sameOrigin = $sameOrigin;
}
function headers() {
if ($this->sameOrigin) {
header("X-Frame-Options: SameOrigin");
}
header("X-XSS-Protection: 0");
return false;
}
}

View file

@ -0,0 +1,138 @@
<?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;
}
}