mirror of
https://github.com/vrana/adminer.git
synced 2025-08-20 13:21:30 +02:00
PHPStan: Fix level 1 errors
This commit is contained in:
@@ -19,6 +19,7 @@ foreach ($routine["fields"] as $i => $field) {
|
||||
if (!$error && $_POST) {
|
||||
$call = array();
|
||||
foreach ($routine["fields"] as $key => $field) {
|
||||
$val = "";
|
||||
if (in_array($key, $in)) {
|
||||
$val = process_input($field);
|
||||
if ($val === false) {
|
||||
|
@@ -316,7 +316,7 @@ if (isset($_GET["mssql"])) {
|
||||
return $connection->error;
|
||||
}
|
||||
|
||||
function get_databases() {
|
||||
function get_databases($flush) {
|
||||
return get_vals("SELECT name FROM sys.databases WHERE name NOT IN ('master', 'tempdb', 'model', 'msdb')");
|
||||
}
|
||||
|
||||
@@ -598,7 +598,7 @@ WHERE OBJECT_NAME(i.object_id) = " . q($table), $connection2) as $row
|
||||
return apply_queries("ALTER SCHEMA " . idf_escape($target) . " TRANSFER", array_merge($tables, $views));
|
||||
}
|
||||
|
||||
function trigger($name) {
|
||||
function trigger($name, $table) {
|
||||
if ($name == "") {
|
||||
return array();
|
||||
}
|
||||
@@ -707,7 +707,7 @@ WHERE sys1.xtype = 'TR' AND sys2.name = " . q($table)) as $row
|
||||
function trigger_sql($table) {
|
||||
$return = "";
|
||||
foreach (triggers($table) as $name => $trigger) {
|
||||
$return .= create_trigger(" ON " . table($table), trigger($name)) . ";";
|
||||
$return .= create_trigger(" ON " . table($table), trigger($name, $table)) . ";";
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
|
@@ -961,10 +961,11 @@ if (!defined('Adminer\DRIVER')) {
|
||||
|
||||
/** Get information about trigger
|
||||
* @param string trigger name
|
||||
* @param string
|
||||
* @return Trigger
|
||||
* @phpstan-type Trigger array{Trigger:string, Timing:string, Event:string, Of:string, Type:string, Statement:string}
|
||||
*/
|
||||
function trigger($name) {
|
||||
function trigger($name, $table) {
|
||||
if ($name == "") {
|
||||
return array();
|
||||
}
|
||||
|
@@ -221,7 +221,7 @@ if (isset($_GET["oracle"])) {
|
||||
return $connection->error;
|
||||
}
|
||||
|
||||
function get_databases() {
|
||||
function get_databases($flush) {
|
||||
return get_vals(
|
||||
"SELECT DISTINCT tablespace_name FROM (
|
||||
SELECT tablespace_name FROM user_tablespaces
|
||||
|
@@ -338,7 +338,7 @@ if (isset($_GET["pgsql"])) {
|
||||
return $connection->error;
|
||||
}
|
||||
|
||||
function get_databases() {
|
||||
function get_databases($flush) {
|
||||
return get_vals("SELECT datname FROM pg_database
|
||||
WHERE datallowconn = TRUE AND has_database_privilege(datname, 'CONNECT')
|
||||
ORDER BY datname");
|
||||
|
@@ -200,7 +200,7 @@ if (isset($_GET["sqlite"])) {
|
||||
return new Db;
|
||||
}
|
||||
|
||||
function get_databases() {
|
||||
function get_databases($flush) {
|
||||
return array();
|
||||
}
|
||||
|
||||
@@ -567,7 +567,7 @@ if (isset($_GET["sqlite"])) {
|
||||
}
|
||||
$triggers = array();
|
||||
foreach (triggers($table) as $trigger_name => $timing_event) {
|
||||
$trigger = trigger($trigger_name);
|
||||
$trigger = trigger($trigger_name, $table);
|
||||
$triggers[] = "CREATE TRIGGER " . idf_escape($trigger_name) . " " . implode(" ", $timing_event) . " ON " . table($name) . "\n$trigger[Statement]";
|
||||
}
|
||||
$auto_increment = $auto_increment ? 0 : get_val("SELECT seq FROM sqlite_sequence WHERE name = " . q($table)); // if $auto_increment is set then it will be updated later
|
||||
@@ -633,7 +633,7 @@ if (isset($_GET["sqlite"])) {
|
||||
return false;
|
||||
}
|
||||
|
||||
function trigger($name) {
|
||||
function trigger($name, $table) {
|
||||
if ($name == "") {
|
||||
return array("Statement" => "BEGIN\n\t;\nEND");
|
||||
}
|
||||
|
@@ -93,6 +93,7 @@ SET foreign_key_checks = 0;
|
||||
$table = (DB == "" || in_array($name, (array) $_POST["tables"]));
|
||||
$data = (DB == "" || in_array($name, (array) $_POST["data"]));
|
||||
if ($table || $data) {
|
||||
$tmp_file = null;
|
||||
if ($ext == "tar") {
|
||||
$tmp_file = new TmpFile;
|
||||
ob_start(array($tmp_file, 'write'), 1e5);
|
||||
|
@@ -1050,8 +1050,10 @@ function lzw_decompress($binary) {
|
||||
}
|
||||
}
|
||||
// decompression
|
||||
/** @var list<?string> */
|
||||
$dictionary = range("\0", "\xFF");
|
||||
$return = "";
|
||||
$word = "";
|
||||
foreach ($codes as $i => $code) {
|
||||
$element = $dictionary[$code];
|
||||
if (!isset($element)) {
|
||||
|
@@ -118,9 +118,7 @@ if ($_POST && !$error) {
|
||||
}
|
||||
}
|
||||
if ($_POST["delete"] || $set) {
|
||||
if ($_POST["clone"]) {
|
||||
$query = "INTO " . table($TABLE) . " (" . implode(", ", array_keys($set)) . ")\nSELECT " . implode(", ", $set) . "\nFROM " . table($TABLE);
|
||||
}
|
||||
$query = ($_POST["clone"] ? "INTO " . table($TABLE) . " (" . implode(", ", array_keys($set)) . ")\nSELECT " . implode(", ", $set) . "\nFROM " . table($TABLE) : "");
|
||||
if ($_POST["all"] || ($primary && is_array($_POST["check"])) || $is_group) {
|
||||
$result = ($_POST["delete"]
|
||||
? $driver->delete($TABLE, $where_check)
|
||||
@@ -484,6 +482,7 @@ if (!$columns && support("table")) {
|
||||
if (!is_ajax()) {
|
||||
if ($rows || $page) {
|
||||
$exact_count = true;
|
||||
$found_rows = null;
|
||||
if ($_GET["page"] != "last") {
|
||||
if ($limit == "" || (count($rows) < $limit && ($rows || !$page))) {
|
||||
$found_rows = ($page ? $page * $limit : 0) + count($rows);
|
||||
@@ -507,10 +506,8 @@ if (!$columns && support("table")) {
|
||||
);
|
||||
echo "\n";
|
||||
}
|
||||
}
|
||||
|
||||
echo "<div class='footer'><div>\n";
|
||||
if ($rows || $page) {
|
||||
echo "<div class='footer'><div>\n";
|
||||
if ($pagination) {
|
||||
// display first, previous 4, next 4 and last page
|
||||
$max_page = ($found_rows === false
|
||||
@@ -578,10 +575,9 @@ if (!$columns && support("table")) {
|
||||
}
|
||||
|
||||
$adminer->selectEmailPrint(array_filter($email_fields, 'strlen'), $columns);
|
||||
echo "</div></div>\n";
|
||||
}
|
||||
|
||||
echo "</div></div>\n";
|
||||
|
||||
if ($adminer->selectImportPrint()) {
|
||||
echo "<div>";
|
||||
echo "<a href='#import'>" . lang('Import') . "</a>";
|
||||
|
@@ -152,6 +152,7 @@ if (!$error && $_POST) {
|
||||
$time .= ", <a href='#$warnings_id'>" . lang('Warnings') . "</a>" . script("qsl('a').onclick = partial(toggle, '$warnings_id');", "");
|
||||
}
|
||||
$explain = null;
|
||||
$orgtables = null;
|
||||
$explain_id = "explain-$commands";
|
||||
if (is_object($result)) {
|
||||
$limit = $_POST["limit"];
|
||||
|
Reference in New Issue
Block a user