|
80 | 80 | echo '<thead><tr class="wrap">'; |
81 | 81 | echo '<td><input id="check-all" type="checkbox" class="jsonly">' . script("qs('#check-all').onclick = partial(formCheck, /^(tables|views)\[/);", ""); |
82 | 82 | echo '<th>' . lang('Table'); |
83 | | - echo '<td>' . lang('Engine') . doc_link(array('sql' => 'storage-engines.html')); |
84 | | - echo '<td>' . lang('Collation') . doc_link(array('sql' => 'charset-charsets.html', 'mariadb' => 'supported-character-sets-and-collations/')); |
85 | | - echo '<td>' . lang('Data Length') . doc_link(array('sql' => 'show-table-status.html', 'pgsql' => 'functions-admin.html#FUNCTIONS-ADMIN-DBOBJECT', 'oracle' => 'REFRN20286')); |
86 | | - echo '<td>' . lang('Index Length') . doc_link(array('sql' => 'show-table-status.html', 'pgsql' => 'functions-admin.html#FUNCTIONS-ADMIN-DBOBJECT')); |
87 | | - echo '<td>' . lang('Data Free') . doc_link(array('sql' => 'show-table-status.html')); |
88 | | - echo '<td>' . lang('Auto Increment') . doc_link(array('sql' => 'example-auto-increment.html', 'mariadb' => 'auto_increment/')); |
89 | | - echo '<td>' . lang('Rows') . doc_link(array('sql' => 'show-table-status.html', 'pgsql' => 'catalog-pg-class.html#CATALOG-PG-CLASS', 'oracle' => 'REFRN20286')); |
90 | | - echo (support("comment") ? '<td>' . lang('Comment') . doc_link(array('sql' => 'show-table-status.html', 'pgsql' => 'functions-info.html#FUNCTIONS-INFO-COMMENT-TABLE')) : ''); |
| 83 | + $columns = array("Engine" => array(lang('Engine') . doc_link(array('sql' => 'storage-engines.html')))); |
| 84 | + if (collations()) { |
| 85 | + $columns["Collation"] = array(lang('Collation') . doc_link(array('sql' => 'charset-charsets.html', 'mariadb' => 'supported-character-sets-and-collations/'))); |
| 86 | + } |
| 87 | + if (function_exists('Adminer\alter_table')) { |
| 88 | + $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')); |
| 89 | + } |
| 90 | + if (support('indexes')) { |
| 91 | + $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')); |
| 92 | + } |
| 93 | + $columns["Data_free"] = array(lang('Data Free') . doc_link(array('sql' => 'show-table-status.html')), "edit", lang('New item')); |
| 94 | + if (function_exists('Adminer\alter_table')) { |
| 95 | + $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')); |
| 96 | + } |
| 97 | + $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')); |
| 98 | + if (support("comment")) { |
| 99 | + $columns["Comment"] = array(lang('Comment') . doc_link(array('sql' => 'show-table-status.html', 'pgsql' => 'functions-info.html#FUNCTIONS-INFO-COMMENT-TABLE'))); |
| 100 | + } |
| 101 | + foreach ($columns as $column) { |
| 102 | + echo "<td>$column[0]"; |
| 103 | + } |
91 | 104 | echo "</thead>\n"; |
92 | 105 |
|
93 | 106 | $tables = 0; |
|
101 | 114 | echo '<td colspan="6">' . (support("view") ? "<a href='" . h(ME) . "view=" . urlencode($name) . "' title='" . lang('Alter view') . "'>$title</a>" : $title); |
102 | 115 | echo '<td align="right"><a href="' . h(ME) . "select=" . urlencode($name) . '" title="' . lang('Select data') . '">?</a>'; |
103 | 116 | } else { |
104 | | - foreach ( |
105 | | - array( |
106 | | - "Engine" => array(), |
107 | | - "Collation" => array(), |
108 | | - "Data_length" => array("create", lang('Alter table')), |
109 | | - "Index_length" => array("indexes", lang('Alter indexes')), |
110 | | - "Data_free" => array("edit", lang('New item')), |
111 | | - "Auto_increment" => array("auto_increment=1&create", lang('Alter table')), |
112 | | - "Rows" => array("select", lang('Select data')), |
113 | | - ) as $key => $link |
114 | | - ) { |
| 117 | + foreach ($columns as $key => $column) { |
115 | 118 | $id = " id='$key-" . h($name) . "'"; |
116 | | - echo ($link ? "<td align='right'>" . (support("table") || $key == "Rows" || (support("indexes") && $key != "Data_length") |
117 | | - ? "<a href='" . h(ME . "$link[0]=") . urlencode($name) . "'$id title='$link[1]'>?</a>" |
118 | | - : "<span$id>?</span>" |
119 | | - ) : "<td id='$key-" . h($name) . "'>"); |
| 119 | + echo ($column[1] |
| 120 | + ? "<td align='right'><a href='" . h(ME . "$column[1]=") . urlencode($name) . "'$id title='$column[2]'>?</a>" |
| 121 | + : "<td id='$key-" . h($name) . "'>" |
| 122 | + ); |
120 | 123 | } |
121 | 124 | $tables++; |
122 | 125 | } |
123 | | - echo (support("comment") ? "<td id='Comment-" . h($name) . "'>" : ""); |
124 | 126 | echo "\n"; |
125 | 127 | } |
126 | 128 |
|
127 | 129 | echo "<tr><td><th>" . lang('%d in total', count($tables_list)); |
128 | 130 | echo "<td>" . h(JUSH == "sql" ? get_val("SELECT @@default_storage_engine") : ""); |
129 | 131 | echo "<td>" . h(db_collation(DB, collations())); |
130 | 132 | foreach (array("Data_length", "Index_length", "Data_free") as $key) { |
131 | | - echo "<td align='right' id='sum-$key'>"; |
| 133 | + echo ($columns[$key] ? "<td align='right' id='sum-$key'>" : ""); |
132 | 134 | } |
133 | 135 | echo "\n"; |
134 | 136 |
|
|
173 | 175 | echo script("tableCheck();"); |
174 | 176 | } |
175 | 177 |
|
176 | | - echo "<p class='links'><a href='" . h(ME) . "create='>" . lang('Create table') . "</a>\n"; |
| 178 | + echo (function_exists('Adminer\alter_table') ? "<p class='links'><a href='" . h(ME) . "create='>" . lang('Create table') . "</a>\n" : ''); |
177 | 179 | echo (support("view") ? "<a href='" . h(ME) . "view='>" . lang('Create view') . "</a>\n" : ""); |
178 | 180 |
|
179 | 181 | if (support("routine")) { |
|
0 commit comments