<?php
$tables_views = array_merge((array) $_POST["tables"], (array) $_POST["views"]);
-if ($tables_views && !$error) {
+if ($tables_views && !$error && !$_POST["search"]) {
$result = true;
$message = "";
if (count($_POST["tables"]) > 1 && ($_POST["drop"] || $_POST["truncate"])) {
echo "<p class='message'>" . lang('No tables.') . "\n";
} else {
echo "<form action='' method='post'>\n";
+ echo "<p><input name='query' value='" . h($_POST["query"]) . "'> <input type='submit' name='search' value='" . lang('Search') . "'>\n";
+ if ($_POST["search"] && $_POST["query"] != "") {
+ $_GET["where"][0]["op"] = "LIKE";
+ $_GET["where"][0]["val"] = "%$_POST[query]%";
+ search_tables();
+ }
echo "<table cellspacing='0' class='nowrap' onclick='tableClick(event);'>\n";
echo '<thead><tr class="wrap"><td><input id="check-all" type="checkbox" onclick="formCheck(this, /^(tables|views)\[/);"><th>' . lang('Table') . '<td>' . lang('Engine') . '<td>' . lang('Collation') . '<td>' . lang('Data Length') . '<td>' . lang('Index Length') . '<td>' . lang('Data Free') . '<td>' . lang('Auto Increment') . '<td>' . lang('Rows') . '<td>' . lang('Comment') . "</thead>\n";
$sums = array();
$db_style[] = 'CREATE+ALTER';
$table_style[] = 'CREATE+ALTER';
}
-echo "<tr><th>" . lang('Output') . "<td><input type='hidden' name='token' value='$token'>" . $adminer->dumpOutput(0) . "\n"; // token is not needed but checked in bootstrap for all POST data
+echo "<tr><th>" . lang('Output') . "<td><input type='hidden' name='token' value='$token'>" . $adminer->dumpOutput(0) . "\n"; // token is not needed but checked in bootstrap for all POST data //! read from cookie
echo "<tr><th>" . lang('Format') . "<td>" . $adminer->dumpFormat(0) . "\n";
echo "<tr><th>" . lang('Database') . "<td>" . html_select('db_style', $db_style, (DB != "" ? '' : 'CREATE'));
if ($connection->server_info >= 5) {
}
}
+/** Print results of search in all tables
+* @uses $_GET["where"][0]
+* @uses $_POST["tables"]
+* @return null
+*/
+function search_tables() {
+ global $adminer, $connection;
+ $found = false;
+ foreach (table_status() as $table => $table_status) {
+ $name = $adminer->tableName($table_status);
+ if (isset($table_status["Engine"]) && $name != "" && (!$_POST["tables"] || in_array($table, $_POST["tables"]))) {
+ $result = $connection->query($q = "SELECT 1 FROM " . idf_escape($table) . " WHERE " . implode(" AND ", $adminer->selectSearchProcess(fields($table), array())) . " LIMIT 1");
+ if ($result->num_rows) {
+ if (!$found) {
+ echo "<ul>\n";
+ $found = true;
+ }
+ echo "<li><a href='" . h(ME . "select=" . urlencode($table) . "&where[0][op]=" . urlencode($_GET["where"][0]["op"]) . "&where[0][val]=" . urlencode($_GET["where"][0]["val"])) . "'>" . h($name) . "</a>\n";
+ }
+ }
+ }
+ echo ($found ? "</ul>" : "<p class='message'>" . lang('No tables.')) . "\n";
+}
+
/** Print CSV row
* @param array
* @return null
Adminer 2.3.0-dev:
Support for permanent login (customization required)
-Search in all tables (Editor)
+Search in all tables
Show status variables
Print sums in tables overview
Add Delete button to Edit page (regression from 2.0.0)
?>
<form action=""><p>
<?php echo SID_FORM; ?>
-<input name="where[][val]" value="<?php echo h($_GET["where"][0]["val"]); ?>">
+<input name="where[0][val]" value="<?php echo h($_GET["where"][0]["val"]); ?>">
<input type="submit" value="<?php echo lang('Search'); ?>" />
</form>
<?php
-if ($_GET["where"]) {
- $found = false;
- foreach (table_status() as $table => $table_status) {
- $name = $adminer->tableName($table_status);
- if (isset($table_status["Engine"]) && $name != "") {
- $result = $connection->query("SELECT 1 FROM " . idf_escape($table) . " WHERE " . implode(" AND ", $adminer->selectSearchProcess(fields($table), array())) . " LIMIT 1");
- if ($result->num_rows) {
- if (!$found) {
- echo "<ul>\n";
- $found = true;
- }
- echo "<li><a href='" . h(ME . "select=" . urlencode($table) . "&where[][val]=" . urlencode($_GET["where"][0]["val"])) . "'>" . h($name) . "</a>\n";
- }
- }
- }
- echo ($found ? "</ul>" : "<p class='message'>" . lang('No tables.')) . "\n";
+if ($_GET["where"][0]["val"] != "") {
+ search_tables();
}
MySQL 5 BIT data type
Transactions in export
Create view and routine options
-Function to fix database encoding - http://php.vrana.cz/prevod-kodovani-mysql.php
Highlight SQL textarea - may use external CodePress
Mass editation of individual rows
Offer enum and set items in search - whisperer
Use event $intervals + microseconds in relative date functions
Optionally check IP address
Disable spell checking in SQL textareas - spellcheck="false"
+Accept Tab in SQL textareas, Ctrl+Enter to send form
Blob download and image display in edit form (important for Editor with hidden fields in select)
Add title to Logout, edit (in select) and select (in menu) in style "hever"
? Column and table names auto-completition in SQL textarea