diff --git a/.editorconfig b/.editorconfig
index b67cfe0d..f416309e 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -7,7 +7,7 @@ end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
-[*.{php,css,js}]
+[*.{php,css,js,xml}]
indent_style = tab
[*.json]
diff --git a/adminer/call.inc.php b/adminer/call.inc.php
index 3bb25bc7..b87f9141 100644
--- a/adminer/call.inc.php
+++ b/adminer/call.inc.php
@@ -101,9 +101,10 @@ echo
$first_row = pre_tr($match[2]);
return "
\n" . ($match[1] ? "$first_row\n" : $first_row) . pre_tr($match[4]) . "\n
";
},
- preg_replace('~(\n( -|mysql)> )(.+)~', "\\1\\3
",
- preg_replace('~(.+)\n---+\n~', "\\1\n",
- h($routine['comment'])
-)));
+ preg_replace(
+ '~(\n( -|mysql)> )(.+)~',
+ "\\1\\3
",
+ preg_replace('~(.+)\n---+\n~', "\\1\n", h($routine['comment']))
+ ));
?>
diff --git a/adminer/create.inc.php b/adminer/create.inc.php
index 1d1906e0..abdf8388 100644
--- a/adminer/create.inc.php
+++ b/adminer/create.inc.php
@@ -188,8 +188,8 @@ foreach ($engines as $engine) {
@@ -197,16 +197,16 @@ edit_fields($row["fields"], $collations, "TABLE", $foreign_keys);
: ">
" . h($row["Comment"]) . ""
- : ''
- )
- : '')
-;
-?>
+ $comments = ($_POST ? $_POST["comments"] : adminer_setting("comments"));
+ echo (support("comment")
+ ? checkbox("comments", 1, $comments, lang('Comment'), "editingCommentsClick(this, true);", "jsonly")
+ . ' ' . (preg_match('~\n~', $row["Comment"])
+ ? ""
+ : ''
+ )
+ : '')
+ ;
+ ?>
@@ -224,13 +224,13 @@ if (support("partitioning")) {
=",
"(date)<=",
);
-
}
function table($idf) {
diff --git a/adminer/drivers/mssql.inc.php b/adminer/drivers/mssql.inc.php
index 1d5dbcde..0af106b2 100644
--- a/adminer/drivers/mssql.inc.php
+++ b/adminer/drivers/mssql.inc.php
@@ -367,8 +367,7 @@ WHERE o.schema_id = SCHEMA_ID(" . q(get_schema()) . ") AND o.type IN ('S', 'U',
FROM sys.indexes i
INNER JOIN sys.index_columns ic ON i.object_id = ic.object_id AND i.index_id = ic.index_id
INNER JOIN sys.columns c ON ic.object_id = c.object_id AND ic.column_id = c.column_id
-WHERE OBJECT_NAME(i.object_id) = " . q($table)
- , $connection2) as $row) {
+WHERE OBJECT_NAME(i.object_id) = " . q($table), $connection2) as $row) {
$name = $row["name"];
$return[$name]["type"] = ($row["is_primary_key"] ? "PRIMARY" : ($row["is_unique"] ? "UNIQUE" : "INDEX"));
$return[$name]["lengths"] = array();
diff --git a/adminer/drivers/mysql.inc.php b/adminer/drivers/mysql.inc.php
index 21b304f5..6ae89e90 100644
--- a/adminer/drivers/mysql.inc.php
+++ b/adminer/drivers/mysql.inc.php
@@ -1152,7 +1152,7 @@ if (!defined("DRIVER")) {
/** Return query to get connection ID
* @return string
*/
- function connection_id(){
+ function connection_id() {
return "SELECT CONNECTION_ID()";
}
diff --git a/adminer/drivers/pgsql.inc.php b/adminer/drivers/pgsql.inc.php
index 33be88ff..b1557ee4 100644
--- a/adminer/drivers/pgsql.inc.php
+++ b/adminer/drivers/pgsql.inc.php
@@ -618,10 +618,10 @@ ORDER BY conkey, conname") as $row) {
function drop_tables($tables) {
foreach ($tables as $table) {
- $status = table_status($table);
- if (!queries("DROP " . strtoupper($status["Engine"]) . " " . table($table))) {
- return false;
- }
+ $status = table_status($table);
+ if (!queries("DROP " . strtoupper($status["Engine"]) . " " . table($table))) {
+ return false;
+ }
}
return true;
}
@@ -902,7 +902,7 @@ AND typelem = 0"
return queries("SELECT pg_terminate_backend(" . number($val) . ")");
}
- function connection_id(){
+ function connection_id() {
return "SELECT pg_backend_pid()";
}
diff --git a/adminer/dump.inc.php b/adminer/dump.inc.php
index 8dfbed60..68235ab7 100644
--- a/adminer/dump.inc.php
+++ b/adminer/dump.inc.php
@@ -10,7 +10,8 @@ if ($_POST && !$error) {
$tables = array_flip((array) $_POST["tables"]) + array_flip((array) $_POST["data"]);
$ext = dump_headers(
(count($tables) == 1 ? key($tables) : DB),
- (DB == "" || count($tables) > 1));
+ (DB == "" || count($tables) > 1)
+ );
$is_sql = preg_match('~sql~', $_POST["format"]);
if ($is_sql) {
diff --git a/adminer/file.inc.php b/adminer/file.inc.php
index 8c817697..0ffe2a89 100644
--- a/adminer/file.inc.php
+++ b/adminer/file.inc.php
@@ -16,11 +16,21 @@ if ($_GET["file"] == "favicon.ico") {
} else {
header("Content-Type: image/gif");
switch ($_GET["file"]) {
- case "plus.gif": echo compile_file('../adminer/static/plus.gif'); break;
- case "cross.gif": echo compile_file('../adminer/static/cross.gif'); break;
- case "up.gif": echo compile_file('../adminer/static/up.gif'); break;
- case "down.gif": echo compile_file('../adminer/static/down.gif'); break;
- case "arrow.gif": echo compile_file('../adminer/static/arrow.gif'); break;
+ case "plus.gif":
+ echo compile_file('../adminer/static/plus.gif');
+ break;
+ case "cross.gif":
+ echo compile_file('../adminer/static/cross.gif');
+ break;
+ case "up.gif":
+ echo compile_file('../adminer/static/up.gif');
+ break;
+ case "down.gif":
+ echo compile_file('../adminer/static/down.gif');
+ break;
+ case "arrow.gif":
+ echo compile_file('../adminer/static/arrow.gif');
+ break;
}
}
exit;
diff --git a/adminer/include/editing.inc.php b/adminer/include/editing.inc.php
index 6739f5e9..b23394ef 100644
--- a/adminer/include/editing.inc.php
+++ b/adminer/include/editing.inc.php
@@ -370,9 +370,11 @@ function edit_fields($fields, $collations, $type = "TABLE", $foreign_keys = arra
" . html_select("fields[$i][inout]", explode("|", $inout), $field["inout"]) : ""); ?>
" data-maxlength="64" autocapitalize="off" aria-labelledby="label-name">
-
+
|
- | | > | >" aria-labelledby="label-default">" : "");
}
@@ -582,9 +584,12 @@ function tar_file($filename, $tmp_file) {
function ini_bytes($ini) {
$val = ini_get($ini);
switch (strtolower(substr($val, -1))) {
- case 'g': $val = (int)$val * 1024; // no break
- case 'm': $val = (int)$val * 1024; // no break
- case 'k': $val = (int)$val * 1024;
+ case 'g':
+ $val = (int)$val * 1024; // no break
+ case 'm':
+ $val = (int)$val * 1024; // no break
+ case 'k':
+ $val = (int)$val * 1024;
}
return $val;
}
diff --git a/adminer/include/functions.inc.php b/adminer/include/functions.inc.php
index bb841de2..a4703154 100644
--- a/adminer/include/functions.inc.php
+++ b/adminer/include/functions.inc.php
@@ -502,17 +502,19 @@ function convert_fields($columns, $fields, $select = array()) {
/** Set cookie valid on current path
* @param string
* @param string
-* @param int number of seconds, 0 for session cookie
+* @param int number of seconds, 0 for session cookie, 2592000 - 30 days
* @return bool
*/
-function cookie($name, $value, $lifetime = 2592000) { // 2592000 - 30 days
+function cookie($name, $value, $lifetime = 2592000) {
global $HTTPS;
- return header("Set-Cookie: $name=" . urlencode($value)
- . ($lifetime ? "; expires=" . gmdate("D, d M Y H:i:s", time() + $lifetime) . " GMT" : "")
- . "; path=" . preg_replace('~\?.*~', '', $_SERVER["REQUEST_URI"])
- . ($HTTPS ? "; secure" : "")
- . "; HttpOnly; SameSite=lax",
- false);
+ return header(
+ "Set-Cookie: $name=" . urlencode($value)
+ . ($lifetime ? "; expires=" . gmdate("D, d M Y H:i:s", time() + $lifetime) . " GMT" : "")
+ . "; path=" . preg_replace('~\?.*~', '', $_SERVER["REQUEST_URI"])
+ . ($HTTPS ? "; secure" : "")
+ . "; HttpOnly; SameSite=lax",
+ false
+ );
}
/** Restart stopped session
diff --git a/adminer/processlist.inc.php b/adminer/processlist.inc.php
index cd804b97..e36143a1 100644
--- a/adminer/processlist.inc.php
+++ b/adminer/processlist.inc.php
@@ -22,7 +22,6 @@ echo script("mixin(qsl('table'), {onclick: tableClick, ondblclick: partialArg(ta
// HTML valid because there is always at least one process
$i = -1;
foreach (process_list() as $i => $row) {
-
if (!$i) {
echo "" . (support("kill") ? "" : "");
foreach ($row as $key => $val) {
diff --git a/adminer/select.inc.php b/adminer/select.inc.php
index 9c5dec8e..065dba40 100644
--- a/adminer/select.inc.php
+++ b/adminer/select.inc.php
@@ -526,9 +526,8 @@ if (!$columns && support("table")) {
echo "\n";
if ($adminer->selectCommandPrint()) {
diff --git a/adminer/static/editing.js b/adminer/static/editing.js
index 46ec30bd..59d8723e 100644
--- a/adminer/static/editing.js
+++ b/adminer/static/editing.js
@@ -238,9 +238,13 @@ function editFields() {
els = qsa('[name$="[type]"]');
for (var i = 0; i < els.length; i++) {
mixin(els[i], {
- onfocus: function () { lastType = selectValue(this); },
+ onfocus: function () {
+ lastType = selectValue(this);
+ },
onchange: editingTypeChange,
- onmouseover: function (event) { helpMouseover.call(this, event, getTarget(event).value, 1) },
+ onmouseover: function (event) {
+ helpMouseover.call(this, event, getTarget(event).value, 1);
+ },
onmouseout: helpMouseout
});
}
diff --git a/adminer/static/functions.js b/adminer/static/functions.js
index 14252b65..787ebf73 100644
--- a/adminer/static/functions.js
+++ b/adminer/static/functions.js
@@ -884,7 +884,8 @@ function addEvent(el, action, handler) {
* @param HTMLElement
*/
function focus(el) {
- setTimeout(function () { // this has to be an anonymous function because Firefox passes some arguments to setTimeout callback
+ setTimeout(function () {
+ // this has to be an anonymous function because Firefox passes some arguments to setTimeout callback
el.focus();
}, 0);
}
diff --git a/adminer/user.inc.php b/adminer/user.inc.php
index 45e0bb05..2a7a53a5 100644
--- a/adminer/user.inc.php
+++ b/adminer/user.inc.php
@@ -135,7 +135,7 @@ if ($_POST) {
| | " autocapitalize="off">
|
---|
| " autocapitalize="off">
|
---|
| " autocomplete="new-password">
-
+
diff --git a/compile.php b/compile.php
index eac03fc8..17d8cb37 100755
--- a/compile.php
+++ b/compile.php
@@ -277,11 +277,12 @@ function php_shrink($input) {
$output = '';
$in_echo = false;
$doc_comment = false; // include only first /**
- for (reset($tokens); list($i, $token) = each($tokens); ) {
+ for (reset($tokens); list($i, $token) = each($tokens);) {
if (!is_array($token)) {
$token = array(0, $token);
}
- if ($tokens[$i+2][0] === T_CLOSE_TAG && $tokens[$i+3][0] === T_INLINE_HTML && $tokens[$i+4][0] === T_OPEN_TAG
+ if (
+ $tokens[$i+2][0] === T_CLOSE_TAG && $tokens[$i+3][0] === T_INLINE_HTML && $tokens[$i+4][0] === T_OPEN_TAG
&& strlen(add_apo_slashes($tokens[$i+3][1])) < strlen($tokens[$i+3][1]) + 3
) {
$tokens[$i+2] = array(T_ECHO, 'echo');
diff --git a/coverage.php b/coverage.php
index f10fc7fa..8f047395 100644
--- a/coverage.php
+++ b/coverage.php
@@ -39,9 +39,15 @@ if (!extension_loaded("xdebug")) {
$line = $file[$l];
$color = "#C0FFC0"; // tested
switch ($coverage[realpath($filename)][$l+1]) {
- case -1: $color = "#FFC0C0"; break; // untested
- case -2: $color = "Silver"; break; // dead code
- case null: $color = ""; break; // not executable
+ case -1: // untested
+ $color = "#FFC0C0";
+ break;
+ case -2: // dead code
+ $color = "Silver";
+ break;
+ case null: // not executable
+ $color = "";
+ break;
}
if ($prev_color === null) {
$prev_color = $color;
diff --git a/lang.php b/lang.php
index fa34b91d..b9b805ff 100755
--- a/lang.php
+++ b/lang.php
@@ -13,13 +13,15 @@ if (isset($_SESSION["lang"])) {
}
$messages_all = array();
-foreach (array_merge(
- glob(__DIR__ . "/adminer/*.php"),
- glob(__DIR__ . "/adminer/include/*.php"),
- glob(__DIR__ . "/adminer/drivers/*.php"),
- glob(__DIR__ . "/editor/*.php"),
- glob(__DIR__ . "/editor/include/*.php")
-) as $filename) {
+foreach (
+ array_merge(
+ glob(__DIR__ . "/adminer/*.php"),
+ glob(__DIR__ . "/adminer/include/*.php"),
+ glob(__DIR__ . "/adminer/drivers/*.php"),
+ glob(__DIR__ . "/editor/*.php"),
+ glob(__DIR__ . "/editor/include/*.php")
+ ) as $filename
+) {
$file = file_get_contents($filename);
if (preg_match_all("~lang\\(('(?:[^\\\\']+|\\\\.)*')([),])~", $file, $matches)) { // lang() always uses apostrophes
$messages_all += array_combine($matches[1], $matches[2]);
diff --git a/phpcs.xml b/phpcs.xml
new file mode 100644
index 00000000..e59547b6
--- /dev/null
+++ b/phpcs.xml
@@ -0,0 +1,50 @@
+
+
+ The coding standard for Adminer.
+
+
+
+ .
+ /externals/
+ /designs/
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/plugins/adminer.js.php b/plugins/adminer.js.php
index 7e8cf892..ad346927 100644
--- a/plugins/adminer.js.php
+++ b/plugins/adminer.js.php
@@ -8,13 +8,12 @@
* @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 AdminerDotJs
-{
- const FileName = "adminer.js";
+class AdminerDotJs {
+ const FILENAME = "adminer.js";
function head() {
- if (file_exists(self::FileName)) {
- echo script_src(self::FileName . "?v=" . crc32(file_get_contents(self::FileName))), "\n";
+ if (file_exists(self::FILENAME)) {
+ echo script_src(self::FILENAME . "?v=" . crc32(file_get_contents(self::FILENAME))), "\n";
}
}
}
diff --git a/plugins/drivers/elastic.php b/plugins/drivers/elastic.php
index 03f480b2..efe8355d 100644
--- a/plugins/drivers/elastic.php
+++ b/plugins/drivers/elastic.php
@@ -365,10 +365,12 @@ if (isset($_GET["elastic"])) {
if ($name != "") {
if (isset($stats["indices"][$name])) {
return format_index_status($name, $stats["indices"][$name]);
- } else foreach ($aliases as $index_name => $index) {
- foreach ($index["aliases"] as $alias_name => $alias) {
- if ($alias_name == $name) {
- return format_alias_status($alias_name, $stats["indices"][$index_name]);
+ } else {
+ foreach ($aliases as $index_name => $index) {
+ foreach ($index["aliases"] as $alias_name => $alias) {
+ if ($alias_name == $name) {
+ return format_alias_status($alias_name, $stats["indices"][$index_name]);
+ }
}
}
}
diff --git a/plugins/drivers/firebird.php b/plugins/drivers/firebird.php
index 31e93fb9..434bb54c 100644
--- a/plugins/drivers/firebird.php
+++ b/plugins/drivers/firebird.php
@@ -8,7 +8,7 @@ add_driver('firebird', 'Firebird (alpha)');
if (isset($_GET["firebird"])) {
define("DRIVER", "firebird");
- if (extension_loaded("interbase") ) {
+ if (extension_loaded("interbase")) {
class Min_DB {
var
$extension = "Firebird",
diff --git a/plugins/edit-calendar.php b/plugins/edit-calendar.php
index 655a3723..93702d5a 100644
--- a/plugins/edit-calendar.php
+++ b/plugins/edit-calendar.php
@@ -49,7 +49,8 @@ class AdminerEditCalendar {
. ($field["type"] == "time" ? "timepicker({ $timeFormat })"
: (preg_match("~time~", $field["type"]) ? "datetimepicker({ $dateFormat, $timeFormat })"
: "datepicker({ $dateFormat })"
- )) . ";");
+ )) . ";"
+ );
}
}
diff --git a/plugins/foreign-system.php b/plugins/foreign-system.php
index ae26cca7..757ae852 100644
--- a/plugins/foreign-system.php
+++ b/plugins/foreign-system.php
@@ -10,18 +10,19 @@ class AdminerForeignSystem {
function foreignKeys($table) {
if (DRIVER == "server" && DB == "mysql") {
- switch ($table) {
- case "columns_priv": return array(array("table" => "user", "source" => array("Host", "User"), "target" => array("Host", "User")));
- case "db": return array(array("table" => "user", "source" => array("Host", "User"), "target" => array("Host", "User")));
- case "help_category": return array(array("table" => "help_category", "source" => array("parent_category_id"), "target" => array("help_category_id")));
- case "help_relation": return array(array("table" => "help_topic", "source" => array("help_topic_id"), "target" => array("help_topic_id")), array("table" => "help_keyword", "source" => array("help_keyword_id"), "target" => array("help_keyword_id")));
- case "help_topic": return array(array("table" => "help_category", "source" => array("help_category_id"), "target" => array("help_category_id")));
- case "procs_priv": return array(array("table" => "user", "source" => array("Host", "User"), "target" => array("Host", "User")), array("table" => "proc", "source" => array("Db", "Routine_name"), "target" => array("db", "name")));
- case "tables_priv": return array(array("table" => "user", "source" => array("Host", "User"), "target" => array("Host", "User")));
- case "time_zone_name": return array(array("table" => "time_zone", "source" => array("Time_zone_id"), "target" => array("Time_zone_id")));
- case "time_zone_transition": return array(array("table" => "time_zone", "source" => array("Time_zone_id"), "target" => array("Time_zone_id")), array("table" => "time_zone_transition_type", "source" => array("Time_zone_id", "Transition_type_id"), "target" => array("Time_zone_id", "Transition_type_id")));
- case "time_zone_transition_type": return array(array("table" => "time_zone", "source" => array("Time_zone_id"), "target" => array("Time_zone_id")));
- }
+ $return = array(
+ "columns_priv" => array(array("table" => "user", "source" => array("Host", "User"), "target" => array("Host", "User"))),
+ "db" => array(array("table" => "user", "source" => array("Host", "User"), "target" => array("Host", "User"))),
+ "help_category" => array(array("table" => "help_category", "source" => array("parent_category_id"), "target" => array("help_category_id"))),
+ "help_relation" => array(array("table" => "help_topic", "source" => array("help_topic_id"), "target" => array("help_topic_id")), array("table" => "help_keyword", "source" => array("help_keyword_id"), "target" => array("help_keyword_id"))),
+ "help_topic" => array(array("table" => "help_category", "source" => array("help_category_id"), "target" => array("help_category_id"))),
+ "procs_priv" => array(array("table" => "user", "source" => array("Host", "User"), "target" => array("Host", "User")), array("table" => "proc", "source" => array("Db", "Routine_name"), "target" => array("db", "name"))),
+ "tables_priv" => array(array("table" => "user", "source" => array("Host", "User"), "target" => array("Host", "User"))),
+ "time_zone_name" => array(array("table" => "time_zone", "source" => array("Time_zone_id"), "target" => array("Time_zone_id"))),
+ "time_zone_transition" => array(array("table" => "time_zone", "source" => array("Time_zone_id"), "target" => array("Time_zone_id")), array("table" => "time_zone_transition_type", "source" => array("Time_zone_id", "Transition_type_id"), "target" => array("Time_zone_id", "Transition_type_id"))),
+ "time_zone_transition_type" => array(array("table" => "time_zone", "source" => array("Time_zone_id"), "target" => array("Time_zone_id"))),
+ );
+ return $return[$table];
} elseif (DB == "information_schema") {
$schemata = array("table" => "SCHEMATA", "source" => array("TABLE_CATALOG", "TABLE_SCHEMA"), "target" => array("CATALOG_NAME", "SCHEMA_NAME"));
$tables = array("table" => "TABLES", "source" => array("TABLE_CATALOG", "TABLE_SCHEMA", "TABLE_NAME"), "target" => array("TABLE_CATALOG", "TABLE_SCHEMA", "TABLE_NAME"));
@@ -29,27 +30,28 @@ class AdminerForeignSystem {
$character_sets = array("table" => "CHARACTER_SETS", "source" => array("CHARACTER_SET_NAME"), "target" => array("CHARACTER_SET_NAME"));
$collations = array("table" => "COLLATIONS", "source" => array("COLLATION_NAME"), "target" => array("COLLATION_NAME"));
$routine_charsets = array(array("source" => array("CHARACTER_SET_CLIENT")) + $character_sets, array("source" => array("COLLATION_CONNECTION")) + $collations, array("source" => array("DATABASE_COLLATION")) + $collations);
- switch ($table) {
- case "CHARACTER_SETS": return array(array("source" => array("DEFAULT_COLLATE_NAME")) + $collations);
- case "COLLATIONS": return array($character_sets);
- case "COLLATION_CHARACTER_SET_APPLICABILITY": return array($collations, $character_sets);
- case "COLUMNS": return array($schemata, $tables, $character_sets, $collations);
- case "COLUMN_PRIVILEGES": return array($schemata, $tables, $columns);
- case "TABLES": return array($schemata, array("source" => array("TABLE_COLLATION")) + $collations);
- case "SCHEMATA": return array(array("source" => array("DEFAULT_CHARACTER_SET_NAME")) + $character_sets, array("source" => array("DEFAULT_COLLATION_NAME")) + $collations);
- case "EVENTS": return array_merge(array(array("source" => array("EVENT_CATALOG", "EVENT_SCHEMA")) + $schemata), $routine_charsets);
- case "FILES": return array($schemata, $tables);
- case "KEY_COLUMN_USAGE": return array(array("source" => array("CONSTRAINT_CATALOG", "CONSTRAINT_SCHEMA")) + $schemata, $schemata, $tables, $columns, array("source" => array("TABLE_CATALOG", "REFERENCED_TABLE_SCHEMA")) + $schemata, array("source" => array("TABLE_CATALOG", "REFERENCED_TABLE_SCHEMA", "REFERENCED_TABLE_NAME")) + $tables, array("source" => array("TABLE_CATALOG", "REFERENCED_TABLE_SCHEMA", "REFERENCED_TABLE_NAME", "REFERENCED_COLUMN_NAME")) + $columns);
- case "PARTITIONS": return array($schemata, $tables);
- case "REFERENTIAL_CONSTRAINTS": return array(array("source" => array("CONSTRAINT_CATALOG", "CONSTRAINT_SCHEMA")) + $schemata, array("source" => array("UNIQUE_CONSTRAINT_CATALOG", "UNIQUE_CONSTRAINT_SCHEMA")) + $schemata, array("source" => array("CONSTRAINT_CATALOG", "CONSTRAINT_SCHEMA", "TABLE_NAME")) + $tables, array("source" => array("CONSTRAINT_CATALOG", "CONSTRAINT_SCHEMA", "REFERENCED_TABLE_NAME")) + $tables);
- case "ROUTINES": return array_merge(array(array("source" => array("ROUTINE_CATALOG", "ROUTINE_SCHEMA")) + $schemata), $routine_charsets);
- case "SCHEMA_PRIVILEGES": return array($schemata);
- case "STATISTICS": return array($schemata, $tables, $columns, array("source" => array("TABLE_CATALOG", "INDEX_SCHEMA")) + $schemata);
- case "TABLE_CONSTRAINTS": return array(array("source" => array("CONSTRAINT_CATALOG", "CONSTRAINT_SCHEMA")) + $schemata, array("source" => array("CONSTRAINT_CATALOG", "TABLE_SCHEMA")) + $schemata, array("source" => array("CONSTRAINT_CATALOG", "TABLE_SCHEMA", "TABLE_NAME")) + $tables);
- case "TABLE_PRIVILEGES": return array($schemata, $tables);
- case "TRIGGERS": return array_merge(array(array("source" => array("TRIGGER_CATALOG", "TRIGGER_SCHEMA")) + $schemata, array("source" => array("EVENT_OBJECT_CATALOG", "EVENT_OBJECT_SCHEMA")) + $schemata, array("source" => array("EVENT_OBJECT_CATALOG", "EVENT_OBJECT_SCHEMA", "EVENT_OBJECT_TABLE")) + $tables), $routine_charsets);
- case "VIEWS": return array($schemata);
- }
+ $return = array(
+ "CHARACTER_SETS" => array(array("source" => array("DEFAULT_COLLATE_NAME")) + $collations),
+ "COLLATIONS" => array($character_sets),
+ "COLLATION_CHARACTER_SET_APPLICABILITY" => array($collations, $character_sets),
+ "COLUMNS" => array($schemata, $tables, $character_sets, $collations),
+ "COLUMN_PRIVILEGES" => array($schemata, $tables, $columns),
+ "TABLES" => array($schemata, array("source" => array("TABLE_COLLATION")) + $collations),
+ "SCHEMATA" => array(array("source" => array("DEFAULT_CHARACTER_SET_NAME")) + $character_sets, array("source" => array("DEFAULT_COLLATION_NAME")) + $collations),
+ "EVENTS" => array_merge(array(array("source" => array("EVENT_CATALOG", "EVENT_SCHEMA")) + $schemata), $routine_charsets),
+ "FILES" => array($schemata, $tables),
+ "KEY_COLUMN_USAGE" => array(array("source" => array("CONSTRAINT_CATALOG", "CONSTRAINT_SCHEMA")) + $schemata, $schemata, $tables, $columns, array("source" => array("TABLE_CATALOG", "REFERENCED_TABLE_SCHEMA")) + $schemata, array("source" => array("TABLE_CATALOG", "REFERENCED_TABLE_SCHEMA", "REFERENCED_TABLE_NAME")) + $tables, array("source" => array("TABLE_CATALOG", "REFERENCED_TABLE_SCHEMA", "REFERENCED_TABLE_NAME", "REFERENCED_COLUMN_NAME")) + $columns),
+ "PARTITIONS" => array($schemata, $tables),
+ "REFERENTIAL_CONSTRAINTS" => array(array("source" => array("CONSTRAINT_CATALOG", "CONSTRAINT_SCHEMA")) + $schemata, array("source" => array("UNIQUE_CONSTRAINT_CATALOG", "UNIQUE_CONSTRAINT_SCHEMA")) + $schemata, array("source" => array("CONSTRAINT_CATALOG", "CONSTRAINT_SCHEMA", "TABLE_NAME")) + $tables, array("source" => array("CONSTRAINT_CATALOG", "CONSTRAINT_SCHEMA", "REFERENCED_TABLE_NAME")) + $tables),
+ "ROUTINES" => array_merge(array(array("source" => array("ROUTINE_CATALOG", "ROUTINE_SCHEMA")) + $schemata), $routine_charsets),
+ "SCHEMA_PRIVILEGES" => array($schemata),
+ "STATISTICS" => array($schemata, $tables, $columns, array("source" => array("TABLE_CATALOG", "INDEX_SCHEMA")) + $schemata),
+ "TABLE_CONSTRAINTS" => array(array("source" => array("CONSTRAINT_CATALOG", "CONSTRAINT_SCHEMA")) + $schemata, array("source" => array("CONSTRAINT_CATALOG", "TABLE_SCHEMA")) + $schemata, array("source" => array("CONSTRAINT_CATALOG", "TABLE_SCHEMA", "TABLE_NAME")) + $tables),
+ "TABLE_PRIVILEGES" => array($schemata, $tables),
+ "TRIGGERS" => array_merge(array(array("source" => array("TRIGGER_CATALOG", "TRIGGER_SCHEMA")) + $schemata, array("source" => array("EVENT_OBJECT_CATALOG", "EVENT_OBJECT_SCHEMA")) + $schemata, array("source" => array("EVENT_OBJECT_CATALOG", "EVENT_OBJECT_SCHEMA", "EVENT_OBJECT_TABLE")) + $tables), $routine_charsets),
+ "VIEWS" => array($schemata),
+ );
+ return $return[$table];
}
}
diff --git a/plugins/plugin.php b/plugins/plugin.php
index adcc440d..03f6b5fd 100644
--- a/plugins/plugin.php
+++ b/plugins/plugin.php
@@ -10,7 +10,8 @@ class AdminerPlugin extends Adminer {
/** @access protected */
var $plugins;
- function _findRootClass($class) { // is_subclass_of(string, string) is available since PHP 5.0.3
+ function _findRootClass($class) {
+ // is_subclass_of(string, string) is available since PHP 5.0.3
do {
$return = $class;
} while ($class = get_parent_class($class));
@@ -41,14 +42,29 @@ class AdminerPlugin extends Adminer {
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);
+ 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;
diff --git a/plugins/tables-filter.php b/plugins/tables-filter.php
index 68363258..879a3924 100644
--- a/plugins/tables-filter.php
+++ b/plugins/tables-filter.php
@@ -7,7 +7,8 @@
* @license https://www.gnu.org/licenses/gpl-2.0.html GNU General Public License, version 2 (one or other)
*/
class AdminerTablesFilter {
- function tablesPrint($tables) { ?>
+ function tablesPrint($tables) {
+ ?>
|
---|
|