From 29fd200ef5038b8ba66eafd7033698cc1df3c859 Mon Sep 17 00:00:00 2001 From: Peter Knut Date: Fri, 4 Oct 2024 00:26:04 +0200 Subject: [PATCH] Unify displaying of 'New item' action based on privileges --- adminer/table.inc.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/adminer/table.inc.php b/adminer/table.inc.php index 6c63f970..10d2b5c4 100644 --- a/adminer/table.inc.php +++ b/adminer/table.inc.php @@ -7,9 +7,19 @@ if (!$fields) { $table_status = table_status1($TABLE, true); $name = $adminer->tableName($table_status); +$rights = []; +foreach ($fields as $key => $field) { + $rights += $field["privileges"]; +} + page_header(($fields && is_view($table_status) ? $table_status['Engine'] == 'materialized view' ? lang('Materialized view') : lang('View') : lang('Table')) . ": " . ($name != "" ? $name : h($TABLE)), $error); -$adminer->selectLinks($table_status); +$set = null; +if (isset($rights["insert"]) || !support("table")) { + $set = ""; +} +$adminer->selectLinks($table_status, $set); + $comment = $table_status["Comment"]; if ($comment != "") { echo "

" . lang('Comment') . ": " . h($comment) . "\n"; @@ -28,7 +38,7 @@ if (!is_view($table_status)) { } echo '

" . lang('Foreign keys') . "

\n"; $foreign_keys = foreign_keys($TABLE);