mirror of
https://github.com/vrana/adminer.git
synced 2025-08-07 23:27:17 +02:00
Move variable initialization
This commit is contained in:
@@ -328,9 +328,9 @@ if (isset($_GET["mongo"])) {
|
|||||||
$limit = min(200, max(1, (int) $limit));
|
$limit = min(200, max(1, (int) $limit));
|
||||||
$skip = $page * $limit;
|
$skip = $page * $limit;
|
||||||
try {
|
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) {
|
} catch (Exception $e) {
|
||||||
$connection->error = $e->getMessage();
|
$this->_conn->error = $e->getMessage();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1311,6 +1311,7 @@ function slow_query($query) {
|
|||||||
$db = $adminer->database();
|
$db = $adminer->database();
|
||||||
$timeout = $adminer->queryTimeout();
|
$timeout = $adminer->queryTimeout();
|
||||||
$slow_query = $driver->slowQuery($query, $timeout);
|
$slow_query = $driver->slowQuery($query, $timeout);
|
||||||
|
$connection2 = null;
|
||||||
if (!$slow_query && support("kill") && is_object($connection2 = connect($adminer->credentials())) && ($db == "" || $connection2->select_db($db))) {
|
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
|
$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; ?>);
|
}, <?php echo 1000 * $timeout; ?>);
|
||||||
</script>
|
</script>
|
||||||
<?php
|
<?php
|
||||||
} else {
|
|
||||||
$connection2 = null;
|
|
||||||
}
|
}
|
||||||
ob_flush();
|
ob_flush();
|
||||||
flush();
|
flush();
|
||||||
@@ -1422,11 +1421,11 @@ function edit_form($table, $fields, $row, $update) {
|
|||||||
?>
|
?>
|
||||||
<form action="" method="post" enctype="multipart/form-data" id="form">
|
<form action="" method="post" enctype="multipart/form-data" id="form">
|
||||||
<?php
|
<?php
|
||||||
|
$first = 0;
|
||||||
if (!$fields) {
|
if (!$fields) {
|
||||||
echo "<p class='error'>" . lang('You have no privileges to update this table.') . "\n";
|
echo "<p class='error'>" . lang('You have no privileges to update this table.') . "\n";
|
||||||
} else {
|
} else {
|
||||||
echo "<table class='layout'>" . script("qsl('table').onkeydown = editingKeydown;");
|
echo "<table class='layout'>" . script("qsl('table').onkeydown = editingKeydown;");
|
||||||
$first = 0;
|
|
||||||
foreach ($fields as $name => $field) {
|
foreach ($fields as $name => $field) {
|
||||||
echo "<tr><th>" . $adminer->fieldName($field);
|
echo "<tr><th>" . $adminer->fieldName($field);
|
||||||
$default = $_GET["set"][bracket_escape($name)];
|
$default = $_GET["set"][bracket_escape($name)];
|
||||||
|
@@ -81,9 +81,8 @@ if ($_POST && !$error) {
|
|||||||
. convert_fields($columns, $fields, $select)
|
. convert_fields($columns, $fields, $select)
|
||||||
. "\nFROM " . table($TABLE);
|
. "\nFROM " . table($TABLE);
|
||||||
$group_by = ($group && $is_group ? "\nGROUP BY " . implode(", ", $group) : "") . ($order ? "\nORDER BY " . implode(", ", $order) : "");
|
$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";
|
||||||
$query = "SELECT $from$where_check$group_by";
|
if (is_array($_POST["check"]) && !$primary) {
|
||||||
} else {
|
|
||||||
$union = array();
|
$union = array();
|
||||||
foreach ($_POST["check"] as $val) {
|
foreach ($_POST["check"] as $val) {
|
||||||
// where is not unique so OR can't be used
|
// where is not unique so OR can't be used
|
||||||
|
@@ -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'))));
|
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;
|
$grants = $new_grants;
|
||||||
} else {
|
} else {
|
||||||
$row = $_GET + array("host" => get_val("SELECT SUBSTRING_INDEX(CURRENT_USER, '@', -1)")); // create user on the same domain by default
|
$row = $_GET + array("host" => get_val("SELECT SUBSTRING_INDEX(CURRENT_USER, '@', -1)")); // create user on the same domain by default
|
||||||
|
Reference in New Issue
Block a user