mirror of
https://github.com/vrana/adminer.git
synced 2025-08-06 06:37:33 +02:00
Add plugin AdminerEditorViews (fix #905)
This commit is contained in:
@@ -20,7 +20,7 @@ if ($adminer->homepage()) {
|
|||||||
|
|
||||||
foreach (table_status() as $table => $row) {
|
foreach (table_status() as $table => $row) {
|
||||||
$name = $adminer->tableName($row);
|
$name = $adminer->tableName($row);
|
||||||
if (isset($row["Engine"]) && $name != "") {
|
if ($name != "") {
|
||||||
echo '<tr><td>' . checkbox("tables[]", $table, in_array($table, (array) $_POST["tables"], true));
|
echo '<tr><td>' . checkbox("tables[]", $table, in_array($table, (array) $_POST["tables"], true));
|
||||||
echo "<th><a href='" . h(ME) . 'select=' . urlencode($table) . "'>$name</a>";
|
echo "<th><a href='" . h(ME) . 'select=' . urlencode($table) . "'>$name</a>";
|
||||||
$val = format_number($row["Rows"]);
|
$val = format_number($row["Rows"]);
|
||||||
|
@@ -90,7 +90,10 @@ class Adminer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function tableName($tableStatus) {
|
function tableName($tableStatus) {
|
||||||
return h($tableStatus["Comment"] != "" ? $tableStatus["Comment"] : $tableStatus["Name"]);
|
return h(isset($tableStatus["Engine"])
|
||||||
|
? ($tableStatus["Comment"] != "" ? $tableStatus["Comment"] : $tableStatus["Name"])
|
||||||
|
: "" // ignore views
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function fieldName($field, $order = 0) {
|
function fieldName($field, $order = 0) {
|
||||||
@@ -632,7 +635,7 @@ qsl('div').onclick = whisperClick;", "")
|
|||||||
foreach ($tables as $row) {
|
foreach ($tables as $row) {
|
||||||
echo '<li>';
|
echo '<li>';
|
||||||
$name = $this->tableName($row);
|
$name = $this->tableName($row);
|
||||||
if (isset($row["Engine"]) && $name != "") { // ignore views and tables without name
|
if ($name != "") { // ignore tables without name
|
||||||
echo "<a href='" . h(ME) . 'select=' . urlencode($row["Name"]) . "'"
|
echo "<a href='" . h(ME) . 'select=' . urlencode($row["Name"]) . "'"
|
||||||
. bold($_GET["select"] == $row["Name"] || $_GET["edit"] == $row["Name"], "select")
|
. bold($_GET["select"] == $row["Name"] || $_GET["edit"] == $row["Name"], "select")
|
||||||
. " title='" . lang('Select data') . "'>$name</a>\n"
|
. " title='" . lang('Select data') . "'>$name</a>\n"
|
||||||
|
14
plugins/editor-views.php
Normal file
14
plugins/editor-views.php
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/** Display views in Adminer Editor
|
||||||
|
* @link https://www.adminer.org/plugins/#use
|
||||||
|
* @author Jakub Vrana, https://www.vrana.cz/
|
||||||
|
* @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 AdminerEditorViews {
|
||||||
|
|
||||||
|
function tableName($tableStatus) {
|
||||||
|
return Adminer\h($tableStatus["Comment"] != "" ? $tableStatus["Comment"] : $tableStatus["Name"]);
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user