diff --git a/adminer/db.inc.php b/adminer/db.inc.php index 0807fae2..8c6629c5 100644 --- a/adminer/db.inc.php +++ b/adminer/db.inc.php @@ -80,14 +80,27 @@ if (adminer()->homepage()) { echo ''; echo '' . script("qs('#check-all').onclick = partial(formCheck, /^(tables|views)\[/);", ""); echo '' . lang('Table'); - echo '' . lang('Engine') . doc_link(array('sql' => 'storage-engines.html')); - echo '' . lang('Collation') . doc_link(array('sql' => 'charset-charsets.html', 'mariadb' => 'supported-character-sets-and-collations/')); - echo '' . lang('Data Length') . doc_link(array('sql' => 'show-table-status.html', 'pgsql' => 'functions-admin.html#FUNCTIONS-ADMIN-DBOBJECT', 'oracle' => 'REFRN20286')); - echo '' . lang('Index Length') . doc_link(array('sql' => 'show-table-status.html', 'pgsql' => 'functions-admin.html#FUNCTIONS-ADMIN-DBOBJECT')); - echo '' . lang('Data Free') . doc_link(array('sql' => 'show-table-status.html')); - echo '' . lang('Auto Increment') . doc_link(array('sql' => 'example-auto-increment.html', 'mariadb' => 'auto_increment/')); - echo '' . lang('Rows') . doc_link(array('sql' => 'show-table-status.html', 'pgsql' => 'catalog-pg-class.html#CATALOG-PG-CLASS', 'oracle' => 'REFRN20286')); - echo (support("comment") ? '' . lang('Comment') . doc_link(array('sql' => 'show-table-status.html', 'pgsql' => 'functions-info.html#FUNCTIONS-INFO-COMMENT-TABLE')) : ''); + $columns = array("Engine" => array(lang('Engine') . doc_link(array('sql' => 'storage-engines.html')))); + if (collations()) { + $columns["Collation"] = array(lang('Collation') . doc_link(array('sql' => 'charset-charsets.html', 'mariadb' => 'supported-character-sets-and-collations/'))); + } + if (function_exists('Adminer\alter_table')) { + $columns["Data_length"] = array(lang('Data Length') . doc_link(array('sql' => 'show-table-status.html', 'pgsql' => 'functions-admin.html#FUNCTIONS-ADMIN-DBOBJECT', 'oracle' => 'REFRN20286')), "create", lang('Alter table')); + } + if (support('indexes')) { + $columns["Index_length"] = array(lang('Index Length') . doc_link(array('sql' => 'show-table-status.html', 'pgsql' => 'functions-admin.html#FUNCTIONS-ADMIN-DBOBJECT')), "indexes", lang('Alter indexes')); + } + $columns["Data_free"] = array(lang('Data Free') . doc_link(array('sql' => 'show-table-status.html')), "edit", lang('New item')); + if (function_exists('Adminer\alter_table')) { + $columns["Auto_increment"] = array(lang('Auto Increment') . doc_link(array('sql' => 'example-auto-increment.html', 'mariadb' => 'auto_increment/')), "auto_increment=1&create", lang('Alter table')); + } + $columns["Rows"] = array(lang('Rows') . doc_link(array('sql' => 'show-table-status.html', 'pgsql' => 'catalog-pg-class.html#CATALOG-PG-CLASS', 'oracle' => 'REFRN20286')), "select", lang('Select data')); + if (support("comment")) { + $columns["Comment"] = array(lang('Comment') . doc_link(array('sql' => 'show-table-status.html', 'pgsql' => 'functions-info.html#FUNCTIONS-INFO-COMMENT-TABLE'))); + } + foreach ($columns as $column) { + echo "$column[0]"; + } echo "\n"; $tables = 0; @@ -101,26 +114,15 @@ if (adminer()->homepage()) { echo '' . (support("view") ? "$title" : $title); echo '?'; } else { - foreach ( - array( - "Engine" => array(), - "Collation" => array(), - "Data_length" => array("create", lang('Alter table')), - "Index_length" => array("indexes", lang('Alter indexes')), - "Data_free" => array("edit", lang('New item')), - "Auto_increment" => array("auto_increment=1&create", lang('Alter table')), - "Rows" => array("select", lang('Select data')), - ) as $key => $link - ) { + foreach ($columns as $key => $column) { $id = " id='$key-" . h($name) . "'"; - echo ($link ? "" . (support("table") || $key == "Rows" || (support("indexes") && $key != "Data_length") - ? "?" - : "?" - ) : ""); + echo ($column[1] + ? "?" + : "" + ); } $tables++; } - echo (support("comment") ? "" : ""); echo "\n"; } @@ -128,7 +130,7 @@ if (adminer()->homepage()) { echo "" . h(JUSH == "sql" ? get_val("SELECT @@default_storage_engine") : ""); echo "" . h(db_collation(DB, collations())); foreach (array("Data_length", "Index_length", "Data_free") as $key) { - echo ""; + echo ($columns[$key] ? "" : ""); } echo "\n"; @@ -173,7 +175,7 @@ if (adminer()->homepage()) { echo script("tableCheck();"); } - echo "
(" . implode(", ", array_map('Adminer\h', $index["columns"])) . ") AGAINST"; echo " "; echo script("qsl('input').oninput = selectFieldChange;", ""); - echo checkbox("boolean[$i]", 1, isset($_GET["boolean"][$i]), "BOOL"); + echo (JUSH == 'sql' ? checkbox("boolean[$i]", 1, isset($_GET["boolean"][$i]), "BOOL") : ''); echo "
\n"; } } @@ -1020,7 +1022,7 @@ class Adminer { $actions[] = "" . lang('Export') . ""; } $in_db = $_GET["ns"] !== "" && !$missing && DB != ""; - if ($in_db) { + if ($in_db && function_exists('Adminer\alter_table')) { $actions[] = '" . lang('Create table') . ""; } echo ($actions ? "