Skip to content

Commit

Permalink
Return to referer after edit
Browse files Browse the repository at this point in the history
git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@1339 7c3ca157-0c34-0410-bff1-cbf682f78f5c
  • Loading branch information
jakubvrana committed Mar 5, 2010
1 parent c1c1b60 commit b681dfb
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 4 deletions.
3 changes: 1 addition & 2 deletions adminer/call.inc.php
Expand Up @@ -28,8 +28,7 @@
}
$call[] = (isset($out[$key]) ? "@" . idf_escape($field["field"]) : $val);
}
$result = $connection->multi_query((isset($_GET["callf"]) ? "SELECT" : "CALL") . " " . idf_escape($PROCEDURE) . "(" . implode(", ", $call) . ")");
if (!$result) {
if (!$connection->multi_query((isset($_GET["callf"]) ? "SELECT" : "CALL") . " " . idf_escape($PROCEDURE) . "(" . implode(", ", $call) . ")")) {
echo "<p class='error'>" . error() . "\n";
} else {
do {
Expand Down
7 changes: 5 additions & 2 deletions adminer/edit.inc.php
Expand Up @@ -9,8 +9,10 @@
}
}
if ($_POST && !$error && !isset($_GET["select"])) {
$location = $_SERVER["REQUEST_URI"]; // continue edit or insert
if (!$_POST["insert"]) {
$location = $_POST["referer"];
if ($_POST["insert"]) { // continue edit or insert
$location = $_SERVER["REQUEST_URI"]; //! doesn't work with change in &where field
} elseif (!ereg('^.+&select=.+$', $location)) {
$location = ME . "select=" . urlencode($TABLE);
$i = 0; // append &set converted to &where
foreach ((array) $_GET["set"] as $key => $val) {
Expand Down Expand Up @@ -96,6 +98,7 @@
?>
<p>
<input type="hidden" name="token" value="<?php echo $token; ?>">
<input type="hidden" name="referer" value="<?php echo h(isset($_POST["referer"]) ? $_POST["referer"] : $_SERVER["HTTP_REFERER"]); ?>">
<input type="hidden" name="save" value="1">
<?php
if (isset($_GET["select"])) {
Expand Down
4 changes: 4 additions & 0 deletions changes.txt
@@ -1,3 +1,7 @@
Adminer 2.3.1-dev:
Add Drop button to Alter pages (regression from 2.0.0)
Return to referer after edit

Adminer 2.3.0 (released 2010-02-26):
Support for permanent login (customization required)
Search in all tables
Expand Down
8 changes: 8 additions & 0 deletions editor/include/editing.inc.php
@@ -1,9 +1,17 @@
<?php
/** Encode e-mail header in UTF-8
* @param string
* @return string
*/
function email_header($header) {
// iconv_mime_encode requires PHP 5, imap_8bit requires IMAP extension
return "=?UTF-8?B?" . base64_encode($header) . "?="; //! split long lines
}

/** Get keys from first column and values from second
* @param string
* @return array
*/
function get_key_vals($query) {
global $connection;
$return = array();
Expand Down
1 change: 1 addition & 0 deletions todo.txt
Expand Up @@ -12,6 +12,7 @@ Highlight SQL textarea, then display query inside textarea in select - may use e
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"
Shift-click in checkboxes to select range
? LIKE %% operator
? Column and table names auto-completition in SQL textarea
? Aliasing of built-in functions can save 7 KB, function minification can save 7 KB, substitution of repetitive $a["a"] can save 4 KB, substitution of $_GET and friends can save 2 KB, JS packer can save 1 KB, not enclosing HTML attribute values can save 1.2 KB, replacing \\n by \n can save .3 KB
? Branch binary_compile: LZW compression of translations can save 30 KB, LZW compression of all texts can save 11 KB, remove of base64_decode() + using chars 127-255 in minification can save 1 KB
Expand Down

0 comments on commit b681dfb

Please sign in to comment.