]> git.joonet.de Git - adminer.git/commitdiff
Tables and views
authorjakubvrana <jakubvrana@7c3ca157-0c34-0410-bff1-cbf682f78f5c>
Thu, 25 Sep 2008 14:27:19 +0000 (14:27 +0000)
committerjakubvrana <jakubvrana@7c3ca157-0c34-0410-bff1-cbf682f78f5c>
Thu, 25 Sep 2008 14:27:19 +0000 (14:27 +0000)
git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@494 7c3ca157-0c34-0410-bff1-cbf682f78f5c

design.inc.php
functions.inc.php
index.php
lang/cs.inc.php
lang/en.inc.php

index 6fcd1ada45dc97c173785b876124bd7a1da2fffc..b73784fc738a3ffc40ff474ef850eea983910650 100644 (file)
@@ -9,7 +9,7 @@ function page_header($title, $error = "", $breadcrumb = array(), $title2 = "") {
 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 <meta http-equiv="Content-Script-Type" content="text/javascript" />
 <meta name="robots" content="noindex" />
-<title><?php echo $title . (strlen($title2) ? ": " . htmlspecialchars($title2) : "") . " - " . lang('phpMinAdmin') . " 1.8.1-dev"; ?></title>
+<title><?php echo $title . (strlen($title2) ? ": " . htmlspecialchars($title2) : "") . " - " . lang('phpMinAdmin') . " 1.9.0-dev"; ?></title>
 <link rel="shortcut icon" type="image/x-icon" href="favicon.ico" />
 <link rel="stylesheet" type="text/css" href="default.css" /><?php // Ondrej Valka, http://valka.info ?>
 </head>
@@ -99,8 +99,8 @@ function page_footer($missing = false) {
                        } else {
                                echo "<p>\n";
                                while ($row = $result->fetch_assoc()) {
-                                       echo '<a href="' . htmlspecialchars($SELF) . 'select=' . urlencode($row["Name"]) . '" title="' . ($row["Engine"] == "MyISAM" ? lang('%d row(s)', $row["Rows"]) : lang('around %d row(s)', $row["Rows"])) . '">' . lang('select') . '</a> ';
-                                       echo '<a href="' . htmlspecialchars($SELF) . (isset($row["Engine"]) ? 'table' : 'view') . '=' . urlencode($row["Name"]) . '" title="' . (isset($row["Engine"]) ? htmlspecialchars($row["Engine"]) : lang('View')) . '">' . htmlspecialchars($row["Name"]) . "</a><br />\n";
+                                       echo '<a href="' . htmlspecialchars($SELF) . 'select=' . urlencode($row["Name"]) . '">' . lang('select') . '</a> ';
+                                       echo '<a href="' . htmlspecialchars($SELF) . (isset($row["Rows"]) ? 'table' : 'view') . '=' . urlencode($row["Name"]) . '">' . htmlspecialchars($row["Name"]) . "</a><br />\n";
                                }
                                echo "</p>\n";
                        }
index 18de4993336cc89ebb3d67a6630dbf70daa108be..de714cd8aa92b73e7efb862f48f779565527e6eb 100644 (file)
@@ -216,7 +216,7 @@ function queries($query = null) {
        global $mysql;
        static $queries = array();
        if (!isset($query)) {
-               return implode("\n", $queries);
+               return implode(";\n", $queries);
        }
        $queries[] = $query;
        return $mysql->query($query);
index 7f9117add2ac32d4345840cf292154f17c9ca805..5810eabbe0208f35135f5701d3175264331daeb9 100644 (file)
--- a/index.php
+++ b/index.php
@@ -118,10 +118,49 @@ if (isset($_GET["download"])) {
                } elseif (isset($_GET["select"])) {
                        include "./select.inc.php";
                } else {
-                       unset($_SESSION["tokens"][$_GET["server"]][$_SERVER["REQUEST_URI"]]);
+                       if ($_POST["tables"] && !$error) {
+                               $result = true;
+                               $message = "";
+                               if (isset($_POST["truncate"])) {
+                                       foreach ($_POST["tables"] as $table) {
+                                               if (!queries("TRUNCATE " . idf_escape($table))) {
+                                                       $result = false;
+                                                       break;
+                                               }
+                                       }
+                                       $message = lang('Tables have been truncated.');
+                               } else {
+                                       $result = queries((isset($_POST["optimize"]) ? "OPTIMIZE" : (isset($_POST["check"]) ? "CHECK" : (isset($_POST["repair"]) ? "REPAIR" : (isset($_POST["drop"]) ? "DROP" : "ANALYZE")))) . " TABLE " . implode(", ", array_map('idf_escape', $_POST["tables"])));
+                                       if ($result) {
+                                               while ($row = $result->fetch_assoc()) {
+                                                       $message .= htmlspecialchars("$row[Table]: $row[Msg_text]") . "<br />";
+                                               }
+                                       }
+                               }
+                               query_redirect(queries(), substr($SELF, 0, -1), $message, $result, false, !$result);
+                       }
+                       
                        page_header(lang('Database') . ": " . htmlspecialchars($_GET["db"]), $error, false);
                        echo '<p><a href="' . htmlspecialchars($SELF) . 'database=">' . lang('Alter database') . "</a></p>\n";
                        echo '<p><a href="' . htmlspecialchars($SELF) . 'schema=">' . lang('Database schema') . "</a></p>\n";
+                       
+                       echo "<h3>" . lang('Tables and views') . "</h3>\n";
+                       $result = $mysql->query("SHOW TABLE STATUS");
+                       if (!$result->num_rows) {
+                               echo "<p class='message'>" . lang('No tables.') . "</p>\n";
+                       } else {
+                               echo "<form action='' method='post'>\n";
+                               echo "<table border='1' cellspacing='0' cellpadding='2'>\n";
+                               echo '<thead><tr><th>' . lang('Table') . '</th><td><label><input type="checkbox" onclick="var elems = this.form.elements; for (var i=0; elems.length > i; i++) if (elems[i].name == \'tables[]\') elems[i].checked = this.checked;" /> Engine</label></td><td>' . lang('Data Length') . "</td><td>" . lang('Index Length') . "</td><td>" . lang('Data Free') . "</td><td>" . lang('Collation') . "</td><td>" . lang('Auto Increment') . "</td><td>Rows</td></tr></tdead>\n";
+                               while ($row = $result->fetch_assoc()) {
+                                       echo '<tr><th><a href="' . htmlspecialchars($SELF) . (isset($row["Rows"]) ? 'table' : 'view') . '=' . urlencode($row["Name"]) . '">' . htmlspecialchars($row["Name"]) . "</a></th>" . (isset($row["Rows"]) ? '<td><label><input type="checkbox" name="tables[]" value="' . htmlspecialchars($row["Name"]) . '" /> ' . $row["Engine"] . "</label></td><td>$row[Data_length]</td><td>$row[Index_length]</td><td>$row[Data_free]</td><td>$row[Collation]</td><td>$row[Auto_increment]</td><td>" . $mysql->result($mysql->query("SELECT COUNT(*) FROM " . idf_escape($row["Name"]))) : '<td colspan="7">' . lang('View')) . "</td></tr>\n";
+                               }
+                               echo "</table>\n";
+                               echo "<p><input type='hidden' name='token' value='$token' /><input type='submit' value='" . lang('Analyze') . "' /> <input type='submit' name='optimize' value='" . lang('Optimize') . "' /> <input type='submit' name='check' value='" . lang('Check') . "' /> <input type='submit' name='repair' value='" . lang('Repair') . "' /> <input type='submit' name='truncate' value='" . lang('Truncate') . "' onclick=\"return confirm('" . lang('Are you sure?') . "');\" /> <input type='submit' name='drop' value='" . lang('Drop') . "' onclick=\"return confirm('" . lang('Are you sure?') . "');\" /></p>\n";
+                               echo "</form>\n";
+                       }
+                       $result->free();
+                       
                        if ($mysql->server_info >= 5) {
                                echo '<p><a href="' . htmlspecialchars($SELF) . 'createv=">' . lang('Create view') . "</a></p>\n";
                                echo "<h3>" . lang('Routines') . "</h3>\n";
@@ -140,6 +179,7 @@ if (isset($_GET["download"])) {
                                $result->free();
                                echo '<p><a href="' . htmlspecialchars($SELF) . 'procedure=">' . lang('Create procedure') . '</a> <a href="' . htmlspecialchars($SELF) . 'function=">' . lang('Create function') . "</a></p>\n";
                        }
+                       
                        if ($mysql->server_info >= 5.1) {
                                echo "<h3>" . lang('Events') . "</h3>\n";
                                $result = $mysql->query("SHOW EVENTS");
index 0c8332d49986503c7c40236d97ae7cb2b53b8b55..98869b14bab4965787cad8e795acddead9772e66 100644 (file)
@@ -136,7 +136,6 @@ $translations = array(
        'Event' => 'Událost',
        'MySQL version: %s through PHP extension %s' => 'Verze MySQL: %s přes PHP extenzi %s',
        '%d row(s)' => array('%d řádek', '%d řádky', '%d řádků'),
-       'around %d row(s)' => array('přibližně %d řádek', 'přibližně %d řádky', 'přibližně %d řádků'),
        'ON UPDATE CURRENT_TIMESTAMP' => 'Při změně aktuální čas',
        'Remove' => 'Odebrat',
        'Are you sure?' => 'Opravdu?',
@@ -187,4 +186,15 @@ $translations = array(
        'End' => 'Konec',
        'Status' => 'Stav',
        'On completion preserve' => 'Po dokončení zachovat',
+       'Tables and views' => 'Tabulky a pohledy',
+       'Data Length' => 'Velikost dat',
+       'Index Length' => 'Velikost indexů',
+       'Data Free' => 'Volné místo',
+       'Collation' => 'Porovnávání',
+       'Analyze' => 'Analyzovat',
+       'Optimize' => 'Optimalizovat',
+       'Check' => 'Zkontrolovat',
+       'Repair' => 'Opravit',
+       'Truncate' => 'Promazat',
+       'Tables have been truncated.' => 'Tabulky byly promazány.',
 );
index 853d50f213ebe80acf1f4a2d4ec7bfc47f1baa24..4de590aee069d1c5650921e6887b0cbe8f2a082b 100644 (file)
@@ -5,6 +5,5 @@ $translations = array(
        'Routine has been called, %d row(s) affected.' => array('Routine has been called, %d row affected.', 'Routine has been called, %d rows affected.'),
        '%d process(es) has been killed.' => array('%d process has been killed.', '%d processes have been killed.'),
        '%d row(s)' => array('%d row', '%d rows'),
-       'around %d row(s)' => array('around %d row', 'around %d rows'),
        '%d item(s) have been deleted.' => array('%d item has been deleted.', '%d items have been deleted.'),
 );