mirror of
https://github.com/vrana/adminer.git
synced 2025-08-06 06:37:33 +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) {
|
if (!$error && $_POST) {
|
||||||
$call = array();
|
$call = array();
|
||||||
foreach ($routine["fields"] as $key => $field) {
|
foreach ($routine["fields"] as $key => $field) {
|
||||||
|
$val = "";
|
||||||
if (in_array($key, $in)) {
|
if (in_array($key, $in)) {
|
||||||
$val = process_input($field);
|
$val = process_input($field);
|
||||||
if ($val === false) {
|
if ($val === false) {
|
||||||
|
@@ -316,7 +316,7 @@ if (isset($_GET["mssql"])) {
|
|||||||
return $connection->error;
|
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')");
|
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));
|
return apply_queries("ALTER SCHEMA " . idf_escape($target) . " TRANSFER", array_merge($tables, $views));
|
||||||
}
|
}
|
||||||
|
|
||||||
function trigger($name) {
|
function trigger($name, $table) {
|
||||||
if ($name == "") {
|
if ($name == "") {
|
||||||
return array();
|
return array();
|
||||||
}
|
}
|
||||||
@@ -707,7 +707,7 @@ WHERE sys1.xtype = 'TR' AND sys2.name = " . q($table)) as $row
|
|||||||
function trigger_sql($table) {
|
function trigger_sql($table) {
|
||||||
$return = "";
|
$return = "";
|
||||||
foreach (triggers($table) as $name => $trigger) {
|
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;
|
return $return;
|
||||||
}
|
}
|
||||||
|
@@ -961,10 +961,11 @@ if (!defined('Adminer\DRIVER')) {
|
|||||||
|
|
||||||
/** Get information about trigger
|
/** Get information about trigger
|
||||||
* @param string trigger name
|
* @param string trigger name
|
||||||
|
* @param string
|
||||||
* @return Trigger
|
* @return Trigger
|
||||||
* @phpstan-type Trigger array{Trigger:string, Timing:string, Event:string, Of:string, Type:string, Statement:string}
|
* @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 == "") {
|
if ($name == "") {
|
||||||
return array();
|
return array();
|
||||||
}
|
}
|
||||||
|
@@ -221,7 +221,7 @@ if (isset($_GET["oracle"])) {
|
|||||||
return $connection->error;
|
return $connection->error;
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_databases() {
|
function get_databases($flush) {
|
||||||
return get_vals(
|
return get_vals(
|
||||||
"SELECT DISTINCT tablespace_name FROM (
|
"SELECT DISTINCT tablespace_name FROM (
|
||||||
SELECT tablespace_name FROM user_tablespaces
|
SELECT tablespace_name FROM user_tablespaces
|
||||||
|
@@ -338,7 +338,7 @@ if (isset($_GET["pgsql"])) {
|
|||||||
return $connection->error;
|
return $connection->error;
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_databases() {
|
function get_databases($flush) {
|
||||||
return get_vals("SELECT datname FROM pg_database
|
return get_vals("SELECT datname FROM pg_database
|
||||||
WHERE datallowconn = TRUE AND has_database_privilege(datname, 'CONNECT')
|
WHERE datallowconn = TRUE AND has_database_privilege(datname, 'CONNECT')
|
||||||
ORDER BY datname");
|
ORDER BY datname");
|
||||||
|
@@ -200,7 +200,7 @@ if (isset($_GET["sqlite"])) {
|
|||||||
return new Db;
|
return new Db;
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_databases() {
|
function get_databases($flush) {
|
||||||
return array();
|
return array();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -567,7 +567,7 @@ if (isset($_GET["sqlite"])) {
|
|||||||
}
|
}
|
||||||
$triggers = array();
|
$triggers = array();
|
||||||
foreach (triggers($table) as $trigger_name => $timing_event) {
|
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]";
|
$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
|
$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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function trigger($name) {
|
function trigger($name, $table) {
|
||||||
if ($name == "") {
|
if ($name == "") {
|
||||||
return array("Statement" => "BEGIN\n\t;\nEND");
|
return array("Statement" => "BEGIN\n\t;\nEND");
|
||||||
}
|
}
|
||||||
|
@@ -93,6 +93,7 @@ SET foreign_key_checks = 0;
|
|||||||
$table = (DB == "" || in_array($name, (array) $_POST["tables"]));
|
$table = (DB == "" || in_array($name, (array) $_POST["tables"]));
|
||||||
$data = (DB == "" || in_array($name, (array) $_POST["data"]));
|
$data = (DB == "" || in_array($name, (array) $_POST["data"]));
|
||||||
if ($table || $data) {
|
if ($table || $data) {
|
||||||
|
$tmp_file = null;
|
||||||
if ($ext == "tar") {
|
if ($ext == "tar") {
|
||||||
$tmp_file = new TmpFile;
|
$tmp_file = new TmpFile;
|
||||||
ob_start(array($tmp_file, 'write'), 1e5);
|
ob_start(array($tmp_file, 'write'), 1e5);
|
||||||
|
@@ -1050,8 +1050,10 @@ function lzw_decompress($binary) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// decompression
|
// decompression
|
||||||
|
/** @var list<?string> */
|
||||||
$dictionary = range("\0", "\xFF");
|
$dictionary = range("\0", "\xFF");
|
||||||
$return = "";
|
$return = "";
|
||||||
|
$word = "";
|
||||||
foreach ($codes as $i => $code) {
|
foreach ($codes as $i => $code) {
|
||||||
$element = $dictionary[$code];
|
$element = $dictionary[$code];
|
||||||
if (!isset($element)) {
|
if (!isset($element)) {
|
||||||
|
@@ -118,9 +118,7 @@ if ($_POST && !$error) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($_POST["delete"] || $set) {
|
if ($_POST["delete"] || $set) {
|
||||||
if ($_POST["clone"]) {
|
$query = ($_POST["clone"] ? "INTO " . table($TABLE) . " (" . implode(", ", array_keys($set)) . ")\nSELECT " . implode(", ", $set) . "\nFROM " . table($TABLE) : "");
|
||||||
$query = "INTO " . table($TABLE) . " (" . implode(", ", array_keys($set)) . ")\nSELECT " . implode(", ", $set) . "\nFROM " . table($TABLE);
|
|
||||||
}
|
|
||||||
if ($_POST["all"] || ($primary && is_array($_POST["check"])) || $is_group) {
|
if ($_POST["all"] || ($primary && is_array($_POST["check"])) || $is_group) {
|
||||||
$result = ($_POST["delete"]
|
$result = ($_POST["delete"]
|
||||||
? $driver->delete($TABLE, $where_check)
|
? $driver->delete($TABLE, $where_check)
|
||||||
@@ -484,6 +482,7 @@ if (!$columns && support("table")) {
|
|||||||
if (!is_ajax()) {
|
if (!is_ajax()) {
|
||||||
if ($rows || $page) {
|
if ($rows || $page) {
|
||||||
$exact_count = true;
|
$exact_count = true;
|
||||||
|
$found_rows = null;
|
||||||
if ($_GET["page"] != "last") {
|
if ($_GET["page"] != "last") {
|
||||||
if ($limit == "" || (count($rows) < $limit && ($rows || !$page))) {
|
if ($limit == "" || (count($rows) < $limit && ($rows || !$page))) {
|
||||||
$found_rows = ($page ? $page * $limit : 0) + count($rows);
|
$found_rows = ($page ? $page * $limit : 0) + count($rows);
|
||||||
@@ -507,10 +506,8 @@ if (!$columns && support("table")) {
|
|||||||
);
|
);
|
||||||
echo "\n";
|
echo "\n";
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
echo "<div class='footer'><div>\n";
|
echo "<div class='footer'><div>\n";
|
||||||
if ($rows || $page) {
|
|
||||||
if ($pagination) {
|
if ($pagination) {
|
||||||
// display first, previous 4, next 4 and last page
|
// display first, previous 4, next 4 and last page
|
||||||
$max_page = ($found_rows === false
|
$max_page = ($found_rows === false
|
||||||
@@ -578,10 +575,9 @@ if (!$columns && support("table")) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$adminer->selectEmailPrint(array_filter($email_fields, 'strlen'), $columns);
|
$adminer->selectEmailPrint(array_filter($email_fields, 'strlen'), $columns);
|
||||||
|
echo "</div></div>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
echo "</div></div>\n";
|
|
||||||
|
|
||||||
if ($adminer->selectImportPrint()) {
|
if ($adminer->selectImportPrint()) {
|
||||||
echo "<div>";
|
echo "<div>";
|
||||||
echo "<a href='#import'>" . lang('Import') . "</a>";
|
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');", "");
|
$time .= ", <a href='#$warnings_id'>" . lang('Warnings') . "</a>" . script("qsl('a').onclick = partial(toggle, '$warnings_id');", "");
|
||||||
}
|
}
|
||||||
$explain = null;
|
$explain = null;
|
||||||
|
$orgtables = null;
|
||||||
$explain_id = "explain-$commands";
|
$explain_id = "explain-$commands";
|
||||||
if (is_object($result)) {
|
if (is_object($result)) {
|
||||||
$limit = $_POST["limit"];
|
$limit = $_POST["limit"];
|
||||||
|
@@ -219,7 +219,7 @@ function minify_js($file) {
|
|||||||
return lzw_compress($file);
|
return lzw_compress($file);
|
||||||
}
|
}
|
||||||
|
|
||||||
function compile_file($match) {
|
function compile_file($match, $callback) { // $callback only to match signature
|
||||||
global $project;
|
global $project;
|
||||||
$file = "";
|
$file = "";
|
||||||
list(, $filenames, $callback) = $match;
|
list(, $filenames, $callback) = $match;
|
||||||
|
@@ -1,10 +1,11 @@
|
|||||||
parameters:
|
parameters:
|
||||||
level: 0
|
level: 1
|
||||||
ignoreErrors:
|
ignoreErrors:
|
||||||
- identifier: include.fileNotFound # relative includes
|
- identifier: include.fileNotFound # relative includes
|
||||||
- identifier: includeOnce.fileNotFound # ./adminer-plugins.php
|
- identifier: includeOnce.fileNotFound # ./adminer-plugins.php
|
||||||
- "~^Function (set_magic_quotes_runtime|mysql_)~" # PHP < 7 functions
|
- "~^Function (set_magic_quotes_runtime|mysql_)~" # PHP < 7 functions
|
||||||
- "~^Instantiated class Adminer\\w~" # no support for classes defined inside function
|
- "~^Instantiated class Adminer\\w~" # no support for classes defined inside function
|
||||||
|
- "~^Variable \\$(adminer|connection|driver|drivers|error|HTTPS|LANG|langs|permanent|has_token|token|translations|VERSION) might not be defined~" # declared in bootstrap.inc.php
|
||||||
paths:
|
paths:
|
||||||
- .
|
- .
|
||||||
phpVersion:
|
phpVersion:
|
||||||
|
@@ -207,9 +207,7 @@ if (isset($_GET["elastic"])) {
|
|||||||
if (empty($search)) {
|
if (empty($search)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if ($select == array("*")) {
|
$tableFields = ($select == array("*") ? array_keys(fields($table)) : array());
|
||||||
$tableFields = array_keys(fields($table));
|
|
||||||
}
|
|
||||||
|
|
||||||
$return = array();
|
$return = array();
|
||||||
foreach ($search["hits"]["hits"] as $hit) {
|
foreach ($search["hits"]["hits"] as $hit) {
|
||||||
@@ -332,7 +330,7 @@ if (isset($_GET["elastic"])) {
|
|||||||
return $credentials[1];
|
return $credentials[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_databases() {
|
function get_databases($flush) {
|
||||||
return array("elastic");
|
return array("elastic");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -445,7 +443,7 @@ if (isset($_GET["elastic"])) {
|
|||||||
return h(connection()->error);
|
return h(connection()->error);
|
||||||
}
|
}
|
||||||
|
|
||||||
function information_schema() {
|
function information_schema($db) {
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -478,7 +478,7 @@ if (isset($_GET["mongo"])) {
|
|||||||
function db_collation($db, $collations) {
|
function db_collation($db, $collations) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function information_schema() {
|
function information_schema($db) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function is_view($table_status) {
|
function is_view($table_status) {
|
||||||
|
@@ -274,7 +274,7 @@ if (isset($_GET["simpledb"])) {
|
|||||||
return $credentials[1];
|
return $credentials[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_databases() {
|
function get_databases($flush) {
|
||||||
return array("domain");
|
return array("domain");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -329,7 +329,7 @@ if (isset($_GET["simpledb"])) {
|
|||||||
return h($connection->error);
|
return h($connection->error);
|
||||||
}
|
}
|
||||||
|
|
||||||
function information_schema() {
|
function information_schema($db) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function indexes($table, $connection2 = null) {
|
function indexes($table, $connection2 = null) {
|
||||||
|
Reference in New Issue
Block a user