Skip to content

Commit

Permalink
Save queries to history
Browse files Browse the repository at this point in the history
git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@654 7c3ca157-0c34-0410-bff1-cbf682f78f5c
  • Loading branch information
jakubvrana committed Jun 4, 2009
1 parent 622f6aa commit 10bdbed
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
6 changes: 5 additions & 1 deletion include/functions.inc.php
Expand Up @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion sql.inc.php
Expand Up @@ -67,7 +67,7 @@
?>

<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'); ?>" />
Expand Down
5 changes: 2 additions & 3 deletions todo.txt
@@ -1,14 +1,13 @@
Join repeated echo in _compile.php
Bulk database create and drop
Add whisperer to fields with foreign key
Highlight found fields
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

0 comments on commit 10bdbed

Please sign in to comment.