]> git.joonet.de Git - adminer.git/commitdiff
Save queries to history
authorjakubvrana <jakubvrana@7c3ca157-0c34-0410-bff1-cbf682f78f5c>
Thu, 4 Jun 2009 14:00:23 +0000 (14:00 +0000)
committerjakubvrana <jakubvrana@7c3ca157-0c34-0410-bff1-cbf682f78f5c>
Thu, 4 Jun 2009 14:00:23 +0000 (14:00 +0000)
git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@654 7c3ca157-0c34-0410-bff1-cbf682f78f5c

include/functions.inc.php
sql.inc.php
todo.txt

index ada6b22cf3a5d96812827da24c2911b1b7624356..5f450ab7efb96884d771569e06ce69637f8f370b 100644 (file)
@@ -94,7 +94,11 @@ function redirect($location, $message = null) {
 function query_redirect($query, $location, $message, $redirect = true, $execute = true, $failed = false) {
        global $dbh, $error, $SELF;
        $id = "sql-" . count($_SESSION["messages"]);
-       $sql = ($query ? " <a href='#$id' onclick=\"return !toggle('$id');\">" . lang('SQL command') . "</a><span id='$id' class='hidden'><br /><code class='jush-sql'>" . htmlspecialchars($query) . '</code> <a href="' . htmlspecialchars($SELF) . 'sql=' . urlencode($query) . '">' . lang('Edit') . '</a></span>' : "");
+       $sql = "";
+       if ($query) {
+               $sql = " <a href='#$id' onclick=\"return !toggle('$id');\">" . lang('SQL command') . "</a><span id='$id' class='hidden'><br /><code class='jush-sql'>" . htmlspecialchars($query) . '</code> <a href="' . htmlspecialchars($SELF) . 'sql=&amp;history=' . count($_SESSION["history"]) . '">' . lang('Edit') . '</a></span>';
+               $_SESSION["history"][] = $query;
+       }
        if ($execute) {
                $failed = !$dbh->query($query);
        }
index 452108bf4661bb95fbf14e4fc8f50e624fab317d..74454ffc0451f6a939cf7c9d4ecaceb8209c8aeb 100644 (file)
@@ -67,7 +67,7 @@ if (!$error && $_POST) {
 ?>
 
 <form action="" method="post">
-<p><textarea name="query" rows="20" cols="80" style="width: 98%;"><?php echo htmlspecialchars($_POST ? $_POST["query"] : $_GET["sql"]); ?></textarea></p>
+<p><textarea name="query" rows="20" cols="80" style="width: 98%;"><?php echo htmlspecialchars($_POST ? $_POST["query"] : (strlen($_GET["history"]) ? $_SESSION["history"][$_GET["history"]] : $_GET["sql"])); ?></textarea></p>
 <p>
 <input type="hidden" name="token" value="<?php echo $token; ?>" />
 <input type="submit" value="<?php echo lang('Execute'); ?>" />
index 018790e19c460283b497380282d6b79b2740d902..451269706e39b637e6803a9541f98600d065e1e4 100644 (file)
--- a/todo.txt
+++ b/todo.txt
@@ -1,4 +1,3 @@
-Join repeated echo in _compile.php
 Bulk database create and drop
 Add whisperer to fields with foreign key
 Highlight found fields
@@ -6,9 +5,9 @@ MySQL 5 BIT data type
 Transactions in export
 Compress export and import
 Create view and routine options
-SQL queries history - utilize in edit link in .message and .error
+Visualize SQL queries history
 Function to fix database encoding - http://php.vrana.cz/prevod-kodovani-mysql.php
 ? Save token also to cookie - for session expiration and login in other window
 ? Save uploaded files after error to session variable instead of hidden field
-? Aliasing of built-in functions can save 7 KB, substitution of $_GET and friends can save 2 KB, remove of base64_decode() + using chars 127-255 in minification can save 1 KB, JS shrink can save 1 KB
+? Aliasing of built-in functions can save 7 KB, substitution of $_GET and friends can save 2 KB, remove of base64_decode() + using chars 127-255 in minification can save 1 KB, JS packer can save 1 KB
 ? AJAX editing - select page has all data to display edit form