You've already forked phpmyadmin
mirror of
https://github.com/phpmyadmin/phpmyadmin.git
synced 2026-10-28 07:41:55 +03:00
Fix some issues with Current::$database
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
This commit is contained in:
@@ -9190,11 +9190,6 @@ parameters:
|
||||
count: 1
|
||||
path: src/Font.php
|
||||
|
||||
-
|
||||
message: "#^Casting to string something that's already string\\.$#"
|
||||
count: 1
|
||||
path: src/Footer.php
|
||||
|
||||
-
|
||||
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
|
||||
count: 4
|
||||
@@ -9225,11 +9220,6 @@ parameters:
|
||||
count: 1
|
||||
path: src/Footer.php
|
||||
|
||||
-
|
||||
message: "#^Right side of && is always true\\.$#"
|
||||
count: 1
|
||||
path: src/Footer.php
|
||||
|
||||
-
|
||||
message: "#^Only booleans are allowed in an elseif condition, int\\|false given\\.$#"
|
||||
count: 1
|
||||
@@ -9745,11 +9735,6 @@ parameters:
|
||||
count: 5
|
||||
path: src/Html/Generator.php
|
||||
|
||||
-
|
||||
message: "#^Casting to string something that's already string\\.$#"
|
||||
count: 1
|
||||
path: src/Html/Generator.php
|
||||
|
||||
-
|
||||
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
|
||||
count: 16
|
||||
@@ -13060,11 +13045,6 @@ parameters:
|
||||
count: 3
|
||||
path: src/Plugins/Import/ImportCsv.php
|
||||
|
||||
-
|
||||
message: "#^Casting to string something that's already string\\.$#"
|
||||
count: 1
|
||||
path: src/Plugins/Import/ImportCsv.php
|
||||
|
||||
-
|
||||
message: "#^For loop initial assignment overwrites variable \\$i\\.$#"
|
||||
count: 1
|
||||
@@ -13350,11 +13330,6 @@ parameters:
|
||||
count: 2
|
||||
path: src/Plugins/Import/ImportShp.php
|
||||
|
||||
-
|
||||
message: "#^Casting to string something that's already string\\.$#"
|
||||
count: 1
|
||||
path: src/Plugins/Import/ImportShp.php
|
||||
|
||||
-
|
||||
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
|
||||
count: 2
|
||||
@@ -14880,11 +14855,6 @@ parameters:
|
||||
count: 1
|
||||
path: src/Replication/ReplicationInfo.php
|
||||
|
||||
-
|
||||
message: "#^Casting to string something that's already string\\.$#"
|
||||
count: 1
|
||||
path: src/ResponseRenderer.php
|
||||
|
||||
-
|
||||
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
|
||||
count: 5
|
||||
@@ -14900,11 +14870,6 @@ parameters:
|
||||
count: 1
|
||||
path: src/ResponseRenderer.php
|
||||
|
||||
-
|
||||
message: "#^Right side of && is always true\\.$#"
|
||||
count: 1
|
||||
path: src/ResponseRenderer.php
|
||||
|
||||
-
|
||||
message: "#^Cannot access offset '/' on mixed\\.$#"
|
||||
count: 1
|
||||
|
||||
@@ -2381,7 +2381,13 @@
|
||||
</InvalidArrayOffset>
|
||||
<MixedArgument>
|
||||
<code><![CDATA[$request->getParsedBodyParam('comment')]]></code>
|
||||
<code>Current::$database</code>
|
||||
<code>Current::$database</code>
|
||||
<code>Current::$database</code>
|
||||
</MixedArgument>
|
||||
<MixedArgumentTypeCoercion>
|
||||
<code><![CDATA[['db' => Current::$database]]]></code>
|
||||
</MixedArgumentTypeCoercion>
|
||||
<MixedAssignment>
|
||||
<code><![CDATA[$GLOBALS['errorUrl']]]></code>
|
||||
<code><![CDATA[$GLOBALS['single_table']]]></code>
|
||||
@@ -6063,9 +6069,6 @@
|
||||
<InvalidArgument>
|
||||
<code>$params</code>
|
||||
</InvalidArgument>
|
||||
<MixedArgument>
|
||||
<code>Current::$database</code>
|
||||
</MixedArgument>
|
||||
<MixedAssignment>
|
||||
<code>$info</code>
|
||||
<code>$subObject</code>
|
||||
@@ -6084,8 +6087,6 @@
|
||||
</RedundantCondition>
|
||||
<TypeDoesNotContainType>
|
||||
<code><![CDATA['']]></code>
|
||||
<code><![CDATA['']]></code>
|
||||
<code><![CDATA['']]></code>
|
||||
</TypeDoesNotContainType>
|
||||
<UnusedReturnValue>
|
||||
<code>mixed</code>
|
||||
@@ -6475,17 +6476,9 @@
|
||||
<PossiblyInvalidArgument>
|
||||
<code>$message</code>
|
||||
</PossiblyInvalidArgument>
|
||||
<RedundantCondition>
|
||||
<code>Current::$database</code>
|
||||
<code>Current::$database</code>
|
||||
</RedundantCondition>
|
||||
<RedundantFunctionCallGivenDocblockType>
|
||||
<code>strtolower</code>
|
||||
</RedundantFunctionCallGivenDocblockType>
|
||||
<TypeDoesNotContainType>
|
||||
<code><![CDATA['']]></code>
|
||||
<code><![CDATA['']]></code>
|
||||
</TypeDoesNotContainType>
|
||||
</file>
|
||||
<file src="src/Html/Generator.php">
|
||||
<DeprecatedMethod>
|
||||
@@ -6515,10 +6508,13 @@
|
||||
<MixedArgument>
|
||||
<code><![CDATA[$GLOBALS['special_message']]]></code>
|
||||
<code>$alt</code>
|
||||
<code>$database</code>
|
||||
<code>$database</code>
|
||||
<code>$title</code>
|
||||
</MixedArgument>
|
||||
<MixedArgumentTypeCoercion>
|
||||
<code>$key</code>
|
||||
<code><![CDATA[['db' => $database]]]></code>
|
||||
</MixedArgumentTypeCoercion>
|
||||
<MixedArrayAssignment>
|
||||
<code><![CDATA[$_SESSION['Import_message']['go_back_url']]]></code>
|
||||
@@ -6528,6 +6524,7 @@
|
||||
</MixedArrayAssignment>
|
||||
<MixedAssignment>
|
||||
<code>$alt</code>
|
||||
<code>$database</code>
|
||||
<code>$title</code>
|
||||
<code>$value</code>
|
||||
</MixedAssignment>
|
||||
@@ -6542,17 +6539,11 @@
|
||||
<PossiblyUndefinedArrayOffset>
|
||||
<code>$parts[1]</code>
|
||||
</PossiblyUndefinedArrayOffset>
|
||||
<RedundantCast>
|
||||
<code>(string) Current::$database</code>
|
||||
</RedundantCast>
|
||||
<RiskyCast>
|
||||
<code><![CDATA[$_REQUEST['pos']]]></code>
|
||||
<code><![CDATA[$_REQUEST['session_max_rows']]]></code>
|
||||
<code><![CDATA[$_REQUEST['unlim_num_rows']]]></code>
|
||||
</RiskyCast>
|
||||
<TypeDoesNotContainType>
|
||||
<code>isset(Current::$database)</code>
|
||||
</TypeDoesNotContainType>
|
||||
</file>
|
||||
<file src="src/Http/Middleware/Authentication.php">
|
||||
<DeprecatedMethod>
|
||||
@@ -7214,6 +7205,9 @@
|
||||
<code>$separator</code>
|
||||
<code>$separator</code>
|
||||
<code>$value</code>
|
||||
<code>Current::$database</code>
|
||||
<code>Current::$database</code>
|
||||
<code>Current::$database</code>
|
||||
</MixedArgument>
|
||||
<MixedArrayAccess>
|
||||
<code><![CDATA[$node->secondIcon['image']]]></code>
|
||||
@@ -7276,9 +7270,6 @@
|
||||
<code>(string) $key</code>
|
||||
<code>(string) $key</code>
|
||||
</RedundantCast>
|
||||
<RedundantCondition>
|
||||
<code>Current::$database</code>
|
||||
</RedundantCondition>
|
||||
<RiskyCast>
|
||||
<code><![CDATA[$_GET['pos']]]></code>
|
||||
<code><![CDATA[$_POST['n' . $count . '_pos2_value']]]></code>
|
||||
@@ -7289,7 +7280,6 @@
|
||||
</RiskyCast>
|
||||
<TypeDoesNotContainType>
|
||||
<code><![CDATA[$value > 500]]></code>
|
||||
<code><![CDATA['']]></code>
|
||||
</TypeDoesNotContainType>
|
||||
<UndefinedMethod>
|
||||
<code>setHiddenCount</code>
|
||||
@@ -8697,7 +8687,6 @@
|
||||
<code>$dbCharset</code>
|
||||
<code>$dbCollation</code>
|
||||
<code>$table</code>
|
||||
<code>Current::$database</code>
|
||||
</MixedArgument>
|
||||
<MixedArgumentTypeCoercion>
|
||||
<code>$events</code>
|
||||
@@ -9153,9 +9142,6 @@
|
||||
<PossiblyUnusedReturnValue>
|
||||
<code>string[]</code>
|
||||
</PossiblyUnusedReturnValue>
|
||||
<RedundantCast>
|
||||
<code>(string) Current::$database</code>
|
||||
</RedundantCast>
|
||||
</file>
|
||||
<file src="src/Plugins/Import/ImportLdi.php">
|
||||
<DeprecatedMethod>
|
||||
@@ -9385,9 +9371,6 @@
|
||||
<PossiblyUnusedReturnValue>
|
||||
<code>string[]</code>
|
||||
</PossiblyUnusedReturnValue>
|
||||
<RedundantCast>
|
||||
<code>(string) Current::$database</code>
|
||||
</RedundantCast>
|
||||
</file>
|
||||
<file src="src/Plugins/Import/ImportSql.php">
|
||||
<DeprecatedMethod>
|
||||
@@ -10710,8 +10693,6 @@
|
||||
</RedundantCondition>
|
||||
<TypeDoesNotContainType>
|
||||
<code><![CDATA['']]></code>
|
||||
<code><![CDATA['']]></code>
|
||||
<code><![CDATA['']]></code>
|
||||
</TypeDoesNotContainType>
|
||||
</file>
|
||||
<file src="src/Routing/Routing.php">
|
||||
@@ -12078,12 +12059,6 @@
|
||||
<code><![CDATA[$tokens[0]->value]]></code>
|
||||
<code><![CDATA[$tokens[2]->value]]></code>
|
||||
</PossiblyNullPropertyFetch>
|
||||
<RedundantCondition>
|
||||
<code>Current::$database</code>
|
||||
</RedundantCondition>
|
||||
<TypeDoesNotContainType>
|
||||
<code><![CDATA['']]></code>
|
||||
</TypeDoesNotContainType>
|
||||
</file>
|
||||
<file src="src/Tracking/Tracking.php">
|
||||
<DeprecatedMethod>
|
||||
|
||||
@@ -23,7 +23,6 @@ use function count;
|
||||
use function htmlspecialchars;
|
||||
use function mb_strtoupper;
|
||||
use function sprintf;
|
||||
use function strlen;
|
||||
use function trim;
|
||||
|
||||
final class EventsController extends AbstractController
|
||||
@@ -63,7 +62,7 @@ final class EventsController extends AbstractController
|
||||
|
||||
return;
|
||||
}
|
||||
} elseif (strlen(Current::$database) > 0) {
|
||||
} elseif (Current::$database !== '') {
|
||||
$this->dbi->selectDb(Current::$database);
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,6 @@ use function htmlspecialchars;
|
||||
use function in_array;
|
||||
use function mb_strtoupper;
|
||||
use function sprintf;
|
||||
use function strlen;
|
||||
use function trim;
|
||||
|
||||
use const ENT_QUOTES;
|
||||
@@ -110,7 +109,7 @@ class RoutinesController extends AbstractController
|
||||
return;
|
||||
}
|
||||
}
|
||||
} elseif (strlen(Current::$database) > 0) {
|
||||
} elseif (Current::$database !== '') {
|
||||
$this->dbi->selectDb(Current::$database);
|
||||
}
|
||||
|
||||
|
||||
@@ -177,12 +177,12 @@ final class ExportController extends AbstractController
|
||||
// Generate error url and check for needed variables
|
||||
if ($GLOBALS['export_type'] === 'server') {
|
||||
$GLOBALS['errorUrl'] = Url::getFromRoute('/server/export');
|
||||
} elseif ($GLOBALS['export_type'] === 'database' && strlen(Current::$database) > 0) {
|
||||
} elseif ($GLOBALS['export_type'] === 'database' && Current::$database !== '') {
|
||||
$GLOBALS['errorUrl'] = Url::getFromRoute('/database/export', ['db' => Current::$database]);
|
||||
// Check if we have something to export
|
||||
$GLOBALS['tables'] = $GLOBALS['table_select'] ?? [];
|
||||
} elseif (
|
||||
$GLOBALS['export_type'] === 'table' && strlen(Current::$database) > 0 && strlen($GLOBALS['table']) > 0
|
||||
$GLOBALS['export_type'] === 'table' && Current::$database !== '' && strlen($GLOBALS['table']) > 0
|
||||
) {
|
||||
$GLOBALS['errorUrl'] = Url::getFromRoute('/table/export', [
|
||||
'db' => Current::$database,
|
||||
|
||||
@@ -248,9 +248,9 @@ final class ImportController extends AbstractController
|
||||
// We don't want anything special in format
|
||||
$GLOBALS['format'] = Core::securePath($GLOBALS['format']);
|
||||
|
||||
if (strlen($GLOBALS['table']) > 0 && strlen(Current::$database) > 0) {
|
||||
if (strlen($GLOBALS['table']) > 0 && Current::$database !== '') {
|
||||
$GLOBALS['urlParams'] = ['db' => Current::$database, 'table' => $GLOBALS['table']];
|
||||
} elseif (strlen(Current::$database) > 0) {
|
||||
} elseif (Current::$database !== '') {
|
||||
$GLOBALS['urlParams'] = ['db' => Current::$database];
|
||||
} else {
|
||||
$GLOBALS['urlParams'] = [];
|
||||
@@ -264,9 +264,9 @@ final class ImportController extends AbstractController
|
||||
} elseif ($GLOBALS['import_type'] === 'server') {
|
||||
$GLOBALS['goto'] = Url::getFromRoute('/server/import');
|
||||
} elseif (empty($GLOBALS['goto']) || ! preg_match('@^index\.php$@i', $GLOBALS['goto'])) {
|
||||
if (strlen($GLOBALS['table']) > 0 && strlen(Current::$database) > 0) {
|
||||
if (strlen($GLOBALS['table']) > 0 && Current::$database !== '') {
|
||||
$GLOBALS['goto'] = Url::getFromRoute('/table/structure');
|
||||
} elseif (strlen(Current::$database) > 0) {
|
||||
} elseif (Current::$database !== '') {
|
||||
$GLOBALS['goto'] = Url::getFromRoute('/database/structure');
|
||||
} else {
|
||||
$GLOBALS['goto'] = Url::getFromRoute('/server/sql');
|
||||
@@ -276,7 +276,7 @@ final class ImportController extends AbstractController
|
||||
$GLOBALS['errorUrl'] = $GLOBALS['goto'] . Url::getCommon($GLOBALS['urlParams'], '&');
|
||||
$_SESSION['Import_message']['go_back_url'] = $GLOBALS['errorUrl'];
|
||||
|
||||
if (strlen(Current::$database) > 0) {
|
||||
if (Current::$database !== '') {
|
||||
$this->dbi->selectDb(Current::$database);
|
||||
}
|
||||
|
||||
|
||||
@@ -28,7 +28,6 @@ use PhpMyAdmin\Util;
|
||||
|
||||
use function __;
|
||||
use function mb_strtolower;
|
||||
use function strlen;
|
||||
|
||||
/**
|
||||
* Handles miscellaneous database operations.
|
||||
@@ -66,7 +65,7 @@ class DatabaseController extends AbstractController
|
||||
* Rename/move or copy database
|
||||
*/
|
||||
if (
|
||||
strlen(Current::$database) > 0 && ($request->hasBodyParam('db_rename') || $request->hasBodyParam('db_copy'))
|
||||
Current::$database !== '' && ($request->hasBodyParam('db_rename') || $request->hasBodyParam('db_copy'))
|
||||
) {
|
||||
$move = $request->hasBodyParam('db_rename');
|
||||
|
||||
|
||||
@@ -127,7 +127,7 @@ class SqlController extends AbstractController
|
||||
|
||||
// Default to browse if no query set and we have table
|
||||
// (needed for browsing from DefaultTabTable)
|
||||
if (empty($GLOBALS['sql_query']) && strlen($GLOBALS['table']) > 0 && strlen(Current::$database) > 0) {
|
||||
if (empty($GLOBALS['sql_query']) && strlen($GLOBALS['table']) > 0 && Current::$database !== '') {
|
||||
$GLOBALS['sql_query'] = $this->sql->getDefaultSqlQueryForBrowse(Current::$database, $GLOBALS['table']);
|
||||
|
||||
// set $goto to what will be displayed if query returns 0 rows
|
||||
|
||||
@@ -51,7 +51,8 @@ class ChartController extends AbstractController
|
||||
if (isset($_REQUEST['pos'], $_REQUEST['session_max_rows']) && $request->isAjax()) {
|
||||
if (
|
||||
strlen($GLOBALS['table']) > 0
|
||||
&& strlen(Current::$database) > 0 && ! $this->checkParameters(['db', 'table'])
|
||||
&& Current::$database !== ''
|
||||
&& ! $this->checkParameters(['db', 'table'])
|
||||
) {
|
||||
return;
|
||||
}
|
||||
@@ -132,7 +133,7 @@ class ChartController extends AbstractController
|
||||
$urlParams['goto'] = Util::getScriptNameForOption($config->settings['DefaultTabTable'], 'table');
|
||||
$urlParams['back'] = Url::getFromRoute('/table/sql');
|
||||
$this->dbi->selectDb(Current::$database);
|
||||
} elseif (strlen(Current::$database) > 0) {
|
||||
} elseif (Current::$database !== '') {
|
||||
$urlParams['goto'] = Util::getScriptNameForOption($config->settings['DefaultTabDatabase'], 'database');
|
||||
$urlParams['back'] = Url::getFromRoute('/sql');
|
||||
|
||||
@@ -221,7 +222,7 @@ class ChartController extends AbstractController
|
||||
{
|
||||
$GLOBALS['urlParams'] ??= null;
|
||||
$GLOBALS['errorUrl'] ??= null;
|
||||
if (strlen($GLOBALS['table']) > 0 && strlen(Current::$database) > 0) {
|
||||
if (strlen($GLOBALS['table']) > 0 && Current::$database !== '') {
|
||||
$GLOBALS['urlParams'] = ['db' => Current::$database, 'table' => $GLOBALS['table']];
|
||||
$GLOBALS['errorUrl'] = Util::getScriptNameForOption(
|
||||
Config::getInstance()->settings['DefaultTabTable'],
|
||||
|
||||
@@ -27,7 +27,6 @@ use function htmlspecialchars;
|
||||
use function in_array;
|
||||
use function mb_strtoupper;
|
||||
use function sprintf;
|
||||
use function strlen;
|
||||
use function trim;
|
||||
|
||||
/**
|
||||
@@ -103,7 +102,7 @@ final class IndexController extends AbstractController
|
||||
return;
|
||||
}
|
||||
}
|
||||
} elseif (strlen(Current::$database) > 0) {
|
||||
} elseif (Current::$database !== '') {
|
||||
$this->dbi->selectDb(Current::$database);
|
||||
}
|
||||
|
||||
|
||||
@@ -131,7 +131,7 @@ class Footer
|
||||
$params = [];
|
||||
$params['route'] = Routing::$route;
|
||||
|
||||
if (isset(Current::$database) && strlen(Current::$database) > 0) {
|
||||
if (Current::$database !== '') {
|
||||
$params['db'] = Current::$database;
|
||||
}
|
||||
|
||||
@@ -186,7 +186,7 @@ class Footer
|
||||
}
|
||||
|
||||
$this->relation->setHistory(
|
||||
isset(Current::$database) && is_scalar(Current::$database) ? (string) Current::$database : '',
|
||||
Current::$database,
|
||||
isset($GLOBALS['table']) && is_scalar($GLOBALS['table']) ? (string) $GLOBALS['table'] : '',
|
||||
Config::getInstance()->selectedServer['user'],
|
||||
$GLOBALS['sql_query'],
|
||||
|
||||
@@ -90,7 +90,7 @@ class Header
|
||||
$dbi = DatabaseInterface::getInstance();
|
||||
$this->console = $console;
|
||||
$this->menuEnabled = $dbi->isConnected();
|
||||
$this->menu = new Menu($dbi, $this->template, Current::$database ?? '', $GLOBALS['table'] ?? '');
|
||||
$this->menu = new Menu($dbi, $this->template, Current::$database, $GLOBALS['table'] ?? '');
|
||||
$this->scripts = new Scripts($this->template);
|
||||
$this->addDefaultScripts();
|
||||
|
||||
@@ -138,7 +138,7 @@ class Header
|
||||
'lang' => $GLOBALS['lang'],
|
||||
'server' => $GLOBALS['server'],
|
||||
'table' => $GLOBALS['table'] ?? '',
|
||||
'db' => Current::$database ?? '',
|
||||
'db' => Current::$database,
|
||||
'token' => $_SESSION[' PMA_token '],
|
||||
'text_dir' => $GLOBALS['text_dir'],
|
||||
'LimitChars' => $config->settings['LimitChars'],
|
||||
|
||||
@@ -130,7 +130,7 @@ class Generator
|
||||
public static function getDbLink(string $database): string
|
||||
{
|
||||
if ($database === '') {
|
||||
if ((string) Current::$database === '') {
|
||||
if (Current::$database === '') {
|
||||
return '';
|
||||
}
|
||||
|
||||
@@ -494,11 +494,7 @@ class Generator
|
||||
|
||||
// Basic url query part
|
||||
$urlParams = [];
|
||||
if (! isset(Current::$database)) {
|
||||
Current::$database = '';
|
||||
}
|
||||
|
||||
if (strlen(Current::$database) > 0) {
|
||||
if (Current::$database !== '') {
|
||||
$urlParams['db'] = Current::$database;
|
||||
if (strlen($GLOBALS['table']) > 0) {
|
||||
$urlParams['table'] = $GLOBALS['table'];
|
||||
@@ -806,7 +802,7 @@ class Generator
|
||||
$urlParams['db'] = Current::$database;
|
||||
$urlParams['table'] = $GLOBALS['table'];
|
||||
$doEditGoto = '<a href="' . Url::getFromRoute('/table/sql', $urlParams) . '">';
|
||||
} elseif (strlen(Current::$database) > 0) {
|
||||
} elseif (Current::$database !== '') {
|
||||
$urlParams['db'] = Current::$database;
|
||||
$doEditGoto = '<a href="' . Url::getFromRoute('/database/sql', $urlParams) . '">';
|
||||
} else {
|
||||
|
||||
@@ -171,7 +171,7 @@ class ListDatabase extends ListAbstract
|
||||
*/
|
||||
public function getDefault(): string
|
||||
{
|
||||
if (strlen(Current::$database) > 0) {
|
||||
if (Current::$database !== '') {
|
||||
return Current::$database;
|
||||
}
|
||||
|
||||
|
||||
@@ -221,7 +221,7 @@ class NavigationTree
|
||||
*/
|
||||
private function getNavigationDbPos(): int
|
||||
{
|
||||
if ((Current::$database ?? '') === '') {
|
||||
if (Current::$database === '') {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -456,7 +456,7 @@ class AuthenticationCookie extends AuthenticationPlugin
|
||||
|
||||
// any parameters to pass?
|
||||
$urlParams = [];
|
||||
if (strlen(Current::$database) > 0) {
|
||||
if (Current::$database !== '') {
|
||||
$urlParams['db'] = Current::$database;
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,6 @@ use function is_array;
|
||||
use function mb_substr;
|
||||
use function rtrim;
|
||||
use function str_replace;
|
||||
use function strlen;
|
||||
|
||||
use const PHP_VERSION;
|
||||
|
||||
@@ -520,6 +519,6 @@ class ExportXml extends ExportPlugin
|
||||
public static function isAvailable(): bool
|
||||
{
|
||||
// Can't do server export.
|
||||
return isset(Current::$database) && strlen(Current::$database) > 0;
|
||||
return Current::$database !== '';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -582,7 +582,7 @@ class ImportCsv extends AbstractImportCsv
|
||||
array_shift($rows);
|
||||
}
|
||||
|
||||
$tblName = $this->getTableNameFromImport((string) Current::$database);
|
||||
$tblName = $this->getTableNameFromImport(Current::$database);
|
||||
|
||||
$tables[] = [$tblName, $colNames, $rows];
|
||||
|
||||
|
||||
@@ -261,7 +261,7 @@ class ImportShp extends ImportPlugin
|
||||
}
|
||||
|
||||
// Set table name based on the number of tables
|
||||
if (strlen((string) Current::$database) > 0) {
|
||||
if (Current::$database !== '') {
|
||||
$result = DatabaseInterface::getInstance()->fetchResult('SHOW TABLES');
|
||||
$tableName = 'TABLE ' . (count($result) + 1);
|
||||
} else {
|
||||
|
||||
@@ -329,8 +329,7 @@ class ResponseRenderer
|
||||
$this->addJSON(
|
||||
'reloadQuerywindow',
|
||||
[
|
||||
'db' => isset(Current::$database) && is_scalar(Current::$database)
|
||||
? (string) Current::$database : '',
|
||||
'db' => Current::$database,
|
||||
'table' => isset($GLOBALS['table']) && is_scalar($GLOBALS['table'])
|
||||
? (string) $GLOBALS['table'] : '',
|
||||
'sql_query' => $query,
|
||||
|
||||
@@ -560,7 +560,7 @@ class Tracker
|
||||
}
|
||||
|
||||
// Get database name
|
||||
$dbname = trim(Current::$database ?? '', '`');
|
||||
$dbname = trim(Current::$database, '`');
|
||||
// $dbname can be empty, for example when coming from Synchronize
|
||||
// and this is a query for the remote server
|
||||
if ($dbname === '') {
|
||||
|
||||
Reference in New Issue
Block a user