Correct redirect after change in where field
git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@1359 7c3ca157-0c34-0410-bff1-cbf682f78f5c
This commit is contained in:
parent
35ec64c61d
commit
640d0ec08d
|
@ -11,7 +11,7 @@ foreach ($fields as $name => $field) {
|
||||||
if ($_POST && !$error && !isset($_GET["select"])) {
|
if ($_POST && !$error && !isset($_GET["select"])) {
|
||||||
$location = $_POST["referer"];
|
$location = $_POST["referer"];
|
||||||
if ($_POST["insert"]) { // continue edit or insert
|
if ($_POST["insert"]) { // continue edit or insert
|
||||||
$location = $_SERVER["REQUEST_URI"]; //! doesn't work with change in &where field
|
$location = ($update ? ME . "&edit=" . urlencode($TABLE) . unique_idf($_POST["fields"], indexes($TABLE)) : $_SERVER["REQUEST_URI"]); //! doesn't work with functions
|
||||||
} elseif (!ereg('^.+&select=.+$', $location)) {
|
} elseif (!ereg('^.+&select=.+$', $location)) {
|
||||||
$location = ME . "select=" . urlencode($TABLE);
|
$location = ME . "select=" . urlencode($TABLE);
|
||||||
$i = 0; // append &set converted to &where
|
$i = 0; // append &set converted to &where
|
||||||
|
|
|
@ -159,6 +159,19 @@ function unique_array($row, $indexes) {
|
||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Get query string for unique identifier of a row
|
||||||
|
* @param array
|
||||||
|
* @param array result of indexes()
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
function unique_idf($row, $indexes) {
|
||||||
|
$return = "";
|
||||||
|
foreach (unique_array($row, $indexes) as $key => $val) {
|
||||||
|
$return .= "&" . (isset($val) ? urlencode("where[" . bracket_escape($key) . "]") . "=" . urlencode($val) : "null%5B%5D=" . urlencode($key));
|
||||||
|
}
|
||||||
|
return $return;
|
||||||
|
}
|
||||||
|
|
||||||
/** Create SQL condition from parsed query string
|
/** Create SQL condition from parsed query string
|
||||||
* @param array parsed query string
|
* @param array parsed query string
|
||||||
* @return string
|
* @return string
|
||||||
|
|
|
@ -205,11 +205,7 @@ if (!$columns) {
|
||||||
}
|
}
|
||||||
echo ($backward_keys ? "<th>" . lang('Relations') : "") . "</thead>\n";
|
echo ($backward_keys ? "<th>" . lang('Relations') : "") . "</thead>\n";
|
||||||
foreach ($adminer->rowDescriptions($rows, $foreign_keys) as $n => $row) {
|
foreach ($adminer->rowDescriptions($rows, $foreign_keys) as $n => $row) {
|
||||||
$unique_array = unique_array($row, $indexes);
|
$unique_idf = unique_idf($row, $indexes);
|
||||||
$unique_idf = "";
|
|
||||||
foreach ($unique_array as $key => $val) {
|
|
||||||
$unique_idf .= "&" . (isset($val) ? urlencode("where[" . bracket_escape($key) . "]") . "=" . urlencode($val) : "null%5B%5D=" . urlencode($key));
|
|
||||||
}
|
|
||||||
echo "<tr" . odd() . "><td>" . checkbox("check[]", substr($unique_idf, 1), in_array(substr($unique_idf, 1), (array) $_POST["check"]), "", "this.form['all'].checked = false; formUncheck('all-page');") . (count($select) != count($group) || information_schema(DB) ? '' : " <a href='" . h(ME . "edit=" . urlencode($TABLE) . $unique_idf) . "'>" . lang('edit') . "</a>");
|
echo "<tr" . odd() . "><td>" . checkbox("check[]", substr($unique_idf, 1), in_array(substr($unique_idf, 1), (array) $_POST["check"]), "", "this.form['all'].checked = false; formUncheck('all-page');") . (count($select) != count($group) || information_schema(DB) ? '' : " <a href='" . h(ME . "edit=" . urlencode($TABLE) . $unique_idf) . "'>" . lang('edit') . "</a>");
|
||||||
foreach ($row as $key => $val) {
|
foreach ($row as $key => $val) {
|
||||||
if (isset($names[$key])) {
|
if (isset($names[$key])) {
|
||||||
|
@ -247,7 +243,7 @@ if (!$columns) {
|
||||||
if ($key == "COUNT(*)") { //! columns looking like functions
|
if ($key == "COUNT(*)") { //! columns looking like functions
|
||||||
$link = h(ME . "select=" . urlencode($TABLE));
|
$link = h(ME . "select=" . urlencode($TABLE));
|
||||||
$i = 0;
|
$i = 0;
|
||||||
foreach ($unique_array as $k => $v) {
|
foreach (unique_array($row, $indexes) as $k => $v) {
|
||||||
$link .= h("&where[$i][col]=" . urlencode($k) . "&where[$i][op]=" . (isset($v) ? "%3D&where[$i][val]=" . urlencode($v) : "IS+NULL"));
|
$link .= h("&where[$i][col]=" . urlencode($k) . "&where[$i][op]=" . (isset($v) ? "%3D&where[$i][val]=" . urlencode($v) : "IS+NULL"));
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
Adminer 2.3.1-dev:
|
Adminer 2.3.1-dev:
|
||||||
Add Drop button to Alter pages (regression from 2.0.0)
|
Add Drop button to Alter pages (regression from 2.0.0)
|
||||||
|
Link COUNT(*) result to listing
|
||||||
|
Newlines in select query edit
|
||||||
Return to referer after edit
|
Return to referer after edit
|
||||||
|
|
||||||
Adminer 2.3.0 (released 2010-02-26):
|
Adminer 2.3.0 (released 2010-02-26):
|
||||||
|
|
Loading…
Reference in a new issue