1
0
mirror of https://github.com/vrana/adminer.git synced 2025-08-06 22:56:46 +02:00

Move variable initialization

This commit is contained in:
Jakub Vrana
2025-03-08 21:45:21 +01:00
parent ad2cbbf26e
commit 862e5b4aa4
4 changed files with 8 additions and 10 deletions

View File

@@ -328,9 +328,9 @@ if (isset($_GET["mongo"])) {
$limit = min(200, max(1, (int) $limit));
$skip = $page * $limit;
try {
return new Result($this->_conn->_link->executeQuery("$connection->_db_name.$table", new \MongoDB\Driver\Query($where, array('projection' => $select, 'limit' => $limit, 'skip' => $skip, 'sort' => $sort))));
return new Result($this->_conn->_link->executeQuery($this->_conn->_db_name . ".$table", new \MongoDB\Driver\Query($where, array('projection' => $select, 'limit' => $limit, 'skip' => $skip, 'sort' => $sort))));
} catch (Exception $e) {
$connection->error = $e->getMessage();
$this->_conn->error = $e->getMessage();
return false;
}
}

View File

@@ -1311,6 +1311,7 @@ function slow_query($query) {
$db = $adminer->database();
$timeout = $adminer->queryTimeout();
$slow_query = $driver->slowQuery($query, $timeout);
$connection2 = null;
if (!$slow_query && support("kill") && is_object($connection2 = connect($adminer->credentials())) && ($db == "" || $connection2->select_db($db))) {
$kill = $connection2->result(connection_id()); // MySQL and MySQLi can use thread_id but it's not in PDO_MySQL
?>
@@ -1321,8 +1322,6 @@ var timeout = setTimeout(function () {
}, <?php echo 1000 * $timeout; ?>);
</script>
<?php
} else {
$connection2 = null;
}
ob_flush();
flush();
@@ -1422,11 +1421,11 @@ function edit_form($table, $fields, $row, $update) {
?>
<form action="" method="post" enctype="multipart/form-data" id="form">
<?php
$first = 0;
if (!$fields) {
echo "<p class='error'>" . lang('You have no privileges to update this table.') . "\n";
} else {
echo "<table class='layout'>" . script("qsl('table').onkeydown = editingKeydown;");
$first = 0;
foreach ($fields as $name => $field) {
echo "<tr><th>" . $adminer->fieldName($field);
$default = $_GET["set"][bracket_escape($name)];

View File

@@ -81,9 +81,8 @@ if ($_POST && !$error) {
. convert_fields($columns, $fields, $select)
. "\nFROM " . table($TABLE);
$group_by = ($group && $is_group ? "\nGROUP BY " . implode(", ", $group) : "") . ($order ? "\nORDER BY " . implode(", ", $order) : "");
if (!is_array($_POST["check"]) || $primary) {
$query = "SELECT $from$where_check$group_by";
} else {
$query = "SELECT $from$where_check$group_by";
if (is_array($_POST["check"]) && !$primary) {
$union = array();
foreach ($_POST["check"] as $val) {
// where is not unique so OR can't be used

View File

@@ -120,8 +120,8 @@ if ($_POST && !$error) {
page_header((isset($_GET["host"]) ? lang('Username') . ": " . h("$USER@$_GET[host]") : lang('Create user')), $error, array("privileges" => array('', lang('Privileges'))));
if ($_POST) {
$row = $_POST;
$row = $_POST;
if ($row) {
$grants = $new_grants;
} else {
$row = $_GET + array("host" => get_val("SELECT SUBSTRING_INDEX(CURRENT_USER, '@', -1)")); // create user on the same domain by default