diff --git a/db_events.php b/db_events.php index 69825c94f1..25d2c0e997 100644 --- a/db_events.php +++ b/db_events.php @@ -18,7 +18,7 @@ if (! defined('ROOT_PATH')) { define('ROOT_PATH', __DIR__ . DIRECTORY_SEPARATOR); } -global $db; +global $db, $table; require_once ROOT_PATH . 'libraries/common.inc.php'; diff --git a/db_export.php b/db_export.php index 0df12550dd..a18f1c3872 100644 --- a/db_export.php +++ b/db_export.php @@ -20,7 +20,7 @@ if (! defined('ROOT_PATH')) { define('ROOT_PATH', __DIR__ . DIRECTORY_SEPARATOR); } -global $db; +global $db, $table; require_once ROOT_PATH . 'libraries/common.inc.php'; diff --git a/db_import.php b/db_import.php index 5fd17e2608..8919b65e2c 100644 --- a/db_import.php +++ b/db_import.php @@ -15,7 +15,7 @@ if (! defined('ROOT_PATH')) { define('ROOT_PATH', __DIR__ . DIRECTORY_SEPARATOR); } -global $db; +global $db, $table; require_once ROOT_PATH . 'libraries/common.inc.php'; diff --git a/db_routines.php b/db_routines.php index defbfa4660..09b5d1a798 100644 --- a/db_routines.php +++ b/db_routines.php @@ -19,7 +19,7 @@ if (! defined('ROOT_PATH')) { define('ROOT_PATH', __DIR__ . DIRECTORY_SEPARATOR); } -global $db; +global $db, $table; require_once ROOT_PATH . 'libraries/common.inc.php'; diff --git a/db_triggers.php b/db_triggers.php index 4e8b364687..cd08461fa5 100644 --- a/db_triggers.php +++ b/db_triggers.php @@ -18,7 +18,7 @@ if (! defined('ROOT_PATH')) { define('ROOT_PATH', __DIR__ . DIRECTORY_SEPARATOR); } -global $db; +global $db, $table; require_once ROOT_PATH . 'libraries/common.inc.php'; diff --git a/import.php b/import.php index 87305b4519..30cf739528 100644 --- a/import.php +++ b/import.php @@ -31,7 +31,7 @@ if (isset($_POST['format']) && $_POST['format'] == 'ldi') { define('PMA_ENABLE_LDI', 1); } -global $db; +global $db, $table; require_once ROOT_PATH . 'libraries/common.inc.php'; diff --git a/libraries/db_table_exists.inc.php b/libraries/db_table_exists.inc.php index c0a009846a..4e6e3694e9 100644 --- a/libraries/db_table_exists.inc.php +++ b/libraries/db_table_exists.inc.php @@ -17,7 +17,7 @@ if (! defined('PHPMYADMIN')) { exit; } -global $db; +global $db, $table; if (empty($is_db)) { if (strlen($db) > 0) { diff --git a/normalization.php b/normalization.php index 19fe60dccf..c483e52050 100644 --- a/normalization.php +++ b/normalization.php @@ -18,7 +18,7 @@ if (! defined('ROOT_PATH')) { define('ROOT_PATH', __DIR__ . DIRECTORY_SEPARATOR); } -global $db; +global $db, $table; require_once ROOT_PATH . 'libraries/common.inc.php'; diff --git a/phpstan.neon.dist b/phpstan.neon.dist index bc55f87ea5..a01cf367cb 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -15,7 +15,7 @@ parameters: - '#Access to an undefined property PhpMyAdmin\\TwoFactor\:\:\$(backend|showSubmit|available|writable)#' - '#Call to an undefined method PhpMyAdmin\\Navigation\\Nodes\\Node\:\:getHiddenCount#' - '#Undefined variable: \$array#' - - '#Undefined variable: \$(table|url_query|text_dir|server|pmaThemeImage|action|sql_query|lang|export_type|err_url|collation_connection|filename_template|transform_key|cn|goto|partitionDetails|token_mismatch|auth_plugin|username|hostname|display_query|where_clause)#'#Others + - '#Undefined variable: \$(url_query|text_dir|server|pmaThemeImage|action|sql_query|lang|export_type|err_url|collation_connection|filename_template|transform_key|cn|goto|partitionDetails|token_mismatch|auth_plugin|username|hostname|display_query|where_clause)#'#Others - '#Undefined variable: \$(unsaved_values|is_upload)#'#tbl_change.php - '#Undefined variable: \$max_upload_size#'#tbl_import.php - '#Undefined variable: \$(repobase|fullrevision|revision|repobranchbase|branch)#'#Footer.php diff --git a/server_export.php b/server_export.php index 6bb8b48a28..ba308c5f22 100644 --- a/server_export.php +++ b/server_export.php @@ -15,7 +15,7 @@ if (! defined('ROOT_PATH')) { define('ROOT_PATH', __DIR__ . DIRECTORY_SEPARATOR); } -global $db; +global $db, $table; require_once ROOT_PATH . 'libraries/common.inc.php'; require_once ROOT_PATH . 'libraries/server_common.inc.php'; diff --git a/server_import.php b/server_import.php index e619851434..ee809e6073 100644 --- a/server_import.php +++ b/server_import.php @@ -15,7 +15,7 @@ if (! defined('ROOT_PATH')) { define('ROOT_PATH', __DIR__ . DIRECTORY_SEPARATOR); } -global $db; +global $db, $table; require_once ROOT_PATH . 'libraries/common.inc.php'; diff --git a/tbl_addfield.php b/tbl_addfield.php index 25985c0c27..1fb9609c8b 100644 --- a/tbl_addfield.php +++ b/tbl_addfield.php @@ -20,7 +20,7 @@ if (! defined('ROOT_PATH')) { define('ROOT_PATH', __DIR__ . DIRECTORY_SEPARATOR); } -global $cfg, $db; +global $cfg, $db, $table; require_once ROOT_PATH . 'libraries/common.inc.php'; diff --git a/tbl_change.php b/tbl_change.php index 4a6f15e3f6..4ea3dc1a15 100644 --- a/tbl_change.php +++ b/tbl_change.php @@ -20,7 +20,7 @@ if (! defined('ROOT_PATH')) { define('ROOT_PATH', __DIR__ . DIRECTORY_SEPARATOR); } -global $cfg, $db; +global $cfg, $db, $table; require_once ROOT_PATH . 'libraries/common.inc.php'; diff --git a/tbl_create.php b/tbl_create.php index dc3f5d4f52..14b7f09dc8 100644 --- a/tbl_create.php +++ b/tbl_create.php @@ -20,7 +20,7 @@ if (! defined('ROOT_PATH')) { define('ROOT_PATH', __DIR__ . DIRECTORY_SEPARATOR); } -global $cfg, $db; +global $cfg, $db, $table; require_once ROOT_PATH . 'libraries/common.inc.php'; diff --git a/tbl_get_field.php b/tbl_get_field.php index fec67355c7..20a0bf2e9c 100644 --- a/tbl_get_field.php +++ b/tbl_get_field.php @@ -17,7 +17,7 @@ if (! defined('ROOT_PATH')) { define('ROOT_PATH', __DIR__ . DIRECTORY_SEPARATOR); } -global $db; +global $db, $table; require_once ROOT_PATH . 'libraries/common.inc.php'; diff --git a/tbl_import.php b/tbl_import.php index 2dc19144b7..8dae13a3df 100644 --- a/tbl_import.php +++ b/tbl_import.php @@ -15,7 +15,7 @@ if (! defined('ROOT_PATH')) { define('ROOT_PATH', __DIR__ . DIRECTORY_SEPARATOR); } -global $db; +global $db, $table; require_once ROOT_PATH . 'libraries/common.inc.php'; diff --git a/tbl_operations.php b/tbl_operations.php index f181f619af..3437347ca3 100644 --- a/tbl_operations.php +++ b/tbl_operations.php @@ -23,7 +23,7 @@ if (! defined('ROOT_PATH')) { define('ROOT_PATH', __DIR__ . DIRECTORY_SEPARATOR); } -global $db; +global $db, $table; require_once ROOT_PATH . 'libraries/common.inc.php'; @@ -43,12 +43,10 @@ $checkUserPrivileges->getPrivileges(); $lowerCaseNames = $dbi->getLowerCaseNames() === '1'; if ($lowerCaseNames) { - $GLOBALS['table'] = mb_strtolower( - $GLOBALS['table'] - ); + $table = mb_strtolower($table); } -$pma_table = new Table($GLOBALS['table'], $db); +$pma_table = new Table($table, $db); $header = $response->getHeader(); $scripts = $header->getScripts(); @@ -78,7 +76,7 @@ $dbi->selectDb($db); */ $pma_table = $dbi->getTable( $db, - $GLOBALS['table'] + $table ); $reread_info = $pma_table->getStatusInfo(null, false); $GLOBALS['showtable'] = $pma_table->getStatusInfo(null, (isset($reread_info) && $reread_info ? true : false)); @@ -112,7 +110,7 @@ if ($pma_table->isEngine('ARIA')) { $pma_table = $dbi->getTable( $db, - $GLOBALS['table'] + $table ); $reread_info = false; $table_alters = []; @@ -168,7 +166,7 @@ if (isset($_POST['submitoptions'])) { $dbi->selectDb($oldDb); $_message .= $pma_table->getLastMessage(); $result = true; - $GLOBALS['table'] = $pma_table->getName(); + $table = $pma_table->getName(); $reread_info = true; $reload = true; } else { @@ -210,7 +208,7 @@ if (isset($_POST['submitoptions'])) { if (count($table_alters) > 0) { $sql_query = 'ALTER TABLE ' - . Util::backquote($GLOBALS['table']); + . Util::backquote($table); $sql_query .= "\r\n" . implode("\r\n", $table_alters); $sql_query .= ';'; $result = $dbi->query($sql_query) ? true : false; @@ -226,7 +224,7 @@ if (isset($_POST['submitoptions'])) { ) { $operations->changeAllColumnsCollation( $db, - $GLOBALS['table'], + $table, $_POST['tbl_collation'] ); } @@ -334,7 +332,7 @@ $url_params['goto'] /** * Get columns names */ -$columns = $dbi->getColumns($db, $GLOBALS['table']); +$columns = $dbi->getColumns($db, $table); /** * Displays the page @@ -348,7 +346,7 @@ $hideOrderTable = false; // a user-defined clustered index (PRIMARY KEY or NOT NULL UNIQUE index). // InnoDB always orders table rows according to such an index if one is present. if ($tbl_storage_engine == 'INNODB') { - $indexes = Index::getFromTable($GLOBALS['table'], $db); + $indexes = Index::getFromTable($table, $db); foreach ($indexes as $name => $idx) { if ($name == 'PRIMARY') { $hideOrderTable = true; @@ -433,7 +431,7 @@ if (! (isset($db_is_system_schema) && $db_is_system_schema)) { && ! (isset($db_is_system_schema) && $db_is_system_schema) ) { $this_sql_query = 'TRUNCATE TABLE ' - . Util::backquote($GLOBALS['table']); + . Util::backquote($table); $truncate_table_url_params = array_merge( $url_params, [ @@ -449,7 +447,7 @@ if (! (isset($db_is_system_schema) && $db_is_system_schema)) { } if (! (isset($db_is_system_schema) && $db_is_system_schema)) { $this_sql_query = 'DROP TABLE ' - . Util::backquote($GLOBALS['table']); + . Util::backquote($table); $drop_table_url_params = array_merge( $url_params, [ @@ -466,7 +464,7 @@ if (! (isset($db_is_system_schema) && $db_is_system_schema)) { ), // table name is needed to avoid running // PhpMyAdmin\RelationCleanup::database() on the whole db later - 'table' => $GLOBALS['table'], + 'table' => $table, ] ); } @@ -497,7 +495,7 @@ unset($partition_names); if ($cfgRelation['relwork'] && ! $pma_table->isEngine("INNODB")) { $dbi->selectDb($db); - $foreign = $relation->getForeigners($db, $GLOBALS['table'], '', 'internal'); + $foreign = $relation->getForeigners($db, $table, '', 'internal'); if (! empty($foreign)) { $response->addHTML( diff --git a/tbl_replace.php b/tbl_replace.php index e759f43448..8cb042db44 100644 --- a/tbl_replace.php +++ b/tbl_replace.php @@ -30,7 +30,7 @@ if (! defined('ROOT_PATH')) { define('ROOT_PATH', __DIR__ . DIRECTORY_SEPARATOR); } -global $db, $url_params; +global $db, $table, $url_params; require_once ROOT_PATH . 'libraries/common.inc.php'; @@ -154,7 +154,7 @@ if ($dbi->getVersion() >= 50600) { } //if some posted fields need to be transformed. -$mime_map = $transformations->getMime($db, $GLOBALS['table']); +$mime_map = $transformations->getMime($db, $table); if ($mime_map === false) { $mime_map = []; } @@ -340,7 +340,7 @@ foreach ($loop_array as $rownumber => $where_clause) { $value_sets[] = implode(', ', $query_values); } else { // build update query - $query[] = 'UPDATE ' . Util::backquote($GLOBALS['table']) + $query[] = 'UPDATE ' . Util::backquote($table) . ' SET ' . implode(', ', $query_values) . ' WHERE ' . $where_clause . ($_POST['clause_is_unique'] ? '' : ' LIMIT 1'); diff --git a/tbl_row_action.php b/tbl_row_action.php index ee6b2d0e08..734e3ab1e4 100644 --- a/tbl_row_action.php +++ b/tbl_row_action.php @@ -15,7 +15,7 @@ if (! defined('ROOT_PATH')) { define('ROOT_PATH', __DIR__ . DIRECTORY_SEPARATOR); } -global $db; +global $db, $table; require_once ROOT_PATH . 'libraries/common.inc.php'; diff --git a/tbl_sql.php b/tbl_sql.php index bbc1e79b84..1ab0363d35 100644 --- a/tbl_sql.php +++ b/tbl_sql.php @@ -16,7 +16,7 @@ if (! defined('ROOT_PATH')) { define('ROOT_PATH', __DIR__ . DIRECTORY_SEPARATOR); } -global $db; +global $db, $table; require_once ROOT_PATH . 'libraries/common.inc.php'; diff --git a/transformation_wrapper.php b/transformation_wrapper.php index dd0cf04eff..291eada8ee 100644 --- a/transformation_wrapper.php +++ b/transformation_wrapper.php @@ -20,7 +20,7 @@ if (! defined('ROOT_PATH')) { define('IS_TRANSFORMATION_WRAPPER', true); -global $db; +global $db, $table; require_once ROOT_PATH . 'libraries/common.inc.php';