Exemple #1
0
 /** Get list of schemas
  * @return array
  */
 function schemas()
 {
     return schemas();
 }
             }
         }
         echo support("comment") ? "<td id='Comment-" . h($name) . "'>&nbsp;" : "";
     }
     echo "<tr><td>&nbsp;<th>" . lang('%d in total', count($tables_list));
     echo "<td>" . nbsp($jush == "sql" ? $connection->result("SELECT @@storage_engine") : "");
     echo "<td>" . nbsp(db_collation(DB, collations()));
     foreach (array("Data_length", "Index_length", "Data_free") as $key) {
         echo "<td align='right' id='sum-{$key}'>&nbsp;";
     }
     echo "</table>\n";
     echo "<script type='text/javascript'>tableCheck();</script>\n";
     if (!information_schema(DB)) {
         echo "<p>" . ($jush == "sql" ? "<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') . "'" . confirm("formChecked(this, /tables/)") . "> <input type='submit' name='drop' value='" . lang('Drop') . "'" . confirm("formChecked(this, /tables|views/)", 1) . ">\n";
         // 1 - eventStop
         $databases = support("scheme") ? schemas() : get_databases();
         if (count($databases) != 1 && $jush != "sqlite") {
             $db = isset($_POST["target"]) ? $_POST["target"] : (support("scheme") ? $_GET["ns"] : DB);
             echo "<p>" . lang('Move to other database') . ": ";
             echo $databases ? html_select("target", $databases, $db) : '<input name="target" value="' . h($db) . '">';
             echo " <input type='submit' name='move' value='" . lang('Move') . "' onclick='eventStop(event);'>";
             echo support("copy") ? " <input type='submit' name='copy' value='" . lang('Copy') . "' onclick='eventStop(event);'>" : "";
             echo "\n";
         }
         echo "<input type='hidden' name='token' value='{$token}'>\n";
     }
     echo "</form>\n";
 }
 echo '<p><a href="' . h(ME) . 'create=">' . lang('Create table') . "</a>\n";
 if (support("view")) {
     echo '<a href="' . h(ME) . 'view=">' . lang('Create view') . "</a>\n";
Exemple #3
0
                 echo $link ? "<td align='right'><a href='" . h(ME . "{$link['0']}=") . urlencode($name) . "' id='{$key}-" . h($name) . "' title='{$link['1']}'>?</a>" : "<td id='{$key}-" . h($name) . "'>&nbsp;";
             }
         }
         echo support("comment") ? "<td id='Comment-" . h($name) . "'>&nbsp;" : "";
     }
     echo "<tr><td>&nbsp;<th>" . lang('%d in total', count($tables_list));
     echo "<td>" . nbsp($jush == "sql" ? $connection->result("SELECT @@storage_engine") : "");
     echo "<td>" . nbsp(db_collation(DB, collations()));
     foreach (array("Data_length", "Index_length", "Data_free") as $key) {
         echo "<td align='right' id='sum-{$key}'>&nbsp;";
     }
     echo "</table>\n";
     echo "<script type='text/javascript'>tableCheck();</script>\n";
     if (!information_schema(DB)) {
         echo "<p>" . (ereg('^(sql|sqlite|pgsql)$', $jush) ? ($jush != "sqlite" ? "<input type='submit' value='" . lang('Analyze') . "'> " : "") . "<input type='submit' name='optimize' value='" . lang('Optimize') . "'> " : "") . ($jush == "sql" ? "<input type='submit' name='check' value='" . lang('Check') . "'> <input type='submit' name='repair' value='" . lang('Repair') . "'> " : "") . "<input type='submit' name='truncate' value='" . lang('Truncate') . "'" . confirm("formChecked(this, /tables/)") . "> <input type='submit' name='drop' value='" . lang('Drop') . "'" . confirm("formChecked(this, /tables|views/)") . ">\n";
         $databases = support("scheme") ? schemas() : $adminer->databases();
         if (count($databases) != 1 && $jush != "sqlite") {
             $db = isset($_POST["target"]) ? $_POST["target"] : (support("scheme") ? $_GET["ns"] : DB);
             echo "<p>" . lang('Move to other database') . ": ";
             echo $databases ? html_select("target", $databases, $db) : '<input name="target" value="' . h($db) . '">';
             echo " <input type='submit' name='move' value='" . lang('Move') . "'>";
             echo support("copy") ? " <input type='submit' name='copy' value='" . lang('Copy') . "'>" : "";
             echo "\n";
         }
         echo "<input type='hidden' name='token' value='{$token}'>\n";
     }
     echo "</form>\n";
 }
 echo '<p class="nav"><a href="' . h(ME) . 'create=">' . lang('Create table') . "</a>\n";
 if (support("view")) {
     echo '<a href="' . h(ME) . 'view=">' . lang('Create view') . "</a>\n";
    /** Prints navigation after Adminer title
     * @param string can be "auth" if there is no database connection, "db" if there is no database selected, "ns" with invalid schema
     * @return null
     */
    function navigation($missing)
    {
        global $VERSION, $connection, $token, $jush, $drivers;
        ?>
<h1>
<?php 
        echo $this->name();
        ?>
 <span class="version"><?php 
        echo $VERSION;
        ?>
</span>
<a href="http://www.adminer.org/#download" id="version"><?php 
        echo version_compare($VERSION, $_COOKIE["adminer_version"]) < 0 ? h($_COOKIE["adminer_version"]) : "";
        ?>
</a>
</h1>
<?php 
        if ($missing == "auth") {
            $first = true;
            foreach ((array) $_SESSION["pwds"] as $driver => $servers) {
                foreach ($servers as $server => $usernames) {
                    foreach ($usernames as $username => $password) {
                        if (isset($password)) {
                            if ($first) {
                                echo "<p onclick='eventStop(event);'>\n";
                                $first = false;
                            }
                            echo "<a href='" . h(auth_url($driver, $server, $username)) . "'>({$drivers[$driver]}) " . h($username . ($server != "" ? "@{$server}" : "")) . "</a><br>\n";
                        }
                    }
                }
            }
        } else {
            $databases = get_databases();
            ?>
<form action="" method="post">
<p class="logout">
<?php 
            if (DB == "" || !$missing) {
                echo "<a href='" . h(ME) . "sql='" . bold(isset($_GET["sql"])) . ">" . lang('SQL command') . "</a>\n";
                if (support("dump")) {
                    echo "<a href='" . h(ME) . "dump=" . urlencode(isset($_GET["table"]) ? $_GET["table"] : $_GET["select"]) . "' id='dump'" . bold(isset($_GET["dump"])) . ">" . lang('Dump') . "</a>\n";
                }
            }
            ?>
<input type="submit" name="logout" value="<?php 
            echo lang('Logout');
            ?>
" onclick="eventStop(event);">
<input type="hidden" name="token" value="<?php 
            echo $token;
            ?>
">
</p>
</form>
<form action="">
<p>
<?php 
            hidden_fields_get();
            echo $databases ? html_select("db", array("" => "(" . lang('database') . ")") + $databases, DB, "this.form.submit();") : '<input name="db" value="' . h(DB) . '">';
            ?>
<input type="submit" value="<?php 
            echo lang('Use');
            ?>
"<?php 
            echo $databases ? " class='hidden'" : "";
            ?>
 onclick="eventStop(event);">
<?php 
            if ($missing != "db" && DB != "" && $connection->select_db(DB)) {
                if (support("scheme")) {
                    echo "<br>" . html_select("ns", array("" => "(" . lang('schema') . ")") + schemas(), $_GET["ns"], "this.form.submit();");
                    if ($_GET["ns"] != "") {
                        set_schema($_GET["ns"]);
                    }
                }
                if ($_GET["ns"] !== "" && !$missing) {
                    echo '<p><a href="' . h(ME) . 'create="' . bold($_GET["create"] === "") . ">" . lang('Create new table') . "</a>\n";
                    $tables = tables_list();
                    if (!$tables) {
                        echo "<p class='message'>" . lang('No tables.') . "\n";
                    } else {
                        $this->tablesPrint($tables);
                        $links = array();
                        foreach ($tables as $table => $type) {
                            $links[] = preg_quote($table, '/');
                        }
                        echo "<script type='text/javascript'>\n";
                        echo "var jushLinks = { {$jush}: [ '" . js_adminer_escape(ME) . "table=\$&', /\\b(" . implode("|", $links) . ")\\b/g ] };\n";
                        foreach (array("bac", "bra", "sqlite_quo", "mssql_bra") as $val) {
                            echo "jushLinks.{$val} = jushLinks.{$jush};\n";
                        }
                        echo "</script>\n";
                    }
                }
            }
            echo isset($_GET["sql"]) ? '<input type="hidden" name="sql" value="">' : (isset($_GET["schema"]) ? '<input type="hidden" name="schema" value="">' : (isset($_GET["dump"]) ? '<input type="hidden" name="dump" value="">' : ""));
            echo "</p></form>\n";
        }
    }