diff --git a/adminer/db.inc.php b/adminer/db.inc.php index a9fcfa69..88de70ec 100644 --- a/adminer/db.inc.php +++ b/adminer/db.inc.php @@ -1,7 +1,7 @@ 1 && ($_POST["drop"] || $_POST["truncate"])) { @@ -47,6 +47,12 @@ if (!$table_status) { echo "

" . lang('No tables.') . "\n"; } else { echo "

\n"; + echo "

\n"; + if ($_POST["search"] && $_POST["query"] != "") { + $_GET["where"][0]["op"] = "LIKE"; + $_GET["where"][0]["val"] = "%$_POST[query]%"; + search_tables(); + } echo "\n"; echo '\n"; $sums = array(); diff --git a/adminer/dump.inc.php b/adminer/dump.inc.php index c2440eec..143fb20c 100644 --- a/adminer/dump.inc.php +++ b/adminer/dump.inc.php @@ -147,7 +147,7 @@ if ($connection->server_info >= 5) { $db_style[] = 'CREATE+ALTER'; $table_style[] = 'CREATE+ALTER'; } -echo "
' . lang('Table') . '' . lang('Engine') . '' . lang('Collation') . '' . lang('Data Length') . '' . lang('Index Length') . '' . lang('Data Free') . '' . lang('Auto Increment') . '' . lang('Rows') . '' . lang('Comment') . "
" . lang('Output') . "" . $adminer->dumpOutput(0) . "\n"; // token is not needed but checked in bootstrap for all POST data +echo "
" . lang('Output') . "" . $adminer->dumpOutput(0) . "\n"; // token is not needed but checked in bootstrap for all POST data //! read from cookie echo "
" . lang('Format') . "" . $adminer->dumpFormat(0) . "\n"; echo "
" . lang('Database') . "" . html_select('db_style', $db_style, (DB != "" ? '' : 'CREATE')); if ($connection->server_info >= 5) { diff --git a/adminer/include/functions.inc.php b/adminer/include/functions.inc.php index 888d46e4..e370f087 100644 --- a/adminer/include/functions.inc.php +++ b/adminer/include/functions.inc.php @@ -479,6 +479,30 @@ function process_input($field) { } } +/** 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 "
    \n"; + $found = true; + } + echo "
  • " . h($name) . "\n"; + } + } + } + echo ($found ? "
" : "

" . lang('No tables.')) . "\n"; +} + /** Print CSV row * @param array * @return null diff --git a/changes.txt b/changes.txt index 9efb18f6..c1777779 100644 --- a/changes.txt +++ b/changes.txt @@ -1,6 +1,6 @@ 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) diff --git a/editor/db.inc.php b/editor/db.inc.php index 2385fb75..ce13ce9b 100644 --- a/editor/db.inc.php +++ b/editor/db.inc.php @@ -4,24 +4,10 @@ page_header(lang('Server'), "", null); ?>

-"> +"> $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 "

    \n"; - $found = true; - } - echo "
  • " . h($name) . "\n"; - } - } - } - echo ($found ? "
" : "

" . lang('No tables.')) . "\n"; +if ($_GET["where"][0]["val"] != "") { + search_tables(); } diff --git a/todo.txt b/todo.txt index 348b0e63..706e8eb8 100644 --- a/todo.txt +++ b/todo.txt @@ -1,7 +1,6 @@ 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 @@ -9,6 +8,7 @@ Variables editation, especially timezone 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