diff --git a/editor/include/adminer.inc.php b/editor/include/adminer.inc.php
index 5df36fcf..903449b4 100644
--- a/editor/include/adminer.inc.php
+++ b/editor/include/adminer.inc.php
@@ -572,10 +572,10 @@ ORDER BY ORDINAL_POSITION", null, "") as $row) { //! requires MySQL 5
$return = &$this->_values[$table];
if (!isset($return)) {
$table_status = table_status($table);
- $return = ($table_status["Rows"] > 1000
- ? (isset($value) ? $connection->result("SELECT $name FROM " . table($table) . " WHERE $id = " . q($value)) : "")
- : array("" => "") + get_key_vals("SELECT $id, $name FROM " . table($table) . " ORDER BY 2")
- );
+ $return = ($table_status["Rows"] > 1000 ? "" : array("" => "") + get_key_vals("SELECT $id, $name FROM " . table($table) . " ORDER BY 2"));
+ }
+ if (!$return && isset($value)) {
+ return $connection->result("SELECT $name FROM " . table($table) . " WHERE $id = " . q($value));
}
return $return;
}
diff --git a/editor/script.inc.php b/editor/script.inc.php
index 1de9ab47..e1189ef2 100644
--- a/editor/script.inc.php
+++ b/editor/script.inc.php
@@ -1,6 +1,6 @@
_foreignColumn(column_foreign_keys($_GET["source"]), $_GET["field"])) {
- $result = $connection->query("SELECT $id, $name FROM " . table($table) . " WHERE $name LIKE " . q("$_GET[value]%") . " ORDER BY 2 LIMIT 11");
+ $result = $connection->query("SELECT $id, $name FROM " . table($table) . " WHERE " . (ereg('^[0-9]+$', $_GET["value"]) ? "$id = $_GET[value] OR " : "") . "$name LIKE " . q("$_GET[value]%") . " ORDER BY 2 LIMIT 11");
for ($i=0; $i < 10 && ($row = $result->fetch_row()); $i++) {
echo "" . h($row[1]) . "
\n";
}
diff --git a/editor/static/editing.js b/editor/static/editing.js
index e89fc140..e12c44f5 100644
--- a/editor/static/editing.js
+++ b/editor/static/editing.js
@@ -18,16 +18,17 @@ function whisperClick(event, field) {
}
function whisper(url, field) {
- if (field.orig != field.value) {
+ if (field.orig != field.value) { // ignore arrows, Shift, ...
field.orig = field.value;
+ field.previousSibling.value = field.value; // accept number, reject string
return ajax(url + encodeURIComponent(field.value), function (xmlhttp) {
- if (xmlhttp.status && field.orig == field.value) {
+ if (xmlhttp.status && field.orig == field.value) { // ignore old responses
field.nextSibling.innerHTML = xmlhttp.responseText;
field.nextSibling.style.display = '';
var a = field.nextSibling.firstChild;
if (a && a.firstChild.data == field.value) {
field.previousSibling.value = decodeURIComponent(a.href.replace(/.*=/, ''));
- a.style.fontWeight = 'bold';
+ a.className = 'active';
}
}
});