insert_final_newline = true
trim_trailing_whitespace = true
-[*.{php,css,js}]
+[*.{php,css,js,xml}]
indent_style = tab
[*.json]
$first_row = pre_tr($match[2]);
return "<table>\n" . ($match[1] ? "<thead>$first_row</thead>\n" : $first_row) . pre_tr($match[4]) . "\n</table>";
},
- preg_replace('~(\n( -|mysql)> )(.+)~', "\\1<code class='jush-sql'>\\3</code>",
- preg_replace('~(.+)\n---+\n~', "<b>\\1</b>\n",
- h($routine['comment'])
-)));
+ preg_replace(
+ '~(\n( -|mysql)> )(.+)~',
+ "\\1<code class='jush-sql'>\\3</code>",
+ preg_replace('~(.+)\n---+\n~', "<b>\\1</b>\n", h($routine['comment']))
+ ));
?>
</pre>
<div class="scrollable">
<table id="edit-fields" class="nowrap">
<?php
-edit_fields($row["fields"], $collations, "TABLE", $foreign_keys);
-?>
+ edit_fields($row["fields"], $collations, "TABLE", $foreign_keys);
+ ?>
</table>
<?php echo script("editFields();"); ?>
</div>
<?php echo lang('Auto Increment'); ?>: <input type="number" name="Auto_increment" class="size" value="<?php echo h($row["Auto_increment"]); ?>">
<?php echo checkbox("defaults", 1, ($_POST ? $_POST["defaults"] : adminer_setting("defaults")), lang('Default values'), "columnShow(this.checked, 5)", "jsonly"); ?>
<?php
-$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"])
- ? "<textarea name='Comment' rows='2' cols='20'" . ($comments ? "" : " class='hidden'") . ">" . h($row["Comment"]) . "</textarea>"
- : '<input name="Comment" value="' . h($row["Comment"]) . '" data-maxlength="' . (min_version(5.5) ? 2048 : 60) . '"' . ($comments ? "" : " class='hidden'") . '>'
- )
- : '')
-;
-?>
+ $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"])
+ ? "<textarea name='Comment' rows='2' cols='20'" . ($comments ? "" : " class='hidden'") . ">" . h($row["Comment"]) . "</textarea>"
+ : '<input name="Comment" value="' . h($row["Comment"]) . '" data-maxlength="' . (min_version(5.5) ? 2048 : 60) . '"' . ($comments ? "" : " class='hidden'") . '>'
+ )
+ : '')
+ ;
+ ?>
<p>
<input type="submit" value="<?php echo lang('Save'); ?>">
<?php } ?>
<table id="partition-table"<?php echo ($partition_table ? "" : " class='hidden'"); ?>>
<thead><tr><th><?php echo lang('Partition name'); ?><th><?php echo lang('Values'); ?></thead>
<?php
-foreach ($row["partition_names"] as $key => $val) {
- echo '<tr>';
- echo '<td><input name="partition_names[]" value="' . h($val) . '" autocapitalize="off">';
- echo ($key == count($row["partition_names"]) - 1 ? script("qsl('input').oninput = partitionNameChange;") : '');
- echo '<td><input name="partition_values[]" value="' . h($row["partition_values"][$key]) . '">';
-}
-?>
+ foreach ($row["partition_names"] as $key => $val) {
+ echo '<tr>';
+ echo '<td><input name="partition_names[]" value="' . h($val) . '" autocapitalize="off">';
+ echo ($key == count($row["partition_names"]) - 1 ? script("qsl('input').oninput = partitionNameChange;") : '');
+ echo '<td><input name="partition_values[]" value="' . h($row["partition_values"][$key]) . '">';
+ }
+ ?>
</table>
</div></fieldset>
<?php
"(date)>=",
"(date)<=",
);
-
}
function table($idf) {
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();
/** Return query to get connection ID
* @return string
*/
- function connection_id(){
+ function connection_id() {
return "SELECT CONNECTION_ID()";
}
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;
}
return queries("SELECT pg_terminate_backend(" . number($val) . ")");
}
- function connection_id(){
+ function connection_id() {
return "SELECT pg_backend_pid()";
}
$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) {
} 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;
<?php echo ($type == "PROCEDURE" ? "<td>" . html_select("fields[$i][inout]", explode("|", $inout), $field["inout"]) : ""); ?>
<th><?php if ($display) { ?><input name="fields[<?php echo $i; ?>][field]" value="<?php echo h($field["field"]); ?>" data-maxlength="64" autocapitalize="off" aria-labelledby="label-name"><?php } ?>
<input type="hidden" name="fields[<?php echo $i; ?>][orig]" value="<?php echo h($orig); ?>"><?php edit_type("fields[$i]", $field, $collations, $foreign_keys); ?>
-<?php if ($type == "TABLE") { ?>
+<?php
+ if ($type == "TABLE") {
+ ?>
<td><?php echo checkbox("fields[$i][null]", 1, $field["null"], "", "", "block", "label-null"); ?>
-<td><label class="block"><input type="radio" name="auto_increment_col" value="<?php echo $i; ?>"<?php if ($field["auto_increment"]) { ?> checked<?php } ?> aria-labelledby="label-ai"></label><td<?php echo $default_class; ?>><?php
+<td><label class="block"><input type="radio" name="auto_increment_col" value="<?php echo $i; ?>"<?php echo ($field["auto_increment"] ? " checked" : ""); ?> aria-labelledby="label-ai"></label><td<?php echo $default_class; ?>><?php
echo checkbox("fields[$i][has_default]", 1, $field["has_default"], "", "", "", "label-default"); ?><input name="fields[<?php echo $i; ?>][default]" value="<?php echo h($field["default"]); ?>" aria-labelledby="label-default"><?php
echo (support("comment") ? "<td$comment_class><input name='fields[$i][comment]' value='" . h($field["comment"]) . "' data-maxlength='" . (min_version(5.5) ? 1024 : 255) . "' aria-labelledby='label-comment'>" : "");
}
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;
}
/** 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
// HTML valid because there is always at least one process
$i = -1;
foreach (process_list() as $i => $row) {
-
if (!$i) {
echo "<thead><tr lang='en'>" . (support("kill") ? "<th>" : "");
foreach ($row as $key => $val) {
echo "<fieldset>";
echo "<legend>" . lang('Whole result') . "</legend>";
$display_rows = ($exact_count ? "" : "~ ") . $found_rows;
- echo checkbox("all", 1, 0, ($found_rows !== false ? ($exact_count ? "" : "~ ") . lang('%d row(s)', $found_rows) : ""),
- "var checked = formChecked(this, /check/); selectCount('selected', this.checked ? '$display_rows' : checked); selectCount('selected2', this.checked || !checked ? '$display_rows' : checked);"
- ) . "\n";
+ $onclick = "var checked = formChecked(this, /check/); selectCount('selected', this.checked ? '$display_rows' : checked); selectCount('selected2', this.checked || !checked ? '$display_rows' : checked);";
+ echo checkbox("all", 1, 0, ($found_rows !== false ? ($exact_count ? "" : "~ ") . lang('%d row(s)', $found_rows) : ""), $onclick) . "\n";
echo "</fieldset>\n";
if ($adminer->selectCommandPrint()) {
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
});
}
* @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);
}
<tr><th><?php echo lang('Server'); ?><td><input name="host" data-maxlength="60" value="<?php echo h($row["host"]); ?>" autocapitalize="off">
<tr><th><?php echo lang('Username'); ?><td><input name="user" data-maxlength="80" value="<?php echo h($row["user"]); ?>" autocapitalize="off">
<tr><th><?php echo lang('Password'); ?><td><input name="pass" id="pass" value="<?php echo h($row["pass"]); ?>" autocomplete="new-password">
-<?php if (!$row["hashed"]) { echo script("typePassword(qs('#pass'));"); } ?>
+<?php echo ($row["hashed"] ? "" : script("typePassword(qs('#pass'));")); ?>
<?php echo (min_version(8) ? "" : checkbox("hashed", 1, $row["hashed"], lang('Hashed'), "typePassword(this.form['pass'], this.checked);")); ?>
</table>
$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');
$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;
}
$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]);
--- /dev/null
+<?xml version="1.0"?>
+<ruleset name="Adminer Coding Standard">
+ <description>The coding standard for Adminer.</description>
+ <arg value="s"/>
+ <arg name="parallel" value="8"/>
+
+ <file>.</file>
+ <exclude-pattern>/externals/</exclude-pattern>
+ <exclude-pattern>/designs/</exclude-pattern>
+
+ <rule ref="PSR12">
+ <exclude name="Generic.Files.LineLength"/>
+ <exclude name="Generic.Whitespace.DisallowTabIndent"/><!-- Replaced by: Generic.Whitespace.DisallowSpaceIndent -->
+ <exclude name="PSR1.Files.SideEffects.FoundWithSymbols"/>
+ <exclude name="PSR12.Files.FileHeader.SpacingAfterBlock"/>
+ <exclude name="PSR12.Operators.OperatorSpacing.NoSpaceBefore"/>
+ <exclude name="PSR12.Operators.OperatorSpacing.NoSpaceAfter"/>
+ <exclude name="PSR1.Classes.ClassDeclaration.MissingNamespace"/>
+ <exclude name="PSR1.Classes.ClassDeclaration.MultipleClasses"/>
+ <exclude name="PSR2.Classes.ClassDeclaration.OpenBraceNewLine"/><!-- Replaced by: Generic.Classes.OpeningBraceSameLine -->
+ <exclude name="PSR2.Classes.ClassDeclaration.CloseBraceAfterBody"/>
+ <exclude name="PSR2.Classes.PropertyDeclaration.Multiple"/>
+ <exclude name="PSR2.Classes.PropertyDeclaration.VarUsed"/>
+ <exclude name="PSR2.Classes.PropertyDeclaration.ScopeMissing"/>
+ <exclude name="PSR2.Classes.PropertyDeclaration.Underscore"/>
+ <exclude name="PSR12.Classes.ClassInstantiation.MissingParentheses"/>
+ <exclude name="PSR12.Classes.OpeningBraceSpace.Found"/>
+ <exclude name="Squiz.Classes.ValidClassName.NotCamelCaps"/>
+ <exclude name="PSR1.Methods.CamelCapsMethodName.NotCamelCaps"/>
+ <exclude name="PSR2.Methods.MethodDeclaration.Underscore"/>
+ <exclude name="PSR2.Methods.FunctionCallSignature.SpaceBeforeCloseBracket"/>
+ <exclude name="PSR12.ControlStructures.ControlStructureSpacing.CloseParenthesisLine"/>
+ <exclude name="PSR12.ControlStructures.ControlStructureSpacing.FirstExpressionLine"/>
+ <exclude name="PSR12.ControlStructures.ControlStructureSpacing.LineIndent"/>
+ <exclude name="Squiz.Functions.MultiLineFunctionDeclaration.BraceOnSameLine"/><!-- Replaced by: Generic.Functions.OpeningFunctionBraceKernighanRitchie -->
+ <exclude name="PSR12.Properties.ConstantVisibility.NotFound"/><!-- PHP 7.1 is not required. -->
+ <exclude name="Squiz.Scope.MethodScope.Missing"/>
+ <exclude name="Squiz.WhiteSpace.ControlStructureSpacing.SpacingBeforeClose"/>
+
+ <!-- TODO: Ignore only in <?php if () { ?><?php } ?> -->
+ <exclude name="Generic.WhiteSpace.ScopeIndent.Incorrect"/>
+ <exclude name="Generic.WhiteSpace.ScopeIndent.IncorrectExact"/>
+ <exclude name="Squiz.ControlStructures.ControlSignature.NewlineAfterOpenBrace"/>
+ <exclude name="Squiz.WhiteSpace.ScopeClosingBrace.ContentBefore"/>
+ </rule>
+
+ <rule ref="Generic.Classes.OpeningBraceSameLine"/>
+ <rule ref="Generic.Whitespace.DisallowSpaceIndent"/>
+ <rule ref="Generic.Functions.OpeningFunctionBraceKernighanRitchie"/>
+</ruleset>
* @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";
}
}
}
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]);
+ }
}
}
}
if (isset($_GET["firebird"])) {
define("DRIVER", "firebird");
- if (extension_loaded("interbase") ) {
+ if (extension_loaded("interbase")) {
class Min_DB {
var
$extension = "Firebird",
. ($field["type"] == "time" ? "timepicker({ $timeFormat })"
: (preg_match("~time~", $field["type"]) ? "datetimepicker({ $dateFormat, $timeFormat })"
: "datepicker({ $dateFormat })"
- )) . ";");
+ )) . ";"
+ );
}
}
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"));
$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];
}
}
/** @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));
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;
* @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) {
+ ?>
<script<?php echo nonce(); ?>>
var tablesFilterTimeout = null;
var tablesFilterValue = '';