Support Editor

This commit is contained in:
Jakub Vrana 2012-08-19 23:25:23 -07:00
parent ea6d6e0d44
commit ef0cb38aa1
3 changed files with 10 additions and 2 deletions

View file

@ -905,7 +905,8 @@ function is_url($string) {
*/ */
function slow_query($query) { function slow_query($query) {
global $adminer, $token; global $adminer, $token;
if (support("kill") && is_object($connection2 = connect()) && (DB == "" || $connection2->select_db(DB))) { $db = $adminer->database();
if (support("kill") && is_object($connection2 = connect()) && ($db == "" || $connection2->select_db($db))) {
$kill = $connection2->result("SELECT CONNECTION_ID()"); // MySQL and MySQLi can use thread_id but it's not in PDO_MySQL $kill = $connection2->result("SELECT CONNECTION_ID()"); // MySQL and MySQLi can use thread_id but it's not in PDO_MySQL
?> ?>
<script type="text/javascript"> <script type="text/javascript">

View file

@ -30,6 +30,10 @@ class Adminer {
return get_databases($flush); return get_databases($flush);
} }
function queryTimeout() {
return 5;
}
function headers() { function headers() {
return true; return true;
} }

View file

@ -1,5 +1,8 @@
<?php <?php
if (list($table, $id, $name) = $adminer->_foreignColumn(column_foreign_keys($_GET["source"]), $_GET["field"])) { if ($_GET["script"] == "kill") {
$connection->query("KILL " . (+$_POST["kill"]));
} elseif (list($table, $id, $name) = $adminer->_foreignColumn(column_foreign_keys($_GET["source"]), $_GET["field"])) {
$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"); $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++) { for ($i=0; $i < 10 && ($row = $result->fetch_row()); $i++) {
echo "<a href='" . h(ME . "edit=" . urlencode($table) . "&where" . urlencode("[" . bracket_escape(idf_unescape($id)) . "]") . "=" . urlencode($row[0])) . "'>" . h($row[1]) . "</a><br>\n"; echo "<a href='" . h(ME . "edit=" . urlencode($table) . "&where" . urlencode("[" . bracket_escape(idf_unescape($id)) . "]") . "=" . urlencode($row[0])) . "'>" . h($row[1]) . "</a><br>\n";